mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-25 02:57:30 +00:00
Stub out integrity check
This commit is contained in:
parent
915ba85c8a
commit
986aecc708
2 changed files with 51 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ import { scrapeLikeData } from "./tasks/scrapeLikes";
|
|||
import { screenshot } from "./tasks/screenshotSkin";
|
||||
import Shooter from "./shooter";
|
||||
import UserContext from "./data/UserContext";
|
||||
import { integrityCheck } from "./tasks/integrityCheck";
|
||||
|
||||
async function main() {
|
||||
const client = new Discord.Client();
|
||||
|
|
@ -23,6 +24,9 @@ async function main() {
|
|||
|
||||
try {
|
||||
switch (argv._[0]) {
|
||||
case "integity-check":
|
||||
await integrityCheck();
|
||||
break;
|
||||
case "screenshot": {
|
||||
const md5 = argv._[1] || (await Skins.getSkinToShoot());
|
||||
if (md5 == null) {
|
||||
|
|
|
|||
47
packages/skin-database/tasks/integrityCheck.ts
Normal file
47
packages/skin-database/tasks/integrityCheck.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { knex } from "../db";
|
||||
|
||||
export async function integrityCheck(): Promise<void> {
|
||||
await skinsWithoutFiles();
|
||||
await filesWithoutSkins();
|
||||
await reviewsWithoutSkins();
|
||||
console.log("Done.");
|
||||
}
|
||||
|
||||
async function skinsWithoutFiles(): Promise<void> {
|
||||
console.log("Checking for skins without files...");
|
||||
const result = await knex("skins")
|
||||
.leftJoin("files", "skins.md5", "=", "files.skin_md5")
|
||||
.where("files.skin_md5", null)
|
||||
.select(["md5"]);
|
||||
if (result.length > 0) {
|
||||
console.warn(`Found ${result.length} skins without files`);
|
||||
} else {
|
||||
console.log("None found.");
|
||||
}
|
||||
}
|
||||
|
||||
async function filesWithoutSkins(): Promise<void> {
|
||||
console.log("Checking for files without skins...");
|
||||
const result = await knex("files")
|
||||
.leftJoin("skins", "skins.md5", "=", "files.skin_md5")
|
||||
.where("skins.md5", null)
|
||||
.select(["files.skin_md5"]);
|
||||
if (result.length > 0) {
|
||||
console.warn(`Found ${result.length} files without skins`);
|
||||
} else {
|
||||
console.log("None found.");
|
||||
}
|
||||
}
|
||||
|
||||
async function reviewsWithoutSkins(): Promise<void> {
|
||||
console.log("Checking for reviews without skins...");
|
||||
const result = await knex("skin_reviews")
|
||||
.leftJoin("skins", "skins.md5", "=", "skin_reviews.skin_md5")
|
||||
.where("skins.md5", null)
|
||||
.select(["skin_reviews.skin_md5"]);
|
||||
if (result.length > 0) {
|
||||
console.warn(`Found ${result.length} reviews without skins`);
|
||||
} else {
|
||||
console.log("None found.");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue