-
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.
feat: support spanish keywords when handling input week ids (#21)
- Loading branch information
Showing
11 changed files
with
98 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ plugins { | |
} | ||
|
||
group 'es.sralloza' | ||
version '0.3.4' | ||
version '0.4.0' | ||
|
||
repositories { | ||
mavenCentral() | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package models; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
|
||
@Accessors(chain = true) | ||
@Data | ||
public class WeekId { | ||
@JsonProperty("week_id") | ||
private String weekId; | ||
} |
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,11 @@ | ||
package repositories; | ||
|
||
import models.WeekId; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
public interface ChoreManagementRepository { | ||
CompletableFuture<Void> skipWeek(String userId, String weekId); | ||
CompletableFuture<WeekId> skipWeek(String userId, String weekId); | ||
|
||
CompletableFuture<Void> unSkipWeek(String userId, String weekId); | ||
CompletableFuture<WeekId> unSkipWeek(String userId, String weekId); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package utils; | ||
|
||
import java.util.Map; | ||
import java.util.function.Function; | ||
|
||
public class Internationalization { | ||
public static Map<String, String> WEEK_ID_KEYWORDS_MAP = Map.of( | ||
"actual", "current", "anterior", "last", "siguiente", "next" | ||
); | ||
|
||
public static String translateWeekId(String weekId) { | ||
return WEEK_ID_KEYWORDS_MAP.entrySet().stream() | ||
.map(param -> (Function<String, String>) s -> s.replace(param.getKey(), param.getValue())) | ||
.reduce(Function.identity(), Function::andThen) | ||
.apply(weekId); | ||
} | ||
} |