From b1723a1ffdaed576ad64829dd90e16bcbfcc6629 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:54:28 +0900 Subject: [PATCH 001/132] =?UTF-8?q?:sparkles:=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=ED=85=8C=ED=81=AC=20=EC=8A=A4=ED=83=9D=20Model=20Count=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/team/msg/sms/domain/techstack/model/TechStack.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/model/TechStack.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/model/TechStack.kt index 6555b098..415c27f8 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/model/TechStack.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/model/TechStack.kt @@ -1,11 +1,10 @@ package team.msg.sms.domain.techstack.model import team.msg.sms.common.annotation.Aggregate -import java.util.* @Aggregate data class TechStack( val id: Long, val stack: String, - val studentId: UUID + val count: Int ) From b40be10f4f42f13d90894a7de85510802338d653 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:54:45 +0900 Subject: [PATCH 002/132] =?UTF-8?q?:sparkles:=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=ED=85=8C=ED=81=AC=20=EC=8A=A4=ED=83=9D=20Entity=20Count=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/techstack/entity/TechStackJpaEntity.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/entity/TechStackJpaEntity.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/entity/TechStackJpaEntity.kt index 0d898897..b37c25d9 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/entity/TechStackJpaEntity.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/entity/TechStackJpaEntity.kt @@ -1,18 +1,14 @@ package team.msg.sms.persistence.techstack.entity import team.msg.sms.persistence.BaseIdEntity -import team.msg.sms.persistence.BaseUuidEntity -import team.msg.sms.persistence.student.entity.StudentJpaEntity -import java.util.* import javax.persistence.* @Entity @Table(name = "tech_stack") class TechStackJpaEntity( + override val id: Long, @Column val stack: String, - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "student_id") - val student: StudentJpaEntity, + @Column + val count: Int ) : BaseIdEntity() \ No newline at end of file From fbcb99b6a3821c88431b8d5e36ba35352b470558 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:55:40 +0900 Subject: [PATCH 003/132] =?UTF-8?q?:sparkles:=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=ED=85=8C=ED=81=AC=20=EC=8A=A4=ED=83=9D=20Mapper=20=EB=B0=94?= =?UTF-8?q?=EB=80=90=EB=8C=80=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/persistence/techstack/mapper/TechStackMapper.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/mapper/TechStackMapper.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/mapper/TechStackMapper.kt index 99f3826e..d0c62d14 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/mapper/TechStackMapper.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/mapper/TechStackMapper.kt @@ -1,20 +1,19 @@ package team.msg.sms.persistence.techstack.mapper import team.msg.sms.domain.techstack.model.TechStack -import team.msg.sms.persistence.student.entity.StudentJpaEntity import team.msg.sms.persistence.techstack.entity.TechStackJpaEntity fun TechStackJpaEntity.toDomain() = TechStack( id = id, stack = stack, - studentId = student.id + count = count ) fun TechStack.toEntity( - student: StudentJpaEntity ) = TechStackJpaEntity( + id = id, stack = stack, - student = student + count = count ) \ No newline at end of file From f7e6e2882161b8b1caf7c70e014c1b06fc66863b Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:55:53 +0900 Subject: [PATCH 004/132] =?UTF-8?q?:sparkles:=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=ED=85=8C=ED=81=AC=20=EC=8A=A4=ED=83=9D=20queryAll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../techstack/TechStackPersistenceAdapter.kt | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/TechStackPersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/TechStackPersistenceAdapter.kt index d62a3108..0515a0ab 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/TechStackPersistenceAdapter.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/TechStackPersistenceAdapter.kt @@ -1,37 +1,34 @@ package team.msg.sms.persistence.techstack import org.springframework.stereotype.Component -import team.msg.sms.domain.student.model.Student import team.msg.sms.domain.techstack.model.TechStack import team.msg.sms.domain.techstack.spi.TechStackPort -import team.msg.sms.domain.user.model.User -import team.msg.sms.persistence.student.mapper.toEntity import team.msg.sms.persistence.techstack.mapper.toDomain import team.msg.sms.persistence.techstack.mapper.toEntity import team.msg.sms.persistence.techstack.repository.TechStackJpaRepository -import team.msg.sms.persistence.user.mapper.toEntity -import java.util.UUID @Component class TechStackPersistenceAdapter( - private val techStackJpaRepository: TechStackJpaRepository, + private val techStackJpaRepository: TechStackJpaRepository ) : TechStackPort { - override fun saveAll(techStack: List, student: Student, user: User): List = + override fun save(techStack: TechStack): TechStack = + techStackJpaRepository.save(techStack.toEntity()).toDomain() + + override fun saveAll(techStack: List): List = techStackJpaRepository.saveAll( techStack - .map { it.toEntity(student.toEntity(user.toEntity())) } + .map { it.toEntity() } ) .map { it.toDomain() } - override fun deleteAllByStudent(student: Student, user: User) = - techStackJpaRepository.deleteAllByStudent(student = student.toEntity(user.toEntity())) - - override fun queryByStudentUuid(uuid: UUID): List = - techStackJpaRepository.findByStudentId(uuid) - .map { it.toDomain() } - override fun queryAll(): List = - techStackJpaRepository.findAll().map { it.toDomain() } + techStackJpaRepository.findAll() + .map { + it.toDomain() + } + + override fun queryAllByCount(): List = + techStackJpaRepository.findAllByCountGreaterThan(2).map { it.toDomain() } override fun queryAllByStack(stack: String): List = techStackJpaRepository.findByStackStartingWith(stack).map { it.toDomain() } From 794fef95519121075e9aa6ab126501b1ea17bccf Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:57:03 +0900 Subject: [PATCH 005/132] =?UTF-8?q?:sparkles:=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=ED=85=8C=ED=81=AC=20=EC=8A=A4=ED=83=9D=20=EA=B0=80=EC=A7=80?= =?UTF-8?q?=EA=B3=A0=20=EC=98=A4=EB=8A=94=EA=B1=B0=20=EC=8A=A4=ED=83=9D=20?= =?UTF-8?q?2=20=EC=9D=B4=EC=83=81=EC=9D=B8=20=EC=97=94=ED=8B=B0=ED=8B=B0?= =?UTF-8?q?=EB=A7=8C=20=EA=B0=80=EC=A0=B8=EC=98=A4=EB=8F=84=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../techstack/repository/TechStackJpaRepository.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/repository/TechStackJpaRepository.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/repository/TechStackJpaRepository.kt index 4c208158..fe3d0ee5 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/repository/TechStackJpaRepository.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/repository/TechStackJpaRepository.kt @@ -2,13 +2,10 @@ package team.msg.sms.persistence.techstack.repository import org.springframework.data.jpa.repository.JpaRepository import org.springframework.stereotype.Repository -import team.msg.sms.persistence.student.entity.StudentJpaEntity import team.msg.sms.persistence.techstack.entity.TechStackJpaEntity -import java.util.UUID @Repository interface TechStackJpaRepository : JpaRepository { - fun findByStudentId(uuid: UUID): List fun findByStackStartingWith(stack: String): List - fun deleteAllByStudent(student: StudentJpaEntity) + fun findAllByCountGreaterThan(count: Long): List } \ No newline at end of file From e739858790612a81eeb9a57c85650223fa2db7c0 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:57:25 +0900 Subject: [PATCH 006/132] =?UTF-8?q?:sparkles:=20StudentTechStack=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/student/model/StudentTechStack.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/student/model/StudentTechStack.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/model/StudentTechStack.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/model/StudentTechStack.kt new file mode 100644 index 00000000..9eadf300 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/model/StudentTechStack.kt @@ -0,0 +1,11 @@ +package team.msg.sms.domain.student.model + +import team.msg.sms.common.annotation.Aggregate +import java.util.UUID + +@Aggregate +data class StudentTechStack( + val id: Long, + val studentId: UUID, + val techStackId: Long +) From 882e9e46c8e091ac0ff5a497670f2fab92474237 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:57:37 +0900 Subject: [PATCH 007/132] =?UTF-8?q?:sparkles:=20StudentTechStack=20?= =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student/entity/StudentTechStackJpaEntity.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/entity/StudentTechStackJpaEntity.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/entity/StudentTechStackJpaEntity.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/entity/StudentTechStackJpaEntity.kt new file mode 100644 index 00000000..596bf2c5 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/entity/StudentTechStackJpaEntity.kt @@ -0,0 +1,17 @@ +package team.msg.sms.persistence.student.entity + +import team.msg.sms.persistence.BaseIdEntity +import team.msg.sms.persistence.techstack.entity.TechStackJpaEntity +import javax.persistence.* + +@Entity +@Table(name = "student_tech_stack") +class StudentTechStackJpaEntity( + @OneToOne + @JoinColumn(name = "student_id") + val student: StudentJpaEntity, + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "tech_stack_id") + val techStack: TechStackJpaEntity +) : BaseIdEntity() \ No newline at end of file From 49f92d312f15dfe37318e5918b7283a2dba302b7 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:58:49 +0900 Subject: [PATCH 008/132] =?UTF-8?q?:sparkles:=20StudentTechStack=20Mapper?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student/mapper/StudentTechStackMapper.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/mapper/StudentTechStackMapper.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/mapper/StudentTechStackMapper.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/mapper/StudentTechStackMapper.kt new file mode 100644 index 00000000..a30c4557 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/mapper/StudentTechStackMapper.kt @@ -0,0 +1,22 @@ +package team.msg.sms.persistence.student.mapper + +import team.msg.sms.domain.student.model.StudentTechStack +import team.msg.sms.persistence.student.entity.StudentJpaEntity +import team.msg.sms.persistence.student.entity.StudentTechStackJpaEntity +import team.msg.sms.persistence.techstack.entity.TechStackJpaEntity + +fun StudentTechStack.toEntity( + studentJpaEntity: StudentJpaEntity, + techStackJpaEntity: TechStackJpaEntity +): StudentTechStackJpaEntity = + StudentTechStackJpaEntity( + techStack = techStackJpaEntity, + student = studentJpaEntity + ) + +fun StudentTechStackJpaEntity.toDomain(): StudentTechStack = + StudentTechStack( + id = this.id, + studentId = this.student.id, + techStackId = this.techStack.id + ) \ No newline at end of file From 542531249d8c25f877ab8ea87b26042e53ba5bfc Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:59:08 +0900 Subject: [PATCH 009/132] =?UTF-8?q?:sparkles:=20StudentTechStackPersistenc?= =?UTF-8?q?eAdapter=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StudentTechStackPersistenceAdapter.kt | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentTechStackPersistenceAdapter.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentTechStackPersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentTechStackPersistenceAdapter.kt new file mode 100644 index 00000000..09d49ba4 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentTechStackPersistenceAdapter.kt @@ -0,0 +1,45 @@ +package team.msg.sms.persistence.student + +import org.springframework.data.repository.findByIdOrNull +import org.springframework.stereotype.Component +import team.msg.sms.domain.student.exception.StudentNotFoundException +import team.msg.sms.domain.student.model.Student +import team.msg.sms.domain.student.model.StudentTechStack +import team.msg.sms.domain.student.spi.StudentTechStackPort +import team.msg.sms.persistence.student.mapper.toDomain +import team.msg.sms.persistence.student.mapper.toEntity +import team.msg.sms.persistence.student.repository.StudentJpaRepository +import team.msg.sms.persistence.student.repository.StudentTechStackJpaRepository +import team.msg.sms.persistence.techstack.repository.TechStackJpaRepository +import java.util.* + +@Component +class StudentTechStackPersistenceAdapter( + private val studentTechStackJpaRepository: StudentTechStackJpaRepository, + private val studentJpaRepository: StudentJpaRepository, + private val techStackJpaRepository: TechStackJpaRepository +) : StudentTechStackPort { + override fun save(studentTechStack: StudentTechStack) { + val student = studentJpaRepository.findByIdOrNull(studentTechStack.studentId) + ?: throw StudentNotFoundException + val techStack = techStackJpaRepository.findByIdOrNull(studentTechStack.techStackId) + studentTechStackJpaRepository.save( + studentTechStack.toEntity( + studentJpaEntity = student, + techStackJpaEntity = techStack!! + ) + ) + } + + override fun deleteAllByStudent(student: Student) { + val student = studentJpaRepository.findByIdOrNull(student.id) + ?: throw StudentNotFoundException + studentTechStackJpaRepository.deleteAllByStudent(student) + } + + override fun queryStudentTechStackByStudentId(studentId: UUID): List = + studentTechStackJpaRepository.findAllByStudentId(studentId = studentId) + .map { + it.toDomain() + } +} \ No newline at end of file From 9c723c5f6222c5f79679eecb551b206a648ab683 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:59:36 +0900 Subject: [PATCH 010/132] :sparkles: StudentTechStackRepository --- .../repository/StudentTechStackJpaRepository.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/repository/StudentTechStackJpaRepository.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/repository/StudentTechStackJpaRepository.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/repository/StudentTechStackJpaRepository.kt new file mode 100644 index 00000000..e425fe50 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/repository/StudentTechStackJpaRepository.kt @@ -0,0 +1,13 @@ +package team.msg.sms.persistence.student.repository + +import org.springframework.data.repository.CrudRepository +import org.springframework.stereotype.Repository +import team.msg.sms.persistence.student.entity.StudentJpaEntity +import team.msg.sms.persistence.student.entity.StudentTechStackJpaEntity +import java.util.UUID + +@Repository +interface StudentTechStackJpaRepository : CrudRepository { + fun findAllByStudentId(studentId: UUID): List + fun deleteAllByStudent(studentJpaEntity: StudentJpaEntity) +} \ No newline at end of file From 9473d406d0739e38e8b7bd825ad00a9864aff2c7 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 14:59:55 +0900 Subject: [PATCH 011/132] =?UTF-8?q?:sparkles:=20=EB=93=A4=EC=97=AC?= =?UTF-8?q?=EC=93=B0=EA=B8=B0=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/persistence/student/repository/StudentJpaRepository.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/repository/StudentJpaRepository.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/repository/StudentJpaRepository.kt index 9cab4c36..ed2a1d81 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/repository/StudentJpaRepository.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/repository/StudentJpaRepository.kt @@ -13,6 +13,5 @@ interface StudentJpaRepository : JpaRepository { @Lock(LockModeType.PESSIMISTIC_WRITE) fun existsByUser(user: UserJpaEntity): Boolean fun findByUserId(userId: UUID): StudentJpaEntity? - fun findByUser(user: UserJpaEntity): StudentJpaEntity } \ No newline at end of file From 0d185e62c74b3f5fc41ac3be38ef3e4d7e4d6420 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:00:26 +0900 Subject: [PATCH 012/132] =?UTF-8?q?:sparkles:=20Student=20Model=EC=97=90?= =?UTF-8?q?=20userId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/team/msg/sms/domain/student/model/Student.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/model/Student.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/model/Student.kt index 0a5c5eef..f36713bd 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/model/Student.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/model/Student.kt @@ -34,7 +34,8 @@ data class Student( val salary: Int, val name: String, val profileImgUrl: String, - val techStack: List + val techStack: List, + val userId: UUID ) data class StudentWithPageInfo( From b5b3879b5e1bc8925564aa57b35b2233e7f0bb87 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:01:04 +0900 Subject: [PATCH 013/132] =?UTF-8?q?:sparkles:=20userId=20StudentMapper=20?= =?UTF-8?q?=EC=97=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student/mapper/StudentMapper.kt | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/mapper/StudentMapper.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/mapper/StudentMapper.kt index 40985f56..16667308 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/mapper/StudentMapper.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/mapper/StudentMapper.kt @@ -57,7 +57,8 @@ fun StudentJpaEntity.toDomainWithUserInfo(): Student.StudentWithUserInfo = salary = salary, name = user.name, profileImgUrl = profileImgUrl, - techStack = arrayListOf() + techStack = arrayListOf(), + userId = user.id ) fun Page.toDomainPageWithUserInfo(): Student.StudentWithPageInfo { @@ -72,4 +73,21 @@ fun Page.toDomainPageWithUserInfo(): Student.StudentWithPageIn totalSize = this.totalElements, last = this.isLast ) -} \ No newline at end of file +} + +fun Student.StudentWithUserInfo.toEntity(user: UserJpaEntity): StudentJpaEntity = + StudentJpaEntity( + id = id, + department = department, + contactEmail = contactEmail, + major = major, + portfolioUrl = portfolioUrl, + dreamBookFileUrl = dreamBookFileUrl, + gsmAuthenticationScore = gsmAuthenticationScore, + salary = salary, + formOfEmployment = formOfEmployment, + introduce = introduce, + militaryService = militaryService, + profileImgUrl = profileImgUrl, + user = user + ) \ No newline at end of file From d7d87c3b5760c2374e3c5d2245e1d1d6b97c2577 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:01:47 +0900 Subject: [PATCH 014/132] =?UTF-8?q?:sparkles:=20StudentPersistenceAdapter?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/persistence/student/StudentPersistenceAdapter.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentPersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentPersistenceAdapter.kt index d3bdac46..a5792506 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentPersistenceAdapter.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentPersistenceAdapter.kt @@ -39,7 +39,10 @@ class StudentPersistenceAdapter( override fun queryStudentsWithPage(page: Int, size: Int): Student.StudentWithPageInfo = studentJpaRepository.findAll(PageRequest.of(page - 1, size)).toDomainPageWithUserInfo() - override fun queryStudentByUserId(userId: UUID): Student.StudentWithUserInfo? = + override fun queryStudentByUserId(userId: UUID): Student = + studentJpaRepository.findByUserId(userId)!!.toDomain() + + override fun queryStudentUserInfoByUserId(userId: UUID): Student.StudentWithUserInfo? = studentJpaRepository.findByUserId(userId)?.toDomainWithUserInfo() override fun queryStudentByUser(user: User): Student { From de10ab73f0c4e40239e005d5911f530715cf92bc Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:02:22 +0900 Subject: [PATCH 015/132] =?UTF-8?q?:sparkles:=20Project=20Model=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/project/model/Project.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/model/Project.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/model/Project.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/model/Project.kt new file mode 100644 index 00000000..30aad072 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/model/Project.kt @@ -0,0 +1,16 @@ +package team.msg.sms.domain.project.model + +import team.msg.sms.common.annotation.Aggregate +import java.util.UUID + +@Aggregate +data class Project( + val id: Long, + val title: String, + val projectIconUrl: String, + val description: String, + val myActivity: String?, + val startDate: String, + val endDate: String?, + val studentId: UUID +) From 6ce3c016b10340e2ad7abaad5de17fe82784e823 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:02:34 +0900 Subject: [PATCH 016/132] =?UTF-8?q?:sparkles:=20Project=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/entity/ProjectJpaEntity.kt | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectJpaEntity.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectJpaEntity.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectJpaEntity.kt new file mode 100644 index 00000000..b1ff1a30 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectJpaEntity.kt @@ -0,0 +1,34 @@ +package team.msg.sms.persistence.project.entity + +import com.fasterxml.jackson.annotation.JsonFormat +import org.springframework.format.annotation.DateTimeFormat +import team.msg.sms.persistence.BaseIdEntity +import team.msg.sms.persistence.student.entity.StudentJpaEntity +import java.time.LocalDateTime +import javax.persistence.* + +@Entity +@Table(name = "project") +class ProjectJpaEntity( + @Column + val title: String, + + @Column + val projectIconUrl: String, + + @Column + val description: String, + + @Column(nullable = true, length = 1000) + val myActivity: String?, + + @Column + val startDate: String, + + @Column(nullable = true) + val endDate: String?, + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "student_id") + val student: StudentJpaEntity +) : BaseIdEntity() \ No newline at end of file From e219d987aaa96f23cd65eab10e4b311fc6b8daaf Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:03:38 +0900 Subject: [PATCH 017/132] =?UTF-8?q?:sparkles:=20ProjectJpaRepository=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/repository/ProjectJpaRepository.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectJpaRepository.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectJpaRepository.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectJpaRepository.kt new file mode 100644 index 00000000..490bbb8c --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectJpaRepository.kt @@ -0,0 +1,10 @@ +package team.msg.sms.persistence.project.repository + +import org.springframework.data.jpa.repository.JpaRepository +import team.msg.sms.persistence.project.entity.ProjectJpaEntity +import team.msg.sms.persistence.student.entity.StudentJpaEntity + +interface ProjectJpaRepository : JpaRepository { + fun save(projectJpaEntity: ProjectJpaEntity): ProjectJpaEntity + fun findAllByStudent(student: StudentJpaEntity): List +} \ No newline at end of file From 74a6ab574c4e0dcb005c5a84b6602df2a40b3cc5 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:04:53 +0900 Subject: [PATCH 018/132] =?UTF-8?q?:sparkles:=20Project=20Mapper=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/mapper/ProjectMapper.kt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectMapper.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectMapper.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectMapper.kt new file mode 100644 index 00000000..819bc5d5 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectMapper.kt @@ -0,0 +1,30 @@ +package team.msg.sms.persistence.project.mapper + +import team.msg.sms.domain.project.model.Project +import team.msg.sms.persistence.project.entity.ProjectJpaEntity +import team.msg.sms.persistence.student.entity.StudentJpaEntity + +fun ProjectJpaEntity.toDomain() = + Project( + id = this.id, + description = this.description, + title = this.title, + myActivity = this.myActivity, + projectIconUrl = this.projectIconUrl, + startDate = this.startDate, + endDate = this.endDate, + studentId = student.id + ) + +fun Project.toEntity( + student: StudentJpaEntity +) = + ProjectJpaEntity( + description = this.description, + title = this.title, + myActivity = this.myActivity, + projectIconUrl = this.projectIconUrl, + startDate = this.startDate, + endDate = this.endDate, + student = student + ) \ No newline at end of file From 3f14792372d4976a542f723af19adab67f01cf1f Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:05:04 +0900 Subject: [PATCH 019/132] =?UTF-8?q?:sparkles:=20ProjectPersistenceAdapter?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/ProjectPersistenceAdapter.kt | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectPersistenceAdapter.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectPersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectPersistenceAdapter.kt new file mode 100644 index 00000000..481befc3 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectPersistenceAdapter.kt @@ -0,0 +1,40 @@ +package team.msg.sms.persistence.project + +import org.springframework.data.repository.findByIdOrNull +import org.springframework.stereotype.Component +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.spi.ProjectPort +import team.msg.sms.domain.student.exception.StudentNotFoundException +import team.msg.sms.domain.student.model.Student +import team.msg.sms.persistence.project.mapper.toDomain +import team.msg.sms.persistence.project.mapper.toEntity +import team.msg.sms.persistence.project.repository.ProjectJpaRepository +import team.msg.sms.persistence.student.repository.StudentJpaRepository +import java.util.* + +@Component +class ProjectPersistenceAdapter( + val projectRepository: ProjectJpaRepository, + val studentRepository: StudentJpaRepository, +) : ProjectPort { + override fun save(project: Project): Project { + val student = studentRepository.findByIdOrNull(project.studentId) ?: throw StudentNotFoundException + return projectRepository.save(project.toEntity(student)).toDomain() + } + + override fun deleteAllByStudent(student: Student) { + val student = studentRepository.findByIdOrNull(student.id) ?: throw StudentNotFoundException + val project = projectRepository.findAllByStudent(student) + projectRepository.deleteAll(project) + } + + override fun queryAllProjectByStudentId(studentId: UUID): List { + val student = studentRepository.findByIdOrNull(studentId) + ?: throw StudentNotFoundException + return projectRepository.findAllByStudent( + student = student + ).map { + it.toDomain() + } + } +} \ No newline at end of file From 5325c3adc46bbc6eeafaba4dafd07d1d3d169770 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:05:40 +0900 Subject: [PATCH 020/132] =?UTF-8?q?:sparkles:=20CommandProjectService=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/project/service/CommandProjectService.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectService.kt new file mode 100644 index 00000000..cbaf4874 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectService.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.project.service + +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.student.model.Student + +interface CommandProjectService { + fun save(project: Project): Project + fun deleteAllByStudent(student: Student) +} \ No newline at end of file From 8af7312285602ae3c8a5499329a6b2d13141593a Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:05:47 +0900 Subject: [PATCH 021/132] =?UTF-8?q?:sparkles:=20CommandProjectService=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommandProjectServiceImpl.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectServiceImpl.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectServiceImpl.kt new file mode 100644 index 00000000..6d7df189 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectServiceImpl.kt @@ -0,0 +1,18 @@ +package team.msg.sms.domain.project.service.impl + +import team.msg.sms.common.annotation.Service +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.service.CommandProjectService +import team.msg.sms.domain.project.spi.ProjectPort +import team.msg.sms.domain.student.model.Student + +@Service +class CommandProjectServiceImpl( + private val projectPort: ProjectPort +) : CommandProjectService { + override fun save(project: Project): Project = + projectPort.save(project) + + override fun deleteAllByStudent(student: Student) = + projectPort.deleteAllByStudent(student) +} \ No newline at end of file From 108e916227c30fdd9fa0ec2af598f5ac73080793 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:06:01 +0900 Subject: [PATCH 022/132] =?UTF-8?q?:sparkles:=20CommandProjectPort=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/project/spi/CommandProjectPort.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectPort.kt new file mode 100644 index 00000000..4e3cb2c1 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectPort.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.project.spi + +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.student.model.Student + +interface CommandProjectPort { + fun save(project: Project): Project + fun deleteAllByStudent(student: Student) +} \ No newline at end of file From 5e74b4f0a0cabd06c62845d3dcfe238e8ba987c5 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:06:56 +0900 Subject: [PATCH 023/132] =?UTF-8?q?:sparkles:=20QueryProjectPort=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/project/spi/QueryProjectPort.kt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectPort.kt new file mode 100644 index 00000000..e9ef7c50 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectPort.kt @@ -0,0 +1,8 @@ +package team.msg.sms.domain.project.spi + +import team.msg.sms.domain.project.model.Project +import java.util.UUID + +interface QueryProjectPort { + fun queryAllProjectByStudentId(studentId: UUID) : List +} \ No newline at end of file From 3c3891d278b25a42eee534385f0f54a1184bdcef Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:07:37 +0900 Subject: [PATCH 024/132] =?UTF-8?q?:sparkles:=20GetProjectService=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/project/service/GetProjectService.kt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectService.kt new file mode 100644 index 00000000..aacfbe58 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectService.kt @@ -0,0 +1,8 @@ +package team.msg.sms.domain.project.service + +import team.msg.sms.domain.project.model.Project +import java.util.UUID + +interface GetProjectService { + fun getAllProjectByStudentId(studentId: UUID): List +} \ No newline at end of file From df12fb8358a98d39721e877837ff78b1174f03c7 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:07:47 +0900 Subject: [PATCH 025/132] =?UTF-8?q?:sparkles:=20GetProjectService=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/service/impl/GetProjectServiceImpl.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectServiceImpl.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectServiceImpl.kt new file mode 100644 index 00000000..cd3be946 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectServiceImpl.kt @@ -0,0 +1,15 @@ +package team.msg.sms.domain.project.service.impl + +import team.msg.sms.common.annotation.Service +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.service.GetProjectService +import team.msg.sms.domain.project.spi.ProjectPort +import java.util.UUID + +@Service +class GetProjectServiceImpl( + private val projectPort: ProjectPort +) : GetProjectService { + override fun getAllProjectByStudentId(studentid: UUID): List = + projectPort.queryAllProjectByStudentId(studentId = studentid) +} \ No newline at end of file From c9fbe1b4d5babc1a8de34f7309c509e15c25e326 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:08:23 +0900 Subject: [PATCH 026/132] =?UTF-8?q?:sparkles:=20Project=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=BD=94=EB=93=9C=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/exception/error/ProjectErrorCode.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/exception/error/ProjectErrorCode.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/exception/error/ProjectErrorCode.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/exception/error/ProjectErrorCode.kt new file mode 100644 index 00000000..23c4e87e --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/exception/error/ProjectErrorCode.kt @@ -0,0 +1,16 @@ +package team.msg.sms.domain.project.exception.error + +import team.msg.sms.common.error.ErrorProperty +import team.msg.sms.common.error.ErrorStatus + +enum class ProjectErrorCode( + private val status: Int, + private val message: String +) : ErrorProperty { + + PROJECT_NOT_FOUND(ErrorStatus.NOT_FOUND, "프로젝트가 존재하지 않습니다."), + ; + + override fun status(): Int = status + override fun message(): String = message +} \ No newline at end of file From 2883ea77651616750b8c66a655db2312c67e2303 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:08:41 +0900 Subject: [PATCH 027/132] =?UTF-8?q?:sparkles:=20ProjectNotFound=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/project/exception/ProjectNotFoundException.kt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/exception/ProjectNotFoundException.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/exception/ProjectNotFoundException.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/exception/ProjectNotFoundException.kt new file mode 100644 index 00000000..7d67e061 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/exception/ProjectNotFoundException.kt @@ -0,0 +1,8 @@ +package team.msg.sms.domain.project.exception + +import team.msg.sms.common.error.SmsException +import team.msg.sms.domain.project.exception.error.ProjectErrorCode + +object ProjectNotFoundException : SmsException( + ProjectErrorCode.PROJECT_NOT_FOUND +) \ No newline at end of file From 2c6436f6e6a4d6edff8b1a9fe230e2395273ebee Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:08:55 +0900 Subject: [PATCH 028/132] =?UTF-8?q?:sparkles:=20ProjectService=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/project/service/ProjectService.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectService.kt new file mode 100644 index 00000000..318bf503 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectService.kt @@ -0,0 +1,10 @@ +package team.msg.sms.domain.project.service + +import team.msg.sms.common.annotation.Service + +@Service +class ProjectService( + commandProjectService: CommandProjectService, + getProjectService: GetProjectService +) : CommandProjectService by commandProjectService, + GetProjectService by getProjectService \ No newline at end of file From 1d886029ae31915084db191832d5bf1d6b8ef584 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:09:17 +0900 Subject: [PATCH 029/132] =?UTF-8?q?:sparkles:=20ProjectPort=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/team/msg/sms/domain/project/spi/ProjectPort.kt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectPort.kt new file mode 100644 index 00000000..00cc447d --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectPort.kt @@ -0,0 +1,5 @@ +package team.msg.sms.domain.project.spi + +interface ProjectPort : + CommandProjectPort, + QueryProjectPort \ No newline at end of file From b42d30ac23bfe4d63d7002220ffd1251a645824e Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:09:48 +0900 Subject: [PATCH 030/132] =?UTF-8?q?:sparkles:=20ProjectLink=20Model=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/project/model/ProjectLink.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/model/ProjectLink.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/model/ProjectLink.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/model/ProjectLink.kt new file mode 100644 index 00000000..a63e5516 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/model/ProjectLink.kt @@ -0,0 +1,11 @@ +package team.msg.sms.domain.project.model + +import team.msg.sms.common.annotation.Aggregate + +@Aggregate +data class ProjectLink( + val id: Long, + val name: String, + val url: String, + val projectId: Long +) From 1d7f66dad391a45170f83f70a29020b18665a691 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:09:55 +0900 Subject: [PATCH 031/132] =?UTF-8?q?:sparkles:=20ProjectLink=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/entity/ProjectLinkJpaEntity.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectLinkJpaEntity.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectLinkJpaEntity.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectLinkJpaEntity.kt new file mode 100644 index 00000000..8930d5d4 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectLinkJpaEntity.kt @@ -0,0 +1,18 @@ +package team.msg.sms.persistence.project.entity + +import team.msg.sms.persistence.BaseIdEntity +import javax.persistence.* + +@Entity +@Table(name = "project_link") +class ProjectLinkJpaEntity( + @Column + val name: String, + + @Column + val url: String, + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "project_id") + val project: ProjectJpaEntity, +) : BaseIdEntity() \ No newline at end of file From 08856c9064ba7d8806f6bea114e77af37d956448 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:10:24 +0900 Subject: [PATCH 032/132] =?UTF-8?q?:sparkles:=20ProjectLinkJpaRepository?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/repository/ProjectLinkJpaRepository.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectLinkJpaRepository.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectLinkJpaRepository.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectLinkJpaRepository.kt new file mode 100644 index 00000000..bfb16c83 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectLinkJpaRepository.kt @@ -0,0 +1,14 @@ +package team.msg.sms.persistence.project.repository + +import org.springframework.data.jpa.repository.Modifying +import org.springframework.data.jpa.repository.Query +import org.springframework.data.repository.CrudRepository +import org.springframework.data.repository.query.Param +import team.msg.sms.persistence.project.entity.ProjectLinkJpaEntity + +interface ProjectLinkJpaRepository : CrudRepository { + fun findAllByProjectId(projectId: Long): List + @Modifying + @Query("delete from ProjectLinkJpaEntity pt where pt.project.id in :projects") + fun deleteAllByProjects(@Param("projects") projects: List) +} \ No newline at end of file From 10a0cb5a62dad295699519af881842e02ad6f0cf Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:10:44 +0900 Subject: [PATCH 033/132] =?UTF-8?q?:sparkles:=20ProjectLink=20Mapper=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/mapper/ProjectLinkMapper.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectLinkMapper.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectLinkMapper.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectLinkMapper.kt new file mode 100644 index 00000000..53642c97 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectLinkMapper.kt @@ -0,0 +1,22 @@ +package team.msg.sms.persistence.project.mapper + +import team.msg.sms.domain.project.model.ProjectLink +import team.msg.sms.persistence.project.entity.ProjectJpaEntity +import team.msg.sms.persistence.project.entity.ProjectLinkJpaEntity + +fun ProjectLink.toEntity( + projectJpaEntity: ProjectJpaEntity +) = + ProjectLinkJpaEntity( + name = name, + url = url, + project = projectJpaEntity + ) + +fun ProjectLinkJpaEntity.toDomain() = + ProjectLink( + id = id, + name = name, + url = url, + projectId = project.id + ) From 224a0ffd3724b2b8092ca46ce89212ad929b1b36 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:10:56 +0900 Subject: [PATCH 034/132] =?UTF-8?q?:sparkles:=20ProjectLinkPersistenceAdap?= =?UTF-8?q?ter=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/ProjectLinkPersistenceAdapter.kt | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectLinkPersistenceAdapter.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectLinkPersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectLinkPersistenceAdapter.kt new file mode 100644 index 00000000..e7f8f799 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectLinkPersistenceAdapter.kt @@ -0,0 +1,44 @@ +package team.msg.sms.persistence.project + +import org.springframework.data.repository.findByIdOrNull +import org.springframework.stereotype.Component +import team.msg.sms.domain.project.exception.ProjectNotFoundException +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectLink +import team.msg.sms.domain.project.spi.ProjectLinkPort +import team.msg.sms.persistence.project.mapper.toDomain +import team.msg.sms.persistence.project.mapper.toEntity +import team.msg.sms.persistence.project.repository.ProjectJpaRepository +import team.msg.sms.persistence.project.repository.ProjectLinkJpaRepository + +@Component +class ProjectLinkPersistenceAdapter( + val projectLinkJpaRepository: ProjectLinkJpaRepository, + val projectJpaRepository: ProjectJpaRepository +) : ProjectLinkPort { + override fun saveAll(projectLinks: List) { + val project = projectJpaRepository.findByIdOrNull(projectLinks[0].projectId) + ?: throw ProjectNotFoundException + projectLinkJpaRepository.saveAll( + projectLinks + .map { + it.toEntity(project) + } + ) + } + + override fun deleteAllByProjects(projects: List) { + projectLinkJpaRepository.deleteAllByProjects( + projects + .map { + it.id + } + ) + } + + override fun queryAllByProjectId(projectId: Long): List = + projectLinkJpaRepository.findAllByProjectId(projectId = projectId) + .map { + it.toDomain() + } +} \ No newline at end of file From ecec2ef2d92628a23073d25904213cdf6118c168 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:11:04 +0900 Subject: [PATCH 035/132] =?UTF-8?q?:sparkles:=20ProjectLinkPort=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/project/spi/ProjectLinkPort.kt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectLinkPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectLinkPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectLinkPort.kt new file mode 100644 index 00000000..94a6d743 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectLinkPort.kt @@ -0,0 +1,5 @@ +package team.msg.sms.domain.project.spi + +interface ProjectLinkPort : + CommandProjectLinkPort, + QueryProjectLinkPort From 6807421636d6f43820d0c2b73238d12ced22258a Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:11:15 +0900 Subject: [PATCH 036/132] =?UTF-8?q?:sparkles:=20ProjectLinkService=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/project/service/ProjectLinkService.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectLinkService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectLinkService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectLinkService.kt new file mode 100644 index 00000000..f9dde626 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectLinkService.kt @@ -0,0 +1,10 @@ +package team.msg.sms.domain.project.service + +import team.msg.sms.common.annotation.Service + +@Service +class ProjectLinkService( + commandProjectLinkService: CommandProjectLinkService, + getProjectLinkService: GetProjectLinkService +) : CommandProjectLinkService by commandProjectLinkService, + GetProjectLinkService by getProjectLinkService \ No newline at end of file From bbf70cc2593b2f86995234a7f04aa6f444d4b909 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:11:36 +0900 Subject: [PATCH 037/132] =?UTF-8?q?:sparkles:=20QueryProjectLinkPort=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/project/spi/QueryProjectLinkPort.kt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectLinkPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectLinkPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectLinkPort.kt new file mode 100644 index 00000000..50f425d3 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectLinkPort.kt @@ -0,0 +1,7 @@ +package team.msg.sms.domain.project.spi + +import team.msg.sms.domain.project.model.ProjectLink + +interface QueryProjectLinkPort { + fun queryAllByProjectId(projectId: Long): List +} \ No newline at end of file From 43d3ece0de3f56f0d0fa96ee64c6c2f4668a4b05 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:12:21 +0900 Subject: [PATCH 038/132] =?UTF-8?q?:sparkles:=20CommandProjectLinkPort=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/project/spi/CommandProjectLinkPort.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectLinkPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectLinkPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectLinkPort.kt new file mode 100644 index 00000000..aa52d891 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectLinkPort.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.project.spi + +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectLink + +interface CommandProjectLinkPort { + fun saveAll(projectLinks: List) + fun deleteAllByProjects(projects: List) +} \ No newline at end of file From 4f0ab6ed0d7280d3ee1c88f213f4999739661ed1 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:12:37 +0900 Subject: [PATCH 039/132] =?UTF-8?q?:sparkles:=20CommandProjectLinkService?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/project/service/CommandProjectLinkService.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectLinkService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectLinkService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectLinkService.kt new file mode 100644 index 00000000..efacc479 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectLinkService.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.project.service + +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectLink + +interface CommandProjectLinkService { + fun saveAll(projectLinks: List) + fun deleteAllByProjects(projects: List) +} \ No newline at end of file From 3a4efa0324ca77053b0ab82bd736b0332f3d6d14 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:12:43 +0900 Subject: [PATCH 040/132] =?UTF-8?q?:sparkles:=20CommandProjectLinkService?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CommandProjectLinkServiceImpl.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectLinkServiceImpl.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectLinkServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectLinkServiceImpl.kt new file mode 100644 index 00000000..8ba07eaf --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectLinkServiceImpl.kt @@ -0,0 +1,19 @@ +package team.msg.sms.domain.project.service.impl + +import team.msg.sms.common.annotation.Service +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectLink +import team.msg.sms.domain.project.service.CommandProjectLinkService +import team.msg.sms.domain.project.spi.ProjectLinkPort + +@Service +class CommandProjectLinkServiceImpl( +private val projectLinkPort: ProjectLinkPort +) : CommandProjectLinkService { + override fun saveAll(projectLinks: List) = + projectLinkPort.saveAll(projectLinks) + + + override fun deleteAllByProjects(projects: List) = + projectLinkPort.deleteAllByProjects(projects = projects) +} \ No newline at end of file From 7f0313fff4ba8bc453b246163b796c2c7bfe17af Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:13:24 +0900 Subject: [PATCH 041/132] =?UTF-8?q?:sparkles:=20Image=20Model=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/team/msg/sms/domain/file/model/Image.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/file/model/Image.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/file/model/Image.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/file/model/Image.kt new file mode 100644 index 00000000..e6f6e498 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/file/model/Image.kt @@ -0,0 +1,10 @@ +package team.msg.sms.domain.file.model + +import team.msg.sms.common.annotation.Aggregate + +@Aggregate +data class Image( + val id: Long, + val imageUrl: String, + val projectId: Long +) \ No newline at end of file From 1b160a4abaf0a2fa75255b030fdce28e78e70f19 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:13:30 +0900 Subject: [PATCH 042/132] =?UTF-8?q?:sparkles:=20Image=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/image/entity/ImageJpaEntity.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/entity/ImageJpaEntity.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/entity/ImageJpaEntity.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/entity/ImageJpaEntity.kt new file mode 100644 index 00000000..e0e63e2e --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/entity/ImageJpaEntity.kt @@ -0,0 +1,16 @@ +package team.msg.sms.persistence.image.entity + +import team.msg.sms.persistence.BaseIdEntity +import team.msg.sms.persistence.project.entity.ProjectJpaEntity +import javax.persistence.* + +@Entity +@Table(name = "image") +class ImageJpaEntity( + @Column(length = 1000) + val imageUrl: String, + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "project_id") + val project: ProjectJpaEntity +) : BaseIdEntity() \ No newline at end of file From 96dab743a83e74ebc857694d96d0c18daafec296 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:13:38 +0900 Subject: [PATCH 043/132] =?UTF-8?q?:sparkles:=20ImageJpaRepository=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../image/repository/ImageJpaRepository.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/repository/ImageJpaRepository.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/repository/ImageJpaRepository.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/repository/ImageJpaRepository.kt new file mode 100644 index 00000000..9d82d047 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/repository/ImageJpaRepository.kt @@ -0,0 +1,15 @@ +package team.msg.sms.persistence.image.repository + +import org.springframework.data.jpa.repository.Modifying +import org.springframework.data.jpa.repository.Query +import org.springframework.data.repository.CrudRepository +import org.springframework.data.repository.query.Param +import team.msg.sms.persistence.image.entity.ImageJpaEntity + +interface ImageJpaRepository : CrudRepository{ + @Modifying + @Query("delete from ImageJpaEntity pt where pt.project.id in :projects") + fun deleteAllByProjects(@Param("projects") projects: List) + + fun findAllByProjectId(projectId: Long): List +} \ No newline at end of file From a49f0dc43c5c0c31bb121742ba377389b547977d Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:13:49 +0900 Subject: [PATCH 044/132] =?UTF-8?q?:sparkles:=20ImageMapper=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/image/mapper/ImageMapper.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/mapper/ImageMapper.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/mapper/ImageMapper.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/mapper/ImageMapper.kt new file mode 100644 index 00000000..3024c697 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/mapper/ImageMapper.kt @@ -0,0 +1,20 @@ +package team.msg.sms.persistence.image.mapper + +import team.msg.sms.domain.file.model.Image +import team.msg.sms.persistence.image.entity.ImageJpaEntity +import team.msg.sms.persistence.project.entity.ProjectJpaEntity + +fun Image.toEntity( + project: ProjectJpaEntity +): ImageJpaEntity = + ImageJpaEntity( + imageUrl = imageUrl, + project = project + ) + +fun ImageJpaEntity.toDomain() = + Image( + id = id, + imageUrl = imageUrl, + projectId = project.id + ) \ No newline at end of file From 95352c42c44cdfa9f6abe667da22cf7cdf917af6 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:14:05 +0900 Subject: [PATCH 045/132] =?UTF-8?q?:sparkles:=20ImagePersistenceAdapter=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../image/ImagePersistenceAdapter.kt | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/ImagePersistenceAdapter.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/ImagePersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/ImagePersistenceAdapter.kt new file mode 100644 index 00000000..f6fe52bc --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/image/ImagePersistenceAdapter.kt @@ -0,0 +1,41 @@ +package team.msg.sms.persistence.image + +import org.springframework.data.repository.findByIdOrNull +import org.springframework.stereotype.Component +import team.msg.sms.domain.file.model.Image +import team.msg.sms.domain.file.spi.ImagePort +import team.msg.sms.domain.project.exception.ProjectNotFoundException +import team.msg.sms.domain.project.model.Project +import team.msg.sms.persistence.image.mapper.toDomain +import team.msg.sms.persistence.image.mapper.toEntity +import team.msg.sms.persistence.image.repository.ImageJpaRepository +import team.msg.sms.persistence.project.repository.ProjectJpaRepository + +@Component +class ImagePersistenceAdapter( + private val imageJpaRepository: ImageJpaRepository, + private val projectJpaRepository: ProjectJpaRepository +) : ImagePort { + override fun saveAll(images: List) { + val project = projectJpaRepository.findByIdOrNull(images[0].projectId) + ?: throw ProjectNotFoundException + imageJpaRepository.saveAll(images + .map { + it.toEntity(project) + }) + } + + + override fun deleteAllByProjects(projects: List) { + imageJpaRepository.deleteAllByProjects( + projects = projects.map { + it.id + }) + } + + override fun queryAllByProjectId(projectId: Long): List = + imageJpaRepository.findAllByProjectId(projectId) + .map { + it.toDomain() + } +} \ No newline at end of file From abd01e3cba397fc18f1dd125caf10c3b03e82aed Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:14:16 +0900 Subject: [PATCH 046/132] =?UTF-8?q?:sparkles:=20ImagePort=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/team/msg/sms/domain/file/spi/ImagePort.kt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/ImagePort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/ImagePort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/ImagePort.kt new file mode 100644 index 00000000..a8a6927a --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/ImagePort.kt @@ -0,0 +1,5 @@ +package team.msg.sms.domain.file.spi + +interface ImagePort : + CommandImagePort, + QueryImagePort \ No newline at end of file From 654c77ee7326338fc2e0221565413c52b445d7e1 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:14:26 +0900 Subject: [PATCH 047/132] =?UTF-8?q?:sparkles:=20ImageService=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/file/service/ImageService.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/file/service/ImageService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/ImageService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/ImageService.kt new file mode 100644 index 00000000..76445bfe --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/ImageService.kt @@ -0,0 +1,10 @@ +package team.msg.sms.domain.file.service + +import team.msg.sms.common.annotation.Service + +@Service +class ImageService( + commandImageService: CommandImageService, + getImageService: GetImageService +) : CommandImageService by commandImageService, + GetImageService by getImageService \ No newline at end of file From 5cc03611df22e56b8b8876162cca04b5b2a32ca5 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:14:53 +0900 Subject: [PATCH 048/132] =?UTF-8?q?:sparkles:=20CommandImageService=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/file/service/CommandImageService.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/file/service/CommandImageService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/CommandImageService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/CommandImageService.kt new file mode 100644 index 00000000..eccaf8b6 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/CommandImageService.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.file.service + +import team.msg.sms.domain.file.model.Image +import team.msg.sms.domain.project.model.Project + +interface CommandImageService { + fun saveAll(images: List) + fun deleteAllByProjects(projects: List) +} \ No newline at end of file From d9442fc3306341b0261500103458566509fbcc50 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:14:57 +0900 Subject: [PATCH 049/132] =?UTF-8?q?:sparkles:=20CommandImageService=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommandImageServiceImpl.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/CommandImageServiceImpl.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/CommandImageServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/CommandImageServiceImpl.kt new file mode 100644 index 00000000..c1d6226b --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/CommandImageServiceImpl.kt @@ -0,0 +1,18 @@ +package team.msg.sms.domain.file.service.impl + +import team.msg.sms.common.annotation.Service +import team.msg.sms.domain.file.model.Image +import team.msg.sms.domain.file.service.CommandImageService +import team.msg.sms.domain.file.spi.ImagePort +import team.msg.sms.domain.project.model.Project + +@Service +class CommandImageServiceImp( + private val imagePort: ImagePort +) : CommandImageService { + override fun saveAll(images: List) = + imagePort.saveAll(images) + + override fun deleteAllByProjects(projects: List) = + imagePort.deleteAllByProjects(projects) +} \ No newline at end of file From 8eb3e6a23e3415690b418f4bdd6679e102d993a8 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:15:33 +0900 Subject: [PATCH 050/132] =?UTF-8?q?:sparkles:=20CommandImagePort=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/file/spi/CommandImagePort.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/CommandImagePort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/CommandImagePort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/CommandImagePort.kt new file mode 100644 index 00000000..cb63a313 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/CommandImagePort.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.file.spi + +import team.msg.sms.domain.file.model.Image +import team.msg.sms.domain.project.model.Project + +interface CommandImagePort { + fun saveAll(images: List) + fun deleteAllByProjects(projects: List) +} \ No newline at end of file From c3e1736b5858c34c211b23738b47ea937cccb4c9 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:15:57 +0900 Subject: [PATCH 051/132] =?UTF-8?q?:sparkles:=20QueryImagePort=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/team/msg/sms/domain/file/spi/QueryImagePort.kt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/QueryImagePort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/QueryImagePort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/QueryImagePort.kt new file mode 100644 index 00000000..3bc7020d --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/file/spi/QueryImagePort.kt @@ -0,0 +1,7 @@ +package team.msg.sms.domain.file.spi + +import team.msg.sms.domain.file.model.Image + +interface QueryImagePort { + fun queryAllByProjectId(projectId: Long): List +} \ No newline at end of file From 73f76659e5929080a540841b990f4cea522de2c4 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:17:47 +0900 Subject: [PATCH 052/132] =?UTF-8?q?:sparkles:=20GetImageService=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/file/service/GetImageService.kt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/file/service/GetImageService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/GetImageService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/GetImageService.kt new file mode 100644 index 00000000..83f1bbc8 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/GetImageService.kt @@ -0,0 +1,7 @@ +package team.msg.sms.domain.file.service + +import team.msg.sms.domain.file.model.Image + +interface GetImageService { + fun getAllByProjectId(projectId: Long): List +} \ No newline at end of file From 94ad2663a513c90a5a3debc17de1532e39beb854 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:18:06 +0900 Subject: [PATCH 053/132] =?UTF-8?q?:sparkles:=20GetImageService=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/service/impl/GetImageServiceImpl.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/GetImageServiceImpl.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/GetImageServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/GetImageServiceImpl.kt new file mode 100644 index 00000000..b66cbeaf --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/GetImageServiceImpl.kt @@ -0,0 +1,14 @@ +package team.msg.sms.domain.file.service.impl + +import team.msg.sms.common.annotation.Service +import team.msg.sms.domain.file.model.Image +import team.msg.sms.domain.file.service.GetImageService +import team.msg.sms.domain.file.spi.ImagePort + +@Service +class GetImageServiceImpl( + private val imagePort: ImagePort +) : GetImageService{ + override fun getAllByProjectId(projectId: Long): List = + imagePort.queryAllByProjectId(projectId) +} \ No newline at end of file From 1b1761ee51572f09a9be7f67607470235b50cb1e Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:19:33 +0900 Subject: [PATCH 054/132] =?UTF-8?q?:sparkles:=20GetProjectLinkService=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/project/service/GetProjectLinkService.kt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectLinkService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectLinkService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectLinkService.kt new file mode 100644 index 00000000..033e5d0b --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectLinkService.kt @@ -0,0 +1,7 @@ +package team.msg.sms.domain.project.service + +import team.msg.sms.domain.project.model.ProjectLink + +interface GetProjectLinkService { + fun getAllByProjectId(projectId: Long): List +} \ No newline at end of file From 3eb124d89733a6f2a06da06719b42982e8ba5107 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:19:39 +0900 Subject: [PATCH 055/132] =?UTF-8?q?:sparkles:=20GetProjectLinkService=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GetProjectLinkServiceImpl.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectLinkServiceImpl.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectLinkServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectLinkServiceImpl.kt new file mode 100644 index 00000000..76a53b01 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectLinkServiceImpl.kt @@ -0,0 +1,14 @@ +package team.msg.sms.domain.project.service.impl + +import team.msg.sms.common.annotation.Service +import team.msg.sms.domain.project.model.ProjectLink +import team.msg.sms.domain.project.service.GetProjectLinkService +import team.msg.sms.domain.project.spi.ProjectLinkPort + +@Service +class GetProjectLinkServiceImpl( + private val projectLinkPort: ProjectLinkPort +) : GetProjectLinkService { + override fun getAllByProjectId(projectId: Long): List = + projectLinkPort.queryAllByProjectId(projectId = projectId) +} \ No newline at end of file From d7cb494019796a638886d1d4044f0d80240ad28e Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 15:25:41 +0900 Subject: [PATCH 056/132] =?UTF-8?q?:sparkles:=20GetStudentService=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/student/service/GetStudentService.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentService.kt index 52e99fdd..a7d53e0f 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentService.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentService.kt @@ -3,6 +3,7 @@ package team.msg.sms.domain.student.service import team.msg.sms.domain.student.model.Student import team.msg.sms.domain.techstack.model.TechStack import team.msg.sms.domain.user.model.User +import java.util.UUID interface GetStudentService { fun getStudentsWithPage(page: Int, size: Int): Student.StudentWithPageInfo @@ -13,7 +14,11 @@ interface GetStudentService { role: String ): List - fun getStudentByUuid(uuid: String): Student.StudentWithUserInfo + fun getStudentUserInfoByUuid(uuid: String): Student.StudentWithUserInfo + + fun getStudentByUuid(uuid: UUID): Student + fun getStudentByUser(user: User): Student + fun currentStudent(): Student.StudentWithUserInfo } \ No newline at end of file From ada415769d00801f22fb8982ce0e539b45656a72 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:13:00 +0900 Subject: [PATCH 057/132] =?UTF-8?q?:sparkles:=20GetStudentService=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student/service/impl/GetStudentServiceImpl.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/GetStudentServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/GetStudentServiceImpl.kt index ac7912fa..5afee159 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/GetStudentServiceImpl.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/GetStudentServiceImpl.kt @@ -4,6 +4,7 @@ import team.msg.sms.common.annotation.Service import team.msg.sms.domain.student.exception.StudentNotFoundException import team.msg.sms.common.spi.SecurityPort import team.msg.sms.domain.student.model.Student +import team.msg.sms.domain.student.model.StudentTechStack import team.msg.sms.domain.student.service.GetStudentService import team.msg.sms.domain.student.spi.StudentPort import team.msg.sms.domain.techstack.model.TechStack @@ -21,10 +22,14 @@ class GetStudentServiceImpl( override fun matchStudentWithTechStacks( students: List, techStacks: List, + studentTechStacks: List, role: String ): List { return students.map { student -> - val matchingTechStacks = techStacks.filter { it.studentId == student.id }.map { it.stack } + val studentTechStack = studentTechStacks.filter { it.studentId == student.id } + val matchingTechStacks = studentTechStack.map { techStack -> + techStacks.find { it.id == techStack.techStackId }!!.stack + } val updatedName = if (role == "ROLE_ANONYMOUS") { student.name.replaceRange(1 until student.name.length, "*".repeat(2)) @@ -40,12 +45,16 @@ class GetStudentServiceImpl( } } - override fun getStudentByUuid(uuid: String): Student.StudentWithUserInfo = + override fun getStudentByUuid(uuid: UUID): Student = + studentPort.queryStudentByUserId(uuid) + + override fun getStudentUserInfoByUuid(uuid: String): Student.StudentWithUserInfo = studentPort.queryStudentById(UUID.fromString(uuid)) ?: throw StudentNotFoundException override fun getStudentByUser(user: User): Student = studentPort.queryStudentByUser(user) override fun currentStudent(): Student.StudentWithUserInfo = - studentPort.queryStudentByUserId(userId = securityPort.getCurrentUserId()) ?: throw StudentNotFoundException + studentPort.queryStudentUserInfoByUserId(userId = securityPort.getCurrentUserId()) + ?: throw StudentNotFoundException } \ No newline at end of file From 52c8037b4623651b8ad9ef7fa7eae08b358a7d53 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:13:17 +0900 Subject: [PATCH 058/132] =?UTF-8?q?:sparkles:=20GetStudentService=20?= =?UTF-8?q?=EC=97=90=20StudentTechStack=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/student/service/GetStudentService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentService.kt index a7d53e0f..74ff1313 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentService.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentService.kt @@ -1,6 +1,7 @@ package team.msg.sms.domain.student.service import team.msg.sms.domain.student.model.Student +import team.msg.sms.domain.student.model.StudentTechStack import team.msg.sms.domain.techstack.model.TechStack import team.msg.sms.domain.user.model.User import java.util.UUID @@ -11,6 +12,7 @@ interface GetStudentService { fun matchStudentWithTechStacks( students: List, techStacks: List, + studentTechStacks: List, role: String ): List From e9fb15d69d801cc62800c17f6994609fe84e4669 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:13:44 +0900 Subject: [PATCH 059/132] =?UTF-8?q?:sparkles:=20GetTechStackService=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/techstack/service/GetTechStackService.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/GetTechStackService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/GetTechStackService.kt index 0ba69e55..2123b9ca 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/GetTechStackService.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/GetTechStackService.kt @@ -1,11 +1,9 @@ package team.msg.sms.domain.techstack.service import team.msg.sms.domain.techstack.model.TechStack -import java.util.UUID interface GetTechStackService { fun getAllTechStack(): List - - fun getTechStackByStudentUuid(uuid: UUID): List + fun getAllTechStackByCount(): List fun getAllTechStackByStack(stack: String): List } \ No newline at end of file From 1329d33e410be1d25cd0eddf033382852b0cbcc3 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:14:12 +0900 Subject: [PATCH 060/132] =?UTF-8?q?:sparkles:=20GetTechStackService=20Coun?= =?UTF-8?q?t=EB=A1=9C=202=EC=9D=B4=EC=83=81=20=EC=95=A0=EB=93=A4=EB=A7=8C?= =?UTF-8?q?=20=EA=B2=80=EC=83=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/techstack/service/impl/GetTechStackServiceImpl.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/impl/GetTechStackServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/impl/GetTechStackServiceImpl.kt index b9cfc5e6..5d15ef8f 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/impl/GetTechStackServiceImpl.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/impl/GetTechStackServiceImpl.kt @@ -4,7 +4,6 @@ import org.springframework.stereotype.Service import team.msg.sms.domain.techstack.model.TechStack import team.msg.sms.domain.techstack.service.GetTechStackService import team.msg.sms.domain.techstack.spi.TechStackPort -import java.util.* @Service class GetTechStackServiceImpl( @@ -13,8 +12,8 @@ class GetTechStackServiceImpl( override fun getAllTechStack(): List = techStackPort.queryAll() - override fun getTechStackByStudentUuid(uuid: UUID): List = - techStackPort.queryByStudentUuid(uuid) + override fun getAllTechStackByCount(): List = + techStackPort.queryAllByCount() override fun getAllTechStackByStack(stack: String): List = techStackPort.queryAllByStack(stack) From 854e3f7e87409f13d8c815044dceae0baf299339 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:14:42 +0900 Subject: [PATCH 061/132] =?UTF-8?q?:sparkles:=20CommandStudentTechStackPor?= =?UTF-8?q?t=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/student/spi/CommandStudentTechStackPort.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/CommandStudentTechStackPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/CommandStudentTechStackPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/CommandStudentTechStackPort.kt new file mode 100644 index 00000000..f40167ac --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/CommandStudentTechStackPort.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.student.spi + +import team.msg.sms.domain.student.model.Student +import team.msg.sms.domain.student.model.StudentTechStack + +interface CommandStudentTechStackPort { + fun save(studentTechStack: StudentTechStack) + fun deleteAllByStudent(student: Student) +} \ No newline at end of file From 89d7490da6e5dd2b5475f2575fd1819c34ddc2cc Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:14:50 +0900 Subject: [PATCH 062/132] =?UTF-8?q?:sparkles:=20CommandStudentTechStackSer?= =?UTF-8?q?vice=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student/service/CommandStudentTechStackService.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/student/service/CommandStudentTechStackService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/CommandStudentTechStackService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/CommandStudentTechStackService.kt new file mode 100644 index 00000000..bab21924 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/CommandStudentTechStackService.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.student.service + +import team.msg.sms.domain.student.model.Student +import team.msg.sms.domain.student.model.StudentTechStack + +interface CommandStudentTechStackService { + fun save(studentTechStack: StudentTechStack) + fun deleteAllByStudent(student: Student) +} \ No newline at end of file From b899c8c7461f7af3357f01f6e39a2295ad53b4cb Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:14:54 +0900 Subject: [PATCH 063/132] =?UTF-8?q?:sparkles:=20CommandStudentTechStackSer?= =?UTF-8?q?vice=20=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CommandStudentTechStackServiceImpl.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/CommandStudentTechStackServiceImpl.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/CommandStudentTechStackServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/CommandStudentTechStackServiceImpl.kt new file mode 100644 index 00000000..93521318 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/CommandStudentTechStackServiceImpl.kt @@ -0,0 +1,18 @@ +package team.msg.sms.domain.student.service.impl + +import team.msg.sms.common.annotation.Service +import team.msg.sms.domain.student.model.Student +import team.msg.sms.domain.student.model.StudentTechStack +import team.msg.sms.domain.student.service.CommandStudentTechStackService +import team.msg.sms.domain.student.spi.StudentTechStackPort + +@Service +class CommandStudentTechStackServiceImpl( + private val studentTechStackPort: StudentTechStackPort +) : CommandStudentTechStackService { + override fun save(studentTechStack: StudentTechStack) = + studentTechStackPort.save(studentTechStack) + + override fun deleteAllByStudent(student: Student) = + studentTechStackPort.deleteAllByStudent(student) +} \ No newline at end of file From dd7b7953ef5002f461fbaf77ca91d0311922f103 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:15:14 +0900 Subject: [PATCH 064/132] =?UTF-8?q?:sparkles:=20CommandStudentTechStackPor?= =?UTF-8?q?t=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/project/spi/CommandProjectTechStackPort.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectTechStackPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectTechStackPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectTechStackPort.kt new file mode 100644 index 00000000..8d457d1c --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/CommandProjectTechStackPort.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.project.spi + +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectTechStack + +interface CommandProjectTechStackPort { + fun save(projectTechStack: ProjectTechStack) + fun deleteAllByProjects(projects: List) +} \ No newline at end of file From c26fa7c0a78412c290cee7f6c0f4f825176cb1a3 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:15:23 +0900 Subject: [PATCH 065/132] =?UTF-8?q?:sparkles:=20CommandStudentTechStackSer?= =?UTF-8?q?vice=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/service/CommandProjectTechStackService.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectTechStackService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectTechStackService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectTechStackService.kt new file mode 100644 index 00000000..8ecb44ae --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/CommandProjectTechStackService.kt @@ -0,0 +1,10 @@ +package team.msg.sms.domain.project.service + +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectTechStack + + +interface CommandProjectTechStackService { + fun save(projectTechStack: ProjectTechStack) + fun deleteAllByProjects(projects: List) +} \ No newline at end of file From 610ffb478e63c400f39297c07c881b4b2ec76428 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:15:30 +0900 Subject: [PATCH 066/132] =?UTF-8?q?:sparkles:=20CommandStudentTechStackSer?= =?UTF-8?q?vice=20=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CommandProjectTechStackServiceImpl.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectTechStackServiceImpl.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectTechStackServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectTechStackServiceImpl.kt new file mode 100644 index 00000000..4349bd49 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/CommandProjectTechStackServiceImpl.kt @@ -0,0 +1,18 @@ +package team.msg.sms.domain.project.service.impl + +import team.msg.sms.common.annotation.Service +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectTechStack +import team.msg.sms.domain.project.service.CommandProjectTechStackService +import team.msg.sms.domain.project.spi.ProjectTechStackPort + +@Service +class CommandProjectTechStackServiceImpl( + private val projectTechStackPort: ProjectTechStackPort +) : CommandProjectTechStackService { + override fun save(projectTechStack: ProjectTechStack) = + projectTechStackPort.save(projectTechStack) + + override fun deleteAllByProjects(projects: List) = + projectTechStackPort.deleteAllByProjects(projects) +} \ No newline at end of file From be7857137fd26c90975507e5651eb047d1cbc5b5 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:15:57 +0900 Subject: [PATCH 067/132] =?UTF-8?q?:sparkles:=20GetProjectTechStackService?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/project/service/GetProjectTechStackService.kt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectTechStackService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectTechStackService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectTechStackService.kt new file mode 100644 index 00000000..4d2ae2ed --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/GetProjectTechStackService.kt @@ -0,0 +1,7 @@ +package team.msg.sms.domain.project.service + +import team.msg.sms.domain.project.model.ProjectTechStack + +interface GetProjectTechStackService { + fun getAllByProjectId(projectId: Long): List +} \ No newline at end of file From 18af2dae1efad85b4fba3bf60af9da053add9046 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:16:06 +0900 Subject: [PATCH 068/132] =?UTF-8?q?:sparkles:=20GetProjectTechStackService?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GetProjectTechStackServiceImpl.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectTechStackServiceImpl.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectTechStackServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectTechStackServiceImpl.kt new file mode 100644 index 00000000..9e7ea738 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/impl/GetProjectTechStackServiceImpl.kt @@ -0,0 +1,14 @@ +package team.msg.sms.domain.project.service.impl + +import team.msg.sms.common.annotation.Service +import team.msg.sms.domain.project.model.ProjectTechStack +import team.msg.sms.domain.project.service.GetProjectTechStackService +import team.msg.sms.domain.project.spi.ProjectTechStackPort + +@Service +class GetProjectTechStackServiceImpl( + private val projectTechStackPort: ProjectTechStackPort +) : GetProjectTechStackService { + override fun getAllByProjectId(projectId: Long): List = + projectTechStackPort.queryAllByProjectId(projectId = projectId) +} \ No newline at end of file From 258b1d9ad753b33d1c859d1024c1bcdf0ab7031f Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:16:23 +0900 Subject: [PATCH 069/132] =?UTF-8?q?:sparkles:=20GetStudentTechStackService?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/student/service/GetStudentTechStackService.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentTechStackService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentTechStackService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentTechStackService.kt new file mode 100644 index 00000000..2eb570f4 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentTechStackService.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.student.service + +import team.msg.sms.domain.student.model.StudentTechStack +import java.util.UUID + +interface GetStudentTechStackService { + fun getStudentTechStackByStudentId(studentId: UUID): List + fun getStudentTechStack(): List +} \ No newline at end of file From c111c18275e1bb38e36e59528edacec5763f7ab8 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:16:37 +0900 Subject: [PATCH 070/132] =?UTF-8?q?:sparkles:=20GetStudentTechStackService?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/GetStudentTechStackServiceImpl.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/GetStudentTechStackServiceImpl.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/GetStudentTechStackServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/GetStudentTechStackServiceImpl.kt new file mode 100644 index 00000000..a2e7b32e --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/GetStudentTechStackServiceImpl.kt @@ -0,0 +1,18 @@ +package team.msg.sms.domain.student.service.impl + +import team.msg.sms.common.annotation.Service +import team.msg.sms.domain.student.model.StudentTechStack +import team.msg.sms.domain.student.service.GetStudentTechStackService +import team.msg.sms.domain.student.spi.StudentTechStackPort +import java.util.* + +@Service +class GetStudentTechStackServiceImpl( + private val studentTechStackPort: StudentTechStackPort +) : GetStudentTechStackService { + override fun getStudentTechStackByStudentId(studentId: UUID): List = + studentTechStackPort.queryStudentTechStackByStudentId(studentId) + + override fun getStudentTechStack(): List = + studentTechStackPort.queryStudentTechStack() +} \ No newline at end of file From 78d2c830c5825dbb1b734607ca2d6874e7de3008 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:16:54 +0900 Subject: [PATCH 071/132] =?UTF-8?q?:sparkles:=20ProjectTechStack=20Model?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/project/model/ProjectTechStack.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/model/ProjectTechStack.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/model/ProjectTechStack.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/model/ProjectTechStack.kt new file mode 100644 index 00000000..42ea9318 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/model/ProjectTechStack.kt @@ -0,0 +1,10 @@ +package team.msg.sms.domain.project.model + +import team.msg.sms.common.annotation.Aggregate + +@Aggregate +data class ProjectTechStack( + val id: Long, + val projectId: Long, + val techStackId: Long +) \ No newline at end of file From 1f3a0a8375bf823bb90dbda243960d7b525a9233 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:17:03 +0900 Subject: [PATCH 072/132] =?UTF-8?q?:sparkles:=20ProjectTechStack=20?= =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/ProjectTechStackJpaEntity.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectTechStackJpaEntity.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectTechStackJpaEntity.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectTechStackJpaEntity.kt new file mode 100644 index 00000000..c1125283 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/entity/ProjectTechStackJpaEntity.kt @@ -0,0 +1,22 @@ +package team.msg.sms.persistence.project.entity + +import team.msg.sms.persistence.BaseIdEntity +import team.msg.sms.persistence.techstack.entity.TechStackJpaEntity +import javax.persistence.CascadeType +import javax.persistence.Entity +import javax.persistence.FetchType +import javax.persistence.JoinColumn +import javax.persistence.ManyToOne +import javax.persistence.Table + +@Entity +@Table(name = "project_tech_stack") +class ProjectTechStackJpaEntity( + @ManyToOne(cascade = [CascadeType.ALL]) + @JoinColumn(name = "project_id") + val project: ProjectJpaEntity, + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "tech_stack_id") + val techStack: TechStackJpaEntity +) : BaseIdEntity() \ No newline at end of file From 9b9ce7bf060417a4f53afd36df7ef8427b3fc58b Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:17:10 +0900 Subject: [PATCH 073/132] =?UTF-8?q?:sparkles:=20ProjectTechStackRepository?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/ProjectTechStackJpaRepository.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectTechStackJpaRepository.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectTechStackJpaRepository.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectTechStackJpaRepository.kt new file mode 100644 index 00000000..616cae78 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/repository/ProjectTechStackJpaRepository.kt @@ -0,0 +1,16 @@ +package team.msg.sms.persistence.project.repository + +import org.springframework.data.jpa.repository.Modifying +import org.springframework.data.jpa.repository.Query +import org.springframework.data.repository.CrudRepository +import org.springframework.data.repository.query.Param +import team.msg.sms.persistence.project.entity.ProjectJpaEntity +import team.msg.sms.persistence.project.entity.ProjectTechStackJpaEntity + +interface ProjectTechStackJpaRepository : CrudRepository { + fun findAllByProjectId(projectId: Long): List + + @Modifying + @Query("delete from ProjectTechStackJpaEntity pt where pt.project.id in :projects") + fun deleteAllByProjects(@Param("projects") projects: List) +} \ No newline at end of file From 1fa4fd34289a1ae634aaafe3acf58487d59b2a07 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:17:25 +0900 Subject: [PATCH 074/132] =?UTF-8?q?:sparkles:=20ProjectTechStackMapper=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/mapper/ProjectTechStackMapper.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectTechStackMapper.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectTechStackMapper.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectTechStackMapper.kt new file mode 100644 index 00000000..3e98397a --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/mapper/ProjectTechStackMapper.kt @@ -0,0 +1,19 @@ +package team.msg.sms.persistence.project.mapper + +import team.msg.sms.domain.project.model.ProjectTechStack +import team.msg.sms.persistence.project.entity.ProjectJpaEntity +import team.msg.sms.persistence.project.entity.ProjectTechStackJpaEntity +import team.msg.sms.persistence.techstack.entity.TechStackJpaEntity + +fun ProjectTechStackJpaEntity.toDomain() = + ProjectTechStack( + id = this.id, + projectId = this.project.id, + techStackId = this.techStack.id + ) + +fun ProjectTechStack.toEntity(projectJpaEntity: ProjectJpaEntity, techStackJpaEntity: TechStackJpaEntity) = + ProjectTechStackJpaEntity( + project = projectJpaEntity, + techStack = techStackJpaEntity + ) \ No newline at end of file From 3db69f8eff1c573859fbe8fec8a860076d6a0edf Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:17:42 +0900 Subject: [PATCH 075/132] =?UTF-8?q?:sparkles:=20ProjectTechStackPersistenc?= =?UTF-8?q?eAdapter=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectTechStackPersistenceAdapter.kt | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectTechStackPersistenceAdapter.kt diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectTechStackPersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectTechStackPersistenceAdapter.kt new file mode 100644 index 00000000..82d23b88 --- /dev/null +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/project/ProjectTechStackPersistenceAdapter.kt @@ -0,0 +1,45 @@ +package team.msg.sms.persistence.project + +import org.springframework.data.repository.findByIdOrNull +import org.springframework.stereotype.Component +import team.msg.sms.domain.project.exception.ProjectNotFoundException +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectTechStack +import team.msg.sms.domain.project.spi.ProjectTechStackPort +import team.msg.sms.domain.student.exception.StudentNotFoundException +import team.msg.sms.persistence.project.mapper.toDomain +import team.msg.sms.persistence.project.mapper.toEntity +import team.msg.sms.persistence.project.repository.ProjectJpaRepository +import team.msg.sms.persistence.project.repository.ProjectTechStackJpaRepository +import team.msg.sms.persistence.student.entity.StudentJpaEntity +import team.msg.sms.persistence.student.repository.StudentJpaRepository +import team.msg.sms.persistence.techstack.repository.TechStackJpaRepository + +@Component +class ProjectTechStackPersistenceAdapter( + private val projectTechStackRepository: ProjectTechStackJpaRepository, + private val projectRepository: ProjectJpaRepository, + private val techStackRepository: TechStackJpaRepository +) : ProjectTechStackPort { + override fun save(projectTechStack: ProjectTechStack) { + val project = projectRepository.findByIdOrNull(projectTechStack.projectId) + ?: throw ProjectNotFoundException + val techStack = techStackRepository.findByIdOrNull(projectTechStack.techStackId) + projectTechStackRepository.save(projectTechStack.toEntity(project, techStack!!)) + } + + override fun deleteAllByProjects(projects: List) { + projectTechStackRepository.deleteAllByProjects( + projects + .map { + it.id + } + ) + } + + override fun queryAllByProjectId(projectId: Long): List = + projectTechStackRepository.findAllByProjectId(projectId = projectId) + .map { + it.toDomain() + } +} \ No newline at end of file From 1401c3b086e515e341802192e85ee2bfa2671562 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:17:53 +0900 Subject: [PATCH 076/132] =?UTF-8?q?:sparkles:=20ProjectTechStackPort=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/project/spi/ProjectTechStackPort.kt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectTechStackPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectTechStackPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectTechStackPort.kt new file mode 100644 index 00000000..d0afa6b1 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/ProjectTechStackPort.kt @@ -0,0 +1,5 @@ +package team.msg.sms.domain.project.spi + +interface ProjectTechStackPort : + CommandProjectTechStackPort, + QueryProjectTechStackPort \ No newline at end of file From 2823585b18dd58c94ba9eb7dafca91407c268a5f Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:18:01 +0900 Subject: [PATCH 077/132] =?UTF-8?q?:sparkles:=20ProjectTechStackService=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/project/service/ProjectTechStackService.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectTechStackService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectTechStackService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectTechStackService.kt new file mode 100644 index 00000000..fafd355f --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/service/ProjectTechStackService.kt @@ -0,0 +1,10 @@ +package team.msg.sms.domain.project.service + +import team.msg.sms.common.annotation.Service + +@Service +class ProjectTechStackService( + commandProjectTechStackService: CommandProjectTechStackService, + getProjectTechStackService: GetProjectTechStackService +) : CommandProjectTechStackService by commandProjectTechStackService, + GetProjectTechStackService by getProjectTechStackService \ No newline at end of file From 431616518bdf9d8859f0d3d8f641781fe77e89f6 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:18:16 +0900 Subject: [PATCH 078/132] =?UTF-8?q?:sparkles:=20QueryProjectTechStackPort?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/project/spi/QueryProjectTechStackPort.kt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectTechStackPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectTechStackPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectTechStackPort.kt new file mode 100644 index 00000000..eb9b7717 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/spi/QueryProjectTechStackPort.kt @@ -0,0 +1,7 @@ +package team.msg.sms.domain.project.spi + +import team.msg.sms.domain.project.model.ProjectTechStack + +interface QueryProjectTechStackPort { + fun queryAllByProjectId(projectId: Long): List +} \ No newline at end of file From ca73754dc8d39c73ed6322f1e41386e846727f5d Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:18:26 +0900 Subject: [PATCH 079/132] =?UTF-8?q?:sparkles:=20QueryStudentPort=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/student/spi/QueryStudentTechStackPort.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/QueryStudentTechStackPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/QueryStudentTechStackPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/QueryStudentTechStackPort.kt new file mode 100644 index 00000000..bf02ac58 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/QueryStudentTechStackPort.kt @@ -0,0 +1,9 @@ +package team.msg.sms.domain.student.spi + +import team.msg.sms.domain.student.model.StudentTechStack +import java.util.UUID + +interface QueryStudentTechStackPort { + fun queryStudentTechStackByStudentId(studentId: UUID): List + fun queryStudentTechStack(): List +} \ No newline at end of file From ca411d578389f8281f66a2055c8610d17d6c2f94 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:18:37 +0900 Subject: [PATCH 080/132] =?UTF-8?q?:sparkles:=20StudentTechStackPort=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/student/spi/StudentTechStackPort.kt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/StudentTechStackPort.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/StudentTechStackPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/StudentTechStackPort.kt new file mode 100644 index 00000000..44ade01c --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/StudentTechStackPort.kt @@ -0,0 +1,5 @@ +package team.msg.sms.domain.student.spi + +interface StudentTechStackPort : + CommandStudentTechStackPort, + QueryStudentTechStackPort \ No newline at end of file From e4920f072acec2e112f880d4be8c8519782f2349 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:18:50 +0900 Subject: [PATCH 081/132] =?UTF-8?q?:sparkles:=20StudentTechStackService=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/student/service/StudentTechStackService.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/student/service/StudentTechStackService.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/StudentTechStackService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/StudentTechStackService.kt new file mode 100644 index 00000000..3dce3f8b --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/service/StudentTechStackService.kt @@ -0,0 +1,10 @@ +package team.msg.sms.domain.student.service + +import team.msg.sms.common.annotation.Service + +@Service +class StudentTechStackService( + commandStudentTechStackService: CommandStudentTechStackService, + getStudentTechStackService: GetStudentTechStackService +) : CommandStudentTechStackService by commandStudentTechStackService, + GetStudentTechStackService by getStudentTechStackService \ No newline at end of file From ee26df1866522be0a3bbb76f37ee2ef2fa39859f Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:19:17 +0900 Subject: [PATCH 082/132] =?UTF-8?q?:sparkles:=20ProjectLinkResponseData=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/project/dto/res/ProjectLinkResponseData.kt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectLinkResponseData.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectLinkResponseData.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectLinkResponseData.kt new file mode 100644 index 00000000..dc19aa11 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectLinkResponseData.kt @@ -0,0 +1,7 @@ +package team.msg.sms.domain.project.dto.res + +data class ProjectLinkResponseData( + val id: Long, + val name: String, + val url: String +) \ No newline at end of file From de0a3469c870a6d5d90919b01f008b116257581f Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:19:27 +0900 Subject: [PATCH 083/132] =?UTF-8?q?:sparkles:=20ProjectResponseData=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/project/dto/res/ProjectResponseData.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectResponseData.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectResponseData.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectResponseData.kt new file mode 100644 index 00000000..dc41aa12 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectResponseData.kt @@ -0,0 +1,12 @@ +package team.msg.sms.domain.project.dto.res + +data class ProjectResponseData( + val id: Long, + val name: String, + val previewImages: List, + val description: String, + val links: List, + val projectTechStacks: List, + val myActivity: String?, + val inProgress: ProjectInProgressResponseData +) From 39b5a616b0b748c150a4270d4ec599a1291faf0d Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:19:46 +0900 Subject: [PATCH 084/132] =?UTF-8?q?:sparkles:=20ProjectRequestData=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/project/dto/req/ProjectRequestData.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/ProjectRequestData.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/ProjectRequestData.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/ProjectRequestData.kt new file mode 100644 index 00000000..016c4cb8 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/ProjectRequestData.kt @@ -0,0 +1,12 @@ +package team.msg.sms.domain.project.dto.req + +data class ProjectRequestData( + val name: String, + val icon: String, + val previewImages: List, + val description: String, + val links: List, + val techStacks: List, + val myActivity : String, + val inProgress: ProjectInProgressData +) \ No newline at end of file From 23d83d0b37de96bcbebfca9be17ea4bd35ae9ee9 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:19:56 +0900 Subject: [PATCH 085/132] =?UTF-8?q?:sparkles:=20ProjectInProgressResponseD?= =?UTF-8?q?ata=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/project/dto/res/ProjectInProgressResponseData.kt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectInProgressResponseData.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectInProgressResponseData.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectInProgressResponseData.kt new file mode 100644 index 00000000..0426edbe --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/res/ProjectInProgressResponseData.kt @@ -0,0 +1,6 @@ +package team.msg.sms.domain.project.dto.res + +data class ProjectInProgressResponseData( + val start: String, + val end: String? +) From b87a642661642f8ab289dac22124ef32648a8926 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:20:03 +0900 Subject: [PATCH 086/132] =?UTF-8?q?:sparkles:=20ProjectInProgressData=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/project/dto/req/ProjectInProgressData.kt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/ProjectInProgressData.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/ProjectInProgressData.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/ProjectInProgressData.kt new file mode 100644 index 00000000..09a5863d --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/ProjectInProgressData.kt @@ -0,0 +1,6 @@ +package team.msg.sms.domain.project.dto.req + +data class ProjectInProgressData( + val start: String, + val end: String? +) \ No newline at end of file From 0bc02f87040711a94bd36576810c721efbde9910 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:20:09 +0900 Subject: [PATCH 087/132] =?UTF-8?q?:sparkles:=20LinkRequestData=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/project/dto/req/LinkRequestData.kt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/LinkRequestData.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/LinkRequestData.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/LinkRequestData.kt new file mode 100644 index 00000000..7f493942 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/project/dto/req/LinkRequestData.kt @@ -0,0 +1,6 @@ +package team.msg.sms.domain.project.dto.req + +data class LinkRequestData( + val name: String, + val url: String +) \ No newline at end of file From 35c86be7a1aeffa9d10a95988a8d189141e1b708 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:21:01 +0900 Subject: [PATCH 088/132] =?UTF-8?q?:sparkles:=20GetRegionServiceImpl=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/{QueryRegionServiceImpl.kt => GetRegionServiceImpl.kt} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/{QueryRegionServiceImpl.kt => GetRegionServiceImpl.kt} (93%) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/QueryRegionServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/GetRegionServiceImpl.kt similarity index 93% rename from sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/QueryRegionServiceImpl.kt rename to sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/GetRegionServiceImpl.kt index 3f32f25c..7028f9de 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/QueryRegionServiceImpl.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/GetRegionServiceImpl.kt @@ -7,7 +7,7 @@ import team.msg.sms.domain.region.spi.RegionPort import java.util.* @Service -class QueryRegionServiceImpl( +class GetRegionServiceImpl( private val regionPort: RegionPort ) : GetRegionService { override fun getRegionByStudentUuid(uuid: UUID): List = From 8176ca06e32780fe9871da7b55b48f89d1578de4 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:21:30 +0900 Subject: [PATCH 089/132] =?UTF-8?q?:sparkles:=20LanguageCertificatePersist?= =?UTF-8?q?enceAdapter=20delete=20=ED=95=A8=EC=88=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LanguageCertificatePersistenceAdapter.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/languagecertificate/LanguageCertificatePersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/languagecertificate/LanguageCertificatePersistenceAdapter.kt index a6064947..9cdbd2e5 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/languagecertificate/LanguageCertificatePersistenceAdapter.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/languagecertificate/LanguageCertificatePersistenceAdapter.kt @@ -1,27 +1,34 @@ package team.msg.sms.persistence.languagecertificate +import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Component import team.msg.sms.domain.languagecertificate.model.LanguageCertificate import team.msg.sms.domain.languagecertificate.spi.LanguageCertificatePort +import team.msg.sms.domain.student.exception.StudentNotFoundException import team.msg.sms.domain.student.model.Student import team.msg.sms.domain.user.model.User import team.msg.sms.persistence.languagecertificate.mapper.toDomain import team.msg.sms.persistence.languagecertificate.mapper.toEntity import team.msg.sms.persistence.languagecertificate.repository.LanguageCertificateJpaRepository import team.msg.sms.persistence.student.mapper.toEntity +import team.msg.sms.persistence.student.repository.StudentJpaRepository import team.msg.sms.persistence.user.mapper.toEntity import java.util.* @Component class LanguageCertificatePersistenceAdapter( - private val languageCertificateJpaRepository: LanguageCertificateJpaRepository + private val languageCertificateJpaRepository: LanguageCertificateJpaRepository, + private val studentJpaRepository: StudentJpaRepository ) : LanguageCertificatePort { override fun saveAll(region: List, student: Student, user: User): List = languageCertificateJpaRepository.saveAll(region.map { it.toEntity(student.toEntity(user.toEntity())) }) .map { it.toDomain() } - override fun deleteAllByStudent(student: Student, user: User) = - languageCertificateJpaRepository.deleteAllByStudent(student.toEntity(user.toEntity())) + override fun deleteAllByStudent(student: Student) { + val student = studentJpaRepository.findByIdOrNull(student.id) + ?: throw StudentNotFoundException + languageCertificateJpaRepository.deleteAllByStudent(student) + } override fun queryByStudentUuid(uuid: UUID): List = languageCertificateJpaRepository.findByStudentId(uuid).map { it.toDomain() } From c5dfb8b184d4af0fe126bc52fd08d47f75555973 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:22:25 +0900 Subject: [PATCH 090/132] =?UTF-8?q?:sparkles:=20QueryCurrentUserProfileDet?= =?UTF-8?q?ailUseCase=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QueryCurrentUserProfileDetailUseCase.kt | 90 +++++++++++++++++-- 1 file changed, 84 insertions(+), 6 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/user/usecase/QueryCurrentUserProfileDetailUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/user/usecase/QueryCurrentUserProfileDetailUseCase.kt index d07709c7..b4e3d670 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/user/usecase/QueryCurrentUserProfileDetailUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/user/usecase/QueryCurrentUserProfileDetailUseCase.kt @@ -2,11 +2,26 @@ package team.msg.sms.domain.user.usecase import team.msg.sms.common.annotation.UseCase import team.msg.sms.domain.certificate.service.CertificateService +import team.msg.sms.domain.file.model.Image +import team.msg.sms.domain.file.service.ImageService import team.msg.sms.domain.languagecertificate.model.LanguageCertificate import team.msg.sms.domain.languagecertificate.service.LanguageCertificateService +import team.msg.sms.domain.project.dto.res.ProjectInProgressResponseData +import team.msg.sms.domain.project.dto.res.ProjectLinkResponseData +import team.msg.sms.domain.project.dto.res.ProjectResponseData +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectLink +import team.msg.sms.domain.project.model.ProjectTechStack +import team.msg.sms.domain.project.service.ProjectLinkService +import team.msg.sms.domain.project.service.ProjectService +import team.msg.sms.domain.project.service.ProjectTechStackService import team.msg.sms.domain.region.service.RegionService +import team.msg.sms.domain.student.exception.StudentNotFoundException import team.msg.sms.domain.student.model.Student +import team.msg.sms.domain.student.model.StudentTechStack import team.msg.sms.domain.student.service.StudentService +import team.msg.sms.domain.student.service.StudentTechStackService +import team.msg.sms.domain.techstack.model.TechStack import team.msg.sms.domain.techstack.service.TechStackService import team.msg.sms.domain.user.dto.res.UserProfileDetailResponseData @@ -16,24 +31,33 @@ class QueryCurrentUserProfileDetailUseCase( private val techStackService: TechStackService, private val certificateService: CertificateService, private val languageCertificateService: LanguageCertificateService, + private val projectService: ProjectService, + private val projectTechStackService: ProjectTechStackService, + private val projectLinkService: ProjectLinkService, + private val imageService: ImageService, + private val studentTechStackService: StudentTechStackService, private val regionService: RegionService ) { fun execute(): UserProfileDetailResponseData { val student = studentService.currentStudent() - val techStacks = techStackService.getTechStackByStudentUuid(student.id).map { it.stack } + val techStacks = techStackService.getAllTechStack() + val projects = projectService.getAllProjectByStudentId(studentId = student.id) val certificates = certificateService.getCertificateByUuid(student.id).map { it.certificateName } - val languageCertificates= languageCertificateService.getLanguageCertificateByStudentUuid(student.id) + val languageCertificates = languageCertificateService.getLanguageCertificateByStudentUuid(student.id) .map { it.toLanguageCertificateScore() } val region = regionService.getRegionByStudentUuid(student.id).map { it.region } - return toData(student, techStacks, region, languageCertificates, certificates) + val studentTechStacks = studentTechStackService.getStudentTechStackByStudentId(studentId = student.id) + return toData(student, techStacks, region, studentTechStacks, languageCertificates, certificates, projects) } private fun toData( student: Student.StudentWithUserInfo, - techStacks: List, + techStacks: List, regions: List, + studentTechStacks: List, languageCertificates: List, - certificates: List + certificates: List, + projects: List ): UserProfileDetailResponseData = UserProfileDetailResponseData( name = student.name, @@ -54,7 +78,21 @@ class QueryCurrentUserProfileDetailUseCase( salary = student.salary, languageCertificates = languageCertificates, certificates = certificates, - techStacks = techStacks + studentTechStacks = studentTechStacks.map { + toStudentTechStacks(techStacks, it)?.stack ?: "" + }, + projects = projects.map { + val image = imageService.getAllByProjectId(projectId = it.id) + val link = projectLinkService.getAllByProjectId(projectId = it.id) + val projectTechStack = projectTechStackService.getAllByProjectId(projectId = it.id) + toProjectResponseData( + project = it, + projectLink = link, + projectImage = image, + projectTechStack = projectTechStack, + techStack = techStacks + ) + } ) private fun LanguageCertificate.toLanguageCertificateScore( @@ -63,4 +101,44 @@ class QueryCurrentUserProfileDetailUseCase( languageCertificateName = this.languageCertificateName, score = this.score, ) + + private fun toStudentTechStacks(techStacks: List, studentTechStack: StudentTechStack): TechStack? = + techStacks.find { it.id == studentTechStack.techStackId } + + private fun toProjectTechStacks(techStacks: List, projectTechStack: ProjectTechStack): TechStack? = + techStacks.find { it.id == projectTechStack.techStackId } + + private fun toProjectResponseData( + project: Project, + projectLink: List, + projectImage: List, + projectTechStack: List, + techStack: List + ): ProjectResponseData = + ProjectResponseData( + id = project.id, + description = project.description, + inProgress = toInProgressResponseData(project.startDate, project.endDate), + links = projectLink.map { toLinkResponseData(it) }, + myActivity = project.myActivity, + previewImages = projectImage.map { it.imageUrl }, + projectTechStacks = projectTechStack.map { + toProjectTechStacks(techStack, it)?.stack ?: throw StudentNotFoundException + }, + name = project.title, + ) + + + private fun toLinkResponseData(projectLink: ProjectLink) = + ProjectLinkResponseData( + id = projectLink.projectId, + name = projectLink.name, + url = projectLink.url + ) + + private fun toInProgressResponseData(start: String, end: String?) = + ProjectInProgressResponseData( + start = start, + end = end + ) } \ No newline at end of file From 39c306a52cf077d0f218855c2cf7578b7828e9bb Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:23:07 +0900 Subject: [PATCH 091/132] =?UTF-8?q?:sparkles:=20CommandCertificatePort=20d?= =?UTF-8?q?elete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/certificate/spi/CommandCertificatePort.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/spi/CommandCertificatePort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/spi/CommandCertificatePort.kt index 9f6a481a..d2d5b736 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/spi/CommandCertificatePort.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/spi/CommandCertificatePort.kt @@ -6,5 +6,5 @@ import team.msg.sms.domain.user.model.User interface CommandCertificatePort { fun saveAll(certificate: List, student: Student, user: User): List - fun deleteAllByStudent(student: Student, user: User) + fun deleteAllByStudent(student: Student) } \ No newline at end of file From 062cb8eeeb27c80797cc049a4614f4f3ccd00b2f Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:23:18 +0900 Subject: [PATCH 092/132] =?UTF-8?q?:sparkles:=20CommandCertificateService?= =?UTF-8?q?=20delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/certificate/service/CommandCertificateService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/service/CommandCertificateService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/service/CommandCertificateService.kt index d18c29d6..87989568 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/service/CommandCertificateService.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/service/CommandCertificateService.kt @@ -6,5 +6,5 @@ import team.msg.sms.domain.user.model.User interface CommandCertificateService { fun saveAll(certificate: List, student: Student, user: User): List - fun deleteAllByStudent(student: Student, user: User) + fun deleteAllByStudent(student: Student) } \ No newline at end of file From 34cf9ac207a1ea4259ffe704401e90fca0caec8b Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:23:26 +0900 Subject: [PATCH 093/132] =?UTF-8?q?:sparkles:=20CommandCertificateServiceI?= =?UTF-8?q?mpl=20delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommandCertificateServiceImpl.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/service/impl/CommandCertificateServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/service/impl/CommandCertificateServiceImpl.kt index 0fd5a85f..c1d0359b 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/service/impl/CommandCertificateServiceImpl.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/certificate/service/impl/CommandCertificateServiceImpl.kt @@ -14,7 +14,6 @@ class CommandCertificateServiceImpl( override fun saveAll(certificate: List, student: Student, user: User): List = certificatePort.saveAll(certificate, student, user) - override fun deleteAllByStudent(student: Student, user: User) = - certificatePort.deleteAllByStudent(student, user) - + override fun deleteAllByStudent(student: Student) = + certificatePort.deleteAllByStudent(student) } \ No newline at end of file From ad7088a341ad79a34a8a9113764ec20fd6904960 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:23:40 +0900 Subject: [PATCH 094/132] =?UTF-8?q?:sparkles:=20CommandLanguageCertificate?= =?UTF-8?q?Port=20delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../languagecertificate/spi/CommandLanguageCertificatePort.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/spi/CommandLanguageCertificatePort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/spi/CommandLanguageCertificatePort.kt index 3d76adbe..969518f4 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/spi/CommandLanguageCertificatePort.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/spi/CommandLanguageCertificatePort.kt @@ -6,5 +6,5 @@ import team.msg.sms.domain.user.model.User interface CommandLanguageCertificatePort { fun saveAll(region: List, student: Student, user: User): List - fun deleteAllByStudent(student: Student, user: User) + fun deleteAllByStudent(student: Student) } \ No newline at end of file From 2d1681853a44cb28262a7aed15758e7981167cf2 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:23:47 +0900 Subject: [PATCH 095/132] =?UTF-8?q?:sparkles:=20CommandLanguageCertificate?= =?UTF-8?q?Service=20delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/CommandLanguageCertificateService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/service/CommandLanguageCertificateService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/service/CommandLanguageCertificateService.kt index 8811a9f7..f1ce039f 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/service/CommandLanguageCertificateService.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/service/CommandLanguageCertificateService.kt @@ -6,5 +6,5 @@ import team.msg.sms.domain.user.model.User interface CommandLanguageCertificateService { fun saveAll(languageCertificate: List, student: Student, user: User): List - fun deleteAllByStudent(student: Student, user: User) + fun deleteAllByStudent(student: Student) } \ No newline at end of file From 5c25c2d2081acca0eae502956e912216a0cd2f7d Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:24:02 +0900 Subject: [PATCH 096/132] =?UTF-8?q?:sparkles:=20CommandLanguageCertificate?= =?UTF-8?q?Service=20=EA=B5=AC=ED=98=84=EC=B2=B4=20delete=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommandLanguageCertificateServiceImpl.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/service/impl/CommandLanguageCertificateServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/service/impl/CommandLanguageCertificateServiceImpl.kt index 75c0bd50..56dc4cda 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/service/impl/CommandLanguageCertificateServiceImpl.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/languagecertificate/service/impl/CommandLanguageCertificateServiceImpl.kt @@ -18,7 +18,7 @@ class CommandLanguageCertificateServiceImpl( ): List = languageCertificatePort.saveAll(languageCertificate, student, user) - override fun deleteAllByStudent(student: Student, user: User) = - languageCertificatePort.deleteAllByStudent(student, user) + override fun deleteAllByStudent(student: Student) = + languageCertificatePort.deleteAllByStudent(student) } \ No newline at end of file From 18d00e09dfcda2222e129780c5910c5e039c092a Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:24:09 +0900 Subject: [PATCH 097/132] =?UTF-8?q?:sparkles:=20CommandRegionPort=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/team/msg/sms/domain/region/spi/CommandRegionPort.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/region/spi/CommandRegionPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/region/spi/CommandRegionPort.kt index f7326c35..e47f0a6e 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/region/spi/CommandRegionPort.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/region/spi/CommandRegionPort.kt @@ -6,5 +6,5 @@ import team.msg.sms.domain.user.model.User interface CommandRegionPort { fun saveAll(region: List, student: Student, user: User): List - fun deleteAllByStudent(student: Student, user: User) + fun deleteAllByStudent(student: Student) } \ No newline at end of file From 05b4e083eb7797f9a54af86c0239dee8a32219bf Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:24:11 +0900 Subject: [PATCH 098/132] =?UTF-8?q?:sparkles:=20CommandRegionPort=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/region/service/CommandRegionService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/CommandRegionService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/CommandRegionService.kt index 7f2c6899..0d00677c 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/CommandRegionService.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/CommandRegionService.kt @@ -6,5 +6,5 @@ import team.msg.sms.domain.user.model.User interface CommandRegionService { fun saveAll(region: List, student: Student, user: User): List - fun deleteAllByStudent(student: Student, user: User) + fun deleteAllByStudent(student: Student) } \ No newline at end of file From 45e95d9e98e5fe6f462b1d59bf1123ce8b1a528d Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:24:13 +0900 Subject: [PATCH 099/132] =?UTF-8?q?:sparkles:=20CommandRegionPort=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/region/service/impl/CommandRegionServiceImpl.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/CommandRegionServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/CommandRegionServiceImpl.kt index d089ce37..71d63f14 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/CommandRegionServiceImpl.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/region/service/impl/CommandRegionServiceImpl.kt @@ -14,6 +14,6 @@ class CommandRegionServiceImpl( override fun saveAll(region: List, student: Student, user: User): List = regionPort.saveAll(region, student, user) - override fun deleteAllByStudent(student: Student, user: User) = - regionPort.deleteAllByStudent(student, user) + override fun deleteAllByStudent(student: Student) = + regionPort.deleteAllByStudent(student) } \ No newline at end of file From 997600cf47d260d1fa6c9e4fd776f3377ffb1a24 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:24:28 +0900 Subject: [PATCH 100/132] =?UTF-8?q?:sparkles:=20CommandTechStackPort=20del?= =?UTF-8?q?ete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/techstack/spi/CommandTechStackPort.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/spi/CommandTechStackPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/spi/CommandTechStackPort.kt index bacb8afe..37942e98 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/spi/CommandTechStackPort.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/spi/CommandTechStackPort.kt @@ -1,10 +1,8 @@ package team.msg.sms.domain.techstack.spi -import team.msg.sms.domain.student.model.Student import team.msg.sms.domain.techstack.model.TechStack -import team.msg.sms.domain.user.model.User interface CommandTechStackPort { - fun saveAll(techStack: List, student: Student, user: User): List - fun deleteAllByStudent(student: Student, user: User) + fun save(techStack: TechStack): TechStack + fun saveAll(techStack: List): List } \ No newline at end of file From 783e14ccd9acf214883aca6c179f08a6d1672774 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:24:36 +0900 Subject: [PATCH 101/132] =?UTF-8?q?:sparkles:=20CommandTechStackService=20?= =?UTF-8?q?delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/techstack/service/CommandTechStackService.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/CommandTechStackService.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/CommandTechStackService.kt index 1d3359fc..70fa058f 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/CommandTechStackService.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/CommandTechStackService.kt @@ -1,10 +1,8 @@ package team.msg.sms.domain.techstack.service -import team.msg.sms.domain.student.model.Student import team.msg.sms.domain.techstack.model.TechStack -import team.msg.sms.domain.user.model.User interface CommandTechStackService { - fun saveAll(techStack: List, student: Student, user: User): List - fun deleteAllByStudent(student: Student, user: User) + fun save(techStack: TechStack): TechStack + fun saveAll(techStack: List): List } \ No newline at end of file From 1e5084b18209201dc333218e9d9d1468da8c86ab Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:24:40 +0900 Subject: [PATCH 102/132] =?UTF-8?q?:sparkles:=20CommandTechStackService=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommandTechStackServiceImpl.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/impl/CommandTechStackServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/impl/CommandTechStackServiceImpl.kt index eec1342f..aefafbc3 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/impl/CommandTechStackServiceImpl.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/service/impl/CommandTechStackServiceImpl.kt @@ -11,10 +11,9 @@ import team.msg.sms.domain.user.model.User class CommandTechStackServiceImpl( private val techStackPort: TechStackPort ) : CommandTechStackService { - override fun saveAll(techStack: List, student: Student, user: User): List = - techStackPort.saveAll(techStack, student, user) + override fun save(techStack: TechStack): TechStack = + techStackPort.save(techStack) - override fun deleteAllByStudent(student: Student, user: User) { - techStackPort.deleteAllByStudent(student, user) - } + override fun saveAll(techStack: List): List = + techStackPort.saveAll(techStack) } \ No newline at end of file From 483f969741d5fb2fdbfa603b8f12af39af56313d Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:25:14 +0900 Subject: [PATCH 103/132] =?UTF-8?q?:sparkles:=20CertificatePersistenceAdap?= =?UTF-8?q?ter=20delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../certificate/CertificatePersistenceAdapter.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/certificate/CertificatePersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/certificate/CertificatePersistenceAdapter.kt index 0a7fc9d6..4f964145 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/certificate/CertificatePersistenceAdapter.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/certificate/CertificatePersistenceAdapter.kt @@ -1,27 +1,34 @@ package team.msg.sms.persistence.certificate +import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Component import team.msg.sms.domain.certificate.model.Certificate import team.msg.sms.domain.certificate.spi.CertificatePort +import team.msg.sms.domain.student.exception.StudentNotFoundException import team.msg.sms.domain.student.model.Student import team.msg.sms.domain.user.model.User import team.msg.sms.persistence.certificate.mapper.toDomain import team.msg.sms.persistence.certificate.mapper.toEntity import team.msg.sms.persistence.certificate.repository.CertificateJpaRepository import team.msg.sms.persistence.student.mapper.toEntity +import team.msg.sms.persistence.student.repository.StudentJpaRepository import team.msg.sms.persistence.user.mapper.toEntity import java.util.* @Component class CertificatePersistenceAdapter( - private val certificateJpaRepository: CertificateJpaRepository + private val certificateJpaRepository: CertificateJpaRepository, + private val studentJpaRepository: StudentJpaRepository ) : CertificatePort { override fun saveAll(certificate: List, student: Student, user: User): List = certificateJpaRepository.saveAll(certificate.map { it.toEntity(student.toEntity(user.toEntity())) }) .map { it.toDomain() } - override fun deleteAllByStudent(student: Student, user: User) = - certificateJpaRepository.deleteAllByStudent(student.toEntity(user.toEntity())) + override fun deleteAllByStudent(student: Student) { + val student = studentJpaRepository.findByIdOrNull(student.id) + ?: throw StudentNotFoundException + certificateJpaRepository.deleteAllByStudent(student) + } override fun queryByStudentUuid(uuid: UUID): List = certificateJpaRepository.findByStudentId(uuid) From 1a3ac684d03c20f8f50669caaa449a2bdd97dbb3 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:25:42 +0900 Subject: [PATCH 104/132] =?UTF-8?q?:sparkles:=20QueryStudentPort=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/student/spi/QueryStudentPort.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/QueryStudentPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/QueryStudentPort.kt index c862011b..8ee1cdaa 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/QueryStudentPort.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/spi/QueryStudentPort.kt @@ -6,9 +6,12 @@ import java.util.UUID interface QueryStudentPort { fun queryStudentById(uuid: UUID): Student.StudentWithUserInfo? + fun queryStudentsWithPage(page: Int, size: Int): Student.StudentWithPageInfo - fun queryStudentByUserId(userId: UUID): Student.StudentWithUserInfo? + fun queryStudentByUserId(userId: UUID): Student + + fun queryStudentUserInfoByUserId(userId: UUID): Student.StudentWithUserInfo? fun queryStudentByUser(user: User): Student From 64351e751b3fd162410e8a8db705725675568452 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:26:10 +0900 Subject: [PATCH 105/132] =?UTF-8?q?:sparkles:=20Count=20=EB=A1=9C=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/techstack/spi/QueryTechStackPort.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/spi/QueryTechStackPort.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/spi/QueryTechStackPort.kt index 3e94a91a..6cdfbc08 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/spi/QueryTechStackPort.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/spi/QueryTechStackPort.kt @@ -1,10 +1,9 @@ package team.msg.sms.domain.techstack.spi import team.msg.sms.domain.techstack.model.TechStack -import java.util.UUID interface QueryTechStackPort { - fun queryByStudentUuid(uuid: UUID): List fun queryAll(): List + fun queryAllByCount(): List fun queryAllByStack(stack: String): List } \ No newline at end of file From 49eccc58835c8bb026a45cecc871cdbc36a48446 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:26:25 +0900 Subject: [PATCH 106/132] =?UTF-8?q?:sparkles:=20RegionPersistenceAdapter?= =?UTF-8?q?=20delete=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/region/RegionPersistenceAdapter.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/region/RegionPersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/region/RegionPersistenceAdapter.kt index 41a13d44..fbd3d826 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/region/RegionPersistenceAdapter.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/region/RegionPersistenceAdapter.kt @@ -1,26 +1,33 @@ package team.msg.sms.persistence.region +import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Component import team.msg.sms.domain.region.model.Region import team.msg.sms.domain.region.spi.RegionPort +import team.msg.sms.domain.student.exception.StudentNotFoundException import team.msg.sms.domain.student.model.Student import team.msg.sms.domain.user.model.User import team.msg.sms.persistence.region.mapper.toDomain import team.msg.sms.persistence.region.mapper.toEntity import team.msg.sms.persistence.region.repository.RegionJpaRepository import team.msg.sms.persistence.student.mapper.toEntity +import team.msg.sms.persistence.student.repository.StudentJpaRepository import team.msg.sms.persistence.user.mapper.toEntity import java.util.* @Component class RegionPersistenceAdapter( - private val regionJpaRepository: RegionJpaRepository + private val regionJpaRepository: RegionJpaRepository, + private val studentJpaRepository: StudentJpaRepository ) : RegionPort { override fun saveAll(region: List, student: Student, user: User): List = regionJpaRepository.saveAll(region.map { it.toEntity(student.toEntity(user.toEntity())) }).map { it.toDomain() } - override fun deleteAllByStudent(student: Student, user: User) = - regionJpaRepository.deleteAllByStudent(student.toEntity(user.toEntity())) + override fun deleteAllByStudent(student: Student) { + val student = studentJpaRepository.findByIdOrNull(student.id) + ?: throw StudentNotFoundException + regionJpaRepository.deleteAllByStudent(student) + } override fun queryByStudentUuid(uuid: UUID): List = regionJpaRepository.findByStudentId(uuid).map { it.toDomain() } From 7225c7510102e486e7540b0889242ef18db82425 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:27:44 +0900 Subject: [PATCH 107/132] =?UTF-8?q?:sparkles:=20=ED=9A=8C=EC=9B=90?= =?UTF-8?q?=EA=B0=80=EC=9E=85=20ROLE=5FSTUDENT=EB=A7=8C=20=EA=B2=80?= =?UTF-8?q?=EC=82=AC=ED=95=98=EB=8A=94=EA=B1=B0=EC=97=90=EC=84=9C=20ROLE?= =?UTF-8?q?=5FTEACHER=EA=B0=80=20=EC=95=84=EB=8B=90=EB=95=8C=EB=A7=8C=20?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt index 374ab402..b02e3b27 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt @@ -37,7 +37,7 @@ class SignInUseCase( User( name = gAuthUserInfo.name, email = gAuthUserInfo.email, - stuNum = if (role.name == "ROLE_STUDENT") "${gAuthUserInfo.grade}${gAuthUserInfo.classNum}" + if (gAuthUserInfo.num < 10) { + stuNum = if (role.name != "ROLE_TEACHER") "${gAuthUserInfo.grade}${gAuthUserInfo.classNum}" + if (gAuthUserInfo.num < 10) { "0${gAuthUserInfo.num}" } else gAuthUserInfo.num else "", roles = mutableListOf(role) From 22dcc8396e7ca24b69e17552414ff4dc44845c8f Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:28:03 +0900 Subject: [PATCH 108/132] =?UTF-8?q?:sparkles:=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=EC=9E=85=20=EB=B6=80=EB=B6=84=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=A0=9D=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/student/usecase/SignUpUseCase.kt | 135 +++++++++++++++--- 1 file changed, 118 insertions(+), 17 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/SignUpUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/SignUpUseCase.kt index 2974d0ce..7f058ea7 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/SignUpUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/SignUpUseCase.kt @@ -4,9 +4,19 @@ import org.springframework.transaction.annotation.Transactional import team.msg.sms.common.annotation.UseCase import team.msg.sms.domain.certificate.model.Certificate import team.msg.sms.domain.certificate.service.CertificateService +import team.msg.sms.domain.file.model.Image +import team.msg.sms.domain.file.service.ImageService import team.msg.sms.domain.languagecertificate.dto.req.LanguageCertificateRequestData import team.msg.sms.domain.languagecertificate.model.LanguageCertificate import team.msg.sms.domain.languagecertificate.service.LanguageCertificateService +import team.msg.sms.domain.project.dto.req.LinkRequestData +import team.msg.sms.domain.project.dto.req.ProjectRequestData +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectLink +import team.msg.sms.domain.project.model.ProjectTechStack +import team.msg.sms.domain.project.service.ProjectLinkService +import team.msg.sms.domain.project.service.ProjectService +import team.msg.sms.domain.project.service.ProjectTechStackService import team.msg.sms.domain.region.model.Region import team.msg.sms.domain.region.service.RegionService import team.msg.sms.domain.student.dto.req.SignUpRequestData @@ -14,22 +24,28 @@ import team.msg.sms.domain.student.exception.StuNumNotRightException import team.msg.sms.domain.student.exception.StudentNotFoundException import team.msg.sms.domain.student.model.Department import team.msg.sms.domain.student.model.Student +import team.msg.sms.domain.student.model.StudentTechStack import team.msg.sms.domain.student.service.StudentService +import team.msg.sms.domain.student.service.StudentTechStackService import team.msg.sms.domain.techstack.model.TechStack import team.msg.sms.domain.techstack.service.TechStackService import team.msg.sms.domain.user.model.User import team.msg.sms.domain.user.service.UserService -import java.lang.Exception -import java.util.UUID +import java.util.* @UseCase class SignUpUseCase( private val studentService: StudentService, + private val studentTechStackService: StudentTechStackService, private val userService: UserService, private val techStackService: TechStackService, private val regionService: RegionService, private val languageCertificateService: LanguageCertificateService, - private val certificateService: CertificateService + private val certificateService: CertificateService, + private val projectService: ProjectService, + private val projectTechStackService: ProjectTechStackService, + private val projectLinkService: ProjectLinkService, + private val imageService: ImageService ) { @Transactional(rollbackFor = [Exception::class]) fun execute(signUpData: SignUpRequestData) { @@ -41,12 +57,25 @@ class SignUpUseCase( val student = studentService.saveStudent(signUpStudent, user) - techStackService.saveAll( - signUpData.techStack.map { toTechStackModel(techStack = it, studentId = student.id) }, - student, - user + val techStacks = techStackService.getAllTechStack().toMutableList() + + studentTechStackValid( + studentId = student.id, + stack = techStacks, + studentTechStacks = signUpData.studentTechStacks ) + signUpData.projects.forEach { + val project = projectService.save(project = toProjectModel(it, studentId = student.id)) + projectTechStackValid(techStacks, it.techStacks, project.id) + projectLinkService.saveAll(it.links.map { linkRequestData -> + toProjectLinkModel(projectLink = linkRequestData, projectId = project.id) + }) + imageService.saveAll(it.previewImages.map { url -> + toImageModel(url = url, projectId = project.id) + }) + } + regionService.saveAll(signUpData.region.map { toRegionModel(it, studentId = student.id) }, student, user) languageCertificateService.saveAll(signUpData.languageCertificate.map { @@ -63,6 +92,13 @@ class SignUpUseCase( ) } + private fun toImageModel(url: String, projectId: Long): Image = + Image( + id = 0, + imageUrl = url, + projectId = projectId + ) + private fun toRegionModel(region: String, studentId: UUID): Region = Region( id = 0, @@ -70,14 +106,6 @@ class SignUpUseCase( studentId = studentId ) - private fun toTechStackModel(techStack: String, studentId: UUID): TechStack = - TechStack( - id = 0, - stack = techStack, - studentId = studentId, - ) - - private fun toCertificate(certificate: String, studentId: UUID): Certificate = Certificate( id = 0, @@ -96,6 +124,13 @@ class SignUpUseCase( studentId = studentId ) + private fun toStackModel(stack: String): TechStack = + TechStack( + id = 0, + stack = stack, + count = 0 + ) + private fun toStudentModel(signUpData: SignUpRequestData, user: User): Student = Student( id = UUID.randomUUID(), @@ -113,8 +148,74 @@ class SignUpUseCase( userId = user.id ) + private fun toProjectModel(projectRequestData: ProjectRequestData, studentId: UUID): Project { + return Project( + id = 0, + description = projectRequestData.description, + projectIconUrl = projectRequestData.icon, + title = projectRequestData.name, + myActivity = projectRequestData.myActivity, + startDate = projectRequestData.inProgress.start, + endDate = projectRequestData.inProgress.end, + studentId = studentId + ) + } + + private fun toProjectTechStackModel(projectId: Long, techStackId: Long): ProjectTechStack = + ProjectTechStack( + id = 0, + projectId = projectId, + techStackId = techStackId + ) + + private fun toProjectLinkModel(projectLink: LinkRequestData, projectId: Long): ProjectLink = + ProjectLink( + id = 0, + name = projectLink.name, + url = projectLink.url, + projectId = projectId + ) + + private fun toStudentTechStackModel(studentId: UUID, techStackId: Long): StudentTechStack = + StudentTechStack( + id = 0, + studentId = studentId, + techStackId = techStackId + ) + + private fun projectTechStackValid(stack: MutableList, projectTechStacks: List, projectId: Long) { + for (stackItem in projectTechStacks) { + val techStackData = stack.find { it.stack == stackItem } + if (techStackData == null) { + val techStack = techStackService.save(toStackModel(stackItem)) + stack.add(0, techStack) + projectTechStackService.save(toProjectTechStackModel(projectId, techStack.id)) + + } else { + val techStack = techStackService.save(techStackData.copy(count = techStackData.count + 1)) + stack.add(0, techStack) + projectTechStackService.save(toProjectTechStackModel(projectId, techStack.id)) + } + } + } + + private fun studentTechStackValid(stack: MutableList, studentTechStacks: List, studentId: UUID) { + for (stackItem in studentTechStacks) { + val techStackData = stack.find { it.stack == stackItem } + if (techStackData == null) { + val techStack = techStackService.save(toStackModel(stackItem)) + stack.add(0, techStack) + studentTechStackService.save(toStudentTechStackModel(studentId, techStack.id)) + } else { + val techStack = techStackService.save(techStack = techStackData.copy(count = techStackData.count + 1)) + stack.add(0, techStack) + studentTechStackService.save(toStudentTechStackModel(studentId, techStack.id)) + } + } + } + private fun findDepartment(stuNum: String): Department { - if(stuNum.isEmpty()) + if (stuNum.isEmpty()) throw StudentNotFoundException val departmentCode = stuNum.slice(IntRange(1, 1)) return when { @@ -132,4 +233,4 @@ class SignUpUseCase( } } } -} \ No newline at end of file +} From 9ef48b9b2377029b2ff2257448a2140999c3edb1 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:28:44 +0900 Subject: [PATCH 109/132] =?UTF-8?q?:sparkles:=20Dto=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=EB=90=9C=EA=B2=83=20Adapter=20=EC=97=90=EC=84=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/kotlin/team/msg/sms/domain/user/UserWebAdapter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sms-presentation/src/main/kotlin/team/msg/sms/domain/user/UserWebAdapter.kt b/sms-presentation/src/main/kotlin/team/msg/sms/domain/user/UserWebAdapter.kt index a3c689e9..ed5da59c 100644 --- a/sms-presentation/src/main/kotlin/team/msg/sms/domain/user/UserWebAdapter.kt +++ b/sms-presentation/src/main/kotlin/team/msg/sms/domain/user/UserWebAdapter.kt @@ -48,7 +48,8 @@ class UserWebAdapter( salary = this.salary, languageCertificates = this.languageCertificates, certificates = this.certificates, - techStacks = this.techStacks + studentTechStacks = this.studentTechStacks, + projects = this.projects ) private fun UserProfileImgResponseData.toResponse(): UserProfileWebResponse = From 2131cba206c674545d67bfabfbeb03fa57ececc8 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:28:58 +0900 Subject: [PATCH 110/132] =?UTF-8?q?:sparkles:=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=ED=83=88=ED=87=B4=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8?= =?UTF-8?q?=EB=8F=84=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/usecase/WithdrawalUseCase.kt | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt index 65559b38..8a3e34bb 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt @@ -1,35 +1,52 @@ package team.msg.sms.domain.auth.usecase -import org.springframework.transaction.annotation.Transactional import team.msg.sms.common.annotation.UseCase import team.msg.sms.domain.certificate.service.CertificateService +import team.msg.sms.domain.file.service.ImageService import team.msg.sms.domain.languagecertificate.service.LanguageCertificateService +import team.msg.sms.domain.project.service.ProjectLinkService +import team.msg.sms.domain.project.service.ProjectService +import team.msg.sms.domain.project.service.ProjectTechStackService import team.msg.sms.domain.region.service.RegionService import team.msg.sms.domain.student.service.StudentService -import team.msg.sms.domain.techstack.service.TechStackService +import team.msg.sms.domain.student.service.StudentTechStackService import team.msg.sms.domain.user.service.UserService @UseCase class WithdrawalUseCase( private val userService: UserService, private val studentService: StudentService, - private val techStackService: TechStackService, + private val projectService: ProjectService, + private val projectTechStackService: ProjectTechStackService, private val regionService: RegionService, + private val studentTechStackService: StudentTechStackService, private val languageCertificateService: LanguageCertificateService, - private val certificateService: CertificateService + private val imageService: ImageService, + private val certificateService: CertificateService, + private val projectLinkService: ProjectLinkService ) { fun execute() { val user = userService.getCurrentUser() if (user.roles[0].name == "ROLE_STUDENT") { val student = studentService.getStudentByUser(user) + val project = projectService.getAllProjectByStudentId(student.id) listOf( - techStackService::deleteAllByStudent, + projectLinkService::deleteAllByProjects, + projectTechStackService::deleteAllByProjects, + imageService::deleteAllByProjects + ).forEach { service -> + service(project) + } + + listOf( + projectService::deleteAllByStudent, regionService::deleteAllByStudent, languageCertificateService::deleteAllByStudent, - certificateService::deleteAllByStudent + certificateService::deleteAllByStudent, + studentTechStackService::deleteAllByStudent ).forEach { service -> - service(student, user) + service(student) } studentService.deleteByUuid(studentId = student.id) From d83d7f599b4dd4efae8ae8d6d599d79395bb0e20 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:29:26 +0900 Subject: [PATCH 111/132] =?UTF-8?q?:sparkles:=20=EB=AA=A8=EB=93=A0=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=20=EB=B3=80=EA=B2=BD=EB=90=9C=EB=8C=80?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/student/usecase/FindAllUseCase.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/FindAllUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/FindAllUseCase.kt index beb77142..1f2bb57e 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/FindAllUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/FindAllUseCase.kt @@ -6,20 +6,28 @@ import team.msg.sms.domain.student.dto.req.FiltersRequestData import team.msg.sms.domain.student.dto.res.MainStudentsResponseData import team.msg.sms.domain.student.dto.res.StudentInfoListResponseData import team.msg.sms.domain.student.service.StudentService +import team.msg.sms.domain.student.service.StudentTechStackService import team.msg.sms.domain.techstack.service.TechStackService @UseCase class FindAllUseCase( private val studentService: StudentService, private val techStackService: TechStackService, - private val securityService: SecurityService + private val securityService: SecurityService, + private val studentTechStackService: StudentTechStackService ) { fun execute(page: Int, size: Int, filtersData: FiltersRequestData): StudentInfoListResponseData { val studentsWithPageInfo = studentService.getStudentsWithPage(page, size) val techStacks = techStackService.getAllTechStack() val currentRole = securityService.getCurrentUserRole() + val studentTechStacks = studentTechStackService.getStudentTechStack() - val students = studentService.matchStudentWithTechStacks(studentsWithPageInfo.students, techStacks, currentRole) + val students = studentService.matchStudentWithTechStacks( + studentsWithPageInfo.students, + techStacks, + studentTechStacks, + currentRole + ) val filterStudents = studentService.filterStudents(students, filtersData, currentRole) From 2a93c4b4ca38ff2966ef94777df6fa53c5c4758f Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:30:03 +0900 Subject: [PATCH 112/132] =?UTF-8?q?:sparkles:=20DetailStudentInfoTeacherRe?= =?UTF-8?q?sponseData=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student/dto/res/DetailStudentInfoTeacherResponseData.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTeacherResponseData.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTeacherResponseData.kt index 03de6d35..a467a882 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTeacherResponseData.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTeacherResponseData.kt @@ -1,6 +1,7 @@ package team.msg.sms.domain.student.dto.res import team.msg.sms.domain.languagecertificate.model.LanguageCertificate +import team.msg.sms.domain.project.dto.res.ProjectResponseData import team.msg.sms.domain.student.model.Department import team.msg.sms.domain.student.model.FormOfEmployment import team.msg.sms.domain.student.model.MilitaryService @@ -24,6 +25,7 @@ class DetailStudentInfoTeacherResponseData( val salary: Int, val languageCertificates: List, val certificates: List, - val techStacks: List + val studentTechStacks: List, + val projects: List ) { } \ No newline at end of file From 8014f9f904f4949570ce8b370027747282c39aed Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:30:14 +0900 Subject: [PATCH 113/132] =?UTF-8?q?:sparkles:=20DetailStudentInfoTeacherWe?= =?UTF-8?q?bResponse=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student/dto/res/DetailStudentInfoTeacherWebResponse.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTeacherWebResponse.kt b/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTeacherWebResponse.kt index ad01d69b..5b1684a3 100644 --- a/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTeacherWebResponse.kt +++ b/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/dto/res/DetailStudentInfoTeacherWebResponse.kt @@ -1,6 +1,7 @@ package team.msg.sms.domain.student.dto.res import team.msg.sms.domain.languagecertificate.model.LanguageCertificate +import team.msg.sms.domain.project.dto.res.ProjectResponseData import team.msg.sms.domain.student.model.Department import team.msg.sms.domain.student.model.FormOfEmployment import team.msg.sms.domain.student.model.MilitaryService @@ -24,5 +25,6 @@ class DetailStudentInfoTeacherWebResponse( val salary: Int, val languageCertificates: List, val certificates: List, - val techStacks: List + val studentTechStacks: List, + val projects: List ) \ No newline at end of file From 3c44edcd12797ef1cb1c8ee5670f65b25afe993e Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:30:26 +0900 Subject: [PATCH 114/132] =?UTF-8?q?:sparkles:=20SignUpRequestData=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/student/dto/req/SignUpRequestData.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/dto/req/SignUpRequestData.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/dto/req/SignUpRequestData.kt index 06b677bf..61d41751 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/dto/req/SignUpRequestData.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/dto/req/SignUpRequestData.kt @@ -1,12 +1,13 @@ package team.msg.sms.domain.student.dto.req import team.msg.sms.domain.languagecertificate.dto.req.LanguageCertificateRequestData +import team.msg.sms.domain.project.dto.req.ProjectRequestData import team.msg.sms.domain.student.model.FormOfEmployment import team.msg.sms.domain.student.model.MilitaryService data class SignUpRequestData( val major: String, - val techStack: List, + val studentTechStacks: List, val profileImgUrl: String, val introduce: String, val portfolioUrl: String, @@ -18,5 +19,6 @@ data class SignUpRequestData( val languageCertificate: List, val dreamBookFileUrl: String, val militaryService: MilitaryService, - val certificate: List + val certificate: List, + val projects: List ) \ No newline at end of file From bfe7979e646c0b4a59bbabda125e8d232118c9b9 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:30:41 +0900 Subject: [PATCH 115/132] =?UTF-8?q?:sparkles:=20SignUpWebRequest=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/student/dto/req/SignUpWebRequest.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/dto/req/SignUpWebRequest.kt b/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/dto/req/SignUpWebRequest.kt index 53a769bb..0b5a5f4f 100644 --- a/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/dto/req/SignUpWebRequest.kt +++ b/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/dto/req/SignUpWebRequest.kt @@ -1,6 +1,7 @@ package team.msg.sms.domain.student.dto.req import team.msg.sms.domain.languagecertificate.dto.req.LanguageCertificateWebRequest +import team.msg.sms.domain.project.dto.req.ProjectRequestData import team.msg.sms.domain.student.model.FormOfEmployment import team.msg.sms.domain.student.model.MilitaryService import javax.validation.constraints.* @@ -8,7 +9,7 @@ import javax.validation.constraints.* data class SignUpWebRequest( val major: String, - val techStack: List, + val studentTechStacks: List, @field:NotBlank @field:Pattern(regexp = "^https://.*") @@ -43,12 +44,14 @@ data class SignUpWebRequest( val militaryService: MilitaryService, - val certificate: List + val certificate: List, + + val projects: List ) { fun toData(): SignUpRequestData = SignUpRequestData( major = major, - techStack = techStack, + studentTechStacks = studentTechStacks, profileImgUrl = profileImgUrl, introduce = introduce, portfolioUrl = portfolioUrl, @@ -60,6 +63,7 @@ data class SignUpWebRequest( languageCertificate = languageCertificate.map { it.toData() }, dreamBookFileUrl = dreamBookFileUrl, militaryService = militaryService, - certificate = certificate + certificate = certificate, + projects = projects ) } From 67abce3e30630128b94f8f18e59452f0a6e59f44 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:31:21 +0900 Subject: [PATCH 116/132] =?UTF-8?q?:sparkles:=20StudentInfoAnonymousUseCas?= =?UTF-8?q?e=20=ED=85=8C=ED=81=AC=20=EC=8A=A4=ED=83=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EB=90=9C=EB=8C=80=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student/usecase/StudentInfoAnonymousUseCase.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoAnonymousUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoAnonymousUseCase.kt index fc58e30b..9e44de47 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoAnonymousUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoAnonymousUseCase.kt @@ -3,24 +3,28 @@ package team.msg.sms.domain.student.usecase import team.msg.sms.common.annotation.UseCase import team.msg.sms.domain.student.dto.res.DetailStudentInfoAnonymousResponseData import team.msg.sms.domain.student.service.StudentService +import team.msg.sms.domain.student.service.StudentTechStackService import team.msg.sms.domain.techstack.service.TechStackService @UseCase class StudentInfoAnonymousUseCase( private val studentService: StudentService, - private val techStackService: TechStackService + private val techStackService: TechStackService, + private val studentTechStackService: StudentTechStackService ) { fun execute(uuid: String): DetailStudentInfoAnonymousResponseData { - val student = studentService.getStudentByUuid(uuid) - val techStackByStudentUuid = techStackService.getTechStackByStudentUuid(student.id) - val techStacks: List = techStackByStudentUuid.map { it.stack } + val student = studentService.getStudentUserInfoByUuid(uuid) + val techStack = techStackService.getAllTechStack() + val studentTechStack = studentTechStackService.getStudentTechStackByStudentId(studentId = student.id) return DetailStudentInfoAnonymousResponseData( name = student.name.replaceRange(1 until student.name.length, "*".repeat(2)), introduce = student.introduce, major = student.major, profileImg = "", - techStack = techStacks + techStack = studentTechStack.map { studentTechStack -> + techStack.find { it.id == studentTechStack.techStackId }?.stack ?: "" + } ) } } \ No newline at end of file From 090af3eb6e06a4ed5aac7496b32b676e12d68e38 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:31:46 +0900 Subject: [PATCH 117/132] =?UTF-8?q?:sparkles:=20StudentInfoDetailUseCase?= =?UTF-8?q?=20=ED=85=8C=ED=81=AC=20=EC=8A=A4=ED=83=9D=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EB=90=9C=EB=8C=80=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student/usecase/StudentInfoDetailUseCase.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoDetailUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoDetailUseCase.kt index f09fb98a..fa1d5e0e 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoDetailUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoDetailUseCase.kt @@ -3,18 +3,20 @@ package team.msg.sms.domain.student.usecase import team.msg.sms.common.annotation.UseCase import team.msg.sms.domain.student.dto.res.DetailStudentInfoResponseData import team.msg.sms.domain.student.service.StudentService +import team.msg.sms.domain.student.service.StudentTechStackService import team.msg.sms.domain.techstack.service.TechStackService @UseCase class StudentInfoDetailUseCase( private val studentService: StudentService, - private val techStackService: TechStackService + private val techStackService: TechStackService, + private val studentTechStackService: StudentTechStackService ) { fun execute(uuid: String): DetailStudentInfoResponseData { - val student = studentService.getStudentByUuid(uuid) - val techStackByStudentUuid = techStackService.getTechStackByStudentUuid(student.id) - val techStacks: List = techStackByStudentUuid.map { it.stack } + val student = studentService.getStudentUserInfoByUuid(uuid) + val techStack = techStackService.getAllTechStack() + val studentTechStack = studentTechStackService.getStudentTechStackByStudentId(studentId = student.id) return DetailStudentInfoResponseData( name = student.name, @@ -25,7 +27,9 @@ class StudentInfoDetailUseCase( department = student.department, major = student.major, profileImg = student.profileImgUrl, - techStack = techStacks, + techStack = studentTechStack.map { studentTechStack -> + techStack.find { it.id == studentTechStack.techStackId }?.stack ?: "" + } ) } } \ No newline at end of file From cb1edfe304954363c944d3bd3d8edd6939e14c1f Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:32:18 +0900 Subject: [PATCH 118/132] =?UTF-8?q?:sparkles:=20StudentInfoTeacherUseCase?= =?UTF-8?q?=20=ED=85=8C=ED=81=AC=20=EC=8A=A4=ED=83=9D=20+=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EB=B3=80=EA=B2=BD=20=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usecase/StudentInfoTeacherUseCase.kt | 88 +++++++++++++++++-- 1 file changed, 81 insertions(+), 7 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoTeacherUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoTeacherUseCase.kt index 675edbf0..c0f5776e 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoTeacherUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoTeacherUseCase.kt @@ -2,29 +2,51 @@ package team.msg.sms.domain.student.usecase import team.msg.sms.common.annotation.UseCase import team.msg.sms.domain.certificate.service.CertificateService +import team.msg.sms.domain.file.model.Image +import team.msg.sms.domain.file.service.ImageService import team.msg.sms.domain.languagecertificate.model.LanguageCertificate import team.msg.sms.domain.languagecertificate.service.LanguageCertificateService +import team.msg.sms.domain.project.dto.res.ProjectInProgressResponseData +import team.msg.sms.domain.project.dto.res.ProjectLinkResponseData +import team.msg.sms.domain.project.dto.res.ProjectResponseData +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectLink +import team.msg.sms.domain.project.model.ProjectTechStack +import team.msg.sms.domain.project.service.ProjectLinkService +import team.msg.sms.domain.project.service.ProjectService +import team.msg.sms.domain.project.service.ProjectTechStackService import team.msg.sms.domain.region.service.RegionService import team.msg.sms.domain.student.dto.res.DetailStudentInfoTeacherResponseData +import team.msg.sms.domain.student.exception.StudentNotFoundException +import team.msg.sms.domain.student.model.StudentTechStack import team.msg.sms.domain.student.service.StudentService +import team.msg.sms.domain.student.service.StudentTechStackService +import team.msg.sms.domain.techstack.model.TechStack import team.msg.sms.domain.techstack.service.TechStackService @UseCase class StudentInfoTeacherUseCase( private val studentService: StudentService, - private val techStackService: TechStackService, private val certificateService: CertificateService, + private val studentTechStackService: StudentTechStackService, + private val projectService: ProjectService, + private val techStackService: TechStackService, + private val projectTechStackService: ProjectTechStackService, + private val projectLinkService: ProjectLinkService, + private val imageService: ImageService, private val languageCertificateService: LanguageCertificateService, private val regionService: RegionService ) { fun execute(uuid: String): DetailStudentInfoTeacherResponseData { - val student = studentService.getStudentByUuid(uuid) - val techStacks: List = techStackService.getTechStackByStudentUuid(student.id).map { it.stack } + val student = studentService.getStudentUserInfoByUuid(uuid) + val projects = projectService.getAllProjectByStudentId(studentId = student.id) val certificates = certificateService.getCertificateByUuid(student.id).map { it.certificateName } val languageCertificates = - languageCertificateService.getLanguageCertificateByStudentUuid(student.id).map { toLanguageCertificateScore(languageCertificate = it) } + languageCertificateService.getLanguageCertificateByStudentUuid(student.id) + .map { toLanguageCertificateScore(languageCertificate = it) } val regions = regionService.getRegionByStudentUuid(student.id).map { it.region } - + val techStacks = techStackService.getAllTechStack() + val studentTechStacks = studentTechStackService.getStudentTechStackByStudentId(student.id) return DetailStudentInfoTeacherResponseData( name = student.name, @@ -45,11 +67,24 @@ class StudentInfoTeacherUseCase( salary = student.salary, languageCertificates = languageCertificates, certificates = certificates, - techStacks = techStacks + studentTechStacks = studentTechStacks.map { + toStudentTechStacks(techStacks, it)?.stack ?: "" + }, + projects = projects.map { + val image = imageService.getAllByProjectId(projectId = it.id) + val link = projectLinkService.getAllByProjectId(projectId = it.id) + val projectTechStack = projectTechStackService.getAllByProjectId(projectId = it.id) + toProjectResponseData( + project = it, + projectLink = link, + projectImage = image, + projectTechStack = projectTechStack, + techStack = techStacks + ) + } ) } - private fun toLanguageCertificateScore( languageCertificate: LanguageCertificate, ): LanguageCertificate.LanguageCertificateScore = @@ -58,5 +93,44 @@ class StudentInfoTeacherUseCase( score = languageCertificate.score, ) + private fun toStudentTechStacks(techStacks: List, studentTechStack: StudentTechStack): TechStack? = + techStacks.find { it.id == studentTechStack.techStackId } + + private fun toProjectTechStacks(techStacks: List, projectTechStack: ProjectTechStack): TechStack? = + techStacks.find { it.id == projectTechStack.techStackId } + + private fun toProjectResponseData( + project: Project, + projectLink: List, + projectImage: List, + projectTechStack: List, + techStack: List + ): ProjectResponseData = + ProjectResponseData( + id = project.id, + description = project.description, + inProgress = toInProgressResponseData(project.startDate, project.endDate), + links = projectLink.map { toLinkResponseData(it) }, + myActivity = project.myActivity, + previewImages = projectImage.map { it.imageUrl }, + projectTechStacks = projectTechStack.map { + toProjectTechStacks(techStack, it)?.stack ?: throw StudentNotFoundException + }, + name = project.title, + ) + + + private fun toLinkResponseData(projectLink: ProjectLink) = + ProjectLinkResponseData( + id = projectLink.projectId, + name = projectLink.name, + url = projectLink.url + ) + + private fun toInProgressResponseData(start: String, end: String?) = + ProjectInProgressResponseData( + start = start, + end = end + ) } From 9f82ff9c770f463286ac06ff2ccd180054c3102e Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:32:58 +0900 Subject: [PATCH 119/132] =?UTF-8?q?:sparkles:=20StudentTechStackPersistenc?= =?UTF-8?q?eAdapter=20=EB=AA=A8=EB=93=A0=20StudentTechStack=20=EA=B0=80?= =?UTF-8?q?=EC=A0=B8=EC=98=A4=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student/StudentTechStackPersistenceAdapter.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentTechStackPersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentTechStackPersistenceAdapter.kt index 09d49ba4..1f4646fa 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentTechStackPersistenceAdapter.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/student/StudentTechStackPersistenceAdapter.kt @@ -42,4 +42,10 @@ class StudentTechStackPersistenceAdapter( .map { it.toDomain() } + + override fun queryStudentTechStack(): List = + studentTechStackJpaRepository.findAll() + .map { + it.toDomain() + } } \ No newline at end of file From 81a259ae9e6e0896eabd7e5a0986d03ef27f076b Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:33:28 +0900 Subject: [PATCH 120/132] =?UTF-8?q?:sparkles:=20StudentWebAdapter=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20+=20=ED=85=8C=ED=81=AC?= =?UTF-8?q?=EC=8A=A4=ED=83=9D=20=EB=B3=80=EA=B2=BD=EC=82=AC=ED=95=AD=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/student/StudentWebAdapter.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/StudentWebAdapter.kt b/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/StudentWebAdapter.kt index a7d3b36b..2f15264f 100644 --- a/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/StudentWebAdapter.kt +++ b/sms-presentation/src/main/kotlin/team/msg/sms/domain/student/StudentWebAdapter.kt @@ -35,7 +35,7 @@ class StudentWebAdapter( @GetMapping("/anonymous/{uuid}") fun findForAnonymousRole(@PathVariable uuid: String): ResponseEntity { - if(!isValidUUID(uuid)) throw InvalidUuidException + if (!isValidUUID(uuid)) throw InvalidUuidException return studentInfoAnonymousUseCase.execute(uuid) .let { ResponseEntity.ok(it.toResponse()) } } @@ -49,7 +49,7 @@ class StudentWebAdapter( @GetMapping("/teacher/{uuid}") fun findForTeacherRole(@PathVariable uuid: String): ResponseEntity { - if(!isValidUUID(uuid)) throw InvalidUuidException + if (!isValidUUID(uuid)) throw InvalidUuidException return studentInfoTeacherUseCase.execute(uuid) .let { ResponseEntity.ok(it.toResponse()) } } @@ -97,7 +97,7 @@ class StudentWebAdapter( profileImg = this.profileImg, dreamBookFileUrl = this.dreamBookFileUrl, contactEmail = this.contactEmail, - techStacks = this.techStacks, + studentTechStacks = this.studentTechStacks, formOfEmployment = this.formOfEmployment, portfolioUrl = this.portfolioUrl, certificates = this.certificates, @@ -105,7 +105,8 @@ class StudentWebAdapter( gsmAuthenticationScore = this.gsmAuthenticationScore, salary = this.salary, languageCertificates = this.languageCertificates, - regions = this.regions + regions = this.regions, + projects = this.projects ) private fun isValidUUID(uuid: String): Boolean { From edf0a15847c865cb0e9c41374c77e924694b7ab0 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:33:46 +0900 Subject: [PATCH 121/132] =?UTF-8?q?:sparkles:=20UserProfileDetailResponseD?= =?UTF-8?q?ata=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20+=20=ED=85=8C?= =?UTF-8?q?=ED=81=AC=EC=8A=A4=ED=83=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/user/dto/res/UserProfileDetailResponseData.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/user/dto/res/UserProfileDetailResponseData.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/user/dto/res/UserProfileDetailResponseData.kt index 691fe029..f5458df7 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/user/dto/res/UserProfileDetailResponseData.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/user/dto/res/UserProfileDetailResponseData.kt @@ -1,6 +1,7 @@ package team.msg.sms.domain.user.dto.res import team.msg.sms.domain.languagecertificate.model.LanguageCertificate +import team.msg.sms.domain.project.dto.res.ProjectResponseData import team.msg.sms.domain.student.model.Department import team.msg.sms.domain.student.model.FormOfEmployment import team.msg.sms.domain.student.model.MilitaryService @@ -24,5 +25,6 @@ data class UserProfileDetailResponseData( val salary: Int, val languageCertificates: List, val certificates: List, - val techStacks: List + val studentTechStacks: List, + val projects: List ) \ No newline at end of file From 7ec929b003fbbbcf5f46ab9fe9a9c873bb808c9c Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 17:33:59 +0900 Subject: [PATCH 122/132] =?UTF-8?q?:sparkles:=20UserProfileDetailWebRespon?= =?UTF-8?q?se=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20+=20=ED=85=8C?= =?UTF-8?q?=ED=81=AC=EC=8A=A4=ED=83=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/user/dto/res/UserProfileDetailWebResponse.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sms-presentation/src/main/kotlin/team/msg/sms/domain/user/dto/res/UserProfileDetailWebResponse.kt b/sms-presentation/src/main/kotlin/team/msg/sms/domain/user/dto/res/UserProfileDetailWebResponse.kt index 415710b1..4e5459e0 100644 --- a/sms-presentation/src/main/kotlin/team/msg/sms/domain/user/dto/res/UserProfileDetailWebResponse.kt +++ b/sms-presentation/src/main/kotlin/team/msg/sms/domain/user/dto/res/UserProfileDetailWebResponse.kt @@ -1,6 +1,7 @@ package team.msg.sms.domain.user.dto.res import team.msg.sms.domain.languagecertificate.model.LanguageCertificate +import team.msg.sms.domain.project.dto.res.ProjectResponseData import team.msg.sms.domain.student.model.Department import team.msg.sms.domain.student.model.FormOfEmployment import team.msg.sms.domain.student.model.MilitaryService @@ -24,5 +25,6 @@ data class UserProfileDetailWebResponse( val salary: Int, val languageCertificates: List, val certificates: List, - val techStacks: List + val studentTechStacks: List, + val projects: List ) From 0fff8cc021711c41e76f527237d6c1b66b55f3a3 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Mon, 14 Aug 2023 20:01:49 +0900 Subject: [PATCH 123/132] =?UTF-8?q?:recycle:=20=EC=B9=B4=EC=9A=B4=ED=8A=B8?= =?UTF-8?q?=EA=B0=80=202=EC=9D=B4=EC=83=81=EC=9D=B8=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=EB=A7=8C=20=EA=B0=80=EC=A0=B8=EC=98=A4=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../techstack/usecase/QueryAllTechStackUseCase.kt | 7 +++---- .../techstack/TechStackPersistenceAdapter.kt | 6 ++++-- .../techstack/repository/TechStackJpaRepository.kt | 11 +++++++++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/usecase/QueryAllTechStackUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/usecase/QueryAllTechStackUseCase.kt index 390d29b4..b675f05b 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/usecase/QueryAllTechStackUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/usecase/QueryAllTechStackUseCase.kt @@ -9,10 +9,9 @@ class QueryAllTechStackUseCase( private val techStackService: TechStackService ) { fun execute(stack: String?): TechStacksResponseData { - val techStack = if (stack == null) techStackService.getAllTechStack() - .map { it.stack }.distinct() else techStackService.getAllTechStackByStack( - stack - ).map { it.stack }.distinct() + val techStack = if (stack == null) techStackService.getAllTechStackByCount() + .map { it.stack } + else techStackService.getAllTechStackByStack(stack).map { it.stack } return TechStacksResponseData( techStack = if (techStack.size > 30) techStack diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/TechStackPersistenceAdapter.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/TechStackPersistenceAdapter.kt index 0515a0ab..9f4cf70e 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/TechStackPersistenceAdapter.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/TechStackPersistenceAdapter.kt @@ -1,8 +1,10 @@ package team.msg.sms.persistence.techstack +import com.querydsl.jpa.impl.JPAQueryFactory import org.springframework.stereotype.Component import team.msg.sms.domain.techstack.model.TechStack import team.msg.sms.domain.techstack.spi.TechStackPort +import team.msg.sms.persistence.techstack.entity.QTechStackJpaEntity import team.msg.sms.persistence.techstack.mapper.toDomain import team.msg.sms.persistence.techstack.mapper.toEntity import team.msg.sms.persistence.techstack.repository.TechStackJpaRepository @@ -28,8 +30,8 @@ class TechStackPersistenceAdapter( } override fun queryAllByCount(): List = - techStackJpaRepository.findAllByCountGreaterThan(2).map { it.toDomain() } + techStackJpaRepository.findAllWithCountGreaterThanTwo().map { it.toDomain() } override fun queryAllByStack(stack: String): List = - techStackJpaRepository.findByStackStartingWith(stack).map { it.toDomain() } + techStackJpaRepository.findByStackStartingWithCountGreaterThanTwo("$stack%").map { it.toDomain() } } \ No newline at end of file diff --git a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/repository/TechStackJpaRepository.kt b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/repository/TechStackJpaRepository.kt index fe3d0ee5..16f29f7a 100644 --- a/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/repository/TechStackJpaRepository.kt +++ b/sms-persistence/src/main/kotlin/team/msg/sms/persistence/techstack/repository/TechStackJpaRepository.kt @@ -1,11 +1,18 @@ package team.msg.sms.persistence.techstack.repository import org.springframework.data.jpa.repository.JpaRepository +import org.springframework.data.jpa.repository.Modifying +import org.springframework.data.jpa.repository.Query +import org.springframework.data.repository.query.Param import org.springframework.stereotype.Repository import team.msg.sms.persistence.techstack.entity.TechStackJpaEntity @Repository interface TechStackJpaRepository : JpaRepository { - fun findByStackStartingWith(stack: String): List - fun findAllByCountGreaterThan(count: Long): List + @Query("select techStack from TechStackJpaEntity techStack where techStack.count >= 2 and techStack.stack like :stack") + fun findByStackStartingWithCountGreaterThanTwo(@Param("stack") stack: String): List + + @Query("select techStack from TechStackJpaEntity techStack where techStack.count >= 2") + fun findAllWithCountGreaterThanTwo(): List + } \ No newline at end of file From b2cc96eaf56056d374ef54623876896f5210ef09 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Thu, 17 Aug 2023 09:09:40 +0900 Subject: [PATCH 124/132] =?UTF-8?q?:recycle:=20=EB=B0=98=EB=B3=B5=EB=90=98?= =?UTF-8?q?=EB=8A=94=20forEach=EB=AC=B8=20=ED=95=A8=EC=88=98=EB=A1=9C=20?= =?UTF-8?q?=EB=B9=BC=EB=B2=84=EB=A0=B8=EC=8A=B5=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/usecase/WithdrawalUseCase.kt | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt index 8a3e34bb..e0456f6e 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt @@ -31,26 +31,32 @@ class WithdrawalUseCase( val student = studentService.getStudentByUser(user) val project = projectService.getAllProjectByStudentId(student.id) - listOf( + val deleteProjectActions = listOf( projectLinkService::deleteAllByProjects, projectTechStackService::deleteAllByProjects, imageService::deleteAllByProjects - ).forEach { service -> - service(project) - } + ) - listOf( + val deleteStudentActions = listOf( projectService::deleteAllByStudent, regionService::deleteAllByStudent, languageCertificateService::deleteAllByStudent, certificateService::deleteAllByStudent, studentTechStackService::deleteAllByStudent - ).forEach { service -> - service(student) - } + ) + + deleteActions(deleteProjectActions, project) + deleteActions(deleteStudentActions, student) studentService.deleteByUuid(studentId = student.id) } userService.deleteByUuid(userId = user.id) } -} \ No newline at end of file +} + +fun deleteActions(actions: List<(T) -> Unit>, target: T) { + actions.forEach { action -> + action(target) + } +} + From aa696bf95df9c235da6a824592434825af9e5f68 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Thu, 17 Aug 2023 09:10:41 +0900 Subject: [PATCH 125/132] =?UTF-8?q?:recycle:=20studentTechStack=20?= =?UTF-8?q?=EC=9D=84=20=EB=B0=98=ED=99=98=ED=95=98=EB=8A=94=20=EB=B6=80?= =?UTF-8?q?=EB=B6=84=EC=9D=84=20=ED=95=A8=EC=88=98=EB=A1=9C=20=EB=BA=8F?= =?UTF-8?q?=EC=8A=B5=EB=8B=88=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/student/usecase/StudentInfoDetailUseCase.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoDetailUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoDetailUseCase.kt index fa1d5e0e..7344161c 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoDetailUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoDetailUseCase.kt @@ -2,8 +2,10 @@ package team.msg.sms.domain.student.usecase import team.msg.sms.common.annotation.UseCase import team.msg.sms.domain.student.dto.res.DetailStudentInfoResponseData +import team.msg.sms.domain.student.model.StudentTechStack import team.msg.sms.domain.student.service.StudentService import team.msg.sms.domain.student.service.StudentTechStackService +import team.msg.sms.domain.techstack.model.TechStack import team.msg.sms.domain.techstack.service.TechStackService @@ -28,8 +30,11 @@ class StudentInfoDetailUseCase( major = student.major, profileImg = student.profileImgUrl, techStack = studentTechStack.map { studentTechStack -> - techStack.find { it.id == studentTechStack.techStackId }?.stack ?: "" + toStudentTechStack(studentTechStack, techStack) } ) } -} \ No newline at end of file +} + +private fun toStudentTechStack(studentTechStack: StudentTechStack, techStack: List) = + techStack.find { studentTechStack.id == studentTechStack.techStackId }?.stack ?: "" From ff075b6165e2ba79a3efa48a9ed8bdbb5fe6238f Mon Sep 17 00:00:00 2001 From: huuuunee Date: Thu, 17 Aug 2023 09:11:26 +0900 Subject: [PATCH 126/132] =?UTF-8?q?:recycle:=20=EA=B8=B0=EC=A1=B4=20ROLE?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=9D=BC=20=ED=95=99=EB=B2=88=EC=9D=84=20?= =?UTF-8?q?=EB=B0=9B=EC=9D=84=EC=A7=80=20=EB=A7=90=EC=A7=80=20=EA=B2=80?= =?UTF-8?q?=EC=82=AC=ED=95=98=EB=8A=94=20=EB=B6=80=EB=B6=84=EC=9D=84=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EB=A1=9C=20=EB=B9=BC=EB=B2=84=EB=A0=B8?= =?UTF-8?q?=EC=8A=B5=EB=8B=88=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/auth/usecase/SignInUseCase.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt index b02e3b27..6d9018b5 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt @@ -1,5 +1,6 @@ package team.msg.sms.domain.auth.usecase +import gauth.GAuthUserInfo import gauth.exception.GAuthException import team.msg.sms.domain.auth.dto.req.SignInRequestData import team.msg.sms.common.annotation.UseCase @@ -9,6 +10,7 @@ import team.msg.sms.domain.auth.exception.ExpiredCodeException import team.msg.sms.domain.auth.exception.SecretMismatchException import team.msg.sms.domain.auth.exception.ServiceNotFoundException import team.msg.sms.domain.auth.model.RefreshToken +import team.msg.sms.domain.auth.model.Role import team.msg.sms.domain.auth.spi.JwtPort import team.msg.sms.domain.auth.spi.RefreshTokenPort import team.msg.sms.domain.student.service.StudentService @@ -37,9 +39,7 @@ class SignInUseCase( User( name = gAuthUserInfo.name, email = gAuthUserInfo.email, - stuNum = if (role.name != "ROLE_TEACHER") "${gAuthUserInfo.grade}${gAuthUserInfo.classNum}" + if (gAuthUserInfo.num < 10) { - "0${gAuthUserInfo.num}" - } else gAuthUserInfo.num else "", + stuNum = stuNumValid(role, gAuthUserInfo), roles = mutableListOf(role) ) ) @@ -67,4 +67,9 @@ class SignInUseCase( } } } -} \ No newline at end of file +} + +private fun stuNumValid(role: Role, gAuthUserInfo: GAuthUserInfo) = + if (role.name != "ROLE_TEACHER") "${gAuthUserInfo.grade}${gAuthUserInfo.classNum}" + if (gAuthUserInfo.num < 10) { + "0${gAuthUserInfo.num}" + } else gAuthUserInfo.num else "" \ No newline at end of file From ed11345f11c45b1ee0badd39975ec1b6233b783e Mon Sep 17 00:00:00 2001 From: huuuunee Date: Thu, 17 Aug 2023 09:12:02 +0900 Subject: [PATCH 127/132] =?UTF-8?q?:recycle:=20=EC=9B=90=EB=9E=98=20?= =?UTF-8?q?=EA=B7=9C=EC=B9=99=EB=8C=80=EB=A1=9C=20=EA=B3=A0=EC=B0=A8?= =?UTF-8?q?=ED=95=A8=EC=88=98=EB=A5=BC=20=EC=A0=81=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=98=80=EC=8A=B5=EB=8B=88=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sms/domain/techstack/usecase/QueryAllTechStackUseCase.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/usecase/QueryAllTechStackUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/usecase/QueryAllTechStackUseCase.kt index b675f05b..b94d621c 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/usecase/QueryAllTechStackUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/techstack/usecase/QueryAllTechStackUseCase.kt @@ -11,7 +11,8 @@ class QueryAllTechStackUseCase( fun execute(stack: String?): TechStacksResponseData { val techStack = if (stack == null) techStackService.getAllTechStackByCount() .map { it.stack } - else techStackService.getAllTechStackByStack(stack).map { it.stack } + else techStackService.getAllTechStackByStack(stack) + .map { it.stack } return TechStacksResponseData( techStack = if (techStack.size > 30) techStack From 153f59d844b0c46f92e6acc13c88c0423ad82463 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Thu, 17 Aug 2023 09:12:41 +0900 Subject: [PATCH 128/132] =?UTF-8?q?:recycle:=20=EB=93=A4=EC=97=AC=EC=93=B0?= =?UTF-8?q?=EA=B8=B0=20=EC=9D=B4=EC=83=81=ED=95=9C=20=EB=B6=80=EB=B6=84?= =?UTF-8?q?=EC=9D=84=20=EC=88=98=EC=A0=95=ED=95=98=EC=98=80=EC=8A=B5?= =?UTF-8?q?=EB=8B=88=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/sms/domain/file/service/impl/GetImageServiceImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/GetImageServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/GetImageServiceImpl.kt index b66cbeaf..cc3e8d6a 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/GetImageServiceImpl.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/file/service/impl/GetImageServiceImpl.kt @@ -8,7 +8,7 @@ import team.msg.sms.domain.file.spi.ImagePort @Service class GetImageServiceImpl( private val imagePort: ImagePort -) : GetImageService{ +) : GetImageService { override fun getAllByProjectId(projectId: Long): List = imagePort.queryAllByProjectId(projectId) } \ No newline at end of file From deba0e63735a6e1c5bc677df09a3e25694bc9e63 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Thu, 17 Aug 2023 09:26:36 +0900 Subject: [PATCH 129/132] =?UTF-8?q?:recycle:=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20Response=20=EB=A5=BC=20?= =?UTF-8?q?=EB=B0=98=ED=99=98=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EA=B0=80=20=EC=A4=91=EB=B3=B5=EB=90=98=EC=96=B4=20Util=20?= =?UTF-8?q?=EB=A1=9C=20=EA=B4=80=EB=A6=AC=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=ED=96=88=EC=8A=B5=EB=8B=88=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/common/util/ProjectUtil.kt | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sms-core/src/main/kotlin/team/msg/sms/common/util/ProjectUtil.kt diff --git a/sms-core/src/main/kotlin/team/msg/sms/common/util/ProjectUtil.kt b/sms-core/src/main/kotlin/team/msg/sms/common/util/ProjectUtil.kt new file mode 100644 index 00000000..b5d0e085 --- /dev/null +++ b/sms-core/src/main/kotlin/team/msg/sms/common/util/ProjectUtil.kt @@ -0,0 +1,73 @@ +package team.msg.sms.common.util + +import team.msg.sms.domain.file.model.Image +import team.msg.sms.domain.file.service.ImageService +import team.msg.sms.domain.project.dto.res.ProjectInProgressResponseData +import team.msg.sms.domain.project.dto.res.ProjectLinkResponseData +import team.msg.sms.domain.project.dto.res.ProjectResponseData +import team.msg.sms.domain.project.model.Project +import team.msg.sms.domain.project.model.ProjectLink +import team.msg.sms.domain.project.model.ProjectTechStack +import team.msg.sms.domain.project.service.ProjectLinkService +import team.msg.sms.domain.project.service.ProjectTechStackService +import team.msg.sms.domain.techstack.model.TechStack + +object ProjectUtil { + + fun generateProjectResponseData( + imageService: ImageService, + projectLinkService: ProjectLinkService, + projectTechStackService: ProjectTechStackService, + projects: List, + techStacks: List + ) : List = + projects.map { + val image = imageService.getAllByProjectId(projectId = it.id) + val link = projectLinkService.getAllByProjectId(projectId = it.id) + val projectTechStack = projectTechStackService.getAllByProjectId(projectId = it.id) + toProjectResponseData( + project = it, + projectLink = link, + projectImage = image, + projectTechStack = projectTechStack, + techStack = techStacks + ) + } + + private fun toProjectTechStacks(techStacks: List, projectTechStack: ProjectTechStack): TechStack? = + techStacks.find { it.id == projectTechStack.techStackId } + + private fun toProjectResponseData( + project: Project, + projectLink: List, + projectImage: List, + projectTechStack: List, + techStack: List + ): ProjectResponseData = + ProjectResponseData( + id = project.id, + description = project.description, + inProgress = toInProgressResponseData(project.startDate, project.endDate), + links = projectLink.map { toLinkResponseData(it) }, + myActivity = project.myActivity, + previewImages = projectImage.map { it.imageUrl }, + projectTechStacks = projectTechStack.map { + toProjectTechStacks(techStack, it)?.stack ?: "" + }, + name = project.title, + ) + + + private fun toLinkResponseData(projectLink: ProjectLink) = + ProjectLinkResponseData( + id = projectLink.projectId, + name = projectLink.name, + url = projectLink.url + ) + + private fun toInProgressResponseData(start: String, end: String?) = + ProjectInProgressResponseData( + start = start, + end = end + ) +} \ No newline at end of file From d6a20cfca40efb27ce0f451e355a9f05d54011c8 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Thu, 17 Aug 2023 09:26:49 +0900 Subject: [PATCH 130/132] =?UTF-8?q?:recycle:=20Util=20=EB=A1=9C=20?= =?UTF-8?q?=EB=BA=B8=20=ED=95=A8=EC=88=98=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QueryCurrentUserProfileDetailUseCase.kt | 67 ++++--------------- 1 file changed, 14 insertions(+), 53 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/user/usecase/QueryCurrentUserProfileDetailUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/user/usecase/QueryCurrentUserProfileDetailUseCase.kt index b4e3d670..2f1d418e 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/user/usecase/QueryCurrentUserProfileDetailUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/user/usecase/QueryCurrentUserProfileDetailUseCase.kt @@ -1,6 +1,8 @@ package team.msg.sms.domain.user.usecase import team.msg.sms.common.annotation.UseCase +import team.msg.sms.common.util.ProjectUtil +import team.msg.sms.common.util.ProjectUtil.generateProjectResponseData import team.msg.sms.domain.certificate.service.CertificateService import team.msg.sms.domain.file.model.Image import team.msg.sms.domain.file.service.ImageService @@ -16,7 +18,6 @@ import team.msg.sms.domain.project.service.ProjectLinkService import team.msg.sms.domain.project.service.ProjectService import team.msg.sms.domain.project.service.ProjectTechStackService import team.msg.sms.domain.region.service.RegionService -import team.msg.sms.domain.student.exception.StudentNotFoundException import team.msg.sms.domain.student.model.Student import team.msg.sms.domain.student.model.StudentTechStack import team.msg.sms.domain.student.service.StudentService @@ -36,16 +37,18 @@ class QueryCurrentUserProfileDetailUseCase( private val projectLinkService: ProjectLinkService, private val imageService: ImageService, private val studentTechStackService: StudentTechStackService, - private val regionService: RegionService + private val regionService: RegionService, ) { fun execute(): UserProfileDetailResponseData { val student = studentService.currentStudent() val techStacks = techStackService.getAllTechStack() val projects = projectService.getAllProjectByStudentId(studentId = student.id) - val certificates = certificateService.getCertificateByUuid(student.id).map { it.certificateName } + val certificates = certificateService.getCertificateByUuid(student.id) + .map { it.certificateName } val languageCertificates = languageCertificateService.getLanguageCertificateByStudentUuid(student.id) .map { it.toLanguageCertificateScore() } - val region = regionService.getRegionByStudentUuid(student.id).map { it.region } + val region = regionService.getRegionByStudentUuid(student.id) + .map { it.region } val studentTechStacks = studentTechStackService.getStudentTechStackByStudentId(studentId = student.id) return toData(student, techStacks, region, studentTechStacks, languageCertificates, certificates, projects) } @@ -81,18 +84,13 @@ class QueryCurrentUserProfileDetailUseCase( studentTechStacks = studentTechStacks.map { toStudentTechStacks(techStacks, it)?.stack ?: "" }, - projects = projects.map { - val image = imageService.getAllByProjectId(projectId = it.id) - val link = projectLinkService.getAllByProjectId(projectId = it.id) - val projectTechStack = projectTechStackService.getAllByProjectId(projectId = it.id) - toProjectResponseData( - project = it, - projectLink = link, - projectImage = image, - projectTechStack = projectTechStack, - techStack = techStacks - ) - } + projects = generateProjectResponseData( + projects = projects, + projectLinkService = projectLinkService, + projectTechStackService = projectTechStackService, + imageService = imageService, + techStacks = techStacks + ) ) private fun LanguageCertificate.toLanguageCertificateScore( @@ -104,41 +102,4 @@ class QueryCurrentUserProfileDetailUseCase( private fun toStudentTechStacks(techStacks: List, studentTechStack: StudentTechStack): TechStack? = techStacks.find { it.id == studentTechStack.techStackId } - - private fun toProjectTechStacks(techStacks: List, projectTechStack: ProjectTechStack): TechStack? = - techStacks.find { it.id == projectTechStack.techStackId } - - private fun toProjectResponseData( - project: Project, - projectLink: List, - projectImage: List, - projectTechStack: List, - techStack: List - ): ProjectResponseData = - ProjectResponseData( - id = project.id, - description = project.description, - inProgress = toInProgressResponseData(project.startDate, project.endDate), - links = projectLink.map { toLinkResponseData(it) }, - myActivity = project.myActivity, - previewImages = projectImage.map { it.imageUrl }, - projectTechStacks = projectTechStack.map { - toProjectTechStacks(techStack, it)?.stack ?: throw StudentNotFoundException - }, - name = project.title, - ) - - - private fun toLinkResponseData(projectLink: ProjectLink) = - ProjectLinkResponseData( - id = projectLink.projectId, - name = projectLink.name, - url = projectLink.url - ) - - private fun toInProgressResponseData(start: String, end: String?) = - ProjectInProgressResponseData( - start = start, - end = end - ) } \ No newline at end of file From f4f8c4ff2045eeb0b44a1edbb913c236ca41ed2a Mon Sep 17 00:00:00 2001 From: huuuunee Date: Thu, 17 Aug 2023 09:26:54 +0900 Subject: [PATCH 131/132] =?UTF-8?q?:recycle:=20Util=20=EB=A1=9C=20?= =?UTF-8?q?=EB=BA=B8=20=ED=95=A8=EC=88=98=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usecase/StudentInfoTeacherUseCase.kt | 57 +++---------------- 1 file changed, 8 insertions(+), 49 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoTeacherUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoTeacherUseCase.kt index c0f5776e..0e7bde9a 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoTeacherUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/student/usecase/StudentInfoTeacherUseCase.kt @@ -1,6 +1,7 @@ package team.msg.sms.domain.student.usecase import team.msg.sms.common.annotation.UseCase +import team.msg.sms.common.util.ProjectUtil.generateProjectResponseData import team.msg.sms.domain.certificate.service.CertificateService import team.msg.sms.domain.file.model.Image import team.msg.sms.domain.file.service.ImageService @@ -70,18 +71,13 @@ class StudentInfoTeacherUseCase( studentTechStacks = studentTechStacks.map { toStudentTechStacks(techStacks, it)?.stack ?: "" }, - projects = projects.map { - val image = imageService.getAllByProjectId(projectId = it.id) - val link = projectLinkService.getAllByProjectId(projectId = it.id) - val projectTechStack = projectTechStackService.getAllByProjectId(projectId = it.id) - toProjectResponseData( - project = it, - projectLink = link, - projectImage = image, - projectTechStack = projectTechStack, - techStack = techStacks - ) - } + projects = generateProjectResponseData( + projects = projects, + projectLinkService = projectLinkService, + projectTechStackService = projectTechStackService, + imageService = imageService, + techStacks = techStacks + ) ) } @@ -95,42 +91,5 @@ class StudentInfoTeacherUseCase( private fun toStudentTechStacks(techStacks: List, studentTechStack: StudentTechStack): TechStack? = techStacks.find { it.id == studentTechStack.techStackId } - - private fun toProjectTechStacks(techStacks: List, projectTechStack: ProjectTechStack): TechStack? = - techStacks.find { it.id == projectTechStack.techStackId } - - private fun toProjectResponseData( - project: Project, - projectLink: List, - projectImage: List, - projectTechStack: List, - techStack: List - ): ProjectResponseData = - ProjectResponseData( - id = project.id, - description = project.description, - inProgress = toInProgressResponseData(project.startDate, project.endDate), - links = projectLink.map { toLinkResponseData(it) }, - myActivity = project.myActivity, - previewImages = projectImage.map { it.imageUrl }, - projectTechStacks = projectTechStack.map { - toProjectTechStacks(techStack, it)?.stack ?: throw StudentNotFoundException - }, - name = project.title, - ) - - - private fun toLinkResponseData(projectLink: ProjectLink) = - ProjectLinkResponseData( - id = projectLink.projectId, - name = projectLink.name, - url = projectLink.url - ) - - private fun toInProgressResponseData(start: String, end: String?) = - ProjectInProgressResponseData( - start = start, - end = end - ) } From d9d1f99514b555153c856127b3f5fd2869498de9 Mon Sep 17 00:00:00 2001 From: huuuunee Date: Thu, 17 Aug 2023 09:59:51 +0900 Subject: [PATCH 132/132] =?UTF-8?q?:recycle:=20stuNumValid=20->=20getStuNu?= =?UTF-8?q?mValid=20=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt index 6d9018b5..3786b683 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/SignInUseCase.kt @@ -39,7 +39,7 @@ class SignInUseCase( User( name = gAuthUserInfo.name, email = gAuthUserInfo.email, - stuNum = stuNumValid(role, gAuthUserInfo), + stuNum = getStuNumValid(role, gAuthUserInfo), roles = mutableListOf(role) ) ) @@ -69,7 +69,7 @@ class SignInUseCase( } } -private fun stuNumValid(role: Role, gAuthUserInfo: GAuthUserInfo) = +private fun getStuNumValid(role: Role, gAuthUserInfo: GAuthUserInfo) = if (role.name != "ROLE_TEACHER") "${gAuthUserInfo.grade}${gAuthUserInfo.classNum}" + if (gAuthUserInfo.num < 10) { "0${gAuthUserInfo.num}" } else gAuthUserInfo.num else "" \ No newline at end of file