-
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.
Story #4: introduce language parameter to the API
- Loading branch information
Showing
18 changed files
with
102 additions
and
67 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
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
12 changes: 12 additions & 0 deletions
12
core/src/main/kotlin/io/granito/segovia/core/model/Lang.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 io.granito.segovia.core.model | ||
|
||
fun langFrom(code: String) = Lang.valueOf(code.uppercase()) | ||
|
||
enum class Lang { | ||
EN, | ||
ES, | ||
FR, | ||
IT; | ||
|
||
override fun toString() = name.lowercase() | ||
} |
4 changes: 2 additions & 2 deletions
4
core/src/main/kotlin/io/granito/segovia/core/model/Sentence.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,5 +1,5 @@ | ||
package io.granito.segovia.core.model | ||
|
||
class Sentence(val id: Slug, val text: String) { | ||
constructor(text: String): this(Slug.of(text), text) | ||
class Sentence(val lang: Lang, val id: Slug, val text: String) { | ||
constructor(lang: Lang, text: String): this(lang, Slug.of(text), text) | ||
} |
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: 2 additions & 1 deletion
3
core/src/main/kotlin/io/granito/segovia/core/usecase/CreateSentenceCase.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,9 @@ | ||
package io.granito.segovia.core.usecase | ||
|
||
import io.granito.segovia.core.model.Lang | ||
import io.granito.segovia.core.model.Sentence | ||
import reactor.core.publisher.Mono | ||
|
||
interface CreateSentenceCase { | ||
fun create(text: String): Mono<Sentence> | ||
fun create(lang: Lang, text: String): Mono<Sentence> | ||
} |
3 changes: 2 additions & 1 deletion
3
core/src/main/kotlin/io/granito/segovia/core/usecase/FetchSentenceCase.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,9 +1,10 @@ | ||
package io.granito.segovia.core.usecase | ||
|
||
import io.granito.segovia.core.model.Lang | ||
import io.granito.segovia.core.model.Sentence | ||
import io.granito.segovia.core.model.Slug | ||
import reactor.core.publisher.Mono | ||
|
||
interface FetchSentenceCase { | ||
fun fetch(id: Slug): Mono<Sentence> | ||
fun fetch(lang: Lang, id: Slug): Mono<Sentence> | ||
} |
3 changes: 2 additions & 1 deletion
3
core/src/main/kotlin/io/granito/segovia/core/usecase/SearchSentencesCase.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,9 @@ | ||
package io.granito.segovia.core.usecase | ||
|
||
import io.granito.segovia.core.model.Lang | ||
import io.granito.segovia.core.model.Sentence | ||
import reactor.core.publisher.Flux | ||
|
||
interface SearchSentencesCase { | ||
fun search(): Flux<Sentence> | ||
fun search(lang: Lang): Flux<Sentence> | ||
} |
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
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
Oops, something went wrong.