remove user

This commit is contained in:
2026-03-17 14:14:04 +01:00
parent 8e1df92813
commit 661d5a2a77
9 changed files with 14 additions and 177 deletions

View File

@@ -1,7 +1,6 @@
import { type Request, type Response } from "express";
import UserModel, { values } from '../models/userModel';
import MediaModel, { Table, Media } from '../models/mediaModel';
import mediaModel from "../models/mediaModel";
interface omdbRes {
Title: string,
@@ -13,7 +12,14 @@ interface omdbRes {
Year: string,
}
function fromStringToTable(value: string): (Table | undefined) {
function fromStringToTable(input: string | string[]): (Table | undefined) {
var value = "";
if (Array.isArray(input)) {
value = input[0];
}
else {
value = input;
}
if (value.localeCompare("games") == 0) return Table.games;
if (value.localeCompare("movies") == 0) return Table.movies;
if (value.localeCompare("series") == 0) return Table.series;
@@ -218,22 +224,22 @@ async function checkImages() {
await checkTableImages(Table.movies);
await checkTableImages(Table.series);
}
function delay(time:number) {
function delay(time: number) {
return new Promise(resolve => setTimeout(resolve, time));
}
}
async function checkTableImages(table: Table) {
const list = mediaModel.find(table);
const list = MediaModel.find(table);
for (const element of list) {
const path = "./public/" + element.webImg;
const f = Bun.file(path);
const exists = await f.exists();
if (!exists){
if (!exists) {
console.log(element.title);
await downloadImage(element, table);
await delay(1000);
await delay(1000);
}
}
}