Skip to content

Commit

Permalink
Merge pull request #48 from Workout-Study/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
12OneTwo12 authored Aug 8, 2024
2 parents cd09dcb + 2726c4f commit eec3f6f
Show file tree
Hide file tree
Showing 42 changed files with 502 additions and 56 deletions.
70 changes: 69 additions & 1 deletion src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,40 @@ http-response

include::{snippets}/delete-fit-record/http-response.adoc[]

=== Update Fit Record Multimedia End Point ( fit record 사진 업데이트 )

path-parameters

include::{snippets}/update-fit-record-multimedia-end-point/path-parameters.adoc[]

http-request

include::{snippets}/update-fit-record-multimedia-end-point/http-request.adoc[]

request-fields

include::{snippets}/update-fit-record-multimedia-end-point/request-fields.adoc[]

request-body

include::{snippets}/update-fit-record-multimedia-end-point/request-body.adoc[]

curl-request

include::{snippets}/update-fit-record-multimedia-end-point/curl-request.adoc[]

response-fields

include::{snippets}/update-fit-record-multimedia-end-point/response-fields.adoc[]

response-body

include::{snippets}/update-fit-record-multimedia-end-point/response-body.adoc[]

http-response

include::{snippets}/update-fit-record-multimedia-end-point/http-response.adoc[]

=== Fit Record Filter ( 사용자의 기록 기간으로 filtering )

http-request
Expand Down Expand Up @@ -632,4 +666,38 @@ include::{snippets}/update-fit-off/response-body.adoc[]

http-response

include::{snippets}/update-fit-off/http-response.adoc[]
include::{snippets}/update-fit-off/http-response.adoc[]

=== Get Proceeding Fit Off List by group id ( 그룹 id로 현재 진행중인 fit off 조회 )

path-parameters

include::{snippets}/get-proceeding-fit-off-by-group-id/path-parameters.adoc[]

http-request

include::{snippets}/get-proceeding-fit-off-by-group-id/http-request.adoc[]

request-fields

include::{snippets}/get-proceeding-fit-off-by-group-id/request-fields.adoc[]

request-body

include::{snippets}/get-proceeding-fit-off-by-group-id/request-body.adoc[]

curl-request

include::{snippets}/get-proceeding-fit-off-by-group-id/curl-request.adoc[]

response-fields

include::{snippets}/get-proceeding-fit-off-by-group-id/response-fields.adoc[]

response-body

include::{snippets}/get-proceeding-fit-off-by-group-id/response-body.adoc[]

http-response

include::{snippets}/get-proceeding-fit-off-by-group-id/http-response.adoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.fitmate.myfit.application.port.`in`.certification.usecase.ReadFitCert
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController

@RestController
Expand All @@ -20,10 +21,11 @@ class FitCertificationFilterController(private val readFitCertificationUseCase:
)
fun getFitCertificationByGroupId(
@PathVariable(GlobalURI.PATH_VARIABLE_FIT_GROUP_ID) fitGroupId: Long,
@PathVariable(GlobalURI.PATH_VARIABLE_USER_ID) requestUserId: Int
@PathVariable(GlobalURI.PATH_VARIABLE_USER_ID) requestUserId: Int,
@RequestParam(required = false) withOwn: Int?
): ResponseEntity<FitCertificationDetailsResponse> {
val fitCertificationFilterByGroupIdCommand =
FitCertificationFilterDtoMapper.filterByGroupIdAndUserIdRequestToCommand(fitGroupId, requestUserId)
FitCertificationFilterDtoMapper.filterByGroupIdAndUserIdRequestToCommand(fitGroupId, requestUserId, withOwn)
val fitCertificationDetailResponseDtoList =
readFitCertificationUseCase.getFitCertificationByGroupId(fitCertificationFilterByGroupIdCommand)
return ResponseEntity.ok()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ class FitCertificationFilterDtoMapper {
companion object {
fun filterByGroupIdAndUserIdRequestToCommand(
fitGroupId: Long,
requestUserId: Int
requestUserId: Int,
withOwn: Int?
): FitCertificationFilterByGroupCommand =
FitCertificationFilterByGroupCommand(fitGroupId, requestUserId)
FitCertificationFilterByGroupCommand(fitGroupId, requestUserId, withOwn)

fun dtoToFitCertificationDetailsResponse(dtoList: List<FitCertificationDetailWithVoteResponseDto>): FitCertificationDetailsResponse =
FitCertificationDetailsResponse(dtoList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import com.fitmate.myfit.adapter.`in`.web.fit.off.request.DeleteFitOffRequest
import com.fitmate.myfit.adapter.`in`.web.fit.off.request.RegisterFitOffRequest
import com.fitmate.myfit.adapter.`in`.web.fit.off.request.UpdateFitOffRequest
import com.fitmate.myfit.adapter.`in`.web.fit.off.response.DeleteFitOffResponse
import com.fitmate.myfit.adapter.`in`.web.fit.off.response.ProceedingFitOffResponse
import com.fitmate.myfit.adapter.`in`.web.fit.off.response.RegisterFitOffResponse
import com.fitmate.myfit.adapter.`in`.web.fit.off.response.UpdateFitOffResponse
import com.fitmate.myfit.application.port.`in`.fit.off.usecase.DeleteFitOffUseCase
import com.fitmate.myfit.application.port.`in`.fit.off.usecase.ReadFitOffUseCase
import com.fitmate.myfit.application.port.`in`.fit.off.usecase.RegisterFitOffUseCase
import com.fitmate.myfit.application.port.`in`.fit.off.usecase.UpdateFitOffUseCase
import jakarta.validation.Valid
Expand All @@ -20,7 +22,8 @@ import org.springframework.web.bind.annotation.*
class FitOffController(
private val registerFitOffUseCase: RegisterFitOffUseCase,
private val deleteFitOffUseCase: DeleteFitOffUseCase,
private val updateFitOffUseCase: UpdateFitOffUseCase
private val updateFitOffUseCase: UpdateFitOffUseCase,
private val readFitOffUseCase: ReadFitOffUseCase
) {

/**
Expand Down Expand Up @@ -72,4 +75,10 @@ class FitOffController(
val updateFitOffResponseDto = updateFitOffUseCase.updateFitOff(updateFitOffCommand)
return ResponseEntity.ok().body(FitOffDtoMapper.dtoToUpdateResponse(updateFitOffResponseDto))
}

@GetMapping(GlobalURI.FIT_OFF_ROOT + GlobalURI.PATH_VARIABLE_FIT_GROUP_ID_WITH_BRACE)
fun getProceedingFitOffByGroupId(@PathVariable(GlobalURI.PATH_VARIABLE_FIT_GROUP_ID) fitGroupId: Long): ResponseEntity<ProceedingFitOffResponse> {
val command = FitOffDtoMapper.proceedingFitOffRequestToCommand(fitGroupId)
return ResponseEntity.ok().body(readFitOffUseCase.getProceedingFitOffByGroupId(command))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.fitmate.myfit.adapter.`in`.web.fit.off.response.DeleteFitOffResponse
import com.fitmate.myfit.adapter.`in`.web.fit.off.response.RegisterFitOffResponse
import com.fitmate.myfit.adapter.`in`.web.fit.off.response.UpdateFitOffResponse
import com.fitmate.myfit.application.port.`in`.fit.off.command.DeleteFitOffCommand
import com.fitmate.myfit.application.port.`in`.fit.off.command.GetProceedingFitOffCommand
import com.fitmate.myfit.application.port.`in`.fit.off.command.RegisterFitOffCommand
import com.fitmate.myfit.application.port.`in`.fit.off.command.UpdateFitOffCommand
import com.fitmate.myfit.application.port.`in`.fit.off.response.DeleteFitOffResponseDto
Expand Down Expand Up @@ -44,5 +45,9 @@ class FitOffDtoMapper {

fun dtoToUpdateResponse(updateFitOffResponseDto: UpdateFitOffResponseDto): UpdateFitOffResponse =
UpdateFitOffResponse(updateFitOffResponseDto.isUpdateSuccess)

fun proceedingFitOffRequestToCommand(fitGroupId: Long): GetProceedingFitOffCommand {
return GetProceedingFitOffCommand(fitGroupId)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.fitmate.myfit.adapter.`in`.web.fit.off.response

import java.time.Instant

data class FitOffDetail(
val fitOffId: Long,
val userId: Int,
var fitOffStartDate: Instant,
var fitOffEndDate: Instant,
var fitOffReason: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.fitmate.myfit.adapter.`in`.web.fit.off.response

data class ProceedingFitOffResponse(
val content: List<FitOffDetail>
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import com.fitmate.myfit.adapter.`in`.web.common.GlobalURI
import com.fitmate.myfit.adapter.`in`.web.fit.record.mapper.FitRecordDtoMapper
import com.fitmate.myfit.adapter.`in`.web.fit.record.request.DeleteFitRecordRequest
import com.fitmate.myfit.adapter.`in`.web.fit.record.request.RegisterFitRecordRequest
import com.fitmate.myfit.adapter.`in`.web.fit.record.request.UpdateFitRecordMultiMediaEndPointRequest
import com.fitmate.myfit.adapter.`in`.web.fit.record.response.DeleteFitRecordResponse
import com.fitmate.myfit.adapter.`in`.web.fit.record.response.RegisterFitRecordResponse
import com.fitmate.myfit.adapter.`in`.web.fit.record.response.UpdateFitRecordMultiMediaEndPointResponse
import com.fitmate.myfit.application.port.`in`.fit.record.usecase.DeleteFitRecordUseCase
import com.fitmate.myfit.application.port.`in`.fit.record.usecase.RegisterFitRecordUseCase
import com.fitmate.myfit.application.port.`in`.fit.record.usecase.UpdateFitRecordMultiMediaEndPointUseCase
import jakarta.validation.Valid
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
Expand All @@ -16,7 +19,8 @@ import org.springframework.web.bind.annotation.*
@RestController
class FitRecordController(
private val registerFitRecordUseCase: RegisterFitRecordUseCase,
private val deleteFitRecordUseCase: DeleteFitRecordUseCase
private val deleteFitRecordUseCase: DeleteFitRecordUseCase,
private val updateFitRecordUseCase: UpdateFitRecordMultiMediaEndPointUseCase
) {

/**
Expand Down Expand Up @@ -52,4 +56,14 @@ class FitRecordController(
return ResponseEntity.ok()
.body(FitRecordDtoMapper.dtoToDeleteResponse(deleteFitRecordResponseDto))
}

@PatchMapping(GlobalURI.FIT_RECORD_ROOT + GlobalURI.PATH_VARIABLE_FIT_RECORD_ID_WITH_BRACE)
fun updateFitRecordMultiMediaEndPoint(
@PathVariable(GlobalURI.PATH_VARIABLE_FIT_RECORD_ID) fitRecordId: Long,
@RequestBody @Valid request: UpdateFitRecordMultiMediaEndPointRequest
): ResponseEntity<UpdateFitRecordMultiMediaEndPointResponse> {
val command = FitRecordDtoMapper.updateMultiMediaEndPointRequestToCommand(fitRecordId, request)
val responseDto = updateFitRecordUseCase.updateFitRecordMultiMediaEndPoint(command)
return ResponseEntity.ok().body(FitRecordDtoMapper.dtoToUpdateMultiMediaEndPointResponse(responseDto))
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
package com.fitmate.myfit.adapter.`in`.web.fit.record.mapper

import com.fitmate.myfit.adapter.`in`.web.fit.record.request.DeleteFitRecordRequest
import com.fitmate.myfit.adapter.`in`.web.fit.record.request.FitRecordFilterRequest
import com.fitmate.myfit.adapter.`in`.web.fit.record.request.FitRecordSliceFilterRequest
import com.fitmate.myfit.adapter.`in`.web.fit.record.request.RegisterFitRecordRequest
import com.fitmate.myfit.adapter.`in`.web.fit.record.request.*
import com.fitmate.myfit.adapter.`in`.web.fit.record.response.DeleteFitRecordResponse
import com.fitmate.myfit.adapter.`in`.web.fit.record.response.FitRecordDetailResponse
import com.fitmate.myfit.adapter.`in`.web.fit.record.response.RegisterFitRecordResponse
import com.fitmate.myfit.application.port.`in`.fit.record.command.DeleteFitRecordCommand
import com.fitmate.myfit.application.port.`in`.fit.record.command.FitRecordFilterCommand
import com.fitmate.myfit.application.port.`in`.fit.record.command.FitRecordSliceFilterCommand
import com.fitmate.myfit.application.port.`in`.fit.record.command.RegisterFitRecordCommand
import com.fitmate.myfit.adapter.`in`.web.fit.record.response.UpdateFitRecordMultiMediaEndPointResponse
import com.fitmate.myfit.application.port.`in`.fit.record.command.*
import com.fitmate.myfit.application.port.`in`.fit.record.response.DeleteFitRecordResponseDto
import com.fitmate.myfit.application.port.`in`.fit.record.response.FitRecordDetailResponseDto
import com.fitmate.myfit.application.port.`in`.fit.record.response.RegisterFitRecordResponseDto
import com.fitmate.myfit.application.port.`in`.fit.record.response.UpdateFitRecordMultiMediaEndPointResponseDto
import org.springframework.data.domain.PageRequest
import org.springframework.data.domain.Slice

Expand Down Expand Up @@ -70,5 +66,14 @@ class FitRecordDtoMapper private constructor() {

fun dtoToDeleteResponse(dto: DeleteFitRecordResponseDto): DeleteFitRecordResponse =
DeleteFitRecordResponse(dto.isDeleteSuccess)

fun updateMultiMediaEndPointRequestToCommand(
fitRecordId: Long,
request: UpdateFitRecordMultiMediaEndPointRequest
) = UpdateFitRecordMultiMediaEndPointCommand(fitRecordId, request.requestUserId, request.multiMediaEndPoints)

fun dtoToUpdateMultiMediaEndPointResponse(
responseDto: UpdateFitRecordMultiMediaEndPointResponseDto
) = UpdateFitRecordMultiMediaEndPointResponse(responseDto.isUpdateSuccess)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.fitmate.myfit.adapter.`in`.web.fit.record.request

data class UpdateFitRecordMultiMediaEndPointRequest(
val requestUserId: Int,
val multiMediaEndPoints: List<String>?
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.fitmate.myfit.adapter.`in`.web.fit.record.response

data class UpdateFitRecordMultiMediaEndPointResponse(val isUpdateSuccess: Boolean)
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MyFitDtoMapper private constructor() {
): FitCertificationProgressResponse = FitCertificationProgressResponse(dtoList)

fun needVoteCertificationRequestToCommand(request: NeedVoteCertificationFilterRequest): NeedVoteCertificationFilterCommand =
NeedVoteCertificationFilterCommand(request.requestUserId)
NeedVoteCertificationFilterCommand(request.requestUserId, request.fitGroupId)

fun dtoToFilteredNeedVoteCertificationResponse(
dtoList: List<NeedVoteCertificationFitGroupResponseDto>
Expand All @@ -32,7 +32,7 @@ class MyFitDtoMapper private constructor() {

fun myFitGroupIssueSliceFilterRequestToCommand(request: MyFitGroupIssueSliceFilterRequest): MyFitGroupIssueSliceFilterCommand {
val pageable = PageRequest.of(request.pageNumber, request.pageSize)

return MyFitGroupIssueSliceFilterCommand(
request.userId,
pageable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.fitmate.myfit.adapter.`in`.web.my.fit.request

data class NeedVoteCertificationFilterRequest(
val requestUserId: Int
val requestUserId: Int,
val fitGroupId: Long?
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ interface FitOffRepository : JpaRepository<FitOffEntity, Long> {
): Int

fun findByIdAndState(fitOffId: Long, state: Boolean): Optional<FitOffEntity>
fun findByUserIdInAndStateAndFitOffStartDateLessThanEqualAndFitOffEndDateGreaterThanEqual(
userIdList: List<Int>,
state: Boolean,
startDate: Instant,
endDate: Instant
): List<FitOffEntity>
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ interface FitRecordMultiMediaEndPointRepository : JpaRepository<FitRecordMultiMe
fitRecordEntity: FitRecordEntity,
state: Boolean
): List<FitRecordMultiMediaEndPointEntity>

fun findByFitRecordEntityAndState(
fitRecordEntity: FitRecordEntity,
state: Boolean
): List<FitRecordMultiMediaEndPointEntity>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.fitmate.myfit.application.port.`in`.fit.off.command

import com.fitmate.myfit.common.SelfValidating

data class GetProceedingFitOffCommand(
val fitGroupId: Long
) : SelfValidating<GetProceedingFitOffCommand>() {
init {
this.validateSelf()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.fitmate.myfit.application.port.`in`.fit.off.usecase

import com.fitmate.myfit.adapter.`in`.web.fit.off.response.ProceedingFitOffResponse
import com.fitmate.myfit.application.port.`in`.fit.off.command.GetProceedingFitOffCommand

interface ReadFitOffUseCase {

fun getProceedingFitOffByGroupId(command: GetProceedingFitOffCommand): ProceedingFitOffResponse
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.fitmate.myfit.application.port.`in`.fit.record.command

import com.fitmate.myfit.common.SelfValidating

data class UpdateFitRecordMultiMediaEndPointCommand(
val fitRecordId: Long,
val requestUserId: Int,
val multiMediaEndPoints: List<String>?
) : SelfValidating<UpdateFitRecordMultiMediaEndPointCommand>() {

init {
this.validateSelf()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.fitmate.myfit.application.port.`in`.fit.record.response

data class UpdateFitRecordMultiMediaEndPointResponseDto(val isUpdateSuccess: Boolean)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.fitmate.myfit.application.port.`in`.fit.record.usecase

import com.fitmate.myfit.application.port.`in`.fit.record.command.UpdateFitRecordMultiMediaEndPointCommand
import com.fitmate.myfit.application.port.`in`.fit.record.response.UpdateFitRecordMultiMediaEndPointResponseDto

interface UpdateFitRecordMultiMediaEndPointUseCase {

fun updateFitRecordMultiMediaEndPoint(command: UpdateFitRecordMultiMediaEndPointCommand): UpdateFitRecordMultiMediaEndPointResponseDto
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ package com.fitmate.myfit.application.port.`in`.my.fit.command

data class FitCertificationFilterByGroupCommand(
val fitGroupId: Long,
val requestUserId: Int
val requestUserId: Int,
val withOwn: Int?
)
Loading

0 comments on commit eec3f6f

Please sign in to comment.