-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#11 #13
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
Merged
Merged
Feat/#11 #13
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
742e1ab
feat: 폴더, 포토 이미지 엔티티 추가
koosco d7f9ad0
feat: Jpa Auditing 설정 추가
koosco 3666ead
feat: Usecase 식별용 annotation 추가
koosco 0b39343
feat: jpa folder 영속성 Port 추가
koosco c49b854
feat: folder 기본 API
koosco a0a0a12
docs: file API swagger schema 추가
koosco 485535b
Merge branch 'staging' into feat/#11
koosco c637106
feat: folder api converter 추가
koosco 6040958
chore: 폴더명 변경 photobooth -> photo
koosco a9ea0cc
apply spotless
koosco a86a931
feat: E2E Test용 Base 클래스
koosco ddfe9bd
feat: Folder E2E Test용 Base 클래스
koosco ddaa2ae
fix: test jasypt 설정 제거
koosco cb35b4d
feat: test Media 구현체 추가
koosco 275c05b
ref: application layer에 맞게 Folder Port 메서드 시그니처 수정
koosco f0c2c91
fix: 폴더 생성 중복 검사 로직
koosco deef531
fix: 폴더명 변경 중복 검사
koosco 63e4d2b
fix: 폴더 목록 조회 메서드 시그니처 변경
koosco a049a69
fix: 폴더 목록 삭제 원자성 검증
koosco 611643a
fix: 폴더 생성 응답 추가
koosco 66d43a8
fix: 폴더 jpa 조회 메서드 추가
koosco 5ed3d5a
fix: 일관성을 위해 ExceptionDto code 변수명 resultCode로 변경
koosco 66e6602
test: Folder API E2E Test 추가
koosco ac9cc3a
feat: 폴더 conflict code 추가
koosco 571b2ed
fix: JasyptTest Spring 의존성 제거
koosco 94febd9
fix: DeleteFolder n+1 문제 해결
koosco b91eaa0
fix: RequiresSecurity class Target 추가
koosco 64a7475
Merge branch 'staging' into feat/#11
koosco 17c28f4
fix: Media 엔티티 추가
koosco 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
This file contains hidden or 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 hidden or 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,14 @@ | ||
| package com.yapp2app.common.annotation | ||
|
|
||
| import org.springframework.stereotype.Component | ||
|
|
||
| /** | ||
| * fileName : UseCase | ||
| * author : koo | ||
| * date : 2025. 12. 23. 오후 6:51 | ||
| * description : usecase annotation | ||
| */ | ||
| @Component | ||
| @Target(AnnotationTarget.CLASS) | ||
| @Retention(AnnotationRetention.RUNTIME) | ||
| annotation class UseCase |
This file contains hidden or 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 hidden or 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
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/com/yapp2app/common/domain/BaseTimeEntity.kt
This file contains hidden or 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,27 @@ | ||
| package com.yapp2app.common.domain | ||
|
|
||
| import jakarta.persistence.Column | ||
| import jakarta.persistence.EntityListeners | ||
| import jakarta.persistence.MappedSuperclass | ||
| import org.springframework.data.annotation.CreatedDate | ||
| import org.springframework.data.annotation.LastModifiedDate | ||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener | ||
| import java.time.LocalDateTime | ||
|
|
||
| /** | ||
| * fileName : BaseTimeEntity | ||
| * author : koo | ||
| * date : 2025. 12. 23. 오후 7:09 | ||
| * description : 생성일, 수정일 base entity | ||
| */ | ||
| @MappedSuperclass | ||
| @EntityListeners(AuditingEntityListener::class) | ||
| abstract class BaseTimeEntity( | ||
| @CreatedDate | ||
| @Column(name = "created_at", nullable = false, updatable = false) | ||
| var createdAt: LocalDateTime? = null, | ||
|
|
||
| @LastModifiedDate | ||
| @Column(name = "updated_at", nullable = false) | ||
| var updatedAt: LocalDateTime? = null, | ||
| ) |
This file contains hidden or 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 hidden or 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
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/yapp2app/common/infra/config/JpaAuditingConfig.kt
This file contains hidden or 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,14 @@ | ||
| package com.yapp2app.common.infra.config | ||
|
|
||
| import org.springframework.context.annotation.Configuration | ||
| import org.springframework.data.jpa.repository.config.EnableJpaAuditing | ||
|
|
||
| /** | ||
| * fileName : JpaAuditingConfig | ||
| * author : koo | ||
| * date : 2025. 12. 23. 오후 7:10 | ||
| * description : Jpa Auditing Config | ||
| */ | ||
| @Configuration | ||
| @EnableJpaAuditing | ||
| class JpaAuditingConfig |
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/yapp2app/common/infra/media/fake/FakeS3MediaStorage.kt
This file contains hidden or 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,14 @@ | ||
| package com.yapp2app.common.infra.media.fake | ||
|
|
||
| import org.springframework.context.annotation.Configuration | ||
| import org.springframework.context.annotation.Profile | ||
|
|
||
| /** | ||
| * fileName : FakeS3MediaStorage | ||
| * author : koo | ||
| * date : 2025. 12. 28. 오후 10:30 | ||
| * description : | ||
| */ | ||
| @Profile("test") | ||
| @Configuration | ||
| class FakeS3MediaStorage |
This file contains hidden or 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
127 changes: 127 additions & 0 deletions
127
src/main/kotlin/com/yapp2app/photo/api/controller/FolderController.kt
This file contains hidden or 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,127 @@ | ||
| package com.yapp2app.photo.api.controller | ||
|
|
||
| import com.yapp2app.common.api.dto.BaseResponse | ||
| import com.yapp2app.photo.api.converter.FolderCommandConverter | ||
| import com.yapp2app.photo.api.converter.FolderResultConverter | ||
| import com.yapp2app.photo.api.dto.CreateFolderRequest | ||
| import com.yapp2app.photo.api.dto.CreateFolderResponse | ||
| import com.yapp2app.photo.api.dto.DeleteFoldersRequest | ||
| import com.yapp2app.photo.api.dto.GetAllFolderResponse | ||
| import com.yapp2app.photo.api.dto.UpdateFolderRequest | ||
| import com.yapp2app.photo.application.usecase.CreateFolderUseCase | ||
| import com.yapp2app.photo.application.usecase.DeleteFolderUseCase | ||
| import com.yapp2app.photo.application.usecase.GetFoldersUseCase | ||
| import com.yapp2app.photo.application.usecase.UpdateFolderUseCase | ||
| import io.swagger.v3.oas.annotations.Operation | ||
| import io.swagger.v3.oas.annotations.tags.Tag | ||
| import jakarta.validation.Valid | ||
| import org.springframework.security.core.annotation.AuthenticationPrincipal | ||
| import org.springframework.web.bind.annotation.DeleteMapping | ||
| import org.springframework.web.bind.annotation.GetMapping | ||
| import org.springframework.web.bind.annotation.PatchMapping | ||
| import org.springframework.web.bind.annotation.PathVariable | ||
| import org.springframework.web.bind.annotation.PostMapping | ||
| import org.springframework.web.bind.annotation.RequestBody | ||
| import org.springframework.web.bind.annotation.RequestMapping | ||
| import org.springframework.web.bind.annotation.RestController | ||
|
|
||
| /** | ||
| * fileName : FolderController | ||
| * author : koo | ||
| * date : 2025. 12. 23. 오후 7:58 | ||
| * description : Folder aggregate에 대한 api endpoint | ||
| */ | ||
| @Tag(name = "folder", description = "폴더 API") | ||
| @RestController | ||
| @RequestMapping("/api/folders") | ||
| class FolderController( | ||
| private val createFolderUseCase: CreateFolderUseCase, | ||
| private val getFoldersUseCase: GetFoldersUseCase, | ||
| private val deleteFolderUseCase: DeleteFolderUseCase, | ||
| private val updateFolderUseCase: UpdateFolderUseCase, | ||
| private val commandConverter: FolderCommandConverter, | ||
| private val resultConverter: FolderResultConverter, | ||
| ) { | ||
|
|
||
| @Operation( | ||
| summary = "폴더 생성 API", | ||
| description = "폴더를 생성합니다.", | ||
| ) | ||
| @PostMapping | ||
| fun createFolder( | ||
| @AuthenticationPrincipal(expression = "id") userId: Long, | ||
| @Valid @RequestBody request: CreateFolderRequest, | ||
| ): BaseResponse<CreateFolderResponse> { | ||
| val command = commandConverter.toCreateFolderCommand(request, userId) | ||
|
|
||
| val result = createFolderUseCase.execute(command) | ||
|
|
||
| val response = resultConverter.toCreateFolderResponse(result) | ||
|
|
||
| return BaseResponse(data = response) | ||
| } | ||
|
|
||
| @Operation( | ||
| summary = "폴더 목록 조회 API", | ||
| description = "폴더 목록을 조회합니다.", | ||
| ) | ||
| @GetMapping | ||
| fun getAllFolder(@AuthenticationPrincipal(expression = "id") userId: Long): BaseResponse<GetAllFolderResponse> { | ||
| val command = commandConverter.toGetFoldersCommand(userId) | ||
|
|
||
| val result = getFoldersUseCase.execute(command) | ||
|
|
||
| val response = resultConverter.toGetAllFoldersResponse(result) | ||
|
|
||
| return BaseResponse(data = response) | ||
| } | ||
|
|
||
| @Operation( | ||
| summary = "폴더 삭제 API", | ||
| description = "단건 폴더 삭제를 합니다.", | ||
| ) | ||
| @DeleteMapping("/{folderId}") | ||
| fun deleteFolder( | ||
| @AuthenticationPrincipal(expression = "id") userId: Long, | ||
| @PathVariable folderId: Long, | ||
| ): BaseResponse<Any> { | ||
| val command = commandConverter.toDeleteFolderCommand(userId, folderId) | ||
|
|
||
| deleteFolderUseCase.execute(command) | ||
|
|
||
| return BaseResponse() | ||
| } | ||
|
|
||
| @Operation( | ||
| summary = "폴더 선택 삭제 API", | ||
| description = "여러 개의 폴더를 선택하여 삭제합니다.", | ||
| ) | ||
| @DeleteMapping | ||
| fun deleteFolders( | ||
| @AuthenticationPrincipal(expression = "id") userId: Long, | ||
| @Valid @RequestBody request: DeleteFoldersRequest, | ||
| ): BaseResponse<Any> { | ||
| val command = commandConverter.toDeleteFoldersCommand(request, userId) | ||
|
|
||
| deleteFolderUseCase.execute(command) | ||
|
|
||
| return BaseResponse() | ||
| } | ||
|
|
||
| @Operation( | ||
| summary = "폴더 갱신 API", | ||
| description = "폴더 정보를 갱신합니다.", | ||
| ) | ||
| @PatchMapping("/{folderId}") | ||
| fun updateFolder( | ||
| @AuthenticationPrincipal(expression = "id") userId: Long, | ||
| @PathVariable folderId: Long, | ||
| @Valid @RequestBody request: UpdateFolderRequest, | ||
| ): BaseResponse<Any> { | ||
| val command = commandConverter.toUpdateFolderCommand(request, folderId, userId) | ||
|
|
||
| updateFolderUseCase.execute(command) | ||
|
|
||
| return BaseResponse() | ||
| } | ||
| } | ||
34 changes: 34 additions & 0 deletions
34
src/main/kotlin/com/yapp2app/photo/api/converter/FolderCommandConverter.kt
This file contains hidden or 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,34 @@ | ||
| package com.yapp2app.photo.api.converter | ||
|
|
||
| import com.yapp2app.photo.api.dto.CreateFolderRequest | ||
| import com.yapp2app.photo.api.dto.DeleteFoldersRequest | ||
| import com.yapp2app.photo.api.dto.UpdateFolderRequest | ||
| import com.yapp2app.photo.application.command.CreateFolderCommand | ||
| import com.yapp2app.photo.application.command.DeleteFolderCommand | ||
| import com.yapp2app.photo.application.command.DeleteFoldersCommand | ||
| import com.yapp2app.photo.application.command.GetFoldersCommand | ||
| import com.yapp2app.photo.application.command.UpdateFolderCommand | ||
| import org.springframework.stereotype.Component | ||
|
|
||
| /** | ||
| * fileName : FolderCommandConverter | ||
| * author : koo | ||
| * date : 2025. 12. 28. 오후 9:44 | ||
| * description : | ||
| */ | ||
| @Component | ||
| class FolderCommandConverter { | ||
|
|
||
| fun toCreateFolderCommand(request: CreateFolderRequest, userId: Long): CreateFolderCommand = | ||
| CreateFolderCommand(userId, request.name) | ||
|
|
||
| fun toGetFoldersCommand(userId: Long): GetFoldersCommand = GetFoldersCommand(userId) | ||
|
|
||
| fun toDeleteFolderCommand(userId: Long, folderId: Long) = DeleteFolderCommand(userId, folderId) | ||
|
|
||
| fun toDeleteFoldersCommand(request: DeleteFoldersRequest, userId: Long) = | ||
| DeleteFoldersCommand(userId, request.folderIds) | ||
|
|
||
| fun toUpdateFolderCommand(request: UpdateFolderRequest, folderId: Long, userId: Long) = | ||
| UpdateFolderCommand(userId, folderId, request.name) | ||
| } |
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/com/yapp2app/photo/api/converter/FolderResultConverter.kt
This file contains hidden or 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,28 @@ | ||
| package com.yapp2app.photo.api.converter | ||
|
|
||
| import com.yapp2app.photo.api.dto.CreateFolderResponse | ||
| import com.yapp2app.photo.api.dto.GetAllFolderResponse | ||
| import com.yapp2app.photo.application.result.CreateFolderResult | ||
| import com.yapp2app.photo.application.result.GetFoldersResult | ||
| import org.springframework.stereotype.Component | ||
|
|
||
| /** | ||
| * fileName : FolderDtoMapper | ||
| * author : koo | ||
| * date : 2025. 12. 28. 오후 9:41 | ||
| * description : | ||
| */ | ||
| @Component | ||
| class FolderResultConverter { | ||
|
|
||
| fun toGetAllFoldersResponse(result: GetFoldersResult): GetAllFolderResponse = GetAllFolderResponse( | ||
| result.items.map { | ||
| GetAllFolderResponse.FolderInfo( | ||
| it.folderId, | ||
| it.name, | ||
| ) | ||
| }, | ||
| ) | ||
|
|
||
| fun toCreateFolderResponse(result: CreateFolderResult): CreateFolderResponse = CreateFolderResponse(result.folderId) | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.