-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
492 additions
and
118 deletions.
There are no files selected for viewing
23 changes: 0 additions & 23 deletions
23
src/main/kotlin/team/sfe/server/domain/disease/domain/Disease.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/kotlin/team/sfe/server/domain/disease/domain/repository/DiseaseRepository.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/kotlin/team/sfe/server/domain/gameInfo/domain/repository/GameInfoRepository.kt
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
src/main/kotlin/team/sfe/server/domain/person/domain/Person.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/kotlin/team/sfe/server/domain/person/domain/repository/PersonRepository.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/kotlin/team/sfe/server/domain/personData/domain/repository/PersonDataRepository.kt
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
src/main/kotlin/team/sfe/server/domain/progress/domain/DiseaseEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package team.sfe.server.domain.progress.domain | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.FetchType | ||
import jakarta.persistence.JoinColumn | ||
import jakarta.persistence.MapsId | ||
import jakarta.persistence.OneToOne | ||
import jakarta.validation.constraints.NotNull | ||
import team.sfe.server.domain.progress.presentation.dto.Disease | ||
import team.sfe.server.domain.user.domain.UserEntity | ||
import team.sfe.server.global.entity.BaseIdEntity | ||
|
||
@Entity | ||
class DiseaseEntity( | ||
override val id: Long = 0L, | ||
|
||
@field:NotNull | ||
@MapsId | ||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
val userEntity: UserEntity, | ||
|
||
@field:NotNull | ||
@Column(columnDefinition = "FLOAT") | ||
val infectWeight: Float, | ||
|
||
@field:NotNull | ||
@Column(columnDefinition = "INT") | ||
val infectivity: Int, | ||
|
||
@field:NotNull | ||
@Column(columnDefinition = "FLOAT") | ||
val infectPower: Float | ||
) : BaseIdEntity(id) { | ||
|
||
fun toDiseaseDto() = Disease( | ||
infectWeight = this.infectWeight, | ||
infectivity = this.infectivity, | ||
infectPower = this.infectPower | ||
) | ||
} |
23 changes: 17 additions & 6 deletions
23
...server/domain/gameInfo/domain/GameInfo.kt → .../domain/progress/domain/GameInfoEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/kotlin/team/sfe/server/domain/progress/domain/PersonEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package team.sfe.server.domain.progress.domain | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.FetchType | ||
import jakarta.persistence.JoinColumn | ||
import jakarta.persistence.MapsId | ||
import jakarta.persistence.OneToOne | ||
import jakarta.validation.constraints.NotNull | ||
import team.sfe.server.domain.progress.presentation.dto.Person | ||
import team.sfe.server.domain.user.domain.UserEntity | ||
import team.sfe.server.global.entity.BaseIdEntity | ||
|
||
@Entity | ||
class PersonEntity( | ||
override val id: Long = 0L, | ||
|
||
@field:NotNull | ||
@MapsId | ||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
val userEntity: UserEntity, | ||
|
||
@field:NotNull | ||
@Column(columnDefinition = "INT") | ||
val totalPerson: Int, | ||
|
||
@field:NotNull | ||
@Column(columnDefinition = "INT") | ||
val healthyPerson: Int, | ||
|
||
@field:NotNull | ||
@Column(columnDefinition = "INT") | ||
val deathPerson: Int, | ||
|
||
@field:NotNull | ||
@Column(columnDefinition = "INT") | ||
val infectedPerson: Int | ||
) : BaseIdEntity(id) { | ||
|
||
fun toPersonDto() = Person( | ||
totalPerson = this.totalPerson, | ||
healthyPerson = this.healthyPerson, | ||
deathPerson = this.deathPerson, | ||
infectedPerson = this.infectedPerson | ||
) | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/kotlin/team/sfe/server/domain/progress/domain/ProgressRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package team.sfe.server.domain.progress.domain | ||
|
||
import com.querydsl.core.group.GroupBy.groupBy | ||
import com.querydsl.core.group.GroupBy.list | ||
import com.querydsl.jpa.impl.JPAQueryFactory | ||
import org.springframework.stereotype.Repository | ||
import team.sfe.server.domain.progress.domain.QDiseaseEntity.diseaseEntity | ||
import team.sfe.server.domain.progress.domain.QGameInfoEntity.gameInfoEntity | ||
import team.sfe.server.domain.progress.domain.QPersonDataEntity.personDataEntity | ||
import team.sfe.server.domain.progress.domain.QPersonEntity.personEntity | ||
import team.sfe.server.domain.progress.domain.vo.QQueryProgressVO | ||
import team.sfe.server.domain.progress.domain.vo.QueryProgressVO | ||
import team.sfe.server.domain.user.domain.QUserEntity.userEntity | ||
|
||
@Repository | ||
class ProgressRepository( | ||
private val jpaQueryFactory: JPAQueryFactory | ||
) { | ||
|
||
fun queryProgress(userId: Long): QueryProgressVO? { | ||
return jpaQueryFactory | ||
.selectFrom(userEntity) | ||
.join(diseaseEntity.userEntity, userEntity) | ||
.join(gameInfoEntity.userEntity, userEntity) | ||
.join(personDataEntity.userEntity, userEntity) | ||
.join(personEntity.userEntity, userEntity) | ||
.where(userEntity.id.eq(userId)) | ||
.transform( | ||
groupBy(userEntity.id).list( | ||
QQueryProgressVO( | ||
diseaseEntity, | ||
gameInfoEntity, | ||
list(personDataEntity), | ||
personEntity | ||
) | ||
) | ||
)[0] | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/team/sfe/server/domain/progress/domain/repository/DiseaseRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package team.sfe.server.domain.progress.domain.repository | ||
|
||
import org.springframework.data.repository.CrudRepository | ||
import team.sfe.server.domain.progress.domain.DiseaseEntity | ||
import team.sfe.server.domain.user.domain.UserEntity | ||
|
||
interface DiseaseRepository : CrudRepository<DiseaseEntity, Long> { | ||
|
||
fun findByUserEntity(userEntity: UserEntity): DiseaseEntity? | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/team/sfe/server/domain/progress/domain/repository/GameInfoRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package team.sfe.server.domain.progress.domain.repository | ||
|
||
import org.springframework.data.repository.CrudRepository | ||
import team.sfe.server.domain.progress.domain.GameInfoEntity | ||
import team.sfe.server.domain.user.domain.UserEntity | ||
|
||
interface GameInfoRepository : CrudRepository<GameInfoEntity, Long> { | ||
|
||
fun findByUserEntity(userEntity: UserEntity): GameInfoEntity? | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/team/sfe/server/domain/progress/domain/repository/PersonDataRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package team.sfe.server.domain.progress.domain.repository | ||
|
||
import org.springframework.data.repository.CrudRepository | ||
import team.sfe.server.domain.progress.domain.PersonDataEntity | ||
import team.sfe.server.domain.user.domain.UserEntity | ||
|
||
interface PersonDataRepository : CrudRepository<PersonDataEntity, Long> { | ||
|
||
fun findAllByUserEntity(userEntity: UserEntity): List<PersonDataEntity> | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/team/sfe/server/domain/progress/domain/repository/PersonRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package team.sfe.server.domain.progress.domain.repository | ||
|
||
import org.springframework.data.repository.CrudRepository | ||
import team.sfe.server.domain.progress.domain.PersonEntity | ||
import team.sfe.server.domain.user.domain.UserEntity | ||
|
||
interface PersonRepository : CrudRepository<PersonEntity, Long> { | ||
|
||
fun findByUserEntity(userEntity: UserEntity): PersonEntity? | ||
} |
2 changes: 1 addition & 1 deletion
2
...ain/personData/domain/type/SymptomType.kt → ...omain/progress/domain/type/SymptomType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/team/sfe/server/domain/progress/domain/vo/QueryProgressVO.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package team.sfe.server.domain.progress.domain.vo | ||
|
||
import com.querydsl.core.annotations.QueryProjection | ||
import team.sfe.server.domain.progress.domain.DiseaseEntity | ||
import team.sfe.server.domain.progress.domain.GameInfoEntity | ||
import team.sfe.server.domain.progress.domain.PersonDataEntity | ||
import team.sfe.server.domain.progress.domain.PersonEntity | ||
|
||
data class QueryProgressVO @QueryProjection constructor( | ||
val diseaseEntity: DiseaseEntity, | ||
val gameInfoEntity: GameInfoEntity, | ||
val personDataEntity: List<PersonDataEntity>, | ||
val personEntity: PersonEntity | ||
) |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/team/sfe/server/domain/progress/exception/ProgressNotFoundException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package team.sfe.server.domain.progress.exception | ||
|
||
import team.sfe.server.global.error.CustomException | ||
|
||
object ProgressNotFoundException : CustomException(404, "게임 진행 상황을 찾지 못했습니다.") |
Oops, something went wrong.