add stage exporter

main 1.1.0
Rosalina 2023-03-07 13:33:59 -05:00
parent 3f31bc7ea9
commit 009e87d4ab
No known key found for this signature in database
3 changed files with 26 additions and 2 deletions

View File

@ -70,7 +70,8 @@
}, },
"npm": { "npm": {
"specifiers": { "specifiers": {
"mongodb": "mongodb@5.1.0" "mongodb": "mongodb@5.1.0",
"splatnet3-types": "splatnet3-types@0.2.20230227204004"
}, },
"packages": { "packages": {
"@types/node@18.14.2": { "@types/node@18.14.2": {
@ -143,6 +144,10 @@
"memory-pager": "memory-pager@1.5.0" "memory-pager": "memory-pager@1.5.0"
} }
}, },
"splatnet3-types@0.2.20230227204004": {
"integrity": "sha512-FAY6pbUcrp5O8c49BNXSKxoyM3UlCrRx2AtA9Y3qlvqOLdHqwxtzcdzbk1b1hRam8ZcrxRzE/ii6ESRiPIAnZw==",
"dependencies": {}
},
"tr46@3.0.0": { "tr46@3.0.0": {
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
"dependencies": { "dependencies": {

View File

@ -1,7 +1,7 @@
import type { StatInkPostBody, VsHistoryDetail } from "./types.ts"; import type { StatInkPostBody, VsHistoryDetail } from "./types.ts";
export const AGENT_NAME = "splashcat / s3si.ts"; export const AGENT_NAME = "splashcat / s3si.ts";
export const AGENT_VERSION = "1.0.1"; export const AGENT_VERSION = "1.1.0";
export const S3SI_VERSION = "0.3.1"; export const S3SI_VERSION = "0.3.1";
export const COMBINED_VERSION = `${AGENT_VERSION}/${S3SI_VERSION}`; export const COMBINED_VERSION = `${AGENT_VERSION}/${S3SI_VERSION}`;
export const NSOAPP_VERSION = "2.5.0"; export const NSOAPP_VERSION = "2.5.0";

View File

@ -5,6 +5,8 @@ import {
ExportResult, ExportResult,
Game, Game,
GameExporter, GameExporter,
Queries,
RespMap,
Summary, Summary,
VsHistoryDetail, VsHistoryDetail,
} from "../types.ts"; } from "../types.ts";
@ -110,4 +112,21 @@ export class MongoDBExporter implements GameExporter {
status: "success", status: "success",
}; };
} }
async exportStages(stages: RespMap[Queries.StageRecordQuery]["stageRecords"]["nodes"]): Promise<ExportResult> {
for (const stage of stages) {
await this.mongoDb.collection("stages").updateOne({
"stage.id": stage.id,
}, {
$set: stage,
}, {
upsert: true,
});
}
return {
status: "success",
}
}
} }