Compare commits
No commits in common. "93b360d5b2125ccc854e762de418885068936657" and "0d647254e0adfffbe826e09b908e40c10dc5ffa7" have entirely different histories.
93b360d5b2
...
0d647254e0
16
deno.lock
16
deno.lock
|
|
@ -69,9 +69,7 @@
|
||||||
"https://deno.land/x/ts_essentials@v9.1.2/mod.ts": "ffae461c16d4a1bf24c2179582ab8d5c81ad0df61e4ae2fba51ef5e5bdf90345"
|
"https://deno.land/x/ts_essentials@v9.1.2/mod.ts": "ffae461c16d4a1bf24c2179582ab8d5c81ad0df61e4ae2fba51ef5e5bdf90345"
|
||||||
},
|
},
|
||||||
"npm": {
|
"npm": {
|
||||||
"specifiers": {
|
"specifiers": { "mongodb": "mongodb@5.1.0" },
|
||||||
"mongodb": "mongodb@5.1.0"
|
|
||||||
},
|
|
||||||
"packages": {
|
"packages": {
|
||||||
"@types/node@18.14.2": {
|
"@types/node@18.14.2": {
|
||||||
"integrity": "sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA==",
|
"integrity": "sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA==",
|
||||||
|
|
@ -122,9 +120,7 @@
|
||||||
},
|
},
|
||||||
"saslprep@1.0.3": {
|
"saslprep@1.0.3": {
|
||||||
"integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
|
"integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
|
||||||
"dependencies": {
|
"dependencies": { "sparse-bitfield": "sparse-bitfield@3.0.3" }
|
||||||
"sparse-bitfield": "sparse-bitfield@3.0.3"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"smart-buffer@4.2.0": {
|
"smart-buffer@4.2.0": {
|
||||||
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
|
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
|
||||||
|
|
@ -139,15 +135,11 @@
|
||||||
},
|
},
|
||||||
"sparse-bitfield@3.0.3": {
|
"sparse-bitfield@3.0.3": {
|
||||||
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
|
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
|
||||||
"dependencies": {
|
"dependencies": { "memory-pager": "memory-pager@1.5.0" }
|
||||||
"memory-pager": "memory-pager@1.5.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"tr46@3.0.0": {
|
"tr46@3.0.0": {
|
||||||
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
|
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
|
||||||
"dependencies": {
|
"dependencies": { "punycode": "punycode@2.3.0" }
|
||||||
"punycode": "punycode@2.3.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"webidl-conversions@7.0.0": {
|
"webidl-conversions@7.0.0": {
|
||||||
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
|
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
|
||||||
|
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
import { MongoDB } from "../deps.ts";
|
|
||||||
import { DEFAULT_ENV } from "../src/env.ts";
|
|
||||||
import { MongoDBExporter } from "../src/exporters/mongodb.ts";
|
|
||||||
import { FileStateBackend, Profile } from "../src/state.ts";
|
|
||||||
|
|
||||||
const env = DEFAULT_ENV;
|
|
||||||
const stateBackend = new FileStateBackend("./profile.json");
|
|
||||||
const profile = new Profile({ stateBackend, env });
|
|
||||||
await profile.readState();
|
|
||||||
|
|
||||||
if (!profile.state.mongoDbUri) {
|
|
||||||
console.error("MongoDB URI not set");
|
|
||||||
Deno.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mongoDbClient = new MongoDB.MongoClient(profile.state.mongoDbUri);
|
|
||||||
const battlesCollection = mongoDbClient.db("splashcat").collection("battles");
|
|
||||||
|
|
||||||
const filter = {
|
|
||||||
"splatNetData.playedTime": {
|
|
||||||
$type: "string"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const cursor = battlesCollection.find(filter);
|
|
||||||
|
|
||||||
const oldDocuments = await battlesCollection.countDocuments(filter);
|
|
||||||
|
|
||||||
console.log(`Found ${oldDocuments} old battles to update...`);
|
|
||||||
|
|
||||||
for await (const doc of cursor) {
|
|
||||||
const { splatNetData, _id } = doc;
|
|
||||||
|
|
||||||
await battlesCollection.updateOne({ _id }, { "$set": {
|
|
||||||
"splatNetData.playedTime": new Date(splatNetData.playedTime),
|
|
||||||
}});
|
|
||||||
|
|
||||||
console.log(`Updated ${splatNetData.playedTime} to ${new Date(splatNetData.playedTime)}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Done!")
|
|
||||||
|
|
@ -63,7 +63,7 @@ export class MongoDBExporter implements GameExporter {
|
||||||
const body:
|
const body:
|
||||||
{
|
{
|
||||||
data: Game,
|
data: Game,
|
||||||
splatNetData: Omit<(VsHistoryDetail | CoopHistoryDetail), "playedTime"> & { playedTime: Date },
|
splatNetData: VsHistoryDetail | CoopHistoryDetail,
|
||||||
gameId: string,
|
gameId: string,
|
||||||
} & typeof common = {
|
} & typeof common = {
|
||||||
...common,
|
...common,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue