41 lines
966 B
TypeScript
41 lines
966 B
TypeScript
import authModel from "../src/models/AuthModel";
|
|
import imageModel, { Image } from "../src/models/ImageModel";
|
|
import { faker } from "@faker-js/faker";
|
|
|
|
export default async function () {
|
|
const images = faker.helpers.multiple(
|
|
() => ({
|
|
url: faker.helpers.unique(faker.internet.url),
|
|
status: faker.helpers.arrayElement([
|
|
"available",
|
|
"unavailable",
|
|
"consumed",
|
|
]),
|
|
tags: faker.helpers.arrayElements(
|
|
[
|
|
"2girls",
|
|
"sleeping",
|
|
"touhou",
|
|
"pokemon",
|
|
"closed_eyes",
|
|
"yume_nikki",
|
|
"waifu",
|
|
"computer",
|
|
"party",
|
|
"yuru_camp",
|
|
],
|
|
{ min: 0, max: 5 }
|
|
),
|
|
}),
|
|
{ count: { min: 5, max: 50 } }
|
|
);
|
|
|
|
// Wait until all images are inserted
|
|
await Promise.allSettled(images.map((image) => imageModel.create(image)));
|
|
|
|
await authModel.create({
|
|
app: "tester",
|
|
secret: "test",
|
|
});
|
|
}
|