Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
meltapplee committed Apr 8, 2024
2 parents fcb1a72 + 54efcd9 commit a833412
Show file tree
Hide file tree
Showing 46 changed files with 231 additions and 128 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: gradle-pick-prod
name: gradle-pick-prod(pick-prod)

on:
push:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/git-action-stag.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: gradle-pick-stag
name: gradle-pick-stag(pick-stag)

on:
push:
Expand Down Expand Up @@ -46,8 +46,8 @@ jobs:
JWT_REFRESH_EXP=36000000
JWT_HEADER=Authorization
JWT_PREFIX=Bearer
DB_URL=${{ secrets.STAG_DB_URL }}
DB_USERNAME=${{ secrets.DB_USERNAME }}
DB_URL=${{ secrets.DB_URL }}
DB_USERNAME=${{ secrets.STAG_DB_USERNAME }}
DB_PASSWORD=${{ secrets.DB_PASSWORD }}
REDIS_HOST=${{ secrets.REDIS_HOST }}
REDIS_PORT=${{ secrets.REDIS_PORT }}
Expand Down
34 changes: 15 additions & 19 deletions .github/workflows/klint-check.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
name: Ktlint Ci
name: ktlint

on: [pull_request]
on:
pull_request:
branches:
- main
- develop

jobs:
ktlint:
name: Check Code Quality
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-latest ]
java-version: [ 17 ]

steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: 'zulu'

- name: Clone repo
uses: actions/checkout@master
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: ktlint
uses: ScaCap/action-ktlint@master
- name: Setup JDK
uses: actions/setup-java@v2
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
reporter: github-pr-check # Change review
fail_on_error: true
java-version: '17'
distribution: 'adopt'

- name: Run ktlint
run: |
./gradlew ktlintCheck --daemon --parallel --configure-on-demand
2 changes: 1 addition & 1 deletion src/main/kotlin/dsm/pick2024/domain/admin/domain/Admin.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dsm.pick2024.domain.admin.domain

import dsm.pick2024.domain.user.entity.enums.Role
import java.util.*
import java.util.UUID

data class Admin(
val id: UUID? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import dsm.pick2024.domain.afterschool.mapper.AfterSchoolStudentMapper
import dsm.pick2024.domain.afterschool.persistence.repository.AfterSchoolStudentRepository
import dsm.pick2024.domain.afterschool.port.out.AfterSchoolStudentPortUser
import org.springframework.stereotype.Component
import java.util.*
import java.util.UUID

@Component
class AfterSchoolStudentPersistenceAdapter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ import dsm.pick2024.domain.afterschool.presentation.dto.request.SaveAfterSchoolS
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.*
import org.springframework.web.bind.annotation.DeleteMapping
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.ResponseStatus
import org.springframework.web.bind.annotation.RestController

@Tag(name = "after school API")
@RestController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import dsm.pick2024.domain.afterschool.enums.Status
import dsm.pick2024.domain.afterschool.port.`in`.SaveAfterSchoolStudentUseCase
import dsm.pick2024.domain.afterschool.port.out.SaveAllAfterSchoolStudentPort
import dsm.pick2024.domain.afterschool.presentation.dto.request.SaveAfterSchoolStudentRequest
import dsm.pick2024.domain.user.exception.UserNotFoundException
import dsm.pick2024.domain.user.port.out.FindByStudentNumPort
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
Expand All @@ -19,10 +20,10 @@ class SaveAfterSchoolStudentService(
val afterSchoolStudent =
request.map { requests ->
val (grade, classNum, num) = parseSchoolNum(requests.studentNum)
val user = findByStudentNumPort.findByStudentNum(grade, classNum, num)
val user = findByStudentNumPort.findByStudentNum(grade, classNum, num) ?: throw UserNotFoundException
AfterSchoolStudent(
id = null,
userId = user!!.id,
userId = user.id,
grade = grade,
classNum = classNum,
num = num,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,35 @@ import dsm.pick2024.global.base.BaseUUIDEntity
import java.time.LocalDate
import java.time.LocalTime
import java.util.UUID
import javax.persistence.*
import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.EnumType
import javax.persistence.Enumerated

@Entity(name = "tbl_application")
class ApplicationJapEntity(
id: UUID?,

@Column(columnDefinition = "BINARY(16)")
val userId: UUID,

@Column(name = "reason", nullable = false)
val reason: String,

@Column(name = "start_time", nullable = false)
val startTime: LocalTime,

@Column(name = "end_time", nullable = false)
val endTime: LocalTime,

@Column(name = "user_name", nullable = false)
val username: String,

val teacherName: String? = null,

@Column(nullable = false)
val date: LocalDate,

@Column(nullable = false)
val grade: Int,

@Column(name = "class_num", nullable = false)
val classNum: Int,

@Column(nullable = false)
val num: Int,

@Enumerated(value = EnumType.STRING)
val status: Status,

@Enumerated(value = EnumType.STRING)
val applicationStatus: ApplicationStatus? = null

) : BaseUUIDEntity(id)
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import dsm.pick2024.domain.application.entity.QApplicationJapEntity
import dsm.pick2024.domain.application.enums.Status
import dsm.pick2024.domain.application.mapper.ApplicationMapper
import dsm.pick2024.domain.application.persistence.repository.ApplicationRepository
import dsm.pick2024.domain.application.port.out.ApplicationByStatusPort
import dsm.pick2024.domain.application.port.out.ApplicationByStatusPortPort
import dsm.pick2024.domain.user.entity.QUserJpaEntity
import org.springframework.stereotype.Component
import java.util.*
import java.util.UUID

@Component
class ApplicationPersistenceAdapterByStatus(
class ApplicationPersistenceAdapterByStatusPort(
private val applicationRepository: ApplicationRepository,
private val applicationMapper: ApplicationMapper,
private val jpaQueryFactory: JPAQueryFactory
) : ApplicationByStatusPort {
) : ApplicationByStatusPortPort {
override fun saveAll(application: List<Application>) {
val entities = application.map { applicationMapper.toEntity(it) }
applicationRepository.saveAll(entities)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dsm.pick2024.domain.application.port.out

interface ApplicationByStatusPort :
interface ApplicationByStatusPortPort :
ExistApplicationByUserIdPort,
SaveAllApplicationPort,
FindApplicationByIdPort,
Expand All @@ -11,6 +11,6 @@ interface ApplicationByStatusPort :
QueryAllApplicationPort,
FindApplicationByUserIdPort,
DeleteAllApplicationPort,
QueryOKMyApplication,
QueryOKMyApplicationPort,
ExistsOKApplicationByUserIdPort,
QueryAllApplicationByStatusPort
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package dsm.pick2024.domain.application.port.out
import dsm.pick2024.domain.application.domain.Application
import java.util.UUID

interface QueryOKMyApplication {
interface QueryOKMyApplicationPort {
fun findOKApplication(id: UUID): Application?
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package dsm.pick2024.domain.application.presentation

import dsm.pick2024.domain.application.port.`in`.*
import dsm.pick2024.domain.application.port.`in`.ApplicationUseCase
import dsm.pick2024.domain.application.port.`in`.QueryAllOKApplicationUseCase
import dsm.pick2024.domain.application.port.`in`.QueryAllReasonApplicationUseCase
import dsm.pick2024.domain.application.port.`in`.QueryClassApplicationUseCase
import dsm.pick2024.domain.application.port.`in`.QueryFloorApplicationUseCase
import dsm.pick2024.domain.application.port.`in`.QueryMyApplicationUseCase
import dsm.pick2024.domain.application.port.`in`.QueryStatusApplicationUseCase
import dsm.pick2024.domain.application.port.`in`.StatusApplicationChangeUseCase
import dsm.pick2024.domain.application.port.`in`.StatusApplicationUseCase
import dsm.pick2024.domain.application.presentation.dto.request.ApplicationRequest
import dsm.pick2024.domain.application.presentation.dto.request.ApplicationStatusRequest
import io.swagger.v3.oas.annotations.Operation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ class QueryStatusApplicationService(
private val queryAllClassroomPort: QueryAllClassroomPort
) : QueryStatusApplicationUseCase {
override fun queryStatusApplication(): QueryStatusApplicationResponse {
val out = queryAllApplicationPort.findAll()
.count { it.status == Status.OK }
val out =
queryAllApplicationPort.findAll()
.count { it.status == Status.OK }

val request =
queryAllEarlyReturnPort.findAll().count { it.status == Status.QUIET } +
queryAllApplicationPort.findAll().count() { it.status == Status.QUIET }
queryAllApplicationPort.findAll().count { it.status == Status.QUIET }

val classMove = queryAllClassroomPort.findAll().count()
val classMove = queryAllClassroomPort.findAll().count { it.status == Status.OK }

return QueryStatusApplicationResponse(out, request, classMove)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import dsm.pick2024.domain.application.port.out.DeleteApplicationPort
import dsm.pick2024.domain.application.port.out.FindApplicationByIdPort
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import java.util.*
import java.util.UUID

@Service
class StatusApplicationChangeService(
private val findApplicationByIdPort: FindApplicationByIdPort,
private val deleteApplicationPort: DeleteApplicationPort
) : StatusApplicationChangeUseCase {

@Transactional
override fun statusApplicationChange(applicationId: UUID) {
findApplicationByIdPort.findById(applicationId) ?: throw ApplicationNotFoundException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dsm.pick2024.domain.applicationstory.domain
import dsm.pick2024.domain.applicationstory.enums.Type
import java.time.LocalDate
import java.time.LocalTime
import java.util.*
import java.util.UUID

data class ApplicationStory(
val id: UUID? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import dsm.pick2024.domain.applicationstory.enums.Type
import dsm.pick2024.global.base.BaseUUIDEntity
import java.time.LocalDate
import java.time.LocalTime
import java.util.*
import java.util.UUID
import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.EnumType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ data class Attendance(
val classNum: Int,
val num: Int,
val name: String,
val place: String? = null,
val floor: Int? = null,
val club: String? = null,
val period6: Status,
val period7: Status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class AttendanceJpaEntity(
val num: Int,
@Column(name = "club")
val club: String? = null,
@Column(name = "place")
val place: String? = null,
@Column(name = "floor")
val floor: Int? = null,
@Enumerated(value = EnumType.STRING)
val period6: Status,
@Enumerated(value = EnumType.STRING)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dsm.pick2024.domain.earlyreturn.exception

import dsm.pick2024.global.error.exception.ErrorCode
import dsm.pick2024.global.error.exception.PickException

object ClubNotFoundException : PickException(
ErrorCode.CLUB_NOT_FOUND
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class AttendanceMapper : GenericMapper<AttendanceJpaEntity, Attendance> {
period7 = period7,
period8 = period8,
period9 = period9,
period10 = period10
period10 = period10,
place = place,
floor = floor
)
}

Expand All @@ -39,7 +41,9 @@ class AttendanceMapper : GenericMapper<AttendanceJpaEntity, Attendance> {
period7 = period7,
period8 = period8,
period9 = period9,
period10 = period10
period10 = period10,
place = place,
floor = floor
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import dsm.pick2024.domain.attendance.mapper.AttendanceMapper
import dsm.pick2024.domain.attendance.persistence.repository.AttendanceRepository
import dsm.pick2024.domain.attendance.port.out.AttendancePort
import org.springframework.stereotype.Component
import java.util.*
import java.util.UUID

@Component
class AttendancePersistenceAdapter(
Expand Down Expand Up @@ -37,4 +37,18 @@ class AttendancePersistenceAdapter(
)
.fetch()
.map { attendanceMapper.toDomain(it) }

override fun findByClub(club: String) =
jpaQueryFactory
.selectFrom(QAttendanceJpaEntity.attendanceJpaEntity)
.where(
QAttendanceJpaEntity.attendanceJpaEntity.club.eq(club)
)
.orderBy(
QAttendanceJpaEntity.attendanceJpaEntity.grade.asc(),
QAttendanceJpaEntity.attendanceJpaEntity.classNum.asc(),
QAttendanceJpaEntity.attendanceJpaEntity.num.asc()
)
.fetch()
.map { attendanceMapper.toDomain(it) }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dsm.pick2024.domain.attendance.port.`in`

import dsm.pick2024.domain.attendance.presentation.dto.response.QueryAttendanceResponse

interface QueryClubAttendanceUseCase {
fun queryClubAttendance(club: String): List<QueryAttendanceResponse>?
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ package dsm.pick2024.domain.attendance.port.out
interface AttendancePort :
SaveAll,
FindByUserIdPort,
QueryClassAttendancePort
QueryClassAttendancePort,
QueryClubAttendancePort
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dsm.pick2024.domain.attendance.port.out

import dsm.pick2024.domain.attendance.domain.Attendance

interface QueryClubAttendancePort {
fun findByClub(club: String): List<Attendance>
}
Loading

0 comments on commit a833412

Please sign in to comment.