Clean up unused/duplicate files and update .env.example
This commit is contained in:
1 parent
2ad374031a
commit
22b36b699d
11 files changed
+7
-729
No files matched your search
+5
-3
@@ -1,4 +1,6 @@
|
||||
DATABASE_URL="postgresql://erp:erppassword@db:5432/erp_db?schema=public"
|
||||
JWT_SECRET="your-super-secret-jwt-key"
|
||||
DATABASE_URL="file:./live.db"
|
||||
LIVE_DATABASE_URL="file:./live.db"
|
||||
JWT_SECRET="ganti-dengan-random-secret-minimal-32-karakter"
|
||||
NEXT_PUBLIC_APP_NAME="EnterpriseCore ERP"
|
||||
PORT=3000
|
||||
PORT=3005
|
||||
TZ="Asia/Jakarta"
|
||||
@@ -7,6 +7,7 @@ dist/
|
||||
.env.*
|
||||
*.log
|
||||
.DS_Store
|
||||
next-env.d.ts
|
||||
tsconfig.tsbuildinfo
|
||||
prisma/*.db
|
||||
prisma/*.db-journal
|
||||
|
||||
Binary file not shown.
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
/// <reference path="./.next/types/routes.d.ts" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
+1
-3
@@ -10,9 +10,7 @@
|
||||
"prisma:generate": "prisma generate",
|
||||
"prisma:push": "prisma db push",
|
||||
"prisma:seed": "node prisma/seed.js",
|
||||
"db:setup": "prisma generate && prisma db push && node prisma/seed.js",
|
||||
"db:sqlite": "node scripts/switch-db.js sqlite",
|
||||
"db:postgres": "node scripts/switch-db.js postgres"
|
||||
"db:setup": "prisma generate && prisma db push && node prisma/seed.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "^6.2.1",
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
enum Role {
|
||||
ADMIN
|
||||
MANAGER
|
||||
INVENTORY
|
||||
SALES
|
||||
PURCHASING
|
||||
ACCOUNTANT
|
||||
}
|
||||
|
||||
enum MovementType {
|
||||
IN
|
||||
OUT
|
||||
ADJUSTMENT
|
||||
TRANSFER
|
||||
}
|
||||
|
||||
enum OrderStatus {
|
||||
DRAFT
|
||||
CONFIRMED
|
||||
SHIPPED
|
||||
COMPLETED
|
||||
CANCELLED
|
||||
}
|
||||
|
||||
enum PaymentStatus {
|
||||
UNPAID
|
||||
PARTIAL
|
||||
PAID
|
||||
}
|
||||
|
||||
enum POStatus {
|
||||
DRAFT
|
||||
ORDERED
|
||||
RECEIVED
|
||||
CANCELLED
|
||||
}
|
||||
|
||||
enum AccountType {
|
||||
ASSET
|
||||
LIABILITY
|
||||
EQUITY
|
||||
REVENUE
|
||||
EXPENSE
|
||||
}
|
||||
|
||||
enum EntryType {
|
||||
DEBIT
|
||||
CREDIT
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
name String
|
||||
password String
|
||||
role Role @default(SALES)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
auditLogs AuditLog[]
|
||||
}
|
||||
|
||||
model AuditLog {
|
||||
id String @id @default(uuid())
|
||||
userId String?
|
||||
userName String?
|
||||
action String // CREATE, UPDATE, DELETE, LOGIN, APPROVE
|
||||
module String // INVENTORY, SALES, PURCHASING, FINANCE, AUTH
|
||||
description String
|
||||
metadata String? // JSON string for extra payload
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
}
|
||||
|
||||
model Warehouse {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
name String
|
||||
address String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
stockItems StockItem[]
|
||||
stockMovements StockMovement[]
|
||||
}
|
||||
|
||||
model Category {
|
||||
id String @id @default(uuid())
|
||||
name String @unique
|
||||
description String?
|
||||
products Product[]
|
||||
}
|
||||
|
||||
model Product {
|
||||
id String @id @default(uuid())
|
||||
sku String @unique
|
||||
name String
|
||||
description String?
|
||||
unit String @default("PCS") // PCS, BOX, KG, LTR, MTR
|
||||
purchasePrice Float @default(0)
|
||||
sellingPrice Float @default(0)
|
||||
minStock Int @default(5)
|
||||
categoryId String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
category Category? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
|
||||
stockItems StockItem[]
|
||||
stockMovements StockMovement[]
|
||||
salesItems SalesOrderItem[]
|
||||
purchaseItems PurchaseOrderItem[]
|
||||
}
|
||||
|
||||
model StockItem {
|
||||
id String @id @default(uuid())
|
||||
productId String
|
||||
warehouseId String
|
||||
quantity Int @default(0)
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
warehouse Warehouse @relation(fields: [warehouseId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([productId, warehouseId])
|
||||
}
|
||||
|
||||
model StockMovement {
|
||||
id String @id @default(uuid())
|
||||
productId String
|
||||
warehouseId String
|
||||
type MovementType
|
||||
quantity Int
|
||||
referenceType String? // SALES_ORDER, PURCHASE_ORDER, MANUAL_ADJUSTMENT
|
||||
referenceId String?
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
warehouse Warehouse @relation(fields: [warehouseId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Customer {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
name String
|
||||
company String?
|
||||
email String?
|
||||
phone String?
|
||||
address String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
salesOrders SalesOrder[]
|
||||
}
|
||||
|
||||
model SalesOrder {
|
||||
id String @id @default(uuid())
|
||||
orderNumber String @unique
|
||||
customerId String
|
||||
orderDate DateTime @default(now())
|
||||
status OrderStatus @default(DRAFT)
|
||||
paymentStatus PaymentStatus @default(UNPAID)
|
||||
totalAmount Float @default(0)
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
customer Customer @relation(fields: [customerId], references: [id], onDelete: Restrict)
|
||||
items SalesOrderItem[]
|
||||
}
|
||||
|
||||
model SalesOrderItem {
|
||||
id String @id @default(uuid())
|
||||
salesOrderId String
|
||||
productId String
|
||||
quantity Int
|
||||
unitPrice Float
|
||||
subtotal Float
|
||||
|
||||
salesOrder SalesOrder @relation(fields: [salesOrderId], references: [id], onDelete: Cascade)
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Restrict)
|
||||
}
|
||||
|
||||
model Supplier {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
name String
|
||||
contactPerson String?
|
||||
email String?
|
||||
phone String?
|
||||
address String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
purchaseOrders PurchaseOrder[]
|
||||
}
|
||||
|
||||
model PurchaseOrder {
|
||||
id String @id @default(uuid())
|
||||
poNumber String @unique
|
||||
supplierId String
|
||||
orderDate DateTime @default(now())
|
||||
status POStatus @default(DRAFT)
|
||||
totalAmount Float @default(0)
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
supplier Supplier @relation(fields: [supplierId], references: [id], onDelete: Restrict)
|
||||
items PurchaseOrderItem[]
|
||||
}
|
||||
|
||||
model PurchaseOrderItem {
|
||||
id String @id @default(uuid())
|
||||
purchaseOrderId String
|
||||
productId String
|
||||
quantity Int
|
||||
unitCost Float
|
||||
subtotal Float
|
||||
|
||||
purchaseOrder PurchaseOrder @relation(fields: [purchaseOrderId], references: [id], onDelete: Cascade)
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Restrict)
|
||||
}
|
||||
|
||||
model Account {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
name String
|
||||
type AccountType
|
||||
balance Float @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
lines JournalLine[]
|
||||
}
|
||||
|
||||
model JournalEntry {
|
||||
id String @id @default(uuid())
|
||||
entryNumber String @unique
|
||||
date DateTime @default(now())
|
||||
description String
|
||||
reference String? // Invoice #, PO #, etc.
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
lines JournalLine[]
|
||||
}
|
||||
|
||||
model JournalLine {
|
||||
id String @id @default(uuid())
|
||||
journalEntryId String
|
||||
accountId String
|
||||
type EntryType
|
||||
amount Float
|
||||
|
||||
journalEntry JournalEntry @relation(fields: [journalEntryId], references: [id], onDelete: Cascade)
|
||||
account Account @relation(fields: [accountId], references: [id], onDelete: Restrict)
|
||||
}
|
||||
@@ -1,288 +0,0 @@
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = "file:./dev.db"
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
name String
|
||||
password String
|
||||
role String @default("SALES")
|
||||
telegramChatId String?
|
||||
notifyEmail Boolean @default(true)
|
||||
notifyTelegram Boolean @default(false)
|
||||
|
||||
// Divisional topic subscriptions
|
||||
notifStockIn Boolean @default(true)
|
||||
notifStockOut Boolean @default(true)
|
||||
notifMoneyIn Boolean @default(true)
|
||||
notifMoneyOut Boolean @default(true)
|
||||
|
||||
// Multi-Factor Authentication (MFA / 2FA)
|
||||
mfaEnabled Boolean @default(false)
|
||||
mfaSecret String?
|
||||
mfaMethod String @default("TOTP")
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
auditLogs AuditLog[]
|
||||
}
|
||||
|
||||
model SystemSetting {
|
||||
id String @id @default(uuid())
|
||||
key String @unique
|
||||
value String
|
||||
category String @default("GENERAL") // TELEGRAM, EMAIL, NOTIFICATION
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model NotificationLog {
|
||||
id String @id @default(uuid())
|
||||
recipient String
|
||||
channel String // EMAIL, TELEGRAM
|
||||
type String // STOCK_IN, STOCK_OUT, MONEY_IN, MONEY_OUT, SYSTEM
|
||||
title String
|
||||
message String
|
||||
status String @default("SENT") // SENT, FAILED, SIMULATED
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model AuditLog {
|
||||
id String @id @default(uuid())
|
||||
userId String?
|
||||
userName String?
|
||||
action String // CREATE, UPDATE, DELETE, LOGIN, APPROVE
|
||||
module String // INVENTORY, SALES, PURCHASING, FINANCE, AUTH
|
||||
description String
|
||||
metadata String? // JSON string
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
}
|
||||
|
||||
model Warehouse {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
name String
|
||||
address String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
stockItems StockItem[]
|
||||
stockMovements StockMovement[]
|
||||
}
|
||||
|
||||
model Category {
|
||||
id String @id @default(uuid())
|
||||
name String @unique
|
||||
description String?
|
||||
products Product[]
|
||||
}
|
||||
|
||||
model Product {
|
||||
id String @id @default(uuid())
|
||||
sku String @unique
|
||||
name String
|
||||
description String?
|
||||
unit String @default("PCS")
|
||||
purchasePrice Float @default(0)
|
||||
sellingPrice Float @default(0)
|
||||
minStock Int @default(5)
|
||||
categoryId String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
category Category? @relation(fields: [categoryId], references: [id], onDelete: SetNull)
|
||||
stockItems StockItem[]
|
||||
stockMovements StockMovement[]
|
||||
salesItems SalesOrderItem[]
|
||||
purchaseItems PurchaseOrderItem[]
|
||||
}
|
||||
|
||||
model StockItem {
|
||||
id String @id @default(uuid())
|
||||
productId String
|
||||
warehouseId String
|
||||
quantity Int @default(0)
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
warehouse Warehouse @relation(fields: [warehouseId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([productId, warehouseId])
|
||||
}
|
||||
|
||||
model StockMovement {
|
||||
id String @id @default(uuid())
|
||||
productId String
|
||||
warehouseId String
|
||||
type String // IN, OUT, ADJUSTMENT, TRANSFER
|
||||
quantity Int
|
||||
referenceType String? // SALES_ORDER, PURCHASE_ORDER, MANUAL_ADJUSTMENT
|
||||
referenceId String?
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
warehouse Warehouse @relation(fields: [warehouseId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Customer {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
name String
|
||||
company String?
|
||||
email String?
|
||||
phone String?
|
||||
address String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
salesOrders SalesOrder[]
|
||||
}
|
||||
|
||||
model SalesOrder {
|
||||
id String @id @default(uuid())
|
||||
orderNumber String @unique
|
||||
invoiceNumber String?
|
||||
customerPoNumber String?
|
||||
customerId String
|
||||
orderDate DateTime @default(now())
|
||||
status String @default("DRAFT") // DRAFT, CONFIRMED, SHIPPED, COMPLETED, CANCELLED
|
||||
paymentStatus String @default("UNPAID") // UNPAID, PARTIAL, PAID
|
||||
totalAmount Float @default(0)
|
||||
totalHpp Float @default(0)
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
customer Customer @relation(fields: [customerId], references: [id], onDelete: Restrict)
|
||||
items SalesOrderItem[]
|
||||
}
|
||||
|
||||
model SalesOrderItem {
|
||||
id String @id @default(uuid())
|
||||
salesOrderId String
|
||||
productId String
|
||||
quantity Int
|
||||
costPrice Float @default(0)
|
||||
unitPrice Float
|
||||
subtotal Float
|
||||
|
||||
salesOrder SalesOrder @relation(fields: [salesOrderId], references: [id], onDelete: Cascade)
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Restrict)
|
||||
}
|
||||
|
||||
model Supplier {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
name String
|
||||
contactPerson String?
|
||||
email String?
|
||||
phone String?
|
||||
address String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
purchaseOrders PurchaseOrder[]
|
||||
}
|
||||
|
||||
model PurchaseOrder {
|
||||
id String @id @default(uuid())
|
||||
poNumber String @unique
|
||||
supplierId String
|
||||
orderDate DateTime @default(now())
|
||||
status String @default("DRAFT") // DRAFT, ORDERED, RECEIVED, COMPLETED, CANCELLED
|
||||
currency String @default("IDR") // IDR, USD
|
||||
exchangeRate Float @default(1)
|
||||
totalAmountUsd Float?
|
||||
totalAmount Float @default(0)
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
supplier Supplier @relation(fields: [supplierId], references: [id], onDelete: Restrict)
|
||||
items PurchaseOrderItem[]
|
||||
}
|
||||
|
||||
model PurchaseOrderItem {
|
||||
id String @id @default(uuid())
|
||||
purchaseOrderId String
|
||||
productId String
|
||||
quantity Int
|
||||
unitCostUsd Float?
|
||||
unitCost Float
|
||||
subtotal Float
|
||||
|
||||
purchaseOrder PurchaseOrder @relation(fields: [purchaseOrderId], references: [id], onDelete: Cascade)
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Restrict)
|
||||
}
|
||||
|
||||
model Account {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
name String
|
||||
type String // ASSET, LIABILITY, EQUITY, REVENUE, EXPENSE
|
||||
companyName String @default("PT EnterpriseCore Utama")
|
||||
balance Float @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
lines JournalLine[]
|
||||
}
|
||||
|
||||
model JournalEntry {
|
||||
id String @id @default(uuid())
|
||||
entryNumber String @unique
|
||||
date DateTime @default(now())
|
||||
description String
|
||||
reference String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
lines JournalLine[]
|
||||
}
|
||||
|
||||
model JournalLine {
|
||||
id String @id @default(uuid())
|
||||
journalEntryId String
|
||||
accountId String
|
||||
type String // DEBIT, CREDIT
|
||||
amount Float
|
||||
|
||||
journalEntry JournalEntry @relation(fields: [journalEntryId], references: [id], onDelete: Cascade)
|
||||
account Account @relation(fields: [accountId], references: [id], onDelete: Restrict)
|
||||
}
|
||||
|
||||
model PayrollRecord {
|
||||
id String @id @default(uuid())
|
||||
payrollNumber String @unique
|
||||
companyName String @default("PT EnterpriseCore Utama")
|
||||
employeeName String
|
||||
role String
|
||||
period String
|
||||
workDays Int @default(22)
|
||||
absentDays Int @default(0)
|
||||
lateCount Int @default(0)
|
||||
baseSalary Float @default(0)
|
||||
dailyMealRate Float @default(0)
|
||||
totalMealAllowance Float @default(0)
|
||||
transportAllowance Float @default(0)
|
||||
absenceDeduction Float @default(0)
|
||||
netSalary Float @default(0)
|
||||
paymentAccountName String?
|
||||
status String @default("PAID")
|
||||
notes String?
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model PayrollEmployee {
|
||||
id String @id @default(uuid())
|
||||
name String @unique
|
||||
companyName String @default("PT EnterpriseCore Utama")
|
||||
position String
|
||||
baseSalary Float @default(0)
|
||||
dailyMealRate Float @default(35000)
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
@@ -5,7 +5,6 @@ const PDFDocument = require("pdfkit");
|
||||
function generateERPGuidePDF() {
|
||||
const publicDir = path.join(__dirname, "..", "public");
|
||||
const outputPath = path.join(publicDir, "Panduan_Alur_Penggunaan_EnterpriseCore_ERP.pdf");
|
||||
const rootOutputPath = path.join(__dirname, "..", "Panduan_Alur_Penggunaan_EnterpriseCore_ERP.pdf");
|
||||
|
||||
if (!fs.existsSync(publicDir)) {
|
||||
fs.mkdirSync(publicDir, { recursive: true });
|
||||
@@ -474,12 +473,6 @@ function generateERPGuidePDF() {
|
||||
|
||||
stream.on("finish", () => {
|
||||
console.log(`PDF v3.0 rapi berhasil dibuat (${totalPages} halaman) di: ${outputPath}`);
|
||||
try {
|
||||
fs.copyFileSync(outputPath, rootOutputPath);
|
||||
console.log(`Salinan PDF disinkronkan ke: ${rootOutputPath}`);
|
||||
} catch (e) {
|
||||
console.error("Gagal menyalin ke root:", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
const target = process.argv[2]?.toLowerCase() || 'sqlite';
|
||||
|
||||
const rootDir = path.resolve(__dirname, '..');
|
||||
const prismaDir = path.join(rootDir, 'prisma');
|
||||
const envPath = path.join(rootDir, '.env');
|
||||
|
||||
if (target === 'sqlite') {
|
||||
console.log('🔄 Mengalihkan database ke SQLite (Zero-dependency local database)...');
|
||||
fs.copyFileSync(
|
||||
path.join(prismaDir, 'schema.sqlite.prisma'),
|
||||
path.join(prismaDir, 'schema.prisma')
|
||||
);
|
||||
|
||||
let envContent = fs.readFileSync(envPath, 'utf8');
|
||||
envContent = envContent.replace(
|
||||
/DATABASE_URL=.*/,
|
||||
'DATABASE_URL="file:./dev.db"'
|
||||
);
|
||||
fs.writeFileSync(envPath, envContent);
|
||||
|
||||
console.log('📦 Menghasilkan Prisma Client & migrasi SQLite dev.db...');
|
||||
execSync('npx prisma generate', { stdio: 'inherit', cwd: rootDir });
|
||||
execSync('npx prisma db push --skip-generate', { stdio: 'inherit', cwd: rootDir });
|
||||
|
||||
console.log('🌱 Melakukan seeding data awal...');
|
||||
execSync('node prisma/seed.js', { stdio: 'inherit', cwd: rootDir });
|
||||
|
||||
console.log('✅ Berhasil beralih ke SQLite! Database lokal dev.db siap dipakai.');
|
||||
} else if (target === 'postgres') {
|
||||
console.log('🔄 Mengalihkan database ke PostgreSQL...');
|
||||
fs.copyFileSync(
|
||||
path.join(prismaDir, 'schema.postgres.prisma'),
|
||||
path.join(prismaDir, 'schema.prisma')
|
||||
);
|
||||
|
||||
let envContent = fs.readFileSync(envPath, 'utf8');
|
||||
envContent = envContent.replace(
|
||||
/DATABASE_URL=.*/,
|
||||
'DATABASE_URL="postgresql://erp:erppassword@localhost:5432/erp_db?schema=public"'
|
||||
);
|
||||
fs.writeFileSync(envPath, envContent);
|
||||
|
||||
console.log('📦 Menghasilkan Prisma Client untuk PostgreSQL...');
|
||||
execSync('npx prisma generate', { stdio: 'inherit', cwd: rootDir });
|
||||
|
||||
console.log('✅ Skema siap untuk PostgreSQL. Pastikan container PostgreSQL aktif (docker compose up -d db).');
|
||||
} else {
|
||||
console.log('Pilihan tidak dikenal. Gunakan: node scripts/switch-db.js [sqlite|postgres]');
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
export type Role =
|
||||
| "ADMIN"
|
||||
| "MANAGER"
|
||||
| "INVENTORY"
|
||||
| "SALES"
|
||||
| "PURCHASING"
|
||||
| "ACCOUNTANT";
|
||||
|
||||
export interface UserSummary {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
role: Role;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface ProductItem {
|
||||
id: string;
|
||||
sku: string;
|
||||
name: string;
|
||||
description?: string | null;
|
||||
unit: string;
|
||||
purchasePrice: number;
|
||||
sellingPrice: number;
|
||||
minStock: number;
|
||||
category?: { id: string; name: string } | null;
|
||||
totalStock: number;
|
||||
stockItems?: {
|
||||
id: string;
|
||||
warehouse: { id: string; name: string; code: string };
|
||||
quantity: number;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface CustomerItem {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
company?: string | null;
|
||||
email?: string | null;
|
||||
phone?: string | null;
|
||||
address?: string | null;
|
||||
}
|
||||
|
||||
export interface SupplierItem {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
contactPerson?: string | null;
|
||||
email?: string | null;
|
||||
phone?: string | null;
|
||||
address?: string | null;
|
||||
}
|
||||
|
||||
export interface SalesOrderItem {
|
||||
id: string;
|
||||
orderNumber: string;
|
||||
customer: { id: string; name: string; company?: string | null };
|
||||
orderDate: string;
|
||||
status: "DRAFT" | "CONFIRMED" | "SHIPPED" | "COMPLETED" | "CANCELLED";
|
||||
paymentStatus: "UNPAID" | "PARTIAL" | "PAID";
|
||||
totalAmount: number;
|
||||
notes?: string | null;
|
||||
items: {
|
||||
id: string;
|
||||
product: { id: string; sku: string; name: string };
|
||||
quantity: number;
|
||||
unitPrice: number;
|
||||
subtotal: number;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface PurchaseOrderItem {
|
||||
id: string;
|
||||
poNumber: string;
|
||||
supplier: { id: string; name: string };
|
||||
orderDate: string;
|
||||
status: "DRAFT" | "ORDERED" | "RECEIVED" | "CANCELLED";
|
||||
totalAmount: number;
|
||||
notes?: string | null;
|
||||
items: {
|
||||
id: string;
|
||||
product: { id: string; sku: string; name: string };
|
||||
quantity: number;
|
||||
unitCost: number;
|
||||
subtotal: number;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface AccountItem {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
type: "ASSET" | "LIABILITY" | "EQUITY" | "REVENUE" | "EXPENSE";
|
||||
balance: number;
|
||||
}
|
||||
|
||||
export interface AuditLogItem {
|
||||
id: string;
|
||||
userName?: string | null;
|
||||
action: string;
|
||||
module: string;
|
||||
description: string;
|
||||
createdAt: string;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{"fileNames":["./node_modules/typescript/lib/lib.es5.d.ts","./node_modules/typescript/lib/lib.es2015.d.ts","./node_modules/typescript/lib/lib.es2016.d.ts","./node_modules/typescript/lib/lib.es2017.d.ts","./node_modules/typescript/lib/lib.es2018.d.ts","./node_modules/typescript/lib/lib.es2019.d.ts","./node_modules/typescript/lib/lib.es2020.d.ts","./node_modules/typescript/lib/lib.es2021.d.ts","./node_modules/typescript/lib/lib.es2022.d.ts","./node_modules/typescript/lib/lib.es2023.d.ts","./node_modules/typescript/lib/lib.es2024.d.ts","./node_modules/typescript/lib/lib.esnext.d.ts","./node_modules/typescript/lib/lib.dom.d.ts","./node_modules/typescript/lib/lib.dom.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.core.d.ts","./node_modules/typescript/lib/lib.es2015.collection.d.ts","./node_modules/typescript/lib/lib.es2015.generator.d.ts","./node_modules/typescript/lib/lib.es2015.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.promise.d.ts","./node_modules/typescript/lib/lib.es2015.proxy.d.ts","./node_modules/typescript/lib/lib.es2015.reflect.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2016.array.include.d.ts","./node_modules/typescript/lib/lib.es2016.intl.d.ts","./node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2017.date.d.ts","./node_modules/typescript/lib/lib.es2017.object.d.ts","./node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2017.string.d.ts","./node_modules/typescript/lib/lib.es2017.intl.d.ts","./node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","./node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","./node_modules/typescript/lib/lib.es2018.intl.d.ts","./node_modules/typescript/lib/lib.es2018.promise.d.ts","./node_modules/typescript/lib/lib.es2018.regexp.d.ts","./node_modules/typescript/lib/lib.es2019.array.d.ts","./node_modules/typescript/lib/lib.es2019.object.d.ts","./node_modules/typescript/lib/lib.es2019.string.d.ts","./node_modules/typescript/lib/lib.es2019.symbol.d.ts","./node_modules/typescript/lib/lib.es2019.intl.d.ts","./node_modules/typescript/lib/lib.es2020.bigint.d.ts","./node_modules/typescript/lib/lib.es2020.date.d.ts","./node_modules/typescript/lib/lib.es2020.promise.d.ts","./node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2020.string.d.ts","./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2020.intl.d.ts","./node_modules/typescript/lib/lib.es2020.number.d.ts","./node_modules/typescript/lib/lib.es2021.promise.d.ts","./node_modules/typescript/lib/lib.es2021.string.d.ts","./node_modules/typescript/lib/lib.es2021.weakref.d.ts","./node_modules/typescript/lib/lib.es2021.intl.d.ts","./node_modules/typescript/lib/lib.es2022.array.d.ts","./node_modules/typescript/lib/lib.es2022.error.d.ts","./node_modules/typescript/lib/lib.es2022.intl.d.ts","./node_modules/typescript/lib/lib.es2022.object.d.ts","./node_modules/typescript/lib/lib.es2022.string.d.ts","./node_modules/typescript/lib/lib.es2022.regexp.d.ts","./node_modules/typescript/lib/lib.es2023.array.d.ts","./node_modules/typescript/lib/lib.es2023.collection.d.ts","./node_modules/typescript/lib/lib.es2023.intl.d.ts","./node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2024.collection.d.ts","./node_modules/typescript/lib/lib.es2024.object.d.ts","./node_modules/typescript/lib/lib.es2024.promise.d.ts","./node_modules/typescript/lib/lib.es2024.regexp.d.ts","./node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2024.string.d.ts","./node_modules/typescript/lib/lib.esnext.array.d.ts","./node_modules/typescript/lib/lib.esnext.collection.d.ts","./node_modules/typescript/lib/lib.esnext.intl.d.ts","./node_modules/typescript/lib/lib.esnext.disposable.d.ts","./node_modules/typescript/lib/lib.esnext.promise.d.ts","./node_modules/typescript/lib/lib.esnext.decorators.d.ts","./node_modules/typescript/lib/lib.esnext.iterator.d.ts","./node_modules/typescript/lib/lib.esnext.float16.d.ts","./node_modules/typescript/lib/lib.esnext.error.d.ts","./node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","./node_modules/typescript/lib/lib.decorators.d.ts","./node_modules/typescript/lib/lib.decorators.legacy.d.ts","./.next/types/routes.d.ts","./node_modules/@types/react/global.d.ts","./node_modules/csstype/index.d.ts","./node_modules/@types/react/index.d.ts","./node_modules/next/dist/styled-jsx/types/css.d.ts","./node_modules/next/dist/styled-jsx/types/macro.d.ts","./node_modules/next/dist/styled-jsx/types/style.d.ts","./node_modules/next/dist/styled-jsx/types/global.d.ts","./node_modules/next/dist/styled-jsx/types/index.d.ts","./node_modules/next/dist/shared/lib/amp.d.ts","./node_moduleLine truncated
|
||||
Reference in new issue
Block a user