mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-27 09:23:03 +03:00
cleanup schemas
This commit is contained in:
@@ -11,7 +11,7 @@ export class AMServer extends Realm.Object<AMServer> implements AMServerInfoResp
|
||||
createdAt: Date;
|
||||
apiVersion: number;
|
||||
|
||||
async getInfo(abort?: AbortSignal | undefined): Promise<AMServerInfoResponse> {
|
||||
async getInfo(abort?: AbortSignal): Promise<AMServerInfoResponse> {
|
||||
try {
|
||||
const response = await fetch(this.serverAddress, {
|
||||
signal: abort
|
||||
@@ -23,7 +23,7 @@ export class AMServer extends Realm.Object<AMServer> implements AMServerInfoResp
|
||||
}
|
||||
}
|
||||
|
||||
async submitCard(cardId: string, abort?: AbortSignal | undefined): Promise<boolean> {
|
||||
async submitCard(cardId: string, abort?: AbortSignal): Promise<boolean> {
|
||||
try {
|
||||
const response = await fetch(`${this.serverAddress}/card`, {
|
||||
method: "POST",
|
||||
@@ -45,11 +45,13 @@ export class AMServer extends Realm.Object<AMServer> implements AMServerInfoResp
|
||||
static generate(serverAddress: string) {
|
||||
return {
|
||||
_id: new Realm.BSON.ObjectId(),
|
||||
apiVersion: 0,
|
||||
serverAddress,
|
||||
createdAt: new Date(),
|
||||
serverName: "New Server",
|
||||
lastUsed: null,
|
||||
apiVersion: 0
|
||||
|
||||
createdAt: new Date(),
|
||||
|
||||
lastUsed: null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,11 +61,11 @@ export class AMServer extends Realm.Object<AMServer> implements AMServerInfoResp
|
||||
|
||||
properties: {
|
||||
_id: "objectId",
|
||||
apiVersion: {type: "int", default: 0},
|
||||
serverAddress: "string",
|
||||
serverName: {type: "string", default: "New Server"},
|
||||
lastUsed: {type: "date", optional: true},
|
||||
createdAt: {type: "date", default: new Date()},
|
||||
apiVersion: {type: "int", default: 0}
|
||||
lastUsed: {type: "date", optional: true}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -6,5 +6,5 @@ import {AMServer} from "./AMServer";
|
||||
export default createRealmContext({
|
||||
schemaVersion: 1,
|
||||
schema: [AMCard, AMServer],
|
||||
deleteRealmIfMigrationNeeded: true
|
||||
deleteRealmIfMigrationNeeded: false
|
||||
});
|
||||
Reference in New Issue
Block a user