-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create tag on clicking fab in form dialog
- Loading branch information
1 parent
e316e64
commit 522bb7b
Showing
6 changed files
with
44 additions
and
14 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
19 changes: 19 additions & 0 deletions
19
shared/src/commonMain/kotlin/com/faltenreich/diaguard/tag/form/CreateTagUseCase.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.faltenreich.diaguard.tag.form | ||
|
||
import com.faltenreich.diaguard.shared.datetime.DateTimeFactory | ||
import com.faltenreich.diaguard.tag.TagRepository | ||
|
||
class CreateTagUseCase( | ||
private val repository: TagRepository, | ||
private val dateTimeFactory: DateTimeFactory, | ||
) { | ||
|
||
operator fun invoke(name: String) { | ||
val now = dateTimeFactory.now() | ||
repository.create( | ||
createdAt = now, | ||
updatedAt = now, | ||
name = name, | ||
) | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
shared/src/commonMain/kotlin/com/faltenreich/diaguard/tag/list/TagListIntent.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,10 @@ | ||
package com.faltenreich.diaguard.tag.list | ||
|
||
sealed interface TagListIntent { | ||
|
||
data object OpenForm : TagListIntent | ||
|
||
data object CloseForm : TagListIntent | ||
|
||
data class Submit(val name: String) : TagListIntent | ||
} |
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