Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ftm.server.adapter.in.web.user.controller;

import com.ftm.server.adapter.in.web.user.dto.request.GeneralUserSignupRequest;
import com.ftm.server.adapter.in.web.user.dto.response.GeneralUserSignupResponse;
import com.ftm.server.application.command.user.GeneralUserSignupCommand;
import com.ftm.server.application.port.in.user.GeneralUserSignupUseCase;
import com.ftm.server.common.response.ApiResponse;
Expand All @@ -22,8 +23,9 @@ public class GeneralUserSignupController {
@PostMapping("/api/users")
public ResponseEntity<ApiResponse> createGeneralUser(
@Valid @RequestBody GeneralUserSignupRequest request) {
generalUserSignupUseCase.execute(GeneralUserSignupCommand.from(request));
GeneralUserSignupResponse response =
generalUserSignupUseCase.execute(GeneralUserSignupCommand.from(request));
return ResponseEntity.status(HttpStatus.CREATED)
.body(ApiResponse.success(SuccessResponseCode.CREATED));
.body(ApiResponse.success(SuccessResponseCode.CREATED, response));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.ftm.server.adapter.in.web.user.dto.response;

import lombok.Data;

@Data
public class GeneralUserSignupResponse {
private final Long userId;

public static GeneralUserSignupResponse of(Long userId) {
return new GeneralUserSignupResponse(userId);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.ftm.server.application.port.in.user;

import com.ftm.server.adapter.in.web.user.dto.response.GeneralUserSignupResponse;
import com.ftm.server.application.command.user.GeneralUserSignupCommand;
import com.ftm.server.common.annotation.UseCase;

@UseCase
public interface GeneralUserSignupUseCase {
void execute(GeneralUserSignupCommand command);
GeneralUserSignupResponse execute(GeneralUserSignupCommand command);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ftm.server.application.service.user;

import com.ftm.server.adapter.in.web.user.dto.response.GeneralUserSignupResponse;
import com.ftm.server.application.command.user.GeneralUserCreationCommand;
import com.ftm.server.application.command.user.GeneralUserSignupCommand;
import com.ftm.server.application.port.in.user.GeneralUserSignupUseCase;
Expand Down Expand Up @@ -35,7 +36,7 @@ public class GeneralUserSignupService implements GeneralUserSignupUseCase {

@Transactional
@Override
public void execute(GeneralUserSignupCommand command) {
public GeneralUserSignupResponse execute(GeneralUserSignupCommand command) {
String email = command.getEmail();
Optional<EmailVerificationLogs> emailVerificationLogs =
loadEmailVerificationLogPort.loadEmailVerificationLogByEmail(
Expand All @@ -61,5 +62,6 @@ public void execute(GeneralUserSignupCommand command) {

User user = saveUserPort.saveUser(User.createGeneralUser(convertedCommand));
saveUserImagePort.saveUserDefaultImage(UserImage.createUserImage(user.getId()));
return GeneralUserSignupResponse.of(user.getId());
}
}
8 changes: 4 additions & 4 deletions src/test/java/com/ftm/server/user/GeneralUserSignupTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public class GeneralUserSignupTest extends BaseTest {
fieldWithPath("status").type(JsonFieldType.NUMBER).description("์‘๋‹ต ์ƒํƒœ"),
fieldWithPath("code").type(JsonFieldType.STRING).description("์ƒํƒœ ์ฝ”๋“œ"),
fieldWithPath("message").type(JsonFieldType.STRING).description("๋ฉ”์‹œ์ง€"),
fieldWithPath("data")
.type(JsonFieldType.OBJECT)
.optional()
.description("data"));
fieldWithPath("data").type(JsonFieldType.OBJECT).optional().description("data"),
fieldWithPath("data.userId")
.type(JsonFieldType.NUMBER)
.description("์‚ฌ์šฉ์ž ๊ณ ์œ  id"));

private ResultActions getResultActions(GeneralUserSignupRequest request) throws Exception {
return mockMvc.perform( // api ์‹คํ–‰
Expand Down