-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 추천템플릿 조회 및 설정 API 컨트롤러 로직 개발 * feat: 추천을 위한 enum 정의 * feat: 추천템플릿 조회 및 설정 API 서비스 로직 개발
- Loading branch information
Showing
11 changed files
with
202 additions
and
2 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
layer-api/src/main/java/org/layer/domain/form/controller/FormApi.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 |
---|---|---|
@@ -1,17 +1,38 @@ | ||
package org.layer.domain.form.controller; | ||
|
||
import org.layer.common.annotation.MemberId; | ||
import org.layer.domain.form.controller.dto.request.RecommendFormQueryDto; | ||
import org.layer.domain.form.controller.dto.request.RecommendFormSetRequest; | ||
import org.layer.domain.form.controller.dto.response.DefaultFormGetResponse; | ||
import org.layer.domain.form.controller.dto.response.RecommendFormResponseDto; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ModelAttribute; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.Parameters; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
|
||
@Tag(name = "회고 폼(커스텀 템플릿)", description = "회고 폼 관련 API") | ||
public interface FormApi { | ||
|
||
@Operation(summary = "회고 폼(커스텀 템플릿) 조회 (기본 회고폼 포함)", method = "GET", description = "회고 폼(커스텀 템플릿)을 조회하는 기능입니다.") | ||
ResponseEntity<DefaultFormGetResponse> getForm(@PathVariable Long formId, @MemberId Long memberId); | ||
|
||
@Parameters( | ||
{ | ||
@Parameter(name = "periodic", description = "회고 주기적 여부", example = "true", required = true), | ||
@Parameter(name = "period", description = "회고 주기", example = "WEEKLY"), | ||
@Parameter(name = "purpose", description = "회고 목적", example = "TEAM_GROWTH", required = true) | ||
} | ||
) | ||
@Operation(summary = "추천 템플릿 조회", method = "GET", description = "추천 템플릿을 조회하는 기능입니다.") | ||
ResponseEntity<RecommendFormResponseDto> getRecommendTemplate(@ModelAttribute @Valid @Parameter(hidden = true) RecommendFormQueryDto queryDto, | ||
@MemberId Long memberId); | ||
|
||
@Operation(summary = "추천 템플릿 설정", method = "POST", description = "추천 템플릿을 설정하는 기능입니다.") | ||
ResponseEntity<Void> setRecommendTemplate(@RequestBody @Valid RecommendFormSetRequest request, @MemberId Long memberId); | ||
} |
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
20 changes: 20 additions & 0 deletions
20
...api/src/main/java/org/layer/domain/form/controller/dto/request/RecommendFormQueryDto.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,20 @@ | ||
package org.layer.domain.form.controller.dto.request; | ||
|
||
import org.layer.domain.form.enums.RetrospectPeriod; | ||
import org.layer.domain.form.enums.RetrospectPurpose; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
@Schema(name = "RecommendFormQueryDto", description = "회고 템플릿 요청 queryParam") | ||
public record RecommendFormQueryDto( | ||
@NotNull | ||
@Schema(description = "회고 주기적 여부", example = "true") | ||
boolean periodic, | ||
@Schema(description = "회고가 주기적일 때, 구체적인 주기", example = "WEEKLY") | ||
RetrospectPeriod period, | ||
@NotNull | ||
@Schema(description = "회고 목적", example = "TEAM_GROWTH") | ||
RetrospectPurpose purpose | ||
) { | ||
} |
15 changes: 15 additions & 0 deletions
15
...i/src/main/java/org/layer/domain/form/controller/dto/request/RecommendFormSetRequest.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,15 @@ | ||
package org.layer.domain.form.controller.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
@Schema(name = "RecommendFormSetRequest", description = "추천 템플릿 설정 요청 Dto") | ||
public record RecommendFormSetRequest( | ||
@NotNull | ||
@Schema(description = "추천 템플릿 폼 id", example = "3") | ||
Long formId, | ||
@NotNull | ||
@Schema(description = "스페이스 id", example = "1") | ||
Long spaceId | ||
) { | ||
} |
30 changes: 30 additions & 0 deletions
30
...src/main/java/org/layer/domain/form/controller/dto/response/RecommendFormResponseDto.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,30 @@ | ||
package org.layer.domain.form.controller.dto.response; | ||
|
||
import java.util.List; | ||
|
||
import org.layer.domain.form.entity.Form; | ||
import org.layer.domain.tag.entity.Tag; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(name = "RecommendFormResponseDto", description = "회고 템플릿 응답 Dto") | ||
public record RecommendFormResponseDto( | ||
@Schema(description = "추천 템플릿 id \n 1. 추천템플릿 설정 API에 해당 데이터 사용 \n 2. 자세한 내용 확인하는 API 사용할 때 해당 데이터 사용", example = "3") | ||
Long formId, | ||
@Schema(description = "템플릿(폼) 이름", example = "차근차근, 단계적인 회고") | ||
String formName, | ||
@Schema(description = "태그", example = "[\"KPT\", \"태그2\"]") | ||
List<String> tags, | ||
@Schema(description = "템플릿(폼) 이미지 url", example = "[url 형식]") | ||
String formImageUrl | ||
|
||
) { | ||
public static RecommendFormResponseDto of(Form form, List<Tag> tags){ | ||
|
||
List<String> tagNames = tags.stream() | ||
.map(Tag::getTagName) | ||
.toList(); | ||
|
||
return new RecommendFormResponseDto(form.getId(), form.getTitle(), tagNames, null); | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
layer-domain/src/main/java/org/layer/domain/form/enums/RetrospectPeriod.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,5 @@ | ||
package org.layer.domain.form.enums; | ||
|
||
public enum RetrospectPeriod { | ||
WEEKLY, MONTHLY, QUARTERLY, END_PROJECT | ||
} |
5 changes: 5 additions & 0 deletions
5
layer-domain/src/main/java/org/layer/domain/form/enums/RetrospectPurpose.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,5 @@ | ||
package org.layer.domain.form.enums; | ||
|
||
public enum RetrospectPurpose { | ||
CHECK_PROGRESS, PERSONAL_GROWTH, TEAM_GROWTH, IMPROVE_COMMUNICATION, SHARE_EXPERIENCE, IMPROVE_PROBLEM, SHARE_EMOTION, STRATEGY_SETTING | ||
} |
30 changes: 30 additions & 0 deletions
30
layer-domain/src/main/java/org/layer/domain/tag/entity/Tag.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,30 @@ | ||
package org.layer.domain.tag.entity; | ||
|
||
import org.layer.domain.common.BaseTimeEntity; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Tag extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@NotNull | ||
private String tagName; | ||
|
||
private Long formId; | ||
|
||
private Long retrospectId; | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
layer-domain/src/main/java/org/layer/domain/tag/repository/TagRepository.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,11 @@ | ||
package org.layer.domain.tag.repository; | ||
|
||
|
||
import java.util.List; | ||
|
||
import org.layer.domain.tag.entity.Tag; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface TagRepository extends JpaRepository<Tag, Long> { | ||
List<Tag> findAllByFormId(Long formId); | ||
} |