Haystack V2: Removing entities completely
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
string,
|
||||
union,
|
||||
uuid,
|
||||
variant,
|
||||
} from "valibot";
|
||||
|
||||
type BaseRequestParams = Partial<{
|
||||
@@ -85,62 +84,6 @@ export const sendImage = async (
|
||||
return parse(sendImageResponseValidator, res);
|
||||
};
|
||||
|
||||
const locationValidator = strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
CreatedAt: pipe(string()),
|
||||
Name: string(),
|
||||
Address: nullable(string()),
|
||||
Description: nullable(string()),
|
||||
Images: array(pipe(string(), uuid())),
|
||||
});
|
||||
|
||||
const contactValidator = strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
CreatedAt: pipe(string()),
|
||||
Name: string(),
|
||||
Description: nullable(string()),
|
||||
PhoneNumber: nullable(string()),
|
||||
Email: nullable(string()),
|
||||
Images: array(pipe(string(), uuid())),
|
||||
});
|
||||
|
||||
const eventValidator = strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
CreatedAt: nullable(pipe(string())),
|
||||
Name: string(),
|
||||
StartDateTime: nullable(pipe(string())),
|
||||
EndDateTime: nullable(pipe(string())),
|
||||
Description: nullable(string()),
|
||||
LocationID: nullable(pipe(string(), uuid())),
|
||||
// Location: nullable(locationValidator),
|
||||
OrganizerID: nullable(pipe(string(), uuid())),
|
||||
// Organizer: nullable(contactValidator),
|
||||
Images: array(pipe(string(), uuid())),
|
||||
});
|
||||
|
||||
const locationDataType = strictObject({
|
||||
type: literal("location"),
|
||||
data: locationValidator,
|
||||
});
|
||||
|
||||
const eventDataType = strictObject({
|
||||
type: literal("event"),
|
||||
data: eventValidator,
|
||||
});
|
||||
|
||||
const contactDataType = strictObject({
|
||||
type: literal("contact"),
|
||||
data: contactValidator,
|
||||
});
|
||||
|
||||
const dataTypeValidator = variant("type", [
|
||||
locationDataType,
|
||||
eventDataType,
|
||||
contactDataType,
|
||||
]);
|
||||
|
||||
export type CategoryUnion = InferOutput<typeof dataTypeValidator>;
|
||||
|
||||
const imageMetaValidator = strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
ImageName: string(),
|
||||
@@ -168,8 +111,6 @@ const userProcessingImageValidator = strictObject({
|
||||
]),
|
||||
});
|
||||
|
||||
export type UserImage = InferOutput<typeof dataTypeValidator>;
|
||||
|
||||
const listValidator = strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
UserID: pipe(string(), uuid()),
|
||||
@@ -212,7 +153,6 @@ export type List = InferOutput<typeof listValidator>;
|
||||
|
||||
const imageRequestValidator = strictObject({
|
||||
UserImages: array(userImageValidator),
|
||||
ImageProperties: array(dataTypeValidator),
|
||||
ProcessingImages: array(userProcessingImageValidator),
|
||||
Lists: array(listValidator),
|
||||
});
|
||||
@@ -233,15 +173,6 @@ export const getUserImages = async (): Promise<
|
||||
return parse(imageRequestValidator, res);
|
||||
};
|
||||
|
||||
export const getImage = async (imageId: string): Promise<UserImage> => {
|
||||
const request = getBaseAuthorizedRequest({
|
||||
path: `image-properties/${imageId}`,
|
||||
});
|
||||
|
||||
const res = await fetch(request).then((res) => res.json());
|
||||
return parse(dataTypeValidator, res);
|
||||
};
|
||||
|
||||
export const postLogin = async (email: string): Promise<void> => {
|
||||
const request = getBaseRequest({
|
||||
path: "login",
|
||||
|
||||
Reference in New Issue
Block a user