-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat] #674 앱잼탬프 스탬프 등록 API 구현 #675
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
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
91af198
[#674] refactor: TeamNumber 파라미터의 required 를 false로 변경, 미션 목록 응답도 다르게…
jher235 5212fb1
[#674] feat: 앱잼 유저 정보 DTO 추가
jher235 83d95d8
[#674] feat: 앱잼탬프 미션 목록 조회 시 요청한 유저의 앱잼 관련 정보를 추가로 반환하도록 함
jher235 f0f0458
[#674] refactor: 조회수 증가 로직 트랜잭션 분리
jher235 cd51cfe
[#674] feat: 앱잼탬프 미션 제출 로직 구현
jher235 b9cb920
[#674] feat: 앱잼탬프 미션 미션 제출 presentation layer 구현
jher235 7653ec3
[#674] feat: 앱잼탬프 미션 등록의 isAppjamJoined 필드 변환 명시
jher235 ac0815f
[#674] feat: 앱잼 정보 조회 API 구현
jher235 5f7b73d
[#674] refactor: 필드명을 isAppjamJoined 로 명시
jher235 e41ec29
[#674] chore: 스탬프 중복 제출 swagger 에러코드 수정
jher235 6662ecf
[#674] fix: 미션 중복 제출 여부를 확인하는 로직에서 userId가 아닌 AppjamUserId를 사용하고 있던 부…
jher235 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
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
41 changes: 41 additions & 0 deletions
41
src/main/java/org/sopt/app/application/stamp/AppjamStampService.java
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,41 @@ | ||
| package org.sopt.app.application.stamp; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.val; | ||
| import org.sopt.app.common.exception.BadRequestException; | ||
| import org.sopt.app.common.response.ErrorCode; | ||
| import org.sopt.app.domain.entity.AppjamUser; | ||
| import org.sopt.app.domain.enums.TeamNumber; | ||
| import org.sopt.app.interfaces.postgres.AppjamUserRepository; | ||
| import org.sopt.app.interfaces.postgres.StampRepository; | ||
| import org.sopt.app.presentation.appjamtamp.AppjamtampRequest; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| public class AppjamStampService { | ||
|
|
||
| private final AppjamUserRepository appjamUserRepository; | ||
| private final StampRepository stampRepository; | ||
|
|
||
| @Transactional(readOnly = true) | ||
| public void checkDuplicateStamp(TeamNumber teamNumber, Long missionId) { | ||
| val appjamUsers = appjamUserRepository.findAllByTeamNumber(teamNumber); | ||
| val isDuplicated = stampRepository.existsByUserIdInAndMissionId( | ||
| appjamUsers.stream().map(AppjamUser::getId).toList(), missionId); | ||
| if (isDuplicated) { | ||
| throw new BadRequestException(ErrorCode.DUPLICATE_STAMP); | ||
| } | ||
| } | ||
|
|
||
| @Transactional | ||
| public StampInfo.Stamp uploadStamp( | ||
| AppjamtampRequest.RegisterStampRequest stampRequest, | ||
| Long userId | ||
| ) { | ||
| val stamp = stampRequest.toStamp(userId); | ||
| val newStamp = stampRepository.save(stamp); | ||
| return StampInfo.Stamp.from(newStamp); | ||
| } | ||
| } | ||
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
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
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
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.