Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
feat :: 구인 디테일 api 개발
Browse files Browse the repository at this point in the history
  • Loading branch information
LimiteDiTempo committed Aug 26, 2024
1 parent 798dcae commit 461f057
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import com.byebye.chapterTwo.domain.gooin.dto.req.AddGooinRequest
import com.byebye.chapterTwo.domain.gooin.entity.GooinEntity
import com.byebye.chapterTwo.domain.gooin.service.GooinService
import com.byebye.chapterTwo.global.common.BaseResponse
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PatchMapping
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
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/gooin")
Expand All @@ -31,4 +26,9 @@ class GooinController(
return gooinService.editGooin(id,dto)
}

@GetMapping("/{id}")
fun getGooin(@PathVariable id:Long):BaseResponse<GooinEntity> {
return gooinService.getDetail(id)
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.byebye.chapterTwo.domain.exception
package com.byebye.chapterTwo.domain.gooin.exception

import com.byebye.chapterTwo.global.auth.exception.CustomErrorCode
import org.springframework.http.HttpStatus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.byebye.chapterTwo.domain.gooin.service

import com.byebye.chapterTwo.domain.exception.GooinErrorCode
import com.byebye.chapterTwo.domain.gooin.exception.GooinErrorCode
import com.byebye.chapterTwo.domain.gooin.dto.Gooin
import com.byebye.chapterTwo.domain.gooin.dto.req.AddGooinRequest
import com.byebye.chapterTwo.domain.gooin.entity.GooinEntity
import com.byebye.chapterTwo.domain.gooin.mapper.GooinMapper
import com.byebye.chapterTwo.domain.gooin.repository.GooinRepository
import com.byebye.chapterTwo.global.auth.exception.CustomErrorCode
import com.byebye.chapterTwo.global.auth.exception.CustomException
import com.byebye.chapterTwo.global.auth.jwt.JwtUtils
import com.byebye.chapterTwo.global.common.BaseResponse
Expand Down Expand Up @@ -52,4 +51,11 @@ class GooinService(
)
}

fun getDetail(id:Long):BaseResponse<GooinEntity>{
return BaseResponse(
message = "조회 성공",
data = gooinRepository.findById(id).orElseThrow { CustomException(GooinErrorCode.GOOIN_NOT_FOUND) }
)
}

}

0 comments on commit 461f057

Please sign in to comment.