-
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.
- Loading branch information
1 parent
55d45f5
commit 303093d
Showing
9 changed files
with
99 additions
and
45 deletions.
There are no files selected for viewing
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: 9 additions & 0 deletions
9
src/main/kotlin/com/hero/alignlab/domain/group/application/JoinCodeGenerator.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.hero.alignlab.domain.group.application | ||
|
||
import java.util.* | ||
|
||
object JoinCodeGenerator { | ||
fun joinCode(code: String? = null): String { | ||
return code ?: UUID.randomUUID().toString().replace("-", "") | ||
} | ||
} |
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/hero/alignlab/domain/group/model/CreateGroupContext.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.hero.alignlab.domain.group.model | ||
|
||
import com.hero.alignlab.domain.auth.model.AuthUser | ||
import com.hero.alignlab.domain.group.application.JoinCodeGenerator | ||
import com.hero.alignlab.domain.group.domain.Group | ||
import com.hero.alignlab.domain.group.model.request.CreateGroupRequest | ||
|
||
class CreateGroupContext( | ||
private val user: AuthUser, | ||
private val request: CreateGroupRequest, | ||
) { | ||
fun create(): Group { | ||
return Group( | ||
name = request.name, | ||
description = request.description, | ||
ownerUid = user.uid, | ||
isHidden = request.isHidden, | ||
joinCode = JoinCodeGenerator.joinCode(request.joinCode) | ||
) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/com/hero/alignlab/domain/group/model/UpdateGroupContext.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,19 @@ | ||
package com.hero.alignlab.domain.group.model | ||
|
||
import com.hero.alignlab.domain.group.application.JoinCodeGenerator | ||
import com.hero.alignlab.domain.group.domain.Group | ||
import com.hero.alignlab.domain.group.model.request.UpdateGroupRequest | ||
|
||
class UpdateGroupContext( | ||
private val before: Group, | ||
private val request: UpdateGroupRequest, | ||
) { | ||
fun update(): Group { | ||
return this.before.apply { | ||
this.name = request.name | ||
this.description = request.description | ||
this.isHidden = request.isHidden | ||
this.joinCode = JoinCodeGenerator.joinCode(request.joinCode) | ||
} | ||
} | ||
} |
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