diff --git a/deno.lock b/deno.lock index 370fed1..fe857dd 100644 --- a/deno.lock +++ b/deno.lock @@ -70,7 +70,8 @@ }, "npm": { "specifiers": { - "mongodb": "mongodb@5.1.0" + "mongodb": "mongodb@5.1.0", + "splatnet3-types": "splatnet3-types@0.2.20230227204004" }, "packages": { "@types/node@18.14.2": { @@ -143,6 +144,10 @@ "memory-pager": "memory-pager@1.5.0" } }, + "splatnet3-types@0.2.20230227204004": { + "integrity": "sha512-FAY6pbUcrp5O8c49BNXSKxoyM3UlCrRx2AtA9Y3qlvqOLdHqwxtzcdzbk1b1hRam8ZcrxRzE/ii6ESRiPIAnZw==", + "dependencies": {} + }, "tr46@3.0.0": { "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", "dependencies": { diff --git a/src/constant.ts b/src/constant.ts index 3061dc7..3aa1727 100644 --- a/src/constant.ts +++ b/src/constant.ts @@ -1,7 +1,7 @@ import type { StatInkPostBody, VsHistoryDetail } from "./types.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 COMBINED_VERSION = `${AGENT_VERSION}/${S3SI_VERSION}`; export const NSOAPP_VERSION = "2.5.0"; diff --git a/src/exporters/mongodb.ts b/src/exporters/mongodb.ts index d9e4b4a..87498d6 100644 --- a/src/exporters/mongodb.ts +++ b/src/exporters/mongodb.ts @@ -5,6 +5,8 @@ import { ExportResult, Game, GameExporter, + Queries, + RespMap, Summary, VsHistoryDetail, } from "../types.ts"; @@ -110,4 +112,21 @@ export class MongoDBExporter implements GameExporter { status: "success", }; } + + async exportStages(stages: RespMap[Queries.StageRecordQuery]["stageRecords"]["nodes"]): Promise { + + for (const stage of stages) { + await this.mongoDb.collection("stages").updateOne({ + "stage.id": stage.id, + }, { + $set: stage, + }, { + upsert: true, + }); + } + + return { + status: "success", + } + } }