move "most recent card used" tracking to separate table

This commit is contained in:
ppc
2025-03-29 10:21:09 +00:00
parent f2550a84e0
commit 1b73b60efa
6 changed files with 117 additions and 33 deletions
+37
View File
@@ -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}
}
}
}