feat(events): search through organizer
This commit is contained in:
@@ -17,7 +17,7 @@ export const SearchCardEvent = ({ item }: Props) => {
|
||||
<IconCalendar size={20} class="text-neutral-500 mt-1" />
|
||||
</div>
|
||||
<p class="text-xs text-neutral-500">
|
||||
Organized by TODO on{" "}
|
||||
Organized by {data.Organizer?.Name ?? "unknown"} on{" "}
|
||||
{new Date(data.StartDateTime).toLocaleDateString("en-US", {
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
|
||||
@@ -2,17 +2,13 @@ import {
|
||||
type InferOutput,
|
||||
array,
|
||||
nullable,
|
||||
object,
|
||||
strictObject,
|
||||
parse,
|
||||
pipe,
|
||||
string,
|
||||
null_,
|
||||
uuid,
|
||||
literal,
|
||||
variant,
|
||||
date,
|
||||
isoDate,
|
||||
isoDateTime,
|
||||
} from "valibot";
|
||||
|
||||
type BaseRequestParams = Partial<{
|
||||
@@ -29,7 +25,7 @@ const getBaseRequest = ({ path, body, method }: BaseRequestParams): Request => {
|
||||
});
|
||||
};
|
||||
|
||||
const sendImageResponseValidator = object({
|
||||
const sendImageResponseValidator = strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
ImageID: pipe(string(), uuid()),
|
||||
UserID: pipe(string(), uuid()),
|
||||
@@ -52,14 +48,22 @@ export const sendImage = async (
|
||||
return parse(sendImageResponseValidator, res);
|
||||
};
|
||||
|
||||
const locationValidator = object({
|
||||
const locationValidator = strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
Name: string(),
|
||||
Address: nullable(string()),
|
||||
Description: nullable(string()),
|
||||
});
|
||||
|
||||
const eventValidator = object({
|
||||
const contactValidator = strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
Name: string(),
|
||||
Description: nullable(string()),
|
||||
PhoneNumber: nullable(string()),
|
||||
Email: nullable(string()),
|
||||
});
|
||||
|
||||
const eventValidator = strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
Name: string(),
|
||||
StartDateTime: nullable(pipe(string())),
|
||||
@@ -67,14 +71,16 @@ const eventValidator = object({
|
||||
Description: nullable(string()),
|
||||
LocationID: nullable(pipe(string(), uuid())),
|
||||
Location: nullable(locationValidator),
|
||||
OrganizerID: nullable(pipe(string(), uuid())),
|
||||
Organizer: nullable(contactValidator),
|
||||
});
|
||||
|
||||
const locationDataType = object({
|
||||
const locationDataType = strictObject({
|
||||
type: literal("location"),
|
||||
data: locationValidator,
|
||||
});
|
||||
|
||||
const eventDataType = object({
|
||||
const eventDataType = strictObject({
|
||||
type: literal("event"),
|
||||
data: eventValidator,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user