mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-10-06 21:58:06 +03:00
move "most recent card used" tracking to separate table
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import {Realm} from "realm";
|
||||
import {AMCard} from "./AMCard";
|
||||
|
||||
/**
|
||||
* Represents a usage of a card for determining which card was last used on a specific game.
|
||||
*/
|
||||
export class AMCardRecentUse extends Realm.Object<AMCardRecentUse> {
|
||||
|
||||
/**
|
||||
* The game id that is being tracked
|
||||
*/
|
||||
gameId: string;
|
||||
|
||||
/**
|
||||
* The card that was last used on the game.
|
||||
* If the card is removed, this record will also be removed.
|
||||
*/
|
||||
card: AMCard;
|
||||
|
||||
static generate(gameId: string, card: AMCard) {
|
||||
return {
|
||||
gameId: gameId,
|
||||
card: card
|
||||
};
|
||||
}
|
||||
|
||||
static schema: Realm.ObjectSchema = {
|
||||
name: "cardUsageHistory",
|
||||
primaryKey: "gameId",
|
||||
|
||||
properties: {
|
||||
gameId: "string",
|
||||
card: {type: "object", objectType: "card", optional: false}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user