-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CORS 설정 및 Profile을 RunnerProfile로 변경 (#120)
* feat: cors 설정 * refactor: MemberProfile 을 RunnerProfile 로 수정 * feat: cors HttpMethod 에 PATCH 추가
- Loading branch information
Showing
6 changed files
with
97 additions
and
63 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
backend/baton/src/main/java/touch/baton/config/WebMvcConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package touch.baton.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.servlet.config.annotation.CorsRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
import static org.springframework.http.HttpHeaders.LOCATION; | ||
import static org.springframework.http.HttpMethod.DELETE; | ||
import static org.springframework.http.HttpMethod.GET; | ||
import static org.springframework.http.HttpMethod.OPTIONS; | ||
import static org.springframework.http.HttpMethod.PATCH; | ||
import static org.springframework.http.HttpMethod.POST; | ||
import static org.springframework.http.HttpMethod.PUT; | ||
|
||
@Configuration | ||
public class WebMvcConfig implements WebMvcConfigurer { | ||
@Override | ||
public void addCorsMappings(final CorsRegistry registry) { | ||
registry.addMapping("/**") | ||
.allowedOrigins("http://localhost:3000") | ||
.allowCredentials(false) | ||
.allowedMethods(GET.name(), POST.name(), PUT.name(), PATCH.name(), DELETE.name(), OPTIONS.name()) | ||
.exposedHeaders(LOCATION) | ||
.maxAge(3600); | ||
} | ||
} |
32 changes: 0 additions & 32 deletions
32
...aton/src/main/java/touch/baton/domain/runnerpost/controller/response/ProfileResponse.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...rc/main/java/touch/baton/domain/runnerpost/controller/response/RunnerProfileResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package touch.baton.domain.runnerpost.controller.response; | ||
|
||
import touch.baton.domain.runner.Runner; | ||
|
||
public record RunnerProfileResponse() { | ||
|
||
public record Detail(Long runnerId, | ||
String name, | ||
String company, | ||
String imageUrl | ||
) { | ||
|
||
public static Detail from(final Runner runner) { | ||
return new Detail( | ||
runner.getId(), | ||
runner.getMember().getMemberName().getValue(), | ||
runner.getMember().getCompany().getValue(), | ||
runner.getMember().getImageUrl().getValue() | ||
); | ||
} | ||
} | ||
|
||
public record Simple(String name, String imageUrl) { | ||
|
||
public static Simple from(final Runner runner) { | ||
return new Simple( | ||
runner.getMember().getMemberName().getValue(), | ||
runner.getMember().getImageUrl().getValue() | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters