better handling of empty lists
This commit is contained in:
@ -104,10 +104,10 @@ func (m UserModel) ListWithImages(ctx context.Context, userId uuid.UUID) ([]List
|
||||
).
|
||||
FROM(
|
||||
Lists.
|
||||
INNER_JOIN(ImageLists, ImageLists.ListID.EQ(Lists.ID)).
|
||||
INNER_JOIN(Schemas, Schemas.ListID.EQ(Lists.ID)).
|
||||
INNER_JOIN(SchemaItems, SchemaItems.SchemaID.EQ(Schemas.ID)).
|
||||
INNER_JOIN(ImageSchemaItems, ImageSchemaItems.ImageID.EQ(ImageLists.ImageID)),
|
||||
LEFT_JOIN(ImageLists, ImageLists.ListID.EQ(Lists.ID)).
|
||||
LEFT_JOIN(ImageSchemaItems, ImageSchemaItems.ImageID.EQ(ImageLists.ImageID)),
|
||||
).
|
||||
WHERE(Lists.UserID.EQ(UUID(userId)))
|
||||
|
||||
|
@ -3,6 +3,7 @@ import {
|
||||
type Component,
|
||||
type ParentProps,
|
||||
createContext,
|
||||
createEffect,
|
||||
createMemo,
|
||||
createResource,
|
||||
useContext,
|
||||
@ -29,6 +30,10 @@ const SearchImageContext = createContext<SearchImageStore>();
|
||||
export const SearchImageContextProvider: Component<ParentProps> = (props) => {
|
||||
const [data, { refetch }] = createResource(getUserImages);
|
||||
|
||||
createEffect(() => {
|
||||
console.log(data());
|
||||
});
|
||||
|
||||
const sortedImages = createMemo<ReturnType<SearchImageStore["imagesByDate"]>>(
|
||||
() => {
|
||||
const d = data();
|
||||
|
@ -10,6 +10,7 @@ import {
|
||||
pipe,
|
||||
strictObject,
|
||||
string,
|
||||
transform,
|
||||
union,
|
||||
uuid,
|
||||
} from "valibot";
|
||||
@ -127,7 +128,9 @@ const listValidator = strictObject({
|
||||
Name: string(),
|
||||
Description: nullable(string()),
|
||||
|
||||
Images: array(
|
||||
Images: pipe(
|
||||
nullable(
|
||||
array(
|
||||
strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
ImageID: pipe(string(), uuid()),
|
||||
@ -142,6 +145,9 @@ const listValidator = strictObject({
|
||||
),
|
||||
}),
|
||||
),
|
||||
),
|
||||
transform((n) => n ?? []),
|
||||
),
|
||||
|
||||
Schema: strictObject({
|
||||
ID: pipe(string(), uuid()),
|
||||
|
Reference in New Issue
Block a user