Add N-ZAP user to seed script

This commit is contained in:
Kalle (Sendou)
2021-12-05 13:28:40 +02:00
parent fb89f5111b
commit 236ed75391
2 changed files with 20 additions and 0 deletions

View File

@@ -48,6 +48,9 @@ export const navItems = [
export const ADMIN_TEST_UUID = "846e12eb-d373-4002-a0c3-e23077e1c88c";
export const ADMIN_TEST_DISCORD_ID = "79237403620945920";
export const ADMIN_TEST_AVATAR = "fcfd65a3bea598905abb9ca25296816b";
export const NZAP_TEST_UUID = "fab649fe-3421-46e9-88cf-d10aa2153821";
export const NZAP_TEST_DISCORD_ID = "455039198672453645";
export const NZAP_TEST_AVATAR = "f809176af93132c3db5f0a5019e96339";
export const TOURNAMENT_TEAM_ROSTER_MIN_SIZE = 4;
export const TOURNAMENT_TEAM_ROSTER_MAX_SIZE = 6;

View File

@@ -3,6 +3,9 @@ import {
ADMIN_TEST_AVATAR,
ADMIN_TEST_DISCORD_ID,
ADMIN_TEST_UUID,
NZAP_TEST_AVATAR,
NZAP_TEST_DISCORD_ID,
NZAP_TEST_UUID,
stages as stagesList,
} from "../../app/constants";
import { readFile } from "fs/promises";
@@ -35,6 +38,7 @@ export async function seed() {
// create mock data
//
const adminUserCreated = await adminUser();
await nzapUser();
const userIds = new Array(500).fill(null).map(() => crypto.randomUUID());
await users(userIds);
const organization = await organizations(adminUserCreated.id);
@@ -64,6 +68,19 @@ async function adminUser() {
});
}
async function nzapUser() {
return prisma.user.create({
data: {
id: NZAP_TEST_UUID,
discordDiscriminator: "6227",
discordId: NZAP_TEST_DISCORD_ID,
discordName: "N-ZAP",
discordRefreshToken: "none",
discordAvatar: NZAP_TEST_AVATAR,
},
});
}
async function users(ids: string[]) {
const usersFromSendouInk = await readFile(
path.resolve("prisma", "seed", "users.json"),