-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
템플릿 CRUD에 태그 및 카테고리 추가, 카테고리 CRUD #252
Merged
Merged
Changes from 74 commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
7298405
feat(domain): Category 도메인 추가
HoeSeong123 865d93d
feat(domain): Tag 도메인 추가
HoeSeong123 de7d1ae
refactor(domain): Tag와 Category에 기본 키 생성 어노테이션 추가
HoeSeong123 b73064b
style(service): test 코드 개행 추가
HoeSeong123 988fff6
feat(category): category 추가 기능 구현
HoeSeong123 6b99ee7
feat(category): category 이름 검증 기능 구현
HoeSeong123 292555f
feat(category): category 이름 중복 검증 기능 구현
HoeSeong123 f23f7ae
feat(category): category 전체 조회 기능 구현
HoeSeong123 62de1ab
refactor(domain): lombok 어노테이션 순서 코드 구현 순서에 맞게 수정
HoeSeong123 aae4cae
refactor(domain): Tag value 필드를 name으로 변경
HoeSeong123 00070a2
feat(codezap): template 생성 기능에 tag와 category 추가
HoeSeong123 965fdb3
Merge remote-tracking branch 'upstream/dev/be' into feat/domain_update
HoeSeong123 36afbd7
Merge pull request #225 from HoeSeong123/feat/template_refactor
HoeSeong123 7a3ed8f
refactor(test): 테스트 코드 오류 수정
HoeSeong123 100d7ec
feat(test): 템플릿 조회 기능에 카테고리, 태그 추가 및 테스트 코드 수정
HoeSeong123 22bbb48
feat(template): 템플릿 수정 기능에 카테고리 및 태그 추가
HoeSeong123 d8d40bc
feat(template): 템플릿 삭제 기능 추가
HoeSeong123 a435e35
Merge pull request #231 from HoeSeong123/feat/template_refactor_chorong
zangsu 457a856
docs(category): 카테고리 기능 swagger 문서화
zangsu f11917b
docs(category): 카테고리 업데이트 기능 구현
zangsu c4ff264
refactor(controller): 테스트 코드 네이밍 및 DisplayName 수정
zangsu 13a537c
feat(category): 카테고리 삭제 기능 구현
zangsu fd8faf6
docs(category): 카테고리 문서화 업데이트
zangsu 4ae7d2a
Merge pull request #240 from zangsu/feat/category
HoeSeong123 7122fd4
feat(domain): Category 도메인 추가
HoeSeong123 d13b256
feat(domain): Tag 도메인 추가
HoeSeong123 dd7fbb7
refactor(domain): Tag와 Category에 기본 키 생성 어노테이션 추가
HoeSeong123 7ebdb48
style(service): test 코드 개행 추가
HoeSeong123 4ee7928
feat(category): category 추가 기능 구현
HoeSeong123 786a089
feat(category): category 이름 검증 기능 구현
HoeSeong123 778f92a
feat(category): category 이름 중복 검증 기능 구현
HoeSeong123 d64dfa2
feat(category): category 전체 조회 기능 구현
HoeSeong123 05fe337
refactor(domain): lombok 어노테이션 순서 코드 구현 순서에 맞게 수정
HoeSeong123 2fc9651
refactor(domain): Tag value 필드를 name으로 변경
HoeSeong123 d12f797
feat(codezap): template 생성 기능에 tag와 category 추가
HoeSeong123 8df56e4
refactor(test): 테스트 코드 오류 수정
HoeSeong123 fae0611
feat(test): 템플릿 조회 기능에 카테고리, 태그 추가 및 테스트 코드 수정
HoeSeong123 a36eb9a
feat(template): 템플릿 수정 기능에 카테고리 및 태그 추가
HoeSeong123 7c6ff87
feat(template): 템플릿 삭제 기능 추가
HoeSeong123 d713868
docs(category): 카테고리 기능 swagger 문서화
zangsu 1b8b6a1
docs(category): 카테고리 업데이트 기능 구현
zangsu 03eb850
refactor(controller): 테스트 코드 네이밍 및 DisplayName 수정
zangsu ba02215
feat(category): 카테고리 삭제 기능 구현
zangsu ebab110
docs(category): 카테고리 문서화 업데이트
zangsu e0a45e3
Merge remote-tracking branch 'upstream/feat/domain_update' into feat/…
HoeSeong123 c087ac3
feat(template): 템플릿 dto에 description 필드 추가
HoeSeong123 5ecab42
feat(cors): cors 헤더 권한 추가
HoeSeong123 96e8aae
docs(codezap): template 및 category 문서화 업데이트
HoeSeong123 bc2fc49
refactor(template): dto 제약 조건 추가 및 테스트 코드 추가
HoeSeong123 901e450
style(codezap): 코드 스타일 정리
HoeSeong123 cc8db54
refactor(codezap): 코드 전반적인 리팩토링
HoeSeong123 24781a9
feat(codezap): Valid 순서 설정 기능 구현
HoeSeong123 c6b77e7
feat(service): 기본 카테고리 삭제 시 예외 처리
HoeSeong123 d851e92
Merge pull request #249 from HoeSeong123/feat/template_refactor_chorong
HoeSeong123 145f9a8
feat(service): 스니펫 순서 검증 groups 추가
HoeSeong123 e59816e
refactor(validation): 검증 순서 변경
HoeSeong123 dbd5900
feat(codezap): 빈 값에 대한 검증 구현
HoeSeong123 b267eea
feat(codezap): 스니펫이 비어있는 경우에 대한 검증 구현
HoeSeong123 094b5b7
refactor(category): 코드 가독성 향상을 위한 리팩토링
HoeSeong123 b8e1995
refactor(codezap): responseDto 네이밍 변경
HoeSeong123 04356e0
refactor(codezap): NoArgsConstructor 접근 제어자 protected로 변경
HoeSeong123 3071716
refactor(category): 의미 있는 숫자 상수화 (기본 카테고리의 id)
HoeSeong123 96408ed
refactor(template): 중복 메서드 삭제
HoeSeong123 4165b92
refactor(codezap): ValidationGroups에서 겹치는 내용 통합
HoeSeong123 8d6afea
refactor(service): tag와 tagName 변수명 구분
HoeSeong123 c117e0e
refactor(service): 메서드 위치 변경
HoeSeong123 99b6fd9
refactor(service): 태그 생성 및 수정 로직 변경
HoeSeong123 d7c7481
refactor(controller): 불필요한 개행 제거
HoeSeong123 eac479c
refactor(service): 상수 접근 제어자 private으로 변경
HoeSeong123 34c94c8
refactor(domain): 상수명 변경
HoeSeong123 4cbfb71
refactor(response): 불필요한 개행 제거
HoeSeong123 8b1b520
refactor(codezap): 템플릿 생성 메서드명 변경
HoeSeong123 39336ab
refactor(service): stream을 통한 save 대신 saveAll을 사용하도록 변경
HoeSeong123 d125035
refactor(service): 조건문을 별도의 메서드로 분리
HoeSeong123 05cd1b4
refactor(template): findBy 메서드의 리턴값을 Optional로 변경
HoeSeong123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
backend/src/main/java/codezap/category/controller/CategoryController.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,60 @@ | ||
package codezap.category.controller; | ||
|
||
import java.net.URI; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import codezap.category.dto.request.CreateCategoryRequest; | ||
import codezap.category.dto.request.UpdateCategoryRequest; | ||
import codezap.category.dto.response.FindAllCategoriesResponse; | ||
import codezap.category.service.CategoryService; | ||
import codezap.global.validation.ValidationSequence; | ||
|
||
@RestController | ||
@RequestMapping("/categories") | ||
public class CategoryController implements SpringDocCategoryController { | ||
|
||
private final CategoryService categoryService; | ||
|
||
public CategoryController(CategoryService categoryService) { | ||
this.categoryService = categoryService; | ||
} | ||
|
||
@PostMapping | ||
public ResponseEntity<Void> createCategory( | ||
@Validated(ValidationSequence.class) @RequestBody CreateCategoryRequest createCategoryRequest | ||
) { | ||
Long createdCategoryId = categoryService.create(createCategoryRequest); | ||
return ResponseEntity.created(URI.create("/categories/" + createdCategoryId)) | ||
.build(); | ||
} | ||
|
||
@GetMapping | ||
public ResponseEntity<FindAllCategoriesResponse> getCategories() { | ||
return ResponseEntity.ok(categoryService.findAll()); | ||
} | ||
|
||
@PutMapping("/{id}") | ||
public ResponseEntity<Void> updateCategory( | ||
@PathVariable Long id, | ||
@Validated(ValidationSequence.class) @RequestBody UpdateCategoryRequest updateCategoryRequest | ||
) { | ||
categoryService.update(id, updateCategoryRequest); | ||
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@DeleteMapping("/{id}") | ||
public ResponseEntity<Void> deleteCategory(@PathVariable Long id) { | ||
categoryService.deleteById(id); | ||
return ResponseEntity.noContent().build(); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
backend/src/main/java/codezap/category/controller/SpringDocCategoryController.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,56 @@ | ||
package codezap.category.controller; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
import codezap.category.dto.request.CreateCategoryRequest; | ||
import codezap.category.dto.request.UpdateCategoryRequest; | ||
import codezap.category.dto.response.FindAllCategoriesResponse; | ||
import codezap.global.swagger.error.ApiErrorResponse; | ||
import codezap.global.swagger.error.ErrorCase; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.headers.Header; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
@Tag(name = "카테고리 CRUD API", description = "카테고리 생성, 목록 조회, 삭제, 수정 API") | ||
public interface SpringDocCategoryController { | ||
|
||
@Operation(summary = "카테고리 생성", description = """ | ||
새로운 카테고리를 생성합니다. \n | ||
새로운 카테고리의 이름이 필요합니다. \n | ||
""") | ||
@ApiResponse(responseCode = "201", description = "카테고리 생성 성공", headers = { | ||
@Header(name = "생성된 카테고리의 API 경로", example = "/categories/1")}) | ||
@ApiErrorResponse(status = HttpStatus.BAD_REQUEST, instance = "/categories", errorCases = { | ||
@ErrorCase(description = "모든 필드 중 null인 값이 있는 경우", exampleMessage = "카테고리 이름이 null 입니다."), | ||
@ErrorCase(description = "카테고리 이름이 255자를 초과한 경우", exampleMessage = "카테고리 이름은 최대 255자까지 입력 가능합니다."), | ||
@ErrorCase(description = "동일한 이름의 카테고리가 존재하는 경우", exampleMessage = "이름이 Spring 인 카테고리가 이미 존재합니다.") | ||
}) | ||
ResponseEntity<Void> createCategory(CreateCategoryRequest createCategoryRequest); | ||
|
||
@Operation(summary = "카테고리 목록 조회", description = "생성된 모든 카테고리를 조회합니다.") | ||
@ApiResponse(responseCode = "200", description = "조회 성공", | ||
content = {@Content(schema = @Schema(implementation = FindAllCategoriesResponse.class))}) | ||
ResponseEntity<FindAllCategoriesResponse> getCategories(); | ||
|
||
@Operation(summary = "카테고리 수정", description = "해당하는 식별자의 카테고리를 수정합니다.") | ||
@ApiResponse(responseCode = "200", description = "카테고리 수정 성공") | ||
@ApiErrorResponse(status = HttpStatus.BAD_REQUEST, instance = "/categories/1", errorCases = { | ||
@ErrorCase(description = "해당하는 id 값인 카테고리가 없는 경우", | ||
exampleMessage = "식별자 1에 해당하는 카테고리가 존재하지 않습니다."), | ||
@ErrorCase(description = "동일한 이름의 카테고리가 존재하는 경우", | ||
exampleMessage = "이름이 Spring 인 카테고리가 이미 존재합니다.") | ||
}) | ||
ResponseEntity<Void> updateCategory(Long id, UpdateCategoryRequest updateCategoryRequest); | ||
|
||
@Operation(summary = "카테고리 삭제", description = "해당하는 식별자의 카테고리를 삭제합니다.") | ||
@ApiResponse(responseCode = "204", description = "카테고리 삭제 성공") | ||
@ApiErrorResponse(status = HttpStatus.BAD_REQUEST, instance = "/categories/1", errorCases = { | ||
@ErrorCase(description = "삭제하려는 카테고리에 템플릿이 존재하는 경우", | ||
exampleMessage = "템플릿이 존재하는 카테고리는 삭제할 수 없습니다."), | ||
}) | ||
ResponseEntity<Void> deleteCategory(Long id); | ||
} |
32 changes: 32 additions & 0 deletions
32
backend/src/main/java/codezap/category/domain/Category.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 codezap.category.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
|
||
import codezap.global.auditing.BaseTimeEntity; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
public class Category extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false, unique = true) | ||
private String name; | ||
|
||
public Category(String name) { | ||
this.name = name; | ||
} | ||
|
||
public void updateName(String name) { | ||
this.name = name; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
backend/src/main/java/codezap/category/dto/request/CreateCategoryRequest.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,16 @@ | ||
package codezap.category.dto.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Size; | ||
|
||
import codezap.global.validation.ValidationGroups.NotNullGroup; | ||
import codezap.global.validation.ValidationGroups.SizeCheckGroup; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
public record CreateCategoryRequest( | ||
@Schema(description = "카테고리 이름", example = "Spring") | ||
@NotBlank(message = "카테고리 이름이 null 입니다.", groups = NotNullGroup.class) | ||
@Size(max = 255, message = "카테고리 이름은 최대 255자까지 입력 가능합니다.", groups = SizeCheckGroup.class) | ||
String name | ||
) { | ||
} |
16 changes: 16 additions & 0 deletions
16
backend/src/main/java/codezap/category/dto/request/UpdateCategoryRequest.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,16 @@ | ||
package codezap.category.dto.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Size; | ||
|
||
import codezap.global.validation.ValidationGroups.NotNullGroup; | ||
import codezap.global.validation.ValidationGroups.SizeCheckGroup; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
public record UpdateCategoryRequest( | ||
@Schema(description = "카테고리 이름", example = "Spring") | ||
@NotBlank(message = "카테고리 이름이 null 입니다.", groups = NotNullGroup.class) | ||
@Size(max = 255, message = "카테고리 이름은 최대 255자까지 입력 가능합니다.", groups = SizeCheckGroup.class) | ||
String name | ||
) { | ||
} |
19 changes: 19 additions & 0 deletions
19
backend/src/main/java/codezap/category/dto/response/FindAllCategoriesResponse.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,19 @@ | ||
package codezap.category.dto.response; | ||
|
||
import java.util.List; | ||
|
||
import codezap.category.domain.Category; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
public record FindAllCategoriesResponse( | ||
@Schema(description = "카테고리 목록") | ||
List<FindCategoryResponse> categories | ||
) { | ||
public static FindAllCategoriesResponse from(List<Category> categories) { | ||
return new FindAllCategoriesResponse( | ||
categories.stream() | ||
.map(FindCategoryResponse::from) | ||
.toList() | ||
); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
backend/src/main/java/codezap/category/dto/response/FindCategoryResponse.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 codezap.category.dto.response; | ||
|
||
import codezap.category.domain.Category; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
public record FindCategoryResponse( | ||
@Schema(description = "카테고리 식별자", example = "1") | ||
Long id, | ||
@Schema(description = "카테고리 이름", example = "Spring") | ||
String name | ||
) { | ||
public static FindCategoryResponse from(Category category) { | ||
return new FindCategoryResponse(category.getId(), category.getName()); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
backend/src/main/java/codezap/category/repository/CategoryRepository.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,17 @@ | ||
package codezap.category.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.http.HttpStatus; | ||
|
||
import codezap.category.domain.Category; | ||
import codezap.global.exception.CodeZapException; | ||
|
||
public interface CategoryRepository extends JpaRepository<Category, Long> { | ||
|
||
default Category fetchById(Long id) { | ||
return findById(id).orElseThrow( | ||
() -> new CodeZapException(HttpStatus.NOT_FOUND, "식별자 " + id + "에 해당하는 카테고리가 존재하지 않습니다.")); | ||
} | ||
|
||
boolean existsByName(String name); | ||
} |
69 changes: 69 additions & 0 deletions
69
backend/src/main/java/codezap/category/service/CategoryService.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,69 @@ | ||
package codezap.category.service; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import codezap.category.domain.Category; | ||
import codezap.category.dto.request.CreateCategoryRequest; | ||
import codezap.category.dto.request.UpdateCategoryRequest; | ||
import codezap.category.dto.response.FindAllCategoriesResponse; | ||
import codezap.category.repository.CategoryRepository; | ||
import codezap.global.exception.CodeZapException; | ||
import codezap.template.repository.TemplateRepository; | ||
|
||
@Service | ||
public class CategoryService { | ||
|
||
private static final long DEFAULT_CATEGORY = 1L; | ||
private final CategoryRepository categoryRepository; | ||
private final TemplateRepository templateRepository; | ||
|
||
public CategoryService(CategoryRepository categoryRepository, TemplateRepository templateRepository) { | ||
this.categoryRepository = categoryRepository; | ||
this.templateRepository = templateRepository; | ||
} | ||
|
||
@Transactional | ||
public Long create(CreateCategoryRequest createCategoryRequest) { | ||
String categoryName = createCategoryRequest.name(); | ||
validateDuplicatedCategory(categoryName); | ||
Category category = new Category(categoryName); | ||
return categoryRepository.save(category).getId(); | ||
} | ||
|
||
public FindAllCategoriesResponse findAll() { | ||
return FindAllCategoriesResponse.from(categoryRepository.findAll()); | ||
} | ||
|
||
@Transactional | ||
public void update(Long id, UpdateCategoryRequest updateCategoryRequest) { | ||
validateDuplicatedCategory(updateCategoryRequest.name()); | ||
Category category = categoryRepository.fetchById(id); | ||
category.updateName(updateCategoryRequest.name()); | ||
} | ||
|
||
private void validateDuplicatedCategory(String categoryName) { | ||
if (categoryRepository.existsByName(categoryName)) { | ||
throw new CodeZapException(HttpStatus.CONFLICT, "이름이 " + categoryName + "인 카테고리가 이미 존재합니다."); | ||
} | ||
} | ||
|
||
public void deleteById(Long id) { | ||
assertNoTemplates(id); | ||
assertDefaultCategory(id); | ||
categoryRepository.deleteById(id); | ||
} | ||
|
||
private void assertNoTemplates(Long id) { | ||
if (templateRepository.existsByCategoryId(id)) { | ||
throw new CodeZapException(HttpStatus.BAD_REQUEST, "템플릿이 존재하는 카테고리는 삭제할 수 없습니다."); | ||
} | ||
} | ||
|
||
private static void assertDefaultCategory(Long id) { | ||
if (id == DEFAULT_CATEGORY) { | ||
throw new CodeZapException(HttpStatus.BAD_REQUEST, "기본 카테고리는 삭제할 수 없습니다."); | ||
} | ||
} | ||
zeus6768 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
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
11 changes: 11 additions & 0 deletions
11
backend/src/main/java/codezap/global/validation/ValidationGroups.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 codezap.global.validation; | ||
|
||
public class ValidationGroups { | ||
public interface NotNullGroup {} | ||
|
||
public interface SnippetOrdinalGroup {} | ||
|
||
public interface SnippetCountGroup {} | ||
|
||
public interface SizeCheckGroup {} | ||
} |
16 changes: 16 additions & 0 deletions
16
backend/src/main/java/codezap/global/validation/ValidationSequence.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,16 @@ | ||
package codezap.global.validation; | ||
|
||
import jakarta.validation.GroupSequence; | ||
|
||
import codezap.global.validation.ValidationGroups.NotNullGroup; | ||
import codezap.global.validation.ValidationGroups.SizeCheckGroup; | ||
import codezap.global.validation.ValidationGroups.SnippetCountGroup; | ||
import codezap.global.validation.ValidationGroups.SnippetOrdinalGroup; | ||
|
||
@GroupSequence({ | ||
NotNullGroup.class, | ||
SizeCheckGroup.class, | ||
SnippetCountGroup.class, | ||
SnippetOrdinalGroup.class}) | ||
public interface ValidationSequence { | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CreateCategoryRequest
와 완전히 동일한 형식인데요.혹여나 나중에 생성 / 수정 기능 중 하나만 request 형식이 변경될 경우를 대비해 요청 DTO 도 분리해 두었습니다.
그런데, 이게 맞는건지 잘 모르겠네요 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 생성하고 수정 request는 구분해 놓는 게 좋을 것 같아요 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 가짜중복이라고 생각해요 :)