-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 소개 탭 CRUD * fix: 권한 체크 추가 * fix: 동아리 id 기준으로 로직 변경 * fix: 쿠키 same-site: strict * 리뷰 반영 * 리뷰 반영
- Loading branch information
Showing
19 changed files
with
471 additions
and
339 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/wafflestudio/csereal/core/about/api/req/CreateClubReq.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.wafflestudio.csereal.core.about.api.req | ||
|
||
data class CreateClubReq( | ||
val ko: ClubReqBody, | ||
val en: ClubReqBody | ||
) | ||
|
||
data class ClubReqBody( | ||
val name: String, | ||
val description: String | ||
) |
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/com/wafflestudio/csereal/core/about/api/req/CreateCompanyReq.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.wafflestudio.csereal.core.about.api.req | ||
|
||
data class CreateCompanyReq( | ||
val name: String, | ||
val url: String?, | ||
val year: Int | ||
) |
12 changes: 12 additions & 0 deletions
12
src/main/kotlin/com/wafflestudio/csereal/core/about/api/req/CreateFacReq.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.wafflestudio.csereal.core.about.api.req | ||
|
||
data class CreateFacReq( | ||
val ko: FacDto, | ||
val en: FacDto | ||
) | ||
|
||
data class FacDto( | ||
val name: String, | ||
val description: String, | ||
val locations: MutableList<String> | ||
) |
12 changes: 12 additions & 0 deletions
12
src/main/kotlin/com/wafflestudio/csereal/core/about/api/req/UpdateAboutReq.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.wafflestudio.csereal.core.about.api.req | ||
|
||
data class UpdateAboutReq( | ||
val ko: BasicAbout, | ||
val en: BasicAbout, | ||
val removeImage: Boolean | ||
) | ||
|
||
data class BasicAbout( | ||
val description: String, | ||
val deleteIds: List<Long> | ||
) |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/com/wafflestudio/csereal/core/about/api/req/UpdateClubReq.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.wafflestudio.csereal.core.about.api.req | ||
|
||
import com.wafflestudio.csereal.core.about.dto.ClubDto | ||
|
||
data class UpdateClubReq( | ||
val ko: ClubDto, | ||
val en: ClubDto, | ||
val removeImage: Boolean | ||
) |
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/com/wafflestudio/csereal/core/about/api/req/UpdateDescriptionReq.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.wafflestudio.csereal.core.about.api.req | ||
|
||
data class UpdateDescriptionReq( | ||
val koDescription: String, | ||
val enDescription: String | ||
) |
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/com/wafflestudio/csereal/core/about/api/req/UpdateFacReq.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.wafflestudio.csereal.core.about.api.req | ||
|
||
data class UpdateFacReq( | ||
val ko: FacDto, | ||
val en: FacDto, | ||
val removeImage: Boolean | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
src/main/kotlin/com/wafflestudio/csereal/core/about/api/v2/AboutController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.wafflestudio.csereal.core.about.api.v2 | ||
|
||
import com.wafflestudio.csereal.common.aop.AuthenticatedStaff | ||
import com.wafflestudio.csereal.core.about.api.req.* | ||
import com.wafflestudio.csereal.core.about.dto.GroupedClubDto | ||
import com.wafflestudio.csereal.core.about.service.AboutService | ||
import org.springframework.web.bind.annotation.* | ||
import org.springframework.web.multipart.MultipartFile | ||
|
||
@RequestMapping("/api/v2/about") | ||
@RestController | ||
class AboutController( | ||
private val aboutService: AboutService | ||
) { | ||
@GetMapping("/student-clubs") | ||
fun readAllClubs(): List<GroupedClubDto> = aboutService.readAllGroupedClubs() | ||
|
||
@AuthenticatedStaff | ||
@PostMapping("/student-clubs") | ||
fun createClub( | ||
@RequestPart request: CreateClubReq, | ||
@RequestPart mainImage: MultipartFile? | ||
) = aboutService.createClub(request, mainImage) | ||
|
||
@AuthenticatedStaff | ||
@PutMapping("/student-clubs") | ||
fun updateClub( | ||
@RequestPart request: UpdateClubReq, | ||
@RequestPart newMainImage: MultipartFile? | ||
) = aboutService.updateClub(request, newMainImage) | ||
|
||
@AuthenticatedStaff | ||
@DeleteMapping("/student-clubs/{id}") | ||
fun deleteClub(@PathVariable id: Long) = aboutService.deleteClub(id) | ||
|
||
@AuthenticatedStaff | ||
@PutMapping("/{postType}") | ||
fun updateAbout( | ||
@PathVariable postType: String, | ||
@RequestPart request: UpdateAboutReq, | ||
@RequestPart newMainImage: MultipartFile?, | ||
@RequestPart newAttachments: List<MultipartFile>? | ||
) = aboutService.updateAbout(postType, request, newMainImage, newAttachments) | ||
|
||
@AuthenticatedStaff | ||
@PostMapping("/facilities") | ||
fun createFacilities(@RequestPart request: CreateFacReq, @RequestPart mainImage: MultipartFile?) = | ||
aboutService.createFacilities(request, mainImage) | ||
|
||
@AuthenticatedStaff | ||
@PutMapping("/facilities/{id}") | ||
fun updateFacility( | ||
@PathVariable id: Long, | ||
@RequestPart request: UpdateFacReq, | ||
@RequestPart newMainImage: MultipartFile? | ||
) = aboutService.updateFacility(id, request, newMainImage) | ||
|
||
@AuthenticatedStaff | ||
@DeleteMapping("/facilities/{id}") | ||
fun deleteFacility(@PathVariable id: Long) = aboutService.deleteFacility(id) | ||
|
||
@AuthenticatedStaff | ||
@PutMapping("/directions/{id}") | ||
fun updateDirection(@PathVariable id: Long, @RequestBody request: UpdateDescriptionReq) = | ||
aboutService.updateDirection(id, request) | ||
|
||
@AuthenticatedStaff | ||
@PutMapping("/future-careers") | ||
fun updateFutureCareersPage(@RequestBody request: UpdateDescriptionReq) = | ||
aboutService.updateFutureCareersPage(request) | ||
|
||
@AuthenticatedStaff | ||
@PostMapping("/future-careers/company") | ||
fun createCompany(@RequestBody request: CreateCompanyReq) = aboutService.createCompany(request) | ||
|
||
@AuthenticatedStaff | ||
@PutMapping("/future-careers/company/{id}") | ||
fun updateCompany(@PathVariable id: Long, @RequestBody request: CreateCompanyReq) = | ||
aboutService.updateCompany(id, request) | ||
|
||
@AuthenticatedStaff | ||
@DeleteMapping("/future-careers/company/{id}") | ||
fun deleteCompany(@PathVariable id: Long) = aboutService.deleteCompany(id) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/com/wafflestudio/csereal/core/about/database/AboutLanguageEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.wafflestudio.csereal.core.about.database | ||
|
||
import com.wafflestudio.csereal.common.config.BaseTimeEntity | ||
import jakarta.persistence.* | ||
|
||
@Entity(name = "about_language") | ||
class AboutLanguageEntity( | ||
@OneToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL], orphanRemoval = true) | ||
@JoinColumn(name = "korean_id") | ||
val koAbout: AboutEntity, | ||
|
||
@OneToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL], orphanRemoval = true) | ||
@JoinColumn(name = "english_id") | ||
val enAbout: AboutEntity | ||
) : BaseTimeEntity() |
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/wafflestudio/csereal/core/about/database/AboutLanguageRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.wafflestudio.csereal.core.about.database | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository | ||
|
||
interface AboutLanguageRepository : JpaRepository<AboutLanguageEntity, Long> { | ||
fun findByKoAbout(koAboutEntity: AboutEntity): AboutLanguageEntity? | ||
fun findByEnAbout(enAboutEntity: AboutEntity): AboutLanguageEntity? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/com/wafflestudio/csereal/core/about/dto/GroupedClubDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.wafflestudio.csereal.core.about.dto | ||
|
||
import com.wafflestudio.csereal.core.about.database.AboutEntity | ||
|
||
data class GroupedClubDto( | ||
val ko: ClubDto, | ||
val en: ClubDto | ||
) | ||
|
||
data class ClubDto( | ||
val id: Long, | ||
val name: String, | ||
val description: String, | ||
val imageURL: String? | ||
) { | ||
companion object { | ||
fun of(aboutEntity: AboutEntity, imageURL: String?): ClubDto { | ||
return ClubDto(aboutEntity.id, aboutEntity.name!!, aboutEntity.description, imageURL) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.