Work on game edit

This commit is contained in:
2024-05-26 13:55:34 +04:00
parent 2572c43733
commit 8b6246a38c
16 changed files with 405 additions and 217 deletions

View File

@@ -1,8 +1,7 @@
import { z } from "zod";
export const gameCardSchema = z
export const gameCardBaseSchema = z
.object({
id: z.number().positive(),
title: z.string().min(3),
cover: z.string().optional(),
description: z.string().optional(),
@@ -19,6 +18,12 @@ export const gameCardSchema = z
: undefined,
};
});
export const gameCardSchema = gameCardBaseSchema.and(
z.object({
id: z.number().positive(),
})
);
export type GameCardType = z.infer<typeof gameCardSchema>;
export const isGameCard = (a: any): a is GameCardType => {