Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
tab_width = 4
disabled_rules = no-wildcard-imports, import-ordering, comment-spacing

[*.{kt,kts}]
ij_kotlin_packages_to_use_import_on_demand = unset
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
kotlin("jvm") version "1.9.24"
kotlin("plugin.spring") version "1.9.24"
id("jacoco")
id("org.jetbrains.dokka") version "1.9.20"

// for querydsl
kotlin("kapt") version "1.9.24"
Expand Down Expand Up @@ -67,6 +68,7 @@ dependencies {
testImplementation("com.navercorp.fixturemonkey:fixture-monkey-kotlin:1.0.25")
implementation("org.bouncycastle:bcpkix-jdk18on:1.75")
implementation("com.nimbusds:nimbus-jose-jwt:9.12")
implementation("io.github.oshai:kotlin-logging-jvm:5.1.4")

// querydsl
implementation("com.querydsl:querydsl-jpa:5.0.0:jakarta")
Expand Down
39 changes: 39 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

IS_GREEN=$(docker ps | grep green)
DEFAULT_CONF=" /etc/nginx/nginx.conf"

if [ -z $IS_GREEN ];then

echo "### GREEN => BLUE ###"

echo "1. get blue image"
docker compose pull blue

echo "2. blue container up"
docker compose up -d blue

while [ 1 = 1 ]; do
echo "3. blue health check..."
sleep 3

REQUEST=$(curl ${server.address})
if [ -n "$REQUEST" ]; then
echo "health check success"
break ;
fi
done;

echo "4. reload nginx"
sudo cp /etc/nginx/nginx.blue.conf /etc/nginx/nginx.conf
sudo nginx -s rel

echo "5. green container down"
docker compose stop green
else
echo "### BLUE => GREEN ###"

echo "1. get green image"
docker compose pull green

echo "2. green container up"
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.springframework.web.bind.support.WebDataBinderFactory
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.web.method.support.HandlerMethodArgumentResolver
import org.springframework.web.method.support.ModelAndViewContainer
import java.util.*
import java.util.UUID

@Component
class MemberIdResolver(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import com.swm_standard.phote.dto.CreateSharedExamResponse
import com.swm_standard.phote.dto.GradeExamRequest
import com.swm_standard.phote.dto.GradeExamResponse
import com.swm_standard.phote.dto.ReadAllSharedExamsResponse
import com.swm_standard.phote.dto.ReadSharedExamInfoResponse
import com.swm_standard.phote.dto.ReadExamHistoryDetailResponse
import com.swm_standard.phote.dto.ReadExamHistoryListResponse
import com.swm_standard.phote.dto.ReadExamResultDetailResponse
import com.swm_standard.phote.dto.ReadExamResultsResponse
import com.swm_standard.phote.dto.ReadSharedExamInfoResponse
import com.swm_standard.phote.dto.RegradeExamRequest
import com.swm_standard.phote.dto.RegradeExamResponse
import com.swm_standard.phote.service.ExamService
Expand All @@ -29,12 +29,20 @@ import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import java.util.UUID

/**
* Exam 관련 컨트롤러 클래스
*/
@RestController
@RequestMapping("/api")
@Tag(name = "Exam", description = "Exam API Document")
class ExamController(
private val examService: ExamService,
) {
/**
* 시험 기록 상세 조회 기능
* @param id 시험 id
* @return 시험 기록 상세 정보
*/
@Operation(summary = "readExamHistoryDetail", description = "문제풀이 기록 상세조회")
@SecurityRequirement(name = "bearer Auth")
@GetMapping("/exam/{id}")
Expand Down Expand Up @@ -82,7 +90,7 @@ class ExamController(
@Operation(summary = "gradeExam", description = "문제풀이 제출 및 채점")
@SecurityRequirement(name = "bearer Auth")
@PostMapping("/exam")
fun gradeExam(
suspend fun gradeExam(
@Valid @RequestBody request: GradeExamRequest,
@Parameter(hidden = true) @MemberId memberId: UUID,
): BaseResponse<GradeExamResponse> {
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/com/swm_standard/phote/entity/Answer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ data class Answer(
)
}

fun checkMultipleAnswer() {
fun checkMultipleAnswer(): Boolean {
isCorrect = submittedAnswer == question?.answer
return isCorrect
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.swm_standard.phote.common.exception.BadRequestException
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Component
import org.springframework.web.multipart.MultipartFile
import java.util.*
import java.util.UUID

@Component
class S3Service(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.swm_standard.phote.repository
import com.swm_standard.phote.entity.Member
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.stereotype.Repository
import java.util.*
import java.util.UUID

@Repository
interface MemberRepository : JpaRepository<Member, UUID> {
Expand Down
Loading
Loading