forked from wine-area/DMS-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
테스트용 api. url 권한은 설정하지 않았습니다. ㅇ .
- Loading branch information
Showing
8 changed files
with
109 additions
and
7 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
dms-core/src/main/kotlin/team/aliens/dms/domain/school/dto/CreateSchoolRequest.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,37 @@ | ||
package team.aliens.dms.domain.school.dto | ||
|
||
import java.time.LocalDate | ||
import java.util.UUID | ||
import team.aliens.dms.common.util.StringUtil | ||
import team.aliens.dms.domain.school.model.AvailableFeature | ||
import team.aliens.dms.domain.school.model.School | ||
|
||
class CreateSchoolRequest( | ||
val schoolName: String, | ||
val schoolAddress: String, | ||
val mealService: Boolean, | ||
val noticeService: Boolean, | ||
val pointService: Boolean, | ||
val studyRoomService: Boolean, | ||
val remainService: Boolean | ||
) { | ||
fun toSchool() = | ||
School( | ||
name = schoolName, | ||
code = StringUtil.randomNumber(School.SCHOOL_CODE_SIZE), | ||
question = "우리 학교 이름은?", | ||
answer = schoolName, | ||
address = schoolAddress, | ||
contractStartedAt = LocalDate.now() | ||
) | ||
|
||
fun toAvailableFeature(schoolId: UUID) = | ||
AvailableFeature( | ||
schoolId = schoolId, | ||
mealService = mealService, | ||
noticeService = noticeService, | ||
pointService = pointService, | ||
studyRoomService = studyRoomService, | ||
remainService = remainService | ||
) | ||
} |
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
3 changes: 3 additions & 0 deletions
3
dms-core/src/main/kotlin/team/aliens/dms/domain/school/service/CommandSchoolService.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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
package team.aliens.dms.domain.school.service | ||
|
||
import team.aliens.dms.domain.school.model.AvailableFeature | ||
import team.aliens.dms.domain.school.model.School | ||
|
||
interface CommandSchoolService { | ||
|
||
fun saveSchool(school: School): School | ||
|
||
fun saveAvailableFeature(availableFeature: AvailableFeature): AvailableFeature | ||
} |
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
3 changes: 3 additions & 0 deletions
3
dms-core/src/main/kotlin/team/aliens/dms/domain/school/spi/CommandSchoolPort.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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
package team.aliens.dms.domain.school.spi | ||
|
||
import team.aliens.dms.domain.school.model.AvailableFeature | ||
import team.aliens.dms.domain.school.model.School | ||
|
||
interface CommandSchoolPort { | ||
|
||
fun saveSchool(school: School): School | ||
|
||
fun saveAvailableFeature(availableFeature: AvailableFeature): AvailableFeature | ||
} |
21 changes: 21 additions & 0 deletions
21
dms-core/src/main/kotlin/team/aliens/dms/domain/school/usecase/CreateSchoolUseCase.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 team.aliens.dms.domain.school.usecase | ||
|
||
import team.aliens.dms.common.annotation.UseCase | ||
import team.aliens.dms.common.service.security.SecurityService | ||
import team.aliens.dms.domain.school.dto.CreateSchoolRequest | ||
import team.aliens.dms.domain.school.service.SchoolService | ||
|
||
@UseCase | ||
class CreateSchoolUseCase( | ||
private val schoolService: SchoolService, | ||
private val securityService: SecurityService | ||
) { | ||
|
||
fun execute(request: CreateSchoolRequest) { | ||
val school = schoolService.saveSchool( | ||
request.toSchool() | ||
) | ||
schoolService.saveAvailableFeature(request.toAvailableFeature(school.id)) | ||
securityService.createSchoolSecretBySchoolId(school.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
11 changes: 11 additions & 0 deletions
11
...ation/src/main/kotlin/team/aliens/dms/domain/school/dto/request/CreateSchoolWebRequest.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 team.aliens.dms.domain.school.dto.request | ||
|
||
class CreateSchoolWebRequest( | ||
val schoolName: String, | ||
val schoolAddress: String, | ||
val mealService: Boolean, | ||
val noticeService: Boolean, | ||
val pointService: Boolean, | ||
val studyRoomService: Boolean, | ||
val remainService: Boolean | ||
) |