Skip to content

Commit facc71f

Browse files
huGgWleeeryboy
andauthored
prod deploy (#320)
* 교과목 정렬, 쿠키 secure 옵션 추가 (#308) * feat: 교과목 정렬 * feat: 쿠키 secure 옵션 추가 * referrer policy 헤더 추가 (#311) * referrer policy 헤더 추가 * 헤더 수정 * feat: scholarship CRUD (#309) * feat: scholarship CRUD * 불필요한 라인 삭제 * 리뷰 반영 * Update deploy_dev.yaml * 강의실 예약 제한 (#312) * feat: 소개 탭 CRUD (#314) * feat: 소개 탭 CRUD * fix: 권한 체크 추가 * fix: 동아리 id 기준으로 로직 변경 * fix: 쿠키 same-site: strict * 리뷰 반영 * 리뷰 반영 * 로그인 핫픽스 (#316) * Feat: Research Group & Center 언어포함 CRUD 생성 (#315) * refactor: deprecated v1 controller * refactor: extract types in seperate package, remove unused attachment from research * feat: make lab's research as nullable * feat: add research language entity & repository * feat: add language & sealed dtos * feat: remove migrate methods & seperate update index methods * feat: add CRUD language considered methods * feat: add v2 reserach controller * fix: fix test compiling * test: fix professerservice test * refactor: fix ktlint formatting * review: research -> fetch lazy * Refactor: 구성원 POST API image => mainImage 리펙토링 #317 * Refactor: PUT API newImage => newMainImage 수정 #318 * Feat: Lab CRUD (#319) * feat: add request body * feat: modify dto nullability * feat: extract lab service && implement CRUD * feat: add lab language dto * feat: add lab events * fix: fix unique constraints for research language entity * feat: add methods to repositories * feat: add LAB CRUD APIs * refactor: seperate event services * refactor: professors to mutable var * fix: fix typos * comment: add comment to professor service method * test: remove unneed test file * feat: split search service and event service * feat: implement professor, research event service * fix: apply ktlint * cascade 제거 (#321) * cascade 제거 * 이미지 제거 추가 --------- Co-authored-by: Junhyeong Kim <[email protected]>
1 parent 08586b7 commit facc71f

File tree

58 files changed

+2158
-1623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2158
-1623
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.wafflestudio.csereal.core.about.api.req
2+
3+
data class CreateClubReq(
4+
val ko: ClubReqBody,
5+
val en: ClubReqBody
6+
)
7+
8+
data class ClubReqBody(
9+
val name: String,
10+
val description: String
11+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.wafflestudio.csereal.core.about.api.req
2+
3+
data class CreateCompanyReq(
4+
val name: String,
5+
val url: String?,
6+
val year: Int
7+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.wafflestudio.csereal.core.about.api.req
2+
3+
data class CreateFacReq(
4+
val ko: FacDto,
5+
val en: FacDto
6+
)
7+
8+
data class FacDto(
9+
val name: String,
10+
val description: String,
11+
val locations: MutableList<String>
12+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.wafflestudio.csereal.core.about.api.req
2+
3+
data class UpdateAboutReq(
4+
val ko: BasicAbout,
5+
val en: BasicAbout,
6+
val removeImage: Boolean
7+
)
8+
9+
data class BasicAbout(
10+
val description: String,
11+
val deleteIds: List<Long>
12+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.wafflestudio.csereal.core.about.api.req
2+
3+
import com.wafflestudio.csereal.core.about.dto.ClubDto
4+
5+
data class UpdateClubReq(
6+
val ko: ClubDto,
7+
val en: ClubDto,
8+
val removeImage: Boolean
9+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.wafflestudio.csereal.core.about.api.req
2+
3+
data class UpdateDescriptionReq(
4+
val koDescription: String,
5+
val enDescription: String
6+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.wafflestudio.csereal.core.about.api.req
2+
3+
data class UpdateFacReq(
4+
val ko: FacDto,
5+
val en: FacDto,
6+
val removeImage: Boolean
7+
)
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
package com.wafflestudio.csereal.core.about.api
1+
package com.wafflestudio.csereal.core.about.api.v1
22

3-
import com.wafflestudio.csereal.common.aop.AuthenticatedStaff
43
import com.wafflestudio.csereal.common.enums.LanguageType
4+
import com.wafflestudio.csereal.core.about.api.req.*
55
import com.wafflestudio.csereal.core.about.api.res.AboutSearchResBody
66
import com.wafflestudio.csereal.core.about.dto.*
7-
import com.wafflestudio.csereal.core.about.dto.AboutRequest
8-
import com.wafflestudio.csereal.core.about.dto.FutureCareersRequest
97
import com.wafflestudio.csereal.core.about.service.AboutService
108
import jakarta.validation.Valid
119
import jakarta.validation.constraints.Positive
12-
import org.springframework.context.annotation.Profile
1310
import org.springframework.http.ResponseEntity
1411
import org.springframework.web.bind.annotation.*
15-
import org.springframework.web.multipart.MultipartFile
1612

1713
@RequestMapping("/api/v1/about")
18-
@RestController
14+
@RestController("AboutControllerV1")
1915
class AboutController(
2016
private val aboutService: AboutService
2117
) {
@@ -24,18 +20,6 @@ class AboutController(
2420
// postType: directions / name -> by-public-transit, by-car, from-far-away
2521

2622
// Todo: 학부장 인사말(greetings) signature
27-
@AuthenticatedStaff
28-
@PostMapping("/{postType}")
29-
fun createAbout(
30-
@PathVariable postType: String,
31-
@Valid
32-
@RequestPart("request")
33-
request: AboutDto,
34-
@RequestPart("mainImage") mainImage: MultipartFile?,
35-
@RequestPart("attachments") attachments: List<MultipartFile>?
36-
): ResponseEntity<AboutDto> {
37-
return ResponseEntity.ok(aboutService.createAbout(postType, request, mainImage, attachments))
38-
}
3923

4024
// read 목록이 하나
4125
@GetMapping("/{postType}")
@@ -46,6 +30,7 @@ class AboutController(
4630
return ResponseEntity.ok(aboutService.readAbout(language, postType))
4731
}
4832

33+
@Deprecated("Use V2 API")
4934
@GetMapping("/student-clubs")
5035
fun readAllClubs(
5136
@RequestParam(required = false, defaultValue = "ko") language: String
@@ -101,56 +86,4 @@ class AboutController(
10186
pageNum,
10287
amount
10388
)
104-
105-
@Profile("!prod")
106-
@PostMapping("/migrate")
107-
fun migrateAbout(
108-
@RequestBody requestList: List<AboutRequest>
109-
): ResponseEntity<List<AboutDto>> {
110-
return ResponseEntity.ok(aboutService.migrateAbout(requestList))
111-
}
112-
113-
@Profile("!prod")
114-
@PostMapping("/future-careers/migrate")
115-
fun migrateFutureCareers(
116-
@RequestBody request: FutureCareersRequest
117-
): ResponseEntity<FutureCareersPage> {
118-
return ResponseEntity.ok(aboutService.migrateFutureCareers(request))
119-
}
120-
121-
@Profile("!prod")
122-
@PostMapping("/student-clubs/migrate")
123-
fun migrateStudentClubs(
124-
@RequestBody requestList: List<StudentClubDto>
125-
): ResponseEntity<List<StudentClubDto>> {
126-
return ResponseEntity.ok(aboutService.migrateStudentClubs(requestList))
127-
}
128-
129-
@Profile("!prod")
130-
@PostMapping("/facilities/migrate")
131-
fun migrateFacilities(
132-
@RequestBody requestList: List<FacilityDto>
133-
): ResponseEntity<List<FacilityDto>> {
134-
return ResponseEntity.ok(aboutService.migrateFacilities(requestList))
135-
}
136-
137-
@Profile("!prod")
138-
@PostMapping("/directions/migrate")
139-
fun migrateDirections(
140-
@RequestBody requestList: List<DirectionDto>
141-
): ResponseEntity<List<DirectionDto>> {
142-
return ResponseEntity.ok(aboutService.migrateDirections(requestList))
143-
}
144-
145-
@Profile("!prod")
146-
@PatchMapping("/migrateImage/{aboutId}")
147-
fun migrateAboutImageAndAttachment(
148-
@PathVariable aboutId: Long,
149-
@RequestPart("mainImage") mainImage: MultipartFile?,
150-
@RequestPart("attachments") attachments: List<MultipartFile>?
151-
): ResponseEntity<AboutDto> {
152-
return ResponseEntity.ok(
153-
aboutService.migrateAboutImageAndAttachments(aboutId, mainImage, attachments)
154-
)
155-
}
15689
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package com.wafflestudio.csereal.core.about.api.v2
2+
3+
import com.wafflestudio.csereal.common.aop.AuthenticatedStaff
4+
import com.wafflestudio.csereal.core.about.api.req.*
5+
import com.wafflestudio.csereal.core.about.dto.GroupedClubDto
6+
import com.wafflestudio.csereal.core.about.service.AboutService
7+
import org.springframework.web.bind.annotation.*
8+
import org.springframework.web.multipart.MultipartFile
9+
10+
@RequestMapping("/api/v2/about")
11+
@RestController
12+
class AboutController(
13+
private val aboutService: AboutService
14+
) {
15+
@GetMapping("/student-clubs")
16+
fun readAllClubs(): List<GroupedClubDto> = aboutService.readAllGroupedClubs()
17+
18+
@AuthenticatedStaff
19+
@PostMapping("/student-clubs")
20+
fun createClub(
21+
@RequestPart request: CreateClubReq,
22+
@RequestPart mainImage: MultipartFile?
23+
) = aboutService.createClub(request, mainImage)
24+
25+
@AuthenticatedStaff
26+
@PutMapping("/student-clubs")
27+
fun updateClub(
28+
@RequestPart request: UpdateClubReq,
29+
@RequestPart newMainImage: MultipartFile?
30+
) = aboutService.updateClub(request, newMainImage)
31+
32+
@AuthenticatedStaff
33+
@DeleteMapping("/student-clubs/{id}")
34+
fun deleteClub(@PathVariable id: Long) = aboutService.deleteClub(id)
35+
36+
@AuthenticatedStaff
37+
@PutMapping("/{postType}")
38+
fun updateAbout(
39+
@PathVariable postType: String,
40+
@RequestPart request: UpdateAboutReq,
41+
@RequestPart newMainImage: MultipartFile?,
42+
@RequestPart newAttachments: List<MultipartFile>?
43+
) = aboutService.updateAbout(postType, request, newMainImage, newAttachments)
44+
45+
@AuthenticatedStaff
46+
@PostMapping("/facilities")
47+
fun createFacilities(@RequestPart request: CreateFacReq, @RequestPart mainImage: MultipartFile?) =
48+
aboutService.createFacilities(request, mainImage)
49+
50+
@AuthenticatedStaff
51+
@PutMapping("/facilities/{id}")
52+
fun updateFacility(
53+
@PathVariable id: Long,
54+
@RequestPart request: UpdateFacReq,
55+
@RequestPart newMainImage: MultipartFile?
56+
) = aboutService.updateFacility(id, request, newMainImage)
57+
58+
@AuthenticatedStaff
59+
@DeleteMapping("/facilities/{id}")
60+
fun deleteFacility(@PathVariable id: Long) = aboutService.deleteFacility(id)
61+
62+
@AuthenticatedStaff
63+
@PutMapping("/directions/{id}")
64+
fun updateDirection(@PathVariable id: Long, @RequestBody request: UpdateDescriptionReq) =
65+
aboutService.updateDirection(id, request)
66+
67+
@AuthenticatedStaff
68+
@PutMapping("/future-careers")
69+
fun updateFutureCareersPage(@RequestBody request: UpdateDescriptionReq) =
70+
aboutService.updateFutureCareersPage(request)
71+
72+
@AuthenticatedStaff
73+
@PostMapping("/future-careers/company")
74+
fun createCompany(@RequestBody request: CreateCompanyReq) = aboutService.createCompany(request)
75+
76+
@AuthenticatedStaff
77+
@PutMapping("/future-careers/company/{id}")
78+
fun updateCompany(@PathVariable id: Long, @RequestBody request: CreateCompanyReq) =
79+
aboutService.updateCompany(id, request)
80+
81+
@AuthenticatedStaff
82+
@DeleteMapping("/future-careers/company/{id}")
83+
fun deleteCompany(@PathVariable id: Long) = aboutService.deleteCompany(id)
84+
}

src/main/kotlin/com/wafflestudio/csereal/core/about/database/AboutEntity.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@ class AboutEntity(
2222
@Column(columnDefinition = "mediumText")
2323
var description: String,
2424

25-
var year: Int?,
26-
2725
@Column(columnDefinition = "TEXT")
2826
@Convert(converter = StringListConverter::class)
2927
var locations: MutableList<String> = mutableListOf(),
3028

3129
@OneToMany(mappedBy = "about", cascade = [CascadeType.ALL], orphanRemoval = true)
3230
var attachments: MutableList<AttachmentEntity> = mutableListOf(),
3331

34-
@OneToOne
32+
@OneToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL], orphanRemoval = true)
3533
var mainImage: MainImageEntity? = null,
3634

3735
@Column(columnDefinition = "TEXT")
@@ -52,7 +50,6 @@ class AboutEntity(
5250
language = languageType,
5351
name = aboutDto.name,
5452
description = aboutDto.description,
55-
year = aboutDto.year,
5653
locations = aboutDto.locations?.toMutableList() ?: mutableListOf(),
5754
searchContent = ""
5855
)

0 commit comments

Comments
 (0)