feat: frontend validation
fix
This commit is contained in:
@ -10,6 +10,7 @@ import {
|
|||||||
pipe,
|
pipe,
|
||||||
strictObject,
|
strictObject,
|
||||||
string,
|
string,
|
||||||
|
union,
|
||||||
uuid,
|
uuid,
|
||||||
variant,
|
variant,
|
||||||
} from "valibot";
|
} from "valibot";
|
||||||
@ -165,11 +166,24 @@ const userImageValidator = strictObject({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const userProcessingImageValidator = strictObject({
|
||||||
|
ID: pipe(string(), uuid()),
|
||||||
|
ImageID: pipe(string(), uuid()),
|
||||||
|
UserID: pipe(string(), uuid()),
|
||||||
|
Image: strictObject({
|
||||||
|
ID: pipe(string(), uuid()),
|
||||||
|
ImageName: string(),
|
||||||
|
Image: null_(),
|
||||||
|
}),
|
||||||
|
Status: union([literal("not-started"), literal("in-progress")]),
|
||||||
|
});
|
||||||
|
|
||||||
export type UserImage = InferOutput<typeof dataTypeValidator>;
|
export type UserImage = InferOutput<typeof dataTypeValidator>;
|
||||||
|
|
||||||
const imageRequestValidator = strictObject({
|
const imageRequestValidator = strictObject({
|
||||||
UserImages: array(userImageValidator),
|
UserImages: array(userImageValidator),
|
||||||
ImageProperties: array(dataTypeValidator),
|
ImageProperties: array(dataTypeValidator),
|
||||||
|
ProcessingImages: array(userProcessingImageValidator),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const getUserImages = async (): Promise<
|
export const getUserImages = async (): Promise<
|
||||||
|
Reference in New Issue
Block a user