-
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.
Merge pull request #101 from ASAP-Lettering/ASAP-238
ASAP-238 refactor: 스페이스 이벤트를 도메인 안에 저장한 다음 영속화할 때 배포하도록 수정
- Loading branch information
Showing
11 changed files
with
140 additions
and
97 deletions.
There are no files selected for viewing
6 changes: 0 additions & 6 deletions
6
Application-Module/src/main/kotlin/com/asap/application/space/event/SpaceDeletedEvent.kt
This file was deleted.
Oops, something went wrong.
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
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
9 changes: 5 additions & 4 deletions
9
Domain-Module/src/main/kotlin/com/asap/domain/space/entity/IndexedSpace.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
24 changes: 18 additions & 6 deletions
24
Domain-Module/src/main/kotlin/com/asap/domain/space/entity/Space.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,25 +1,37 @@ | ||
package com.asap.domain.space.entity | ||
|
||
import com.asap.domain.common.Aggregate | ||
import com.asap.domain.common.DomainId | ||
import com.asap.domain.space.event.SpaceEvent | ||
|
||
data class Space( | ||
val id: DomainId = DomainId.generate(), | ||
class Space( | ||
id: DomainId, | ||
val userId: DomainId, | ||
val name: String, | ||
var name: String, | ||
val templateType: Int, | ||
) { | ||
) : Aggregate<Space>(id) { | ||
companion object { | ||
fun create( | ||
id: DomainId = DomainId.generate(), | ||
userId: DomainId, | ||
name: String, | ||
templateType: Int, | ||
): Space = | ||
Space( | ||
id = id, | ||
userId = userId, | ||
name = name, | ||
templateType = templateType, | ||
) | ||
).also { | ||
it.registerEvent(SpaceEvent.SpaceCreatedEvent(it)) | ||
} | ||
} | ||
|
||
fun updateName(name: String): Space = this.copy(name = name) | ||
fun updateName(name: String) { | ||
this.name = name | ||
} | ||
|
||
fun delete() { | ||
this.registerEvent(SpaceEvent.SpaceDeletedEvent(this)) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Domain-Module/src/main/kotlin/com/asap/domain/space/event/SpaceEvent.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,14 @@ | ||
package com.asap.domain.space.event | ||
|
||
import com.asap.domain.common.DomainEvent | ||
import com.asap.domain.space.entity.Space | ||
|
||
sealed class SpaceEvent : DomainEvent<Space> { | ||
data class SpaceCreatedEvent( | ||
val space: Space, | ||
) : SpaceEvent() | ||
|
||
data class SpaceDeletedEvent( | ||
val space: Space, | ||
) : SpaceEvent() | ||
} |
Oops, something went wrong.