-
Notifications
You must be signed in to change notification settings - Fork 1
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
74a4ada
commit 0839831
Showing
76 changed files
with
320 additions
and
279 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
4 changes: 2 additions & 2 deletions
4
app/src/main/java/com/jcaique/dialetus/DialetusApplication.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
14 changes: 0 additions & 14 deletions
14
data/src/main/java/com/jcaique/data/mappers/DialectsMapper.kt
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
data/src/main/java/com/jcaique/data/service/dialects/DialectsInfrastructure.kt
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
data/src/main/java/com/jcaique/data/service/regions/RegionsInfrastructure.kt
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
.../src/main/java/com/jcaique/data/Consts.kt → .../java/com/jcaique/dialetus/data/Consts.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
18 changes: 9 additions & 9 deletions
18
...ain/java/com/jcaique/data/di/injection.kt → ...com/jcaique/dialetus/data/di/injection.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
20 changes: 20 additions & 0 deletions
20
data/src/main/java/com/jcaique/dialetus/data/mappers/DialectsMapper.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,20 @@ | ||
package com.jcaique.dialetus.data.mappers | ||
|
||
import com.jcaique.dialetus.data.responses.DialectResponse | ||
import com.jcaique.dialetus.domain.models.Dialect | ||
import com.jcaique.dialetus.domain.models.DialectSlug | ||
|
||
internal object DialectsMapper { | ||
|
||
fun toDomain(response: DialectResponse): Dialect = | ||
Dialect( | ||
response.slug, | ||
response.dialect, | ||
response.meanings, | ||
response.examples | ||
) | ||
|
||
fun toDomain(response: Map.Entry<String, List<DialectResponse>>): Pair<DialectSlug, List<Dialect>> = | ||
DialectSlug(response.key) to response.value.map( | ||
DialectsMapper::toDomain) | ||
} |
9 changes: 9 additions & 0 deletions
9
data/src/main/java/com/jcaique/dialetus/data/mappers/RegionsMapper.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.jcaique.dialetus.data.mappers | ||
|
||
import com.jcaique.dialetus.data.responses.RegionResponse | ||
import com.jcaique.dialetus.domain.models.Region | ||
|
||
internal object RegionsMapper { | ||
fun toDomain(response: RegionResponse): Region = | ||
Region(response.name, response.total) | ||
} |
7 changes: 5 additions & 2 deletions
7
...aique/data/networking/ExecutionHandler.kt → ...letus/data/networking/ExecutionHandler.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
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
2 changes: 1 addition & 1 deletion
2
...e/data/networking/OkHttpClientProvider.kt → ...s/data/networking/OkHttpClientProvider.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
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
6 changes: 3 additions & 3 deletions
6
...a/networking/SerializationErrorHandler.kt → ...a/networking/SerializationErrorHandler.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
2 changes: 1 addition & 1 deletion
2
...jcaique/data/responses/DialectResponse.kt → ...ialetus/data/responses/DialectResponse.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
2 changes: 1 addition & 1 deletion
2
.../jcaique/data/responses/RegionResponse.kt → ...dialetus/data/responses/RegionResponse.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
6 changes: 3 additions & 3 deletions
6
...m/jcaique/data/service/DialetusGateway.kt → .../dialetus/data/service/DialetusGateway.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
25 changes: 25 additions & 0 deletions
25
data/src/main/java/com/jcaique/dialetus/data/service/dialects/DialectsInfrastructure.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,25 @@ | ||
package com.jcaique.dialetus.data.service.dialects | ||
|
||
import com.jcaique.dialetus.data.mappers.DialectsMapper | ||
import com.jcaique.dialetus.data.networking.executionHandler | ||
import com.jcaique.dialetus.data.service.DialetusGateway | ||
import com.jcaique.dialetus.domain.dialects.DialectsService | ||
import com.jcaique.dialetus.domain.models.Dialect | ||
import com.jcaique.dialetus.domain.models.DialectSlug | ||
|
||
internal class DialectsInfrastructure(private val api: DialetusGateway) : | ||
DialectsService { | ||
|
||
override suspend fun getDialectsBy(region: String): List<Dialect> = | ||
executionHandler { | ||
api.getDialectsBy(region) | ||
.map(DialectsMapper::toDomain) | ||
} | ||
|
||
override suspend fun searchDialects(query: String): Map<DialectSlug, List<Dialect>> = | ||
executionHandler { | ||
api.searchDialects(query) | ||
.map(DialectsMapper::toDomain) | ||
.toMap() | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
data/src/main/java/com/jcaique/dialetus/data/service/regions/RegionsInfrastructure.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,16 @@ | ||
package com.jcaique.dialetus.data.service.regions | ||
|
||
import com.jcaique.dialetus.data.mappers.RegionsMapper | ||
import com.jcaique.dialetus.data.networking.executionHandler | ||
import com.jcaique.dialetus.data.service.DialetusGateway | ||
import com.jcaique.dialetus.domain.models.Region | ||
import com.jcaique.dialetus.domain.regions.RegionsService | ||
|
||
internal class RegionsInfrastructure(private val api: DialetusGateway) : | ||
RegionsService { | ||
|
||
override suspend fun fetchRegions(): List<Region> = | ||
executionHandler { | ||
api.fetchRegions().map { RegionsMapper.toDomain(it) } | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
.../com/jcaique/data/common/SetupScenario.kt → ...que/dialetus/data/common/SetupScenario.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
2 changes: 1 addition & 1 deletion
2
...aique/data/common/read_file_extensions.kt → ...letus/data/common/read_file_extensions.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,4 +1,4 @@ | ||
package com.jcaique.data.common | ||
package com.jcaique.dialetus.data.common | ||
|
||
internal fun Any.loadFile(path: String) = | ||
this.javaClass.classLoader.getResourceAsStream(path).bufferedReader().use { it.readText() } |
14 changes: 7 additions & 7 deletions
14
...a/dialects/DialectsInfrastructureTests.kt → ...a/dialects/DialectsInfrastructureTests.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
12 changes: 6 additions & 6 deletions
12
...data/regions/RegionsInfrastructureTest.kt → ...data/regions/RegionsInfrastructureTest.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
6 changes: 3 additions & 3 deletions
6
...caique/domain/dialects/DialectsService.kt → ...aletus/domain/dialects/DialectsService.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
2 changes: 1 addition & 1 deletion
2
...jcaique/domain/errors/ErrorTransformer.kt → ...ialetus/domain/errors/ErrorTransformer.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
2 changes: 1 addition & 1 deletion
2
...domain/errors/GatewayIntegrationIssues.kt → ...domain/errors/GatewayIntegrationIssues.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
3 changes: 3 additions & 0 deletions
3
domain/src/main/java/com/jcaique/dialetus/domain/errors/UnexpectedResponse.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,3 @@ | ||
package com.jcaique.dialetus.domain.errors | ||
|
||
object UnexpectedResponse : Throwable() |
2 changes: 1 addition & 1 deletion
2
...java/com/jcaique/domain/models/Dialect.kt → ...jcaique/dialetus/domain/models/Dialect.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,4 +1,4 @@ | ||
package com.jcaique.domain.models | ||
package com.jcaique.dialetus.domain.models | ||
|
||
import java.io.Serializable | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
.../com/jcaique/domain/models/DialectSlug.kt → ...que/dialetus/domain/models/DialectSlug.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,4 +1,4 @@ | ||
package com.jcaique.domain.models | ||
package com.jcaique.dialetus.domain.models | ||
|
||
import java.io.Serializable | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
.../java/com/jcaique/domain/models/Region.kt → .../jcaique/dialetus/domain/models/Region.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,4 +1,4 @@ | ||
package com.jcaique.domain.models | ||
package com.jcaique.dialetus.domain.models | ||
|
||
import java.io.Serializable | ||
|
||
|
8 changes: 8 additions & 0 deletions
8
domain/src/main/java/com/jcaique/dialetus/domain/regions/RegionsService.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,8 @@ | ||
package com.jcaique.dialetus.domain.regions | ||
|
||
import com.jcaique.dialetus.domain.models.Region | ||
|
||
interface RegionsService { | ||
|
||
suspend fun fetchRegions(): List<Region> | ||
} |
3 changes: 0 additions & 3 deletions
3
domain/src/main/java/com/jcaique/domain/errors/UnexpectedResponse.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.