Skip to content

Commit

Permalink
feat(getAchievementUnlocks): add new query params (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
gboquizosanchez authored Jun 17, 2024
1 parent 8d88387 commit 29d9910
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/achievement/getAchievementUnlocks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe("Function: getAchievementUnlocks", () => {
{
User: "Tiotroll2022",
RAPoints: "348",
RASoftcorePoints: "363",
DateAwarded: "2023-01-29 21:45:41",
HardcoreMode: "0",
},
Expand Down Expand Up @@ -91,6 +92,7 @@ describe("Function: getAchievementUnlocks", () => {
{
user: "Tiotroll2022",
raPoints: 348,
raSoftcorePoints: 363,
dateAwarded: "2023-01-29 21:45:41",
hardcoreMode: false,
},
Expand Down
8 changes: 7 additions & 1 deletion src/achievement/getAchievementUnlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ export const getAchievementUnlocks = async (
const rawResponse = await call<GetAchievementUnlocksResponse>({ url });

return serializeProperties(rawResponse, {
shouldCastToNumbers: ["ID", "Points", "TrueRatio", "RAPoints"],
shouldCastToNumbers: [
"ID",
"Points",
"TrueRatio",
"RAPoints",
"RASoftcorePoints",
],
shouldMapToBooleans: ["HardcoreMode"],
});
};
1 change: 1 addition & 0 deletions src/achievement/models/achievement-unlock-entity.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface AchievementUnlockEntity {
user: string;
raPoints: number;
raSoftcorePoints: number;
dateAwarded: string;
hardcoreMode: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
interface AchievementUnlocksResponseEntity {
User: string;
RAPoints: string;
RASoftcorePoints: string;
DateAwarded: string;
HardcoreMode: string;
}
Expand Down
4 changes: 4 additions & 0 deletions src/feed/getAchievementOfTheWeek.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe("Function: getAchievementOfTheWeek", () => {
{
User: "Tirbaba2",
RAPoints: "72",
RASoftcorePoints: "72",
DateAwarded: "2022-10-10 01:42:19",
HardcoreMode: "1",
},
Expand Down Expand Up @@ -91,6 +92,7 @@ describe("Function: getAchievementOfTheWeek", () => {
{
user: "Tirbaba2",
raPoints: 72,
raSoftcorePoints: 72,
dateAwarded: "2022-10-10 01:42:19",
hardcoreMode: true,
},
Expand Down Expand Up @@ -131,6 +133,7 @@ describe("Function: getAchievementOfTheWeek", () => {
{
User: "Tirbaba2",
RAPoints: "72",
RASoftcorePoints: "72",
DateAwarded: "2022-10-10 01:42:19",
HardcoreMode: "0",
},
Expand Down Expand Up @@ -169,6 +172,7 @@ describe("Function: getAchievementOfTheWeek", () => {
{
user: "Tirbaba2",
raPoints: 72,
raSoftcorePoints: 72,
dateAwarded: "2022-10-10 01:42:19",
hardcoreMode: false,
},
Expand Down
4 changes: 3 additions & 1 deletion src/feed/getAchievementOfTheWeek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ import type {
* unlocks: [
* {
* user: "Tirbaba2",
* rAPoints: "72",
* raPoints: "72",
* raSoftcorePoints: "72",
* dateAwarded: "2022-10-10 01:42:19",
* hardcoreMode: "1"
* }
Expand All @@ -75,6 +76,7 @@ export const getAchievementOfTheWeek = async (
"TrueRatio",
"TotalPlayers",
"RAPoints",
"RASoftcorePoints",
"UnlocksCount",
],
shouldMapToBooleans: ["HardcoreMode"],
Expand Down
1 change: 1 addition & 0 deletions src/feed/models/achievement-of-the-week.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface AchievementOfTheWeek {
unlocks: Array<{
user: string;
raPoints: number;
raSoftcorePoints: number;
dateAwarded: string;
hardcoreMode: boolean;
}>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface GetAchievementOfTheWeekResponse {
Unlocks: Array<{
User: string;
RAPoints: string;
RASoftcorePoints: string;
DateAwarded: string;
HardcoreMode: string;
}>;
Expand Down

0 comments on commit 29d9910

Please sign in to comment.