Skip to content

Commit

Permalink
๐Ÿ”€ :: ์™ธ์ถœ์‹ ์ฒญ์ž ์กฐํšŒ API ๋ฆฌํŒฉํ† ๋ง (#123)
Browse files Browse the repository at this point in the history
๐Ÿ”€ :: ์™ธ์ถœ์‹ ์ฒญ์ž ์กฐํšŒ API ๋ฆฌํŒฉํ† ๋ง (#123)
  • Loading branch information
jeongho1209 authored Jan 7, 2024
1 parent dfffba2 commit f0dc850
Show file tree
Hide file tree
Showing 47 changed files with 177 additions and 246 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
root = true

[*.{kt,kts}]
disabled_rules=import-ordering
disabled_rules = import-ordering
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.pickdsm.pickserverspring.domain.application.spi

import com.pickdsm.pickserverspring.domain.application.Status
import com.pickdsm.pickserverspring.domain.application.StatusType
import com.pickdsm.pickserverspring.domain.application.vo.PicnicApplicationVO
import java.time.LocalDate
import java.util.UUID

Expand All @@ -19,7 +20,11 @@ interface QueryStatusSpi {

fun queryPicnicStudentByStudentIdAndToday(studentId: UUID): Status?

fun queryStatusByStudentIdAndStartPeriodAndEndPeriodAndToday(studentId: UUID, startPeriod: Int, endPeriod: Int): Status?
fun queryStatusByStudentIdAndStartPeriodAndEndPeriodAndToday(
studentId: UUID,
startPeriod: Int,
endPeriod: Int,
): Status?

fun queryMovementStudentByStudentId(studentId: UUID): Status?

Expand All @@ -38,4 +43,6 @@ interface QueryStatusSpi {
fun existAwaitOrPicnicStatusByStudentId(studentId: UUID): Boolean

fun queryPicnicOrAwaitOrMovementStatusStudentIdListByToday(): List<UUID>

fun queryPicnicApplicationListByToday(): List<PicnicApplicationVO>
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.pickdsm.pickserverspring.domain.application.vo

import java.util.UUID

open class PicnicApplicationVO(
val studentId: UUID,
val startPeriod: Int,
val endPeriod: Int,
val reason: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ data class User(
val num: Int,
val birthDay: LocalDate,
val profileFileName: String?,
)
) {
companion object {
fun User.processGcn() = "${this.grade}${this.classNum}${this.paddedUserNum()}"

private fun User.paddedUserNum(): String = this.num.toString().padStart(2, '0')
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.annotation
package com.pickdsm.pickserverspring.common.annotation

import org.springframework.stereotype.Component
import org.springframework.transaction.annotation.Transactional
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.pickdsm.pickserverspring.common.annotation

annotation class NoArg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.annotation.config
package com.pickdsm.pickserverspring.common.annotation.config

import com.pickdsm.pickserverspring.common.annotation.ReadOnlyUseCase
import com.pickdsm.pickserverspring.common.annotation.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.querydsl
package com.pickdsm.pickserverspring.common.config

import com.querydsl.jpa.impl.JPAQueryFactory
import org.springframework.context.annotation.Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.config
package com.pickdsm.pickserverspring.common.config

import org.springframework.context.annotation.Configuration
import org.springframework.scheduling.annotation.EnableScheduling
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.entity
package com.pickdsm.pickserverspring.common.entity

import org.hibernate.annotations.GenericGenerator
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.error
package com.pickdsm.pickserverspring.common.error

import com.pickdsm.pickserverspring.common.error.ErrorProperty
import org.springframework.dao.DataIntegrityViolationException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.error
package com.pickdsm.pickserverspring.common.error

import com.pickdsm.pickserverspring.common.error.ErrorProperty

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.error
package com.pickdsm.pickserverspring.common.error

import org.springframework.dao.DataIntegrityViolationException
import org.springframework.http.HttpStatus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.pickdsm.pickserverspring.global.exception
package com.pickdsm.pickserverspring.common.exception

import com.pickdsm.pickserverspring.common.error.PickException
import com.pickdsm.pickserverspring.global.error.GlobalErrorCode
import com.pickdsm.pickserverspring.common.error.GlobalErrorCode

object InternalServerErrorException : PickException(
GlobalErrorCode.INTERNAL_SERVER_ERROR
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.pickdsm.pickserverspring.common.feign.client.dto.response

import com.pickdsm.pickserverspring.global.annotation.NoArg
import com.pickdsm.pickserverspring.common.annotation.NoArg
import java.time.LocalDate
import java.time.LocalTime
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.pickdsm.pickserverspring.global.filter
package com.pickdsm.pickserverspring.common.filter

import com.fasterxml.jackson.databind.ObjectMapper
import com.pickdsm.pickserverspring.common.error.ErrorProperty
import com.pickdsm.pickserverspring.common.error.PickException
import com.pickdsm.pickserverspring.global.error.of
import com.pickdsm.pickserverspring.global.exception.InternalServerErrorException
import com.pickdsm.pickserverspring.common.error.of
import com.pickdsm.pickserverspring.common.exception.InternalServerErrorException
import io.sentry.Sentry
import org.springframework.http.MediaType
import org.springframework.web.filter.OncePerRequestFilter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.scheduler
package com.pickdsm.pickserverspring.common.scheduler

import com.pickdsm.pickserverspring.domain.application.StatusType
import com.pickdsm.pickserverspring.domain.application.exception.StatusNotFoundException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.security
package com.pickdsm.pickserverspring.common.security

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken
import org.springframework.security.core.Authentication
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.pickdsm.pickserverspring.global.security
package com.pickdsm.pickserverspring.common.security

import com.fasterxml.jackson.databind.ObjectMapper
import com.pickdsm.pickserverspring.global.filter.ExceptionFilter
import com.pickdsm.pickserverspring.common.filter.ExceptionFilter
import org.springframework.security.config.annotation.SecurityConfigurerAdapter
import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.web.DefaultSecurityFilterChain
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.security
package com.pickdsm.pickserverspring.common.security

import com.fasterxml.jackson.databind.ObjectMapper
import org.springframework.context.annotation.Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.pickdsm.pickserverspring.common.security

enum class UserRole {
STU,
SCH,
DOR,
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pickdsm.pickserverspring.global.security
package com.pickdsm.pickserverspring.common.security

import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.CorsRegistry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.pickdsm.pickserverspring.domain.afterschool.persistence.vo.QQueryAfte
import com.pickdsm.pickserverspring.domain.afterschool.persistence.vo.QueryAfterSchoolRoomVO
import com.pickdsm.pickserverspring.domain.afterschool.spi.AfterSchoolSpi
import com.pickdsm.pickserverspring.domain.classroom.persistence.entity.QClassroomEntity.classroomEntity
import com.pickdsm.pickserverspring.global.annotation.Adapter
import com.pickdsm.pickserverspring.common.annotation.Adapter
import com.querydsl.jpa.impl.JPAQueryFactory
import java.util.UUID
import javax.persistence.LockModeType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.pickdsm.pickserverspring.domain.afterschool.persistence.entity

import com.pickdsm.pickserverspring.global.entity.BaseUUIDEntity
import com.pickdsm.pickserverspring.common.entity.BaseUUIDEntity
import java.util.UUID
import javax.persistence.Column
import javax.persistence.Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.pickdsm.pickserverspring.domain.afterschool.persistence.entity

import com.pickdsm.pickserverspring.domain.classroom.persistence.entity.ClassroomEntity
import com.pickdsm.pickserverspring.global.entity.BaseUUIDEntity
import com.pickdsm.pickserverspring.common.entity.BaseUUIDEntity
import org.hibernate.annotations.ColumnDefault
import java.util.UUID
import javax.persistence.Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.pickdsm.pickserverspring.domain.application.persistence.ApplicationRe
import com.pickdsm.pickserverspring.domain.application.persistence.entity.QApplicationEntity.applicationEntity
import com.pickdsm.pickserverspring.domain.application.persistence.entity.QStatusEntity.statusEntity
import com.pickdsm.pickserverspring.domain.application.spi.ApplicationSpi
import com.pickdsm.pickserverspring.global.annotation.Adapter
import com.pickdsm.pickserverspring.common.annotation.Adapter
import com.querydsl.jpa.impl.JPAQueryFactory
import java.time.LocalDate
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package com.pickdsm.pickserverspring.domain.application.persistence.adapter

import com.pickdsm.pickserverspring.common.annotation.Adapter
import com.pickdsm.pickserverspring.domain.application.Status
import com.pickdsm.pickserverspring.domain.application.StatusType
import com.pickdsm.pickserverspring.domain.application.mapper.StatusMapper
import com.pickdsm.pickserverspring.domain.application.persistence.StatusRepository
import com.pickdsm.pickserverspring.domain.application.persistence.entity.QApplicationEntity.applicationEntity
import com.pickdsm.pickserverspring.domain.application.persistence.entity.QStatusEntity.statusEntity
import com.pickdsm.pickserverspring.domain.application.persistence.vo.QQueryPicnicApplicationVO
import com.pickdsm.pickserverspring.domain.application.spi.StatusSpi
import com.pickdsm.pickserverspring.domain.application.vo.PicnicApplicationVO
import com.pickdsm.pickserverspring.domain.classroom.persistence.entity.QClassroomEntity.classroomEntity
import com.pickdsm.pickserverspring.domain.classroom.persistence.entity.QClassroomMovementEntity.classroomMovementEntity
import com.pickdsm.pickserverspring.global.annotation.Adapter
import com.querydsl.core.types.dsl.BooleanExpression
import com.querydsl.jpa.impl.JPAQueryFactory
import java.time.LocalDate
Expand Down Expand Up @@ -231,4 +233,23 @@ class StatusPersistenceAdapter(
.and(statusEntity.date.eq(LocalDate.now())),
)
.fetch()

override fun queryPicnicApplicationListByToday(): List<PicnicApplicationVO> =
jpaQueryFactory
.select(
QQueryPicnicApplicationVO(
statusEntity.studentId,
statusEntity.startPeriod,
statusEntity.endPeriod,
applicationEntity.reason,
),
)
.from(statusEntity)
.innerJoin(applicationEntity)
.on(statusEntity.id.eq(applicationEntity.statusEntity.id))
.where(
statusEntity.date.eq(LocalDate.now()),
statusEntity.type.eq(StatusType.AWAIT),
)
.fetch()
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.pickdsm.pickserverspring.domain.application.persistence.entity

import com.pickdsm.pickserverspring.global.entity.BaseUUIDEntity
import com.pickdsm.pickserverspring.common.entity.BaseUUIDEntity
import org.hibernate.annotations.ColumnDefault
import java.util.UUID
import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.FetchType
import javax.persistence.JoinColumn
import javax.persistence.OneToOne
import javax.persistence.Table
import javax.persistence.Column

@Table(name = "tbl_application")
@Entity
Expand All @@ -28,4 +28,4 @@ class ApplicationEntity(
@ColumnDefault("false")
val isReturn: Boolean,

) : BaseUUIDEntity(id)
) : BaseUUIDEntity(id)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.pickdsm.pickserverspring.domain.application.persistence.entity

import com.pickdsm.pickserverspring.domain.application.StatusType
import com.pickdsm.pickserverspring.global.entity.BaseUUIDEntity
import com.pickdsm.pickserverspring.common.entity.BaseUUIDEntity
import org.hibernate.annotations.ColumnDefault
import java.time.LocalDate
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.pickdsm.pickserverspring.domain.application.persistence.vo

import com.pickdsm.pickserverspring.domain.application.vo.PicnicApplicationVO
import com.querydsl.core.annotations.QueryProjection
import java.util.UUID

class QueryPicnicApplicationVO @QueryProjection constructor(
studentId: UUID,
startPeriod: Int,
endPeriod: Int,
reason: String,
) : PicnicApplicationVO(
studentId = studentId,
startPeriod = startPeriod,
endPeriod = endPeriod,
reason = reason,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.pickdsm.pickserverspring.domain.classroom.persistence.entity.QClassro
import com.pickdsm.pickserverspring.domain.classroom.persistence.vo.QQueryClassroomVO
import com.pickdsm.pickserverspring.domain.classroom.persistence.vo.QueryClassroomVO
import com.pickdsm.pickserverspring.domain.classroom.spi.ClassroomSpi
import com.pickdsm.pickserverspring.global.annotation.Adapter
import com.pickdsm.pickserverspring.common.annotation.Adapter
import com.querydsl.jpa.impl.JPAQueryFactory
import java.util.UUID

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.pickdsm.pickserverspring.domain.classroom.persistence.ClassroomMoveme
import com.pickdsm.pickserverspring.domain.classroom.persistence.entity.QClassroomEntity.classroomEntity
import com.pickdsm.pickserverspring.domain.classroom.persistence.entity.QClassroomMovementEntity.classroomMovementEntity
import com.pickdsm.pickserverspring.domain.classroom.spi.ClassroomMovementSpi
import com.pickdsm.pickserverspring.global.annotation.Adapter
import com.pickdsm.pickserverspring.common.annotation.Adapter
import com.querydsl.jpa.impl.JPAQueryFactory
import java.time.LocalDate
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.pickdsm.pickserverspring.domain.classroom.persistence.entity

import com.pickdsm.pickserverspring.global.entity.BaseUUIDEntity
import com.pickdsm.pickserverspring.common.entity.BaseUUIDEntity
import org.hibernate.annotations.ColumnDefault
import java.util.UUID
import javax.persistence.Column
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.pickdsm.pickserverspring.domain.classroom.persistence.entity

import com.pickdsm.pickserverspring.domain.application.persistence.entity.StatusEntity
import com.pickdsm.pickserverspring.global.entity.BaseUUIDEntity
import com.pickdsm.pickserverspring.common.entity.BaseUUIDEntity
import java.util.UUID
import javax.persistence.Entity
import javax.persistence.FetchType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.pickdsm.pickserverspring.domain.club.persistence.entity.QClubInfoEnti
import com.pickdsm.pickserverspring.domain.club.persistence.vo.QQueryClubRoomVO
import com.pickdsm.pickserverspring.domain.club.persistence.vo.QueryClubRoomVO
import com.pickdsm.pickserverspring.domain.club.spi.ClubSpi
import com.pickdsm.pickserverspring.global.annotation.Adapter
import com.pickdsm.pickserverspring.common.annotation.Adapter
import com.querydsl.jpa.impl.JPAQueryFactory
import java.util.UUID

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.pickdsm.pickserverspring.domain.club.persistence.entity

import com.pickdsm.pickserverspring.global.entity.BaseUUIDEntity
import com.pickdsm.pickserverspring.common.entity.BaseUUIDEntity
import java.util.UUID
import javax.persistence.Column
import javax.persistence.Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.pickdsm.pickserverspring.domain.club.persistence.entity

import com.pickdsm.pickserverspring.domain.classroom.persistence.entity.ClassroomEntity
import com.pickdsm.pickserverspring.global.entity.BaseUUIDEntity
import com.pickdsm.pickserverspring.common.entity.BaseUUIDEntity
import org.hibernate.annotations.ColumnDefault
import java.util.UUID
import javax.persistence.Column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.pickdsm.pickserverspring.domain.schedule

import com.pickdsm.pickserverspring.common.feign.client.ScheduleClient
import com.pickdsm.pickserverspring.domain.schedule.spi.QueryScheduleSpi
import com.pickdsm.pickserverspring.global.annotation.Adapter
import com.pickdsm.pickserverspring.common.annotation.Adapter

@Adapter
class SchedulePersistenceAdapter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.pickdsm.pickserverspring.domain.selfstudydirector.persistence.SelfStu
import com.pickdsm.pickserverspring.domain.selfstudydirector.persistence.entity.QSelfStudyDirectorEntity.selfStudyDirectorEntity
import com.pickdsm.pickserverspring.domain.selfstudydirector.persistence.entity.QTypeEntity.typeEntity
import com.pickdsm.pickserverspring.domain.selfstudydirector.spi.SelfStudyDirectorSpi
import com.pickdsm.pickserverspring.global.annotation.Adapter
import com.pickdsm.pickserverspring.common.annotation.Adapter
import com.querydsl.jpa.impl.JPAQueryFactory
import java.time.LocalDate
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.pickdsm.pickserverspring.domain.selfstudydirector.mapper.TypeMapper
import com.pickdsm.pickserverspring.domain.selfstudydirector.persistence.TypeRepository
import com.pickdsm.pickserverspring.domain.selfstudydirector.persistence.entity.QTypeEntity.typeEntity
import com.pickdsm.pickserverspring.domain.selfstudydirector.spi.TypeSpi
import com.pickdsm.pickserverspring.global.annotation.Adapter
import com.pickdsm.pickserverspring.common.annotation.Adapter
import com.querydsl.jpa.impl.JPAQueryFactory
import java.time.LocalDate
import java.util.UUID
Expand Down
Loading

0 comments on commit f0dc850

Please sign in to comment.