bug fixed
This commit is contained in:
parent
f68582e28c
commit
d146ec296c
|
@ -35,7 +35,7 @@ export default async function updateCollection(
|
|||
return { response: "Collection is not accessible.", status: 401 };
|
||||
|
||||
if (data.parentId) {
|
||||
if (data.parentId !== ("root" as any)) {
|
||||
if (data.parentId !== "root") {
|
||||
const findParentCollection = await prisma.collection.findUnique({
|
||||
where: {
|
||||
id: data.parentId,
|
||||
|
@ -79,13 +79,13 @@ export default async function updateCollection(
|
|||
iconWeight: data.iconWeight,
|
||||
isPublic: data.isPublic,
|
||||
parent:
|
||||
data.parentId && data.parentId !== ("root" as any)
|
||||
data.parentId && data.parentId !== "root"
|
||||
? {
|
||||
connect: {
|
||||
id: data.parentId,
|
||||
},
|
||||
}
|
||||
: data.parentId === ("root" as any)
|
||||
: data.parentId === "root"
|
||||
? {
|
||||
disconnect: true,
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ export const UpdateCollectionSchema = z.object({
|
|||
isPublic: z.boolean().optional(),
|
||||
icon: z.string().trim().max(50).nullish(),
|
||||
iconWeight: z.string().trim().max(50).nullish(),
|
||||
parentId: z.number().nullish(),
|
||||
parentId: z.union([z.number(), z.literal("root")]).nullish(),
|
||||
members: z.array(
|
||||
z.object({
|
||||
userId: z.number(),
|
||||
|
|
Ŝarĝante…
Reference in New Issue