Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | 54x 10744x 10744x 54x 117x 117x 54x | import mongoose from "mongoose";
import { z } from "zod";
import dayjs from "dayjs";
import {
InclusivityValue,
Genre,
Language,
Gamestyle,
Popularity,
ProgramItemSignupStrategy,
ProgramType,
SignupType,
Tag,
AgeGroup,
State,
} from "shared/types/models/programItem";
export const ProgramItemSchemaDb = z
.object({
programItemId: z.string(),
parentId: z.string(),
title: z.string(),
description: z.string(),
location: z.string(),
startTime: z.date().transform((date) => dayjs(date).toISOString()),
mins: z.number(),
tags: z.array(z.enum(Tag)),
ageGroups: z.array(z.enum(AgeGroup)),
genres: z.array(z.enum(Genre)),
styles: z.array(z.enum(Gamestyle)),
languages: z.array(z.enum(Language)),
endTime: z.date().transform((date) => dayjs(date).toISOString()),
people: z.string(),
minAttendance: z.number(),
maxAttendance: z.number(),
gameSystem: z.string(),
popularity: z.enum(Popularity),
shortDescription: z.string(),
revolvingDoor: z.boolean(),
programType: z.enum(ProgramType),
contentWarnings: z.string(),
otherAuthor: z.string(),
accessibilityValues: z.array(z.enum(InclusivityValue)),
signupStrategy: z.optional(z.enum(ProgramItemSignupStrategy)),
otherAccessibilityInformation: z.string(),
entryFee: z.string(),
signupType: z.enum(SignupType),
state: z.enum(State),
})
.strip();
const programItemSchema = new mongoose.Schema(
{
programItemId: { type: String, required: true },
parentId: { type: String, required: true },
title: { type: String, required: true },
description: { type: String, required: true },
location: { type: String, required: true },
startTime: {
type: Date,
get: (value: Date) => new Date(value),
required: true,
},
mins: { type: Number, required: true },
tags: { type: [String], required: true },
ageGroups: { type: [String], required: true },
genres: { type: [String], required: true },
styles: { type: [String], required: true },
languages: { type: [String], required: true },
endTime: {
type: Date,
get: (value: Date) => new Date(value),
required: true,
},
people: { type: String, required: true },
minAttendance: { type: Number, required: true },
maxAttendance: { type: Number, required: true },
gameSystem: { type: String, required: true },
shortDescription: { type: String, required: true },
revolvingDoor: { type: Boolean, required: true },
popularity: { type: String, default: Popularity.NULL },
programType: { type: String, required: true },
contentWarnings: { type: String, required: true },
otherAuthor: { type: String, required: true },
accessibilityValues: { type: [String], required: true },
otherAccessibilityInformation: { type: String, required: true },
entryFee: { type: String, required: true },
signupType: { type: String, required: true },
state: { type: String, required: true },
},
{ timestamps: true },
);
export const ProgramItemModel = mongoose.model(
"program-item",
programItemSchema,
);
|