mirror of
https://github.com/CaramelFur/Picsur.git
synced 2026-05-07 03:27:26 +02:00
link image with user
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
import { EImageSchema } from '../../entities/image.entity';
|
||||
import { EUserSchema } from '../../entities/user.entity';
|
||||
import { createZodDto } from '../../util/create-zod-dto';
|
||||
import { ImageFileType } from '../image-file-types.dto';
|
||||
|
||||
@@ -32,6 +33,7 @@ export class ImageRequestParams extends createZodDto(
|
||||
|
||||
export const ImageMetaResponseSchema = z.object({
|
||||
image: EImageSchema,
|
||||
user: EUserSchema,
|
||||
fileMimes: z.object({
|
||||
[ImageFileType.MASTER]: z.string(),
|
||||
[ImageFileType.ORIGINAL]: z.union([z.string(), z.undefined()]),
|
||||
|
||||
@@ -3,5 +3,7 @@ import { IsEntityID } from '../validators/entity-id.validator';
|
||||
|
||||
export const EImageSchema = z.object({
|
||||
id: IsEntityID(),
|
||||
user_id: z.string(),
|
||||
created: z.preprocess((data: any) => new Date(data), z.date()),
|
||||
});
|
||||
export type EImage = z.infer<typeof EImageSchema>;
|
||||
|
||||
@@ -11,7 +11,7 @@ export const SimpleUserSchema = z.object({
|
||||
export type SimpleUser = z.infer<typeof SimpleUserSchema>;
|
||||
|
||||
export const EUserSchema = z.object({
|
||||
id: IsEntityID().optional(),
|
||||
id: IsEntityID(),
|
||||
username: IsUsername(),
|
||||
roles: IsStringList(),
|
||||
hashedPassword: z.undefined(),
|
||||
|
||||
Reference in New Issue
Block a user