update file endpoints

This commit is contained in:
2025-04-15 13:17:53 +05:30
parent e7194e22c4
commit 93e77d5e16
2 changed files with 3 additions and 2 deletions

View File

@@ -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({

View File

@@ -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 },