-
Notifications
You must be signed in to change notification settings - Fork 0
merge(#41) 봉사 조회 및 역할 지정 api 추가 #44
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
Open
ByunDohwi
wants to merge
27
commits into
develop
Choose a base branch
from
feat/(#41)-봉사-조회-및-역할-지정-api-추가
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "feat/(#41)-\uBD09\uC0AC-\uC870\uD68C-\uBC0F-\uC5ED\uD560-\uC9C0\uC815-api-\uCD94\uAC00"
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e13a605
chore(#42): gitkeep 제거
ByunDohwi 621873f
chore(#42): gitkeep 제거
ByunDohwi 06540c3
Merge remote-tracking branch 'origin/feat/(#41)-봉사-조회-및-역할-지정-api-추가'…
ByunDohwi 2eb3690
feat(#41): userActivity
ByunDohwi 1672417
chore(#41): gitkeep 삭제
ByunDohwi c0bf658
feat(#41): 컬럼 추가 및 역할 추가 api
ByunDohwi 387a04f
chore(#42): gitkeep 삭제
ByunDohwi a0fb13a
feat(#41): 봉사 상세 조회 api 추가
ByunDohwi 1695d52
feat(#42): schema 수정
ByunDohwi 21e486a
feat(#41): 봉사활동 리스트 조회 api 추가
ByunDohwi 1dfccad
fix(#41): 유저 활동 생성 요청 바디 매핑 추가
ByunDohwi e74e054
sytle(#42): lint format
ByunDohwi 28b7a7c
feat(#41): status 추가
ByunDohwi 09e7c29
feat(#41): schema 수정
ByunDohwi c9d134c
feat(#41): 봉사활동 리스트 조회 api 추가
ByunDohwi 9cfd30e
fix(#41): 유저 활동 생성 요청 바디 매핑 추가
ByunDohwi 272e3b4
sytle(#41): lint format
ByunDohwi 21119a1
feat(#41): status 추가
ByunDohwi 91b7e94
Merge remote-tracking branch 'origin/feat/(#41)-봉사-조회-및-역할-지정-api-추가'…
ByunDohwi 0306eac
chore(#41): valid 추가
ByunDohwi 631094e
fix(#41): delete response status 변경
ByunDohwi e2d4cd7
chore(#41): userId 삭제
ByunDohwi c276ebf
chore(#41): 내부/외부 DTO 분리
ByunDohwi f9a1e0a
chore(#41): 환경변수 삭제
ByunDohwi 66b5ea3
chore(#41): 환경변수 파일 ignore 추가
ByunDohwi 0558d05
chore(#41): 환경변수 파일 ignore 추가
ByunDohwi 40aedab
chore(#41): exception 하위 도메인 패키지 생성
ByunDohwi 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
Some comments aren't visible on the classic Files Changed page.
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
Empty file.
17 changes: 16 additions & 1 deletion
17
...-volunteer/src/main/kotlin/finda/findavolunteer/adapter/in/activity/ActivityWebAdapter.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 |
|---|---|---|
| @@ -1,8 +1,23 @@ | ||
| package finda.findavolunteer.adapter.`in`.activity | ||
|
|
||
| import finda.findavolunteer.adapter.`in`.activity.dto.request.CreateUserActivityRequest | ||
| import finda.findavolunteer.adapter.`in`.activity.mapper.toCommand | ||
| import finda.findavolunteer.application.port.`in`.activity.CreateUserActivityUseCase | ||
| import jakarta.validation.Valid | ||
| 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 | ||
|
|
||
| @RestController | ||
| @RequestMapping("/activities") | ||
| class ActivityWebAdapter | ||
| class ActivityWebAdapter( | ||
| private val createUserActivityUseCase: CreateUserActivityUseCase | ||
| ) { | ||
| @PostMapping("/user") | ||
| fun createUserActivity( | ||
| @Valid @RequestBody | ||
| request: CreateUserActivityRequest | ||
| ) = | ||
| createUserActivityUseCase.execute(request.toCommand()) | ||
| } | ||
16 changes: 16 additions & 0 deletions
16
.../kotlin/finda/findavolunteer/adapter/in/activity/dto/request/CreateUserActivityRequest.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,16 @@ | ||
| package finda.findavolunteer.adapter.`in`.activity.dto.request | ||
|
|
||
| import jakarta.validation.Valid | ||
| import jakarta.validation.constraints.NotEmpty | ||
| import java.util.* | ||
|
|
||
| data class CreateUserActivityRequest( | ||
| @field:Valid | ||
| @field:NotEmpty | ||
| val userActivityList: List<UserActivity> | ||
| ) | ||
|
|
||
| data class UserActivity( | ||
| val userId: UUID, | ||
| val activityId: UUID | ||
| ) |
15 changes: 15 additions & 0 deletions
15
...kotlin/finda/findavolunteer/adapter/in/activity/mapper/CreateUserActivityRequestMapper.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,15 @@ | ||
| package finda.findavolunteer.adapter.`in`.activity.mapper | ||
|
|
||
| import finda.findavolunteer.adapter.`in`.activity.dto.request.CreateUserActivityRequest | ||
| import finda.findavolunteer.application.port.`in`.activity.dto.request.CreateUserActivityCommand | ||
| import finda.findavolunteer.application.port.`in`.activity.dto.request.UserActivityCommand | ||
|
|
||
| fun CreateUserActivityRequest.toCommand(): CreateUserActivityCommand = | ||
| CreateUserActivityCommand( | ||
| userActivityCommandList = userActivityList.map { | ||
| UserActivityCommand( | ||
| userId = it.userId, | ||
| activityId = it.activityId | ||
| ) | ||
| } | ||
| ) |
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
59 changes: 59 additions & 0 deletions
59
.../kotlin/finda/findavolunteer/adapter/in/volunteer/dto/response/VolunteerDetailResponse.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,59 @@ | ||
| package finda.findavolunteer.adapter.`in`.volunteer.dto.response | ||
|
|
||
| import finda.findavolunteer.domain.participation.enum.ParticipationStatus | ||
| import finda.findavolunteer.domain.volunteer.enum.CycleType | ||
| import finda.findavolunteer.domain.volunteer.enum.GroupVolunteerType | ||
| import finda.findavolunteer.domain.volunteer.enum.VolunteerStatus | ||
| import finda.findavolunteer.domain.volunteer.enum.VolunteerType | ||
| import finda.findavolunteer.domain.volunteer.enum.Weekday | ||
| import java.time.LocalDate | ||
| import java.time.LocalDateTime | ||
| import java.time.LocalTime | ||
| import java.util.UUID | ||
|
|
||
| data class VolunteerDetailResponse( | ||
| val volunteerId: UUID, | ||
| val title: String, | ||
| val description: String, | ||
| val status: VolunteerStatus, | ||
| val personnel: Int, | ||
| val unitVolunteerHours: Float, | ||
| val applicationStartDate: LocalDate, | ||
| val applicationEndDate: LocalDate, | ||
| val workStartDate: LocalDate, | ||
| val workEndDate: LocalDate, | ||
| val cycleType: CycleType, | ||
| val weekdays: List<Weekday>, | ||
| val monthDate: Int?, | ||
| val remindTime: LocalTime, | ||
| val groupVolunteerType: GroupVolunteerType, | ||
| val volunteerType: VolunteerType, | ||
| val writerUserId: UUID, | ||
| val schedules: List<VolunteerScheduleResponse>, | ||
| val studentParticipations: List<StudentParticipationResponse>, | ||
| val activities: List<ActivityResponse>, | ||
| val userActivities: List<UserActivityResponse> | ||
| ) | ||
|
|
||
| data class VolunteerScheduleResponse( | ||
| val scheduleId: UUID, | ||
| val scheduleDate: LocalDate | ||
| ) | ||
|
|
||
| data class StudentParticipationResponse( | ||
| val userId: UUID, | ||
| val name: String, | ||
| val status: ParticipationStatus, | ||
| val participatedAt: LocalDateTime | ||
| ) | ||
|
|
||
| data class ActivityResponse( | ||
| val activityId: UUID, | ||
| val activityName: String | ||
| ) | ||
|
|
||
| data class UserActivityResponse( | ||
| val userId: UUID, | ||
| val userName: String, | ||
| val activityId: UUID | ||
| ) |
12 changes: 12 additions & 0 deletions
12
...in/kotlin/finda/findavolunteer/adapter/in/volunteer/dto/response/VolunteerListResponse.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,12 @@ | ||
| package finda.findavolunteer.adapter.`in`.volunteer.dto.response | ||
|
|
||
| import java.time.LocalDate | ||
| import java.util.UUID | ||
|
|
||
| data class VolunteerListResponse( | ||
| val volunteerId: UUID, | ||
| val title: String, | ||
| val workStartDate: LocalDate, | ||
| val workEndDate: LocalDate, | ||
| val unitVolunteerHours: Float | ||
| ) |
31 changes: 31 additions & 0 deletions
31
...n/kotlin/finda/findavolunteer/adapter/in/volunteer/mapper/CreateVolunteerRequestMapper.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,31 @@ | ||
| package finda.findavolunteer.adapter.`in`.volunteer.mapper | ||
|
|
||
| import finda.findavolunteer.adapter.`in`.volunteer.dto.request.CreateVolunteerRequest | ||
| import finda.findavolunteer.application.port.`in`.volunteer.dto.request.CreateVolunteerCommand | ||
| import finda.findavolunteer.application.port.`in`.volunteer.dto.request.VolunteerDateCommand | ||
|
|
||
| fun CreateVolunteerRequest.toCommand(): CreateVolunteerCommand = | ||
| CreateVolunteerCommand( | ||
| personnel = personnal, | ||
| title = title, | ||
| description = description, | ||
| unitVolunteerTime = unitVolunteerTime, | ||
| applicationDateCommand = VolunteerDateCommand( | ||
| startDate = applicationDate.startDate, | ||
| endDate = applicationDate.endDate | ||
| ), | ||
| workDateCommand = VolunteerDateCommand( | ||
| startDate = workDate.startDate, | ||
| endDate = workDate.endDate | ||
| ), | ||
| cycle = cycle, | ||
| volunteerDateList = volunteerDate, | ||
| teacherIdList = teachers, | ||
| studentIdList = students, | ||
| remindTime = remindTime, | ||
| volunteerType = volunteerType, | ||
| groupVolunteerType = groupVolunteerType, | ||
| activityNameList = activity, | ||
| weekdayList = weekdays, | ||
| monthDate = monthDate | ||
| ) |
67 changes: 67 additions & 0 deletions
67
...src/main/kotlin/finda/findavolunteer/adapter/in/volunteer/mapper/VolunteerResultMapper.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,67 @@ | ||
| package finda.findavolunteer.adapter.`in`.volunteer.mapper | ||
|
|
||
| import finda.findavolunteer.adapter.`in`.volunteer.dto.response.ActivityResponse | ||
| import finda.findavolunteer.adapter.`in`.volunteer.dto.response.StudentParticipationResponse | ||
| import finda.findavolunteer.adapter.`in`.volunteer.dto.response.UserActivityResponse | ||
| import finda.findavolunteer.adapter.`in`.volunteer.dto.response.VolunteerDetailResponse | ||
| import finda.findavolunteer.adapter.`in`.volunteer.dto.response.VolunteerListResponse | ||
| import finda.findavolunteer.adapter.`in`.volunteer.dto.response.VolunteerScheduleResponse | ||
| import finda.findavolunteer.application.port.`in`.volunteer.dto.response.VolunteerDetailResult | ||
| import finda.findavolunteer.application.port.`in`.volunteer.dto.response.VolunteerListResult | ||
|
|
||
| fun VolunteerDetailResult.toResponse(): VolunteerDetailResponse = | ||
| VolunteerDetailResponse( | ||
| volunteerId = volunteerId, | ||
| title = title, | ||
| description = description, | ||
| status = status, | ||
| personnel = personnel, | ||
| unitVolunteerHours = unitVolunteerHours, | ||
| applicationStartDate = applicationStartDate, | ||
| applicationEndDate = applicationEndDate, | ||
| workStartDate = workStartDate, | ||
| workEndDate = workEndDate, | ||
| cycleType = cycleType, | ||
| weekdays = weekdayList, | ||
| monthDate = monthDate, | ||
| remindTime = remindTime, | ||
| groupVolunteerType = groupVolunteerType, | ||
| volunteerType = volunteerType, | ||
| writerUserId = writerUserId, | ||
| schedules = scheduleResultList.map { | ||
| VolunteerScheduleResponse( | ||
| scheduleId = it.scheduleId, | ||
| scheduleDate = it.scheduleDate | ||
| ) | ||
| }, | ||
| studentParticipations = studentParticipationResultList.map { | ||
| StudentParticipationResponse( | ||
| userId = it.userId, | ||
| name = it.name, | ||
| status = it.status, | ||
| participatedAt = it.participatedAt | ||
| ) | ||
| }, | ||
| activities = activityResultList.map { | ||
| ActivityResponse( | ||
| activityId = it.activityId, | ||
| activityName = it.activityName | ||
| ) | ||
| }, | ||
| userActivities = userActivityResultList.map { | ||
| UserActivityResponse( | ||
| userId = it.userId, | ||
| userName = it.userName, | ||
| activityId = it.activityId | ||
| ) | ||
| } | ||
| ) | ||
|
|
||
| fun VolunteerListResult.toResponse(): VolunteerListResponse = | ||
| VolunteerListResponse( | ||
| volunteerId = volunteerId, | ||
| title = title, | ||
| workStartDate = workStartDate, | ||
| workEndDate = workEndDate, | ||
| unitVolunteerHours = unitVolunteerHours | ||
| ) |
41 changes: 41 additions & 0 deletions
41
finda-volunteer/src/main/kotlin/finda/findavolunteer/adapter/out/grpc/UserGrpcAdapter.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,41 @@ | ||
| package finda.findavolunteer.adapter.out.grpc | ||
|
|
||
| import finda.findaauth.adapter.`in`.grpc.AuthServiceGrpc | ||
| import finda.findaauth.adapter.`in`.grpc.UserRequest | ||
| import finda.findavolunteer.application.port.out.user.UserQueryPort | ||
| import io.grpc.Status | ||
| import io.grpc.StatusRuntimeException | ||
| import net.devh.boot.grpc.client.inject.GrpcClient | ||
| import org.slf4j.LoggerFactory | ||
| import org.springframework.stereotype.Component | ||
| import java.util.UUID | ||
| import java.util.concurrent.TimeUnit | ||
|
|
||
| @Component | ||
| class UserGrpcAdapter : UserQueryPort { | ||
| private val log = LoggerFactory.getLogger(javaClass) | ||
|
|
||
| @GrpcClient("auth-service") | ||
| private lateinit var authServiceStub: AuthServiceGrpc.AuthServiceBlockingStub | ||
|
|
||
| override fun getUserName(userId: UUID): String? { | ||
| return try { | ||
| authServiceStub | ||
| .withDeadlineAfter(2L, TimeUnit.SECONDS) | ||
| .getUserName( | ||
| UserRequest.newBuilder() | ||
| .setUserId(userId.toString()) | ||
| .build() | ||
| ) | ||
| .userName | ||
| } catch (e: StatusRuntimeException) { | ||
| when (e.status.code) { | ||
| Status.Code.NOT_FOUND -> null | ||
| else -> { | ||
| log.error("gRPC getUserName failed.", e) | ||
| throw e | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
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.
ResponseStatus 추가하시면 좋을 것 같아요
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.
28b7a7c