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

Commit

Permalink
feat :: 구인 신청 서비스 개발
Browse files Browse the repository at this point in the history
  • Loading branch information
LimiteDiTempo committed Aug 26, 2024
1 parent 7535812 commit 3171147
Show file tree
Hide file tree
Showing 82 changed files with 110 additions and 14 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ jobs:
with:
java-version: '17'
distribution: 'temurin'
- name: List directory
run: |
echo "Current directory:"
pwd
echo "List files:"
ls -la
echo "List HackerGround directory:"
ls -la HackerGround

- name: Run Gradle Build
run: ./gradlew build
Expand Down
Binary file modified .gradle/8.8/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/8.8/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/8.8/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/8.8/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/cacheable/last-build.bin
Binary file not shown.
Binary file modified build/kotlin/compileKotlin/local-state/build-history.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/kotlin/kaptGenerateStubsKotlin/cacheable/last-build.bin
Binary file not shown.
Binary file not shown.
Binary file modified build/tmp/kapt3/incApCache/main/apt-cache.bin
Binary file not shown.
Binary file modified build/tmp/kapt3/incApCache/main/java-cache.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.byebye.chapterTwo.domain.exception

import com.byebye.chapterTwo.global.auth.exception.CustomErrorCode
import org.springframework.http.HttpStatus

enum class GooinErrorCode (
override val status: HttpStatus,
override val message: String,
) : CustomErrorCode {

GOOIN_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 구인 신청을 찾을 수 없습니다"),
GOOIN_ALREADY_EXIST(HttpStatus.CONFLICT, "해당 구인 신청이 이미 존재합니다")

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.byebye.chapterTwo.domain.gooin.controller

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

@RestController
@RequestMapping("/gooin")
class GooinController(
private val gooinService: GooinService
) {
@PostMapping
fun addGooin(@RequestBody request: AddGooinRequest): BaseResponse<String> {
return gooinService.saveGooin(request)
}

@GetMapping
fun getGooin():BaseResponse<List<GooinEntity>>{
return gooinService.getGooin()
}

@PatchMapping("/{id}")
fun editGooin(id:Long, dto:AddGooinRequest): BaseResponse<String> {
return gooinService.editGooin(id,dto)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.byebye.chapterTwo.domain.gooin.mapper

import com.byebye.chapterTwo.domain.gooin.dto.Gooin
import com.byebye.chapterTwo.domain.gooin.entity.GooinEntity
import org.springframework.stereotype.Component

@Component
class GooinMapper {
fun toDomain(entity: GooinEntity): Gooin {
return Gooin (
id = entity.id!!,
title = entity.title,
description = entity.description,
userId = entity.userId
)
}

fun toEntity(domain: Gooin): GooinEntity {
return GooinEntity (
id = domain.id?: 0,
title = domain.title,
description = domain.description,
userId = domain.userId
)
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,55 @@
package com.byebye.chapterTwo.domain.gooin.service

import com.byebye.chapterTwo.domain.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
import org.springframework.stereotype.Service

@Service
class GooinService(
private val gooinRepository: GooinRepository,
private val jwtUtils: JwtUtils
private val jwtUtils: JwtUtils,
private val gooinMapper: GooinMapper
) {

fun saveGooin(dto: AddGooinRequest){
fun saveGooin(dto: AddGooinRequest) : BaseResponse<String>{
gooinRepository.save(
GooinEntity(
title = dto.title,
description = dto.description,
userId = jwtUtils.getMember().id!!
gooinMapper.toEntity(Gooin(
dto,
jwtUtils.getMember().id!!
)
)
)
return BaseResponse(
status = 201,
message = "구인 신청 성공!!"
)
}

fun getGooin() : BaseResponse<List<GooinEntity>> {
return BaseResponse(
message = "조회 성공",
data = gooinRepository.findAll()
)
}

fun editGooin(id:Long,dto: AddGooinRequest) : BaseResponse<String>{
val gooin = gooinRepository.findById(id).orElseThrow { CustomException(GooinErrorCode.GOOIN_NOT_FOUND) }
.let {
gooinMapper.toDomain(it)
}
gooin.editGooin(dto)
gooinRepository.save(gooinMapper.toEntity(gooin))
return BaseResponse(
message = "수정 성공"
)
}

}

0 comments on commit 3171147

Please sign in to comment.