TrollCallAPIs/src/types/dialoglog.ts

46 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-06-19 05:16:00 +00:00
import { WithId } from "@/lib/db/crud";
import * as yup from "yup";
import { ObjectIdSchema } from "./assist/mongo";
2023-08-07 23:29:30 +00:00
import { ClientClanSchema } from "./clan";
2023-06-19 05:16:00 +00:00
import { SubmitDialogSchema } from "./client/dialoglog";
import { ClientTroll, ClientTrollSchema } from "./troll";
export const ServerDialogSchema = SubmitDialogSchema.shape({
owners: yup.array().of(ObjectIdSchema.required()).required().min(1),
characters: yup
.array()
.of(
yup
.object({
troll: ObjectIdSchema.required(),
time: yup.string().ensure()
})
.required()
)
.required()
});
export type ServerDialog = WithId<yup.InferType<typeof ServerDialogSchema>>;
export const ClientDialogSchema = SubmitDialogSchema.shape({
2023-08-07 23:29:30 +00:00
owners: yup.array().of(ClientClanSchema.required()).required().min(1),
2023-06-19 05:16:00 +00:00
characters: yup
.array()
.of(
yup
.object({
troll: ClientTrollSchema.required(),
time: yup.string().ensure()
})
.required()
)
.required()
});
export interface ClientDialog extends yup.InferType<typeof ClientDialogSchema> {
characters: {
troll: ClientTroll;
time: string;
}[];
} // [SEARCH: HACK] a hack. thanks, jquense