fix: rename data -> models

This commit is contained in:
Vasily Zubarev
2025-03-22 10:39:47 +01:00
parent ac8f848d94
commit 9ca7d9c712
50 changed files with 103 additions and 98 deletions

View File

@@ -1,7 +1,7 @@
"use server"
import { createFile } from "@/data/files"
import { FILE_UNSORTED_UPLOAD_PATH, getUnsortedFileUploadPath } from "@/lib/files"
import { createFile } from "@/models/files"
import { existsSync } from "fs"
import { mkdir, writeFile } from "fs/promises"
import { revalidatePath } from "next/cache"

View File

@@ -1,4 +1,4 @@
import { getFileById } from "@/data/files"
import { getFileById } from "@/models/files"
import fs from "fs/promises"
import { NextResponse } from "next/server"
@@ -16,12 +16,11 @@ export async function GET(request: Request, { params }: { params: Promise<{ file
if (!file) {
return new NextResponse("File not found", { status: 404 })
}
// Check if file exists
try {
await fs.access(file.path)
} catch {
return new NextResponse("File not found on disk", { status: 404 })
return new NextResponse(`File not found on disk: ${file.path}`, { status: 404 })
}
// Read file

View File

@@ -1,6 +1,6 @@
import { getFileById } from "@/data/files"
import { resizeImage } from "@/lib/images"
import { pdfToImages } from "@/lib/pdf"
import { getFileById } from "@/models/files"
import fs from "fs/promises"
import { NextResponse } from "next/server"
import path from "path"
@@ -27,7 +27,7 @@ export async function GET(request: Request, { params }: { params: Promise<{ file
try {
await fs.access(file.path)
} catch {
return new NextResponse("File not found on disk", { status: 404 })
return new NextResponse(`File not found on disk: ${file.path}`, { status: 404 })
}
let previewPath = file.path