Skip to content

Commit 26a716f

Browse files
authored
Feat/back office
Feat/back office
2 parents 7daa933 + c0cbae1 commit 26a716f

26 files changed

Lines changed: 133 additions & 103 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ sonarqube {
2222
property("sonar.sources", "src")
2323
property("sonar.sourceEncoding", "UTF-8")
2424
property("sonar.test.inclusions", "**/*Test.kt")
25-
property("sonar.exclusions", "**/test/**, **/resources/**, **/docs/**, **/*Application*.kt, **/global/**, **/dto/**, **/*Exception*.kt, **/*ErrorCode*.kt, **/*Category*.kt, **/admin/**, **/*RepositoryImpl.kt" )
25+
property("sonar.exclusions", "**/test/**, **/resources/**, **/docs/**, **/*Application*.kt, **/global/**, **/dto/**, **/entity/**, **/*Exception*.kt, **/*ErrorCode*.kt, **/*Category*.kt, **/admin/**, **/*RepositoryImpl.kt" )
2626
property("sonar.java.coveragePlugin", "jacoco")
2727
property("sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/customJacocoReportDir/test/jacocoTestReport.xml")
2828
}

src/main/kotlin/com/example/jhouse_server/domain/record/dto/RecordDto.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.example.jhouse_server.domain.record.dto
22

3-
import com.example.jhouse_server.domain.record.entity.Part
43
import com.example.jhouse_server.domain.record_comment.dto.RecordCommentResDto
54
import com.example.jhouse_server.domain.record_review.dto.RecordReviewResDto
65
import com.example.jhouse_server.domain.record_review_apply.dto.RecordReviewApplyResDto

src/main/kotlin/com/example/jhouse_server/domain/record/entity/Part.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import com.example.jhouse_server.global.exception.ApplicationException
44
import com.example.jhouse_server.global.exception.ErrorCode
55

66
enum class Part(val value: String) {
7+
ALL("all"),
78
WEB("web"),
89
SERVER("server"),
910
INFRA("infra");
1011

1112
companion object {
12-
fun getPart(value: String): Part? {
13+
fun getPart(value: String): Part {
1314
for(part in Part.values()) {
14-
if(part.value == value) {
15+
if(part.value == value.lowercase()) {
1516
return part
1617
}
1718
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.example.jhouse_server.domain.record.entity
2+
3+
import com.example.jhouse_server.global.exception.ApplicationException
4+
import com.example.jhouse_server.global.exception.ErrorCode
5+
6+
enum class RecordType(val value: String) {
7+
ALL("all"),
8+
ODORI("odori"),
9+
RETRO("retro"),
10+
TECH("tech");
11+
12+
companion object {
13+
fun getType(value: String): RecordType {
14+
for(type in RecordType.values()) {
15+
if(type.value == value.lowercase()) {
16+
return type
17+
}
18+
}
19+
throw ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION)
20+
}
21+
}
22+
}

src/main/kotlin/com/example/jhouse_server/domain/record/entity/odori/Odori.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package com.example.jhouse_server.domain.record.entity.odori
22

3-
import com.example.jhouse_server.domain.record.entity.Part
43
import com.example.jhouse_server.domain.record.entity.Record
5-
import com.example.jhouse_server.domain.record.entity.RecordStatus
6-
import com.example.jhouse_server.domain.user.entity.User
74
import javax.persistence.DiscriminatorValue
85
import javax.persistence.Entity
96
import javax.persistence.EnumType

src/main/kotlin/com/example/jhouse_server/domain/record/entity/retrospection/Retrospection.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package com.example.jhouse_server.domain.record.entity.retrospection
22

3-
import com.example.jhouse_server.domain.record.entity.Part
43
import com.example.jhouse_server.domain.record.entity.Record
5-
import com.example.jhouse_server.domain.record.entity.RecordStatus
6-
import com.example.jhouse_server.domain.user.entity.User
74
import javax.persistence.DiscriminatorValue
85
import javax.persistence.Entity
96
import javax.persistence.EnumType

src/main/kotlin/com/example/jhouse_server/domain/record/entity/technology/Technology.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package com.example.jhouse_server.domain.record.entity.technology
22

3-
import com.example.jhouse_server.domain.record.entity.Part
43
import com.example.jhouse_server.domain.record.entity.Record
5-
import com.example.jhouse_server.domain.record.entity.RecordStatus
6-
import com.example.jhouse_server.domain.user.entity.User
74
import javax.persistence.DiscriminatorValue
85
import javax.persistence.Entity
96
import javax.persistence.EnumType

src/main/kotlin/com/example/jhouse_server/domain/record/repository/RecordRepository.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package com.example.jhouse_server.domain.record.repository
22

33
import com.example.jhouse_server.domain.record.entity.Record
4-
import com.example.jhouse_server.domain.record.repository.odori.OdoriRepositoryCustom
5-
import com.example.jhouse_server.domain.record.repository.retrospection.RetrospectionRepositoryCustom
6-
import com.example.jhouse_server.domain.record.repository.technology.TechnologyRepositoryCustom
74
import org.springframework.data.jpa.repository.EntityGraph
85
import org.springframework.data.jpa.repository.JpaRepository
96
import org.springframework.data.jpa.repository.Query
Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
package com.example.jhouse_server.domain.record.repository.common
22

33
import com.example.jhouse_server.domain.record.entity.Part
4-
import com.example.jhouse_server.domain.record.entity.QRecord
54
import com.example.jhouse_server.domain.record.entity.QRecord.record
5+
import com.example.jhouse_server.domain.record.entity.RecordType
66
import com.example.jhouse_server.domain.record.entity.odori.OdoriCategory
7-
import com.example.jhouse_server.domain.record.entity.odori.QOdori
87
import com.example.jhouse_server.domain.record.entity.odori.QOdori.odori
9-
import com.example.jhouse_server.domain.record.entity.retrospection.QRetrospection
108
import com.example.jhouse_server.domain.record.entity.retrospection.QRetrospection.retrospection
119
import com.example.jhouse_server.domain.record.entity.retrospection.RetrospectionCategory
12-
import com.example.jhouse_server.domain.record.entity.technology.QTechnology
1310
import com.example.jhouse_server.domain.record.entity.technology.QTechnology.technology
1411
import com.example.jhouse_server.domain.record.entity.technology.TechnologyCategory
15-
import com.example.jhouse_server.global.exception.ApplicationException
16-
import com.example.jhouse_server.global.exception.ErrorCode
1712
import com.querydsl.core.types.dsl.BooleanExpression
1813
import com.querydsl.jpa.impl.JPAQuery
1914
import org.springframework.data.domain.Page
@@ -29,52 +24,47 @@ class RecordCommonMethod {
2924
}
3025

3126
fun recordPartEq(part: String): BooleanExpression? {
32-
return when (part) {
33-
"all" -> null
34-
"web" -> record.part.eq(Part.WEB)
35-
"server" -> record.part.eq(Part.SERVER)
36-
"infra" -> record.part.eq(Part.INFRA)
37-
else -> throw ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION)
27+
return when (Part.getPart(part)) {
28+
Part.ALL -> null
29+
Part.WEB -> record.part.eq(Part.WEB)
30+
Part.SERVER -> record.part.eq(Part.SERVER)
31+
Part.INFRA -> record.part.eq(Part.INFRA)
3832
}
3933
}
4034

4135
fun odoriPartEq(part: String): BooleanExpression? {
42-
return when (part) {
43-
"all" -> null
44-
"web" -> odori.part.eq(Part.WEB)
45-
"server" -> odori.part.eq(Part.SERVER)
46-
"infra" -> odori.part.eq(Part.INFRA)
47-
else -> throw ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION)
36+
return when (Part.getPart(part)) {
37+
Part.ALL -> null
38+
Part.WEB -> odori.part.eq(Part.WEB)
39+
Part.SERVER -> odori.part.eq(Part.SERVER)
40+
Part.INFRA -> odori.part.eq(Part.INFRA)
4841
}
4942
}
5043

5144
fun retroPartEq(part: String): BooleanExpression? {
52-
return when (part) {
53-
"all" -> null
54-
"web" -> retrospection.part.eq(Part.WEB)
55-
"server" -> retrospection.part.eq(Part.SERVER)
56-
"infra" -> retrospection.part.eq(Part.INFRA)
57-
else -> throw ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION)
45+
return when (Part.getPart(part)) {
46+
Part.ALL -> null
47+
Part.WEB -> retrospection.part.eq(Part.WEB)
48+
Part.SERVER -> retrospection.part.eq(Part.SERVER)
49+
Part.INFRA -> retrospection.part.eq(Part.INFRA)
5850
}
5951
}
6052

6153
fun techPartEq(part: String): BooleanExpression? {
62-
return when (part) {
63-
"all" -> null
64-
"web" -> technology.part.eq(Part.WEB)
65-
"server" -> technology.part.eq(Part.SERVER)
66-
"infra" -> technology.part.eq(Part.INFRA)
67-
else -> throw ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION)
54+
return when (Part.getPart(part)) {
55+
Part.ALL -> null
56+
Part.WEB -> technology.part.eq(Part.WEB)
57+
Part.SERVER -> technology.part.eq(Part.SERVER)
58+
Part.INFRA -> technology.part.eq(Part.INFRA)
6859
}
6960
}
7061

7162
fun categoryEq(type: String, category: String): BooleanExpression? {
72-
return when (type) {
73-
"all" -> null
74-
"odori" -> odori.category.eq(OdoriCategory.getCategoryByEnum(category))
75-
"retro" -> retrospection.category.eq(RetrospectionCategory.getCategoryByEnum(category))
76-
"tech" -> technology.category.eq(TechnologyCategory.getCategoryByEnum(category))
77-
else -> throw ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION)
63+
return when (RecordType.getType(type)) {
64+
RecordType.ALL -> null
65+
RecordType.ODORI -> odori.category.eq(OdoriCategory.getCategoryByEnum(category))
66+
RecordType.RETRO -> retrospection.category.eq(RetrospectionCategory.getCategoryByEnum(category))
67+
RecordType.TECH -> technology.category.eq(TechnologyCategory.getCategoryByEnum(category))
7868
}
7969
}
8070
}

src/main/kotlin/com/example/jhouse_server/domain/record/service/RecordService.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import com.example.jhouse_server.domain.record.dto.*
44
import com.example.jhouse_server.domain.record.entity.Record
55
import com.example.jhouse_server.domain.user.entity.User
66
import org.springframework.data.domain.Pageable
7-
import javax.servlet.http.HttpServletRequest
87

98
interface RecordService {
109

0 commit comments

Comments
 (0)