update file endpoints
This commit is contained in:
@@ -44,6 +44,7 @@ const createFileInput = z.object({
|
||||
const updateFileInput = z.object({
|
||||
parentId: z.string().optional(),
|
||||
name: z.string().optional(),
|
||||
root: z.boolean().optional(),
|
||||
});
|
||||
|
||||
const downloadFileResponse = z.object({
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function createFile(
|
||||
return await fileModel.create({
|
||||
tenantId: user.tenantId,
|
||||
pid: generateId(),
|
||||
status: input.mimeType == "folder" ? "done" : "penidng",
|
||||
status: input.mimeType == "folder" ? "done" : "pending",
|
||||
createdAt: new Date(),
|
||||
createdBy: user.userId,
|
||||
isDeleted: false,
|
||||
@@ -67,7 +67,7 @@ export async function updateFile(
|
||||
input: UpdateFileInput,
|
||||
tenantId: string
|
||||
) {
|
||||
if (input.parentId) {
|
||||
if (input.parentId && !input.root) {
|
||||
const parentInDb = await fileModel.findOne({
|
||||
$and: [
|
||||
{ tenantId: tenantId },
|
||||
|
||||
Reference in New Issue
Block a user