mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 21:35:19 +00:00
fix: rename data -> models
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { ExportFields, ExportFilters, exportImportFieldsMapping } from "@/data/export_and_import"
|
||||
import { getFields } from "@/data/fields"
|
||||
import { getFilesByTransactionId } from "@/data/files"
|
||||
import { getTransactions } from "@/data/transactions"
|
||||
import { ExportFields, ExportFilters, exportImportFieldsMapping } from "@/models/export_and_import"
|
||||
import { getFields } from "@/models/fields"
|
||||
import { getFilesByTransactionId } from "@/models/files"
|
||||
import { getTransactions } from "@/models/transactions"
|
||||
import { format } from "@fast-csv/format"
|
||||
import { formatDate } from "date-fns"
|
||||
import fs from "fs"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server"
|
||||
|
||||
import { exportImportFieldsMapping } from "@/data/export_and_import"
|
||||
import { createTransaction } from "@/data/transactions"
|
||||
import { exportImportFieldsMapping } from "@/models/export_and_import"
|
||||
import { createTransaction } from "@/models/transactions"
|
||||
import { parse } from "@fast-csv/parse"
|
||||
import { revalidatePath } from "next/cache"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ImportCSVTable } from "@/components/import/csv"
|
||||
import { getFields } from "@/data/fields"
|
||||
import { getFields } from "@/models/fields"
|
||||
|
||||
export default async function CSVImportPage() {
|
||||
const fields = await getFields()
|
||||
|
||||
@@ -3,8 +3,8 @@ import MobileMenu from "@/components/sidebar/mobile-menu"
|
||||
import { AppSidebar } from "@/components/sidebar/sidebar"
|
||||
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"
|
||||
import { Toaster } from "@/components/ui/sonner"
|
||||
import { getUnsortedFilesCount } from "@/data/files"
|
||||
import { getSettings } from "@/data/settings"
|
||||
import { getUnsortedFilesCount } from "@/models/files"
|
||||
import { getSettings } from "@/models/settings"
|
||||
import type { Metadata, Viewport } from "next"
|
||||
import { NotificationProvider } from "./context"
|
||||
import "./globals.css"
|
||||
|
||||
@@ -3,9 +3,9 @@ import { StatsWidget } from "@/components/dashboard/stats-widget"
|
||||
import DashboardUnsortedWidget from "@/components/dashboard/unsorted-widget"
|
||||
import { WelcomeWidget } from "@/components/dashboard/welcome-widget"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { getUnsortedFiles } from "@/data/files"
|
||||
import { getSettings } from "@/data/settings"
|
||||
import { TransactionFilters } from "@/data/transactions"
|
||||
import { getUnsortedFiles } from "@/models/files"
|
||||
import { getSettings } from "@/models/settings"
|
||||
import { TransactionFilters } from "@/models/transactions"
|
||||
|
||||
export default async function Home({ searchParams }: { searchParams: Promise<TransactionFilters> }) {
|
||||
const filters = await searchParams
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"use server"
|
||||
|
||||
import { createCategory, deleteCategory, updateCategory } from "@/data/categories"
|
||||
import { createCurrency, deleteCurrency, updateCurrency } from "@/data/currencies"
|
||||
import { createField, deleteField, updateField } from "@/data/fields"
|
||||
import { createProject, deleteProject, updateProject } from "@/data/projects"
|
||||
import { updateSettings } from "@/data/settings"
|
||||
import { settingsFormSchema } from "@/forms/settings"
|
||||
import { codeFromName } from "@/lib/utils"
|
||||
import { createCategory, deleteCategory, updateCategory } from "@/models/categories"
|
||||
import { createCurrency, deleteCurrency, updateCurrency } from "@/models/currencies"
|
||||
import { createField, deleteField, updateField } from "@/models/fields"
|
||||
import { createProject, deleteProject, updateProject } from "@/models/projects"
|
||||
import { updateSettings } from "@/models/settings"
|
||||
import { revalidatePath } from "next/cache"
|
||||
import { redirect } from "next/navigation"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { addCategoryAction, deleteCategoryAction, editCategoryAction } from "@/app/settings/actions"
|
||||
import { CrudTable } from "@/components/settings/crud"
|
||||
import { getCategories } from "@/data/categories"
|
||||
import { randomHexColor } from "@/lib/utils"
|
||||
import { getCategories } from "@/models/categories"
|
||||
|
||||
export default async function CategoriesSettingsPage() {
|
||||
const categories = await getCategories()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { addCurrencyAction, deleteCurrencyAction, editCurrencyAction } from "@/app/settings/actions"
|
||||
import { CrudTable } from "@/components/settings/crud"
|
||||
import { getCurrencies } from "@/data/currencies"
|
||||
import { getCurrencies } from "@/models/currencies"
|
||||
|
||||
export default async function CurrenciesSettingsPage() {
|
||||
const currencies = await getCurrencies()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { addFieldAction, deleteFieldAction, editFieldAction } from "@/app/settings/actions"
|
||||
import { CrudTable } from "@/components/settings/crud"
|
||||
import { getFields } from "@/data/fields"
|
||||
import { getFields } from "@/models/fields"
|
||||
|
||||
export default async function FieldsSettingsPage() {
|
||||
const fields = await getFields()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import LLMSettingsForm from "@/components/settings/llm-settings-form"
|
||||
import { getFields } from "@/data/fields"
|
||||
import { getSettings } from "@/data/settings"
|
||||
import { getFields } from "@/models/fields"
|
||||
import { getSettings } from "@/models/settings"
|
||||
|
||||
export default async function LlmSettingsPage() {
|
||||
const settings = await getSettings()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import GlobalSettingsForm from "@/components/settings/global-settings-form"
|
||||
import { getCategories } from "@/data/categories"
|
||||
import { getCurrencies } from "@/data/currencies"
|
||||
import { getSettings } from "@/data/settings"
|
||||
import { getCategories } from "@/models/categories"
|
||||
import { getCurrencies } from "@/models/currencies"
|
||||
import { getSettings } from "@/models/settings"
|
||||
|
||||
export default async function SettingsPage() {
|
||||
const settings = await getSettings()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { addProjectAction, deleteProjectAction, editProjectAction } from "@/app/settings/actions"
|
||||
import { CrudTable } from "@/components/settings/crud"
|
||||
import { getProjects } from "@/data/projects"
|
||||
import { randomHexColor } from "@/lib/utils"
|
||||
import { getProjects } from "@/models/projects"
|
||||
|
||||
export default async function ProjectsSettingsPage() {
|
||||
const projects = await getProjects()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getTransactionById } from "@/data/transactions"
|
||||
import { getTransactionById } from "@/models/transactions"
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
export default async function TransactionLayout({
|
||||
|
||||
@@ -2,13 +2,13 @@ import { FormTextarea } from "@/components/forms/simple"
|
||||
import TransactionEditForm from "@/components/transactions/edit"
|
||||
import TransactionFiles from "@/components/transactions/transaction-files"
|
||||
import { Card } from "@/components/ui/card"
|
||||
import { getCategories } from "@/data/categories"
|
||||
import { getCurrencies } from "@/data/currencies"
|
||||
import { getFields } from "@/data/fields"
|
||||
import { getFilesByTransactionId } from "@/data/files"
|
||||
import { getProjects } from "@/data/projects"
|
||||
import { getSettings } from "@/data/settings"
|
||||
import { getTransactionById } from "@/data/transactions"
|
||||
import { getCategories } from "@/models/categories"
|
||||
import { getCurrencies } from "@/models/currencies"
|
||||
import { getFields } from "@/models/fields"
|
||||
import { getFilesByTransactionId } from "@/models/files"
|
||||
import { getProjects } from "@/models/projects"
|
||||
import { getSettings } from "@/models/settings"
|
||||
import { getTransactionById } from "@/models/transactions"
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
export default async function TransactionPage({ params }: { params: Promise<{ transactionId: string }> }) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"use server"
|
||||
|
||||
import { createFile, deleteFile } from "@/data/files"
|
||||
import { transactionFormSchema } from "@/forms/transactions"
|
||||
import { FILE_UPLOAD_PATH, getTransactionFileUploadPath } from "@/lib/files"
|
||||
import { createFile, deleteFile } from "@/models/files"
|
||||
import {
|
||||
bulkDeleteTransactions,
|
||||
createTransaction,
|
||||
@@ -8,9 +10,7 @@ import {
|
||||
getTransactionById,
|
||||
updateTransaction,
|
||||
updateTransactionFiles,
|
||||
} from "@/data/transactions"
|
||||
import { transactionFormSchema } from "@/forms/transactions"
|
||||
import { FILE_UPLOAD_PATH, getTransactionFileUploadPath } from "@/lib/files"
|
||||
} from "@/models/transactions"
|
||||
import { existsSync } from "fs"
|
||||
import { mkdir, writeFile } from "fs/promises"
|
||||
import { revalidatePath } from "next/cache"
|
||||
|
||||
@@ -4,10 +4,10 @@ import { TransactionSearchAndFilters } from "@/components/transactions/filters"
|
||||
import { TransactionList } from "@/components/transactions/list"
|
||||
import { NewTransactionDialog } from "@/components/transactions/new"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { getCategories } from "@/data/categories"
|
||||
import { getFields } from "@/data/fields"
|
||||
import { getProjects } from "@/data/projects"
|
||||
import { getTransactions, TransactionFilters } from "@/data/transactions"
|
||||
import { getCategories } from "@/models/categories"
|
||||
import { getFields } from "@/models/fields"
|
||||
import { getProjects } from "@/models/projects"
|
||||
import { getTransactions, TransactionFilters } from "@/models/transactions"
|
||||
import { Download, Plus, Upload } from "lucide-react"
|
||||
import { Metadata } from "next"
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"use server"
|
||||
|
||||
import { deleteFile, getFileById, updateFile } from "@/data/files"
|
||||
import { createTransaction, updateTransactionFiles } from "@/data/transactions"
|
||||
import { transactionFormSchema } from "@/forms/transactions"
|
||||
import { getTransactionFileUploadPath } from "@/lib/files"
|
||||
import { deleteFile, getFileById, updateFile } from "@/models/files"
|
||||
import { createTransaction, updateTransactionFiles } from "@/models/transactions"
|
||||
import { mkdir, rename } from "fs/promises"
|
||||
import { revalidatePath } from "next/cache"
|
||||
import path from "path"
|
||||
|
||||
@@ -4,12 +4,12 @@ import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card } from "@/components/ui/card"
|
||||
import AnalyzeForm from "@/components/unsorted/analyze-form"
|
||||
import { getCategories } from "@/data/categories"
|
||||
import { getCurrencies } from "@/data/currencies"
|
||||
import { getFields } from "@/data/fields"
|
||||
import { getUnsortedFiles } from "@/data/files"
|
||||
import { getProjects } from "@/data/projects"
|
||||
import { getSettings } from "@/data/settings"
|
||||
import { getCategories } from "@/models/categories"
|
||||
import { getCurrencies } from "@/models/currencies"
|
||||
import { getFields } from "@/models/fields"
|
||||
import { getUnsortedFiles } from "@/models/files"
|
||||
import { getProjects } from "@/models/projects"
|
||||
import { getSettings } from "@/models/settings"
|
||||
import { FileText, PartyPopper, Settings, Upload } from "lucide-react"
|
||||
import { Metadata } from "next"
|
||||
import Link from "next/link"
|
||||
|
||||
Reference in New Issue
Block a user