Skip to content

Commit

Permalink
refactor: api POST로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Enble committed May 3, 2024
1 parent 1ef19a4 commit cbff1e6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ COPY . /app
# Gradle 빌드를 실행하여 JAR 파일 생성
ENV JWT_SECRET 12341234
ENV REDIS_HOST redis
ENV MAIL_USERNAME mail
ENV MAIL_PASSWORD 12341234
RUN gradle clean build --no-daemon

FROM --platform=linux/arm64/v8 eclipse-temurin:17.0.10_7-jre
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,41 @@
import dynamicquad.agilehub.project.controller.request.ProjectInviteRequestDto;
import dynamicquad.agilehub.project.service.ProjectInviteService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.RequestToViewNameTranslator;

@Tag(name = "프로젝트 초대", description = "프로젝트에 이메일주소를 통해 초대합니다.")
@RestController
@RequiredArgsConstructor
@RequestMapping("/projects/invite")
public class ProjectInviteController {

private final ProjectInviteService projectInviteService;
private final RequestToViewNameTranslator viewNameTranslator;

@Operation(summary = "프로젝트 초대", description = "이메일로 프로젝트 초대 코드를 발송합니다.")
@PostMapping("/projects/invite")
@ApiResponses({
@ApiResponse(responseCode = "EMAIL_5001", description = "이메일이 정상적으로 송신되지 않았습니다.")
})
@PostMapping("/send")
public CommonResponse<Void> sendInviteEmail(@Auth AuthMember authMember,
@RequestBody ProjectInviteRequestDto.SendInviteMail sendInviteMail) {
projectInviteService.sendInviteEmail(authMember, sendInviteMail);
return CommonResponse.onSuccess(null);
}

@Operation(summary = "프로젝트 초대 수락", description = "초대 코드 확인 후 멤버를 프로젝트에 Editor로 추가합니다.")
@GetMapping("/projects/invite")
@ApiResponses({
@ApiResponse(responseCode = "EMAIL_4001", description = "초대 코드를 찾을 수 없습니다.")
})
@PostMapping("/receive")
public CommonResponse<Void> receiveInviteEmail(@Auth AuthMember authMember,
@RequestParam String inviteCode) {
@RequestBody String inviteCode) {
projectInviteService.receiveInviteEmail(authMember, inviteCode);
return CommonResponse.onSuccess(null);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package dynamicquad.agilehub.project.controller.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Builder;
import lombok.Getter;

Expand All @@ -9,11 +11,25 @@ public class ProjectInviteRequestDto {
private ProjectInviteRequestDto() {
}

@Schema(description = "초대 메일 송신")
@Getter
@Builder
@Schema
public static class SendInviteMail {
@Schema(description = "초대할 사람의 이메일 주소", example = "[email protected]")
@NotBlank
String email;

@Schema(description = "초대할 프로젝트 id", example = "1")
@NotNull
long projectId;
}

@Schema(description = "초대 메일 수신")
@Getter
@Builder
public static class ReceiveInviteMail {
@Schema(description = "메일로부터 온 인증번호")
@NotBlank
String inviteCode;
}
}

0 comments on commit cbff1e6

Please sign in to comment.