bug fixes

This commit is contained in:
daniel31x13 2024-11-08 17:57:50 -05:00
parent 8593df4673
commit 7ca574b76f
5 changed files with 50 additions and 33 deletions

View File

@ -16,6 +16,10 @@ export const styles: StylesConfig = {
}, },
transition: "all 100ms", transition: "all 100ms",
}), }),
menu: (styles) => ({
...styles,
zIndex: 10,
}),
control: (styles, state) => ({ control: (styles, state) => ({
...styles, ...styles,
fontFamily: font, fontFamily: font,

View File

@ -23,7 +23,6 @@ const usePublicTags = (): UseQueryResult<TagIncludingCount[]> => {
const data = await response.json(); const data = await response.json();
return data.response; return data.response;
}, },
enabled: status === "authenticated",
}); });
}; };

View File

@ -7,8 +7,9 @@ export default async function getTags({
userId?: number; userId?: number;
collectionId?: number; collectionId?: number;
}) { }) {
console.log("collectionId", collectionId);
if (userId) {
// Remove empty tags // Remove empty tags
if (userId)
await prisma.tag.deleteMany({ await prisma.tag.deleteMany({
where: { where: {
ownerId: userId, ownerId: userId,
@ -35,13 +36,6 @@ export default async function getTags({
}, },
}, },
}, },
{
links: {
some: {
collectionId,
},
},
},
], ],
}, },
include: { include: {
@ -56,5 +50,25 @@ export default async function getTags({
// }, // },
}); });
return { response: tags, status: 200 };
} else if (collectionId) {
const tags = await prisma.tag.findMany({
where: {
links: {
some: {
collection: {
id: collectionId,
},
},
},
},
include: {
_count: {
select: { links: true },
},
},
});
return { response: tags, status: 200 }; return { response: tags, status: 200 };
} }
}

View File

@ -81,7 +81,7 @@ export const UpdateUserSchema = () => {
collectionOrder: z.array(z.number()).optional(), collectionOrder: z.array(z.number()).optional(),
linksRouteTo: z.nativeEnum(LinksRouteTo).optional(), linksRouteTo: z.nativeEnum(LinksRouteTo).optional(),
whitelistedUsers: z.array(z.string().max(50)).optional(), whitelistedUsers: z.array(z.string().max(50)).optional(),
referredBy: z.string().max(100).optional(), referredBy: z.string().max(100).nullish(),
}); });
}; };

View File

@ -37,6 +37,6 @@ export default async function collections(
collectionId: collection.id, collectionId: collection.id,
}); });
return res.status(tags.status).json({ response: tags.response }); return res.status(tags?.status || 500).json({ response: tags?.response });
} }
} }