feat: add challenge types

This commit is contained in:
zkldi
2022-07-02 20:43:54 +01:00
parent 81931874ba
commit b68f368693
2 changed files with 37 additions and 0 deletions
+1
View File
@@ -10,4 +10,5 @@ export const ALL_PERMISSIONS: Record<APIPermissions, true> = {
manage_rivals: true,
manage_targets: true,
submit_score: true,
manage_challenges: true,
};
+36
View File
@@ -1392,6 +1392,7 @@ export type APIPermissions =
| "customise_score"
| "customise_session"
| "delete_score"
| "manage_challenges"
| "manage_rivals"
| "manage_targets"
| "submit_score";
@@ -1579,6 +1580,19 @@ interface BaseNotification {
}
export type NotificationBody =
| {
type: "CHALLENGE_BEAT";
content: {
userID: integer;
challengeSub: ChallengeSubscriptionDocument;
};
}
| {
type: "CHALLENGE_RECEIVED";
content: {
challenge: ChallengeWallDocument;
};
}
| {
type: "MILESTONE_CHANGED"; // Emitted when a milestone the user is subscribed to changed.
content: {
@@ -1597,3 +1611,25 @@ export type NotificationBody =
export type NotificationDocument = BaseNotification & {
body: NotificationBody;
};
export interface ChallengeSubscriptionDocument {
chartID: string;
authorID: integer;
type: "lamp" | "score";
game: Game;
playtype: Playtype;
userID: integer;
achieved: boolean;
achievedAt: number | null;
}
export interface ChallengeWallDocument {
chartID: string;
authorID: integer;
type: "lamp" | "score";
game: Game;
playtype: Playtype;
}