Skip to content

Commit

Permalink
Merge pull request #9 from GesangPJ/test
Browse files Browse the repository at this point in the history
v1.4.5 Merge
  • Loading branch information
GesangPJ authored Aug 17, 2024
2 parents 7602783 + 4b83ada commit 4af0b3a
Show file tree
Hide file tree
Showing 33 changed files with 1,569 additions and 405 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ Aplikasi Sistem Manajemen Penjualan untuk UMKM berbasis Node.JS dengan framework

## Changelog

### v1.4.1
### v1.4.5

- Update Dashboard Design
- Fix Typo
- Fix Bug Transaksi
- Fix Bug Pembelian / Purchasing
- Konfirmasi Kedatangan pembelian
- Fitur Laporan pembelian bermasalah (jumlah produk yang diterima tidak sesuai dengan pesanan pembelian / purchasing)

### v1.3.2

Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "GTRetail",
"version": "1.4.1",
"version": "1.4.5",
"license": "Commercial",
"private": true,
"scripts": {
Expand All @@ -16,6 +16,8 @@
"seedadmin": "node prisma/seedAdmin.js",
"seedkaryawan": "node prisma/seedKaryawan.js",
"resettransaksi": "node prisma/resetTransaksi.js",
"resetpembelian": "node prisma/resetPembelian.js",
"resetkedatangan":"node prisma/resetKedatangan.js",
"seedkategori": "node prisma/seedkategori.js"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- CreateTable
CREATE TABLE "PembelianBermasalah" (
"id" SERIAL NOT NULL,
"pembeliandetailId" INTEGER NOT NULL,
"kodepembelian" TEXT,
"produkId" INTEGER NOT NULL,
"jumlahpesanan" INTEGER NOT NULL,
"jumlahkedatangan" INTEGER NOT NULL,
"selisih" INTEGER NOT NULL,
"status" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "PembelianBermasalah_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "PembelianBermasalah" ADD CONSTRAINT "PembelianBermasalah_produkId_fkey" FOREIGN KEY ("produkId") REFERENCES "Produk"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "PembelianBermasalah" ADD CONSTRAINT "PembelianBermasalah_pembeliandetailId_fkey" FOREIGN KEY ("pembeliandetailId") REFERENCES "PembelianDetail"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Warnings:
- You are about to drop the column `jumlahproduk` on the `Kedatangan` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Kedatangan" DROP COLUMN "jumlahproduk";

-- CreateTable
CREATE TABLE "KedatanganDetail" (
"id" SERIAL NOT NULL,
"kedatanganId" INTEGER NOT NULL,
"produkId" INTEGER NOT NULL,
"jumlahkedatangan" INTEGER NOT NULL,

CONSTRAINT "KedatanganDetail_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "KedatanganDetail" ADD CONSTRAINT "KedatanganDetail_produkId_fkey" FOREIGN KEY ("produkId") REFERENCES "Produk"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
38 changes: 38 additions & 0 deletions prisma/migrations/20240816035900_edit_kedatangan/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Warnings:
- You are about to drop the column `notes` on the `Kedatangan` table. All the data in the column will be lost.
- You are about to drop the column `receivedBy` on the `Kedatangan` table. All the data in the column will be lost.
- You are about to drop the column `tanggalkedatangan` on the `Kedatangan` table. All the data in the column will be lost.
- You are about to drop the `KedatanganDetail` table. If the table is not empty, all the data it contains will be lost.
- Added the required column `jumlahkedatangan` to the `Kedatangan` table without a default value. This is not possible if the table is not empty.
- Added the required column `jumlahpesanan` to the `Kedatangan` table without a default value. This is not possible if the table is not empty.
- Added the required column `kodepembelian` to the `Kedatangan` table without a default value. This is not possible if the table is not empty.
- Added the required column `produkId` to the `Kedatangan` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `Kedatangan` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Kedatangan" DROP CONSTRAINT "Kedatangan_receivedBy_fkey";

-- DropForeignKey
ALTER TABLE "KedatanganDetail" DROP CONSTRAINT "KedatanganDetail_produkId_fkey";

-- AlterTable
ALTER TABLE "Kedatangan" DROP COLUMN "notes",
DROP COLUMN "receivedBy",
DROP COLUMN "tanggalkedatangan",
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "jumlahkedatangan" INTEGER NOT NULL,
ADD COLUMN "jumlahpesanan" INTEGER NOT NULL,
ADD COLUMN "kodepembelian" TEXT NOT NULL,
ADD COLUMN "produkId" INTEGER NOT NULL,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL,
ALTER COLUMN "status" DROP NOT NULL,
ALTER COLUMN "status" DROP DEFAULT;

-- DropTable
DROP TABLE "KedatanganDetail";

-- AddForeignKey
ALTER TABLE "Kedatangan" ADD CONSTRAINT "Kedatangan_produkId_fkey" FOREIGN KEY ("produkId") REFERENCES "Produk"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:
- You are about to drop the column `pembeliandetailId` on the `Kedatangan` table. All the data in the column will be lost.
*/
-- DropForeignKey
ALTER TABLE "Kedatangan" DROP CONSTRAINT "Kedatangan_pembeliandetailId_fkey";

-- AlterTable
ALTER TABLE "Kedatangan" DROP COLUMN "pembeliandetailId";
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:
- You are about to drop the column `selisih` on the `PembelianBermasalah` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "PembelianBermasalah" DROP COLUMN "selisih";
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:
- You are about to drop the column `pembeliandetailId` on the `PembelianBermasalah` table. All the data in the column will be lost.
*/
-- DropForeignKey
ALTER TABLE "PembelianBermasalah" DROP CONSTRAINT "PembelianBermasalah_pembeliandetailId_fkey";

-- AlterTable
ALTER TABLE "PembelianBermasalah" DROP COLUMN "pembeliandetailId";
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
Warnings:
- You are about to drop the column `jumlahkedatangan` on the `Kedatangan` table. All the data in the column will be lost.
- You are about to drop the column `jumlahpesanan` on the `Kedatangan` table. All the data in the column will be lost.
- You are about to drop the column `produkId` on the `Kedatangan` table. All the data in the column will be lost.
- You are about to drop the column `jumlahkedatangan` on the `PembelianBermasalah` table. All the data in the column will be lost.
- You are about to drop the column `jumlahpesanan` on the `PembelianBermasalah` table. All the data in the column will be lost.
- You are about to drop the column `produkId` on the `PembelianBermasalah` table. All the data in the column will be lost.
*/
-- DropForeignKey
ALTER TABLE "Kedatangan" DROP CONSTRAINT "Kedatangan_produkId_fkey";

-- DropForeignKey
ALTER TABLE "PembelianBermasalah" DROP CONSTRAINT "PembelianBermasalah_produkId_fkey";

-- AlterTable
ALTER TABLE "Kedatangan" DROP COLUMN "jumlahkedatangan",
DROP COLUMN "jumlahpesanan",
DROP COLUMN "produkId";

-- AlterTable
ALTER TABLE "PembelianBermasalah" DROP COLUMN "jumlahkedatangan",
DROP COLUMN "jumlahpesanan",
DROP COLUMN "produkId";

-- CreateTable
CREATE TABLE "DetailBermasalah" (
"id" SERIAL NOT NULL,
"pembelianbermasalahId" INTEGER NOT NULL,
"produkId" INTEGER NOT NULL,
"jumlahpesanan" INTEGER NOT NULL,
"jumlahkedatangan" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "DetailBermasalah_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "KedatanganDetail" (
"id" SERIAL NOT NULL,
"kedatanganId" INTEGER NOT NULL,
"produkId" INTEGER NOT NULL,
"jumlahpesanan" INTEGER NOT NULL,
"jumlahkedatangan" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "KedatanganDetail_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "DetailBermasalah" ADD CONSTRAINT "DetailBermasalah_produkId_fkey" FOREIGN KEY ("produkId") REFERENCES "Produk"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "KedatanganDetail" ADD CONSTRAINT "KedatanganDetail_produkId_fkey" FOREIGN KEY ("produkId") REFERENCES "Produk"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- AddForeignKey
ALTER TABLE "DetailBermasalah" ADD CONSTRAINT "DetailBermasalah_pembelianbermasalahId_fkey" FOREIGN KEY ("pembelianbermasalahId") REFERENCES "PembelianBermasalah"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "KedatanganDetail" ADD CONSTRAINT "KedatanganDetail_kedatanganId_fkey" FOREIGN KEY ("kedatanganId") REFERENCES "Kedatangan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:
- Added the required column `pembelianId` to the `PembelianBermasalah` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "PembelianBermasalah" ADD COLUMN "pembelianId" INTEGER NOT NULL;

-- AddForeignKey
ALTER TABLE "PembelianBermasalah" ADD CONSTRAINT "PembelianBermasalah_pembelianId_fkey" FOREIGN KEY ("pembelianId") REFERENCES "Pembelian"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
11 changes: 11 additions & 0 deletions prisma/migrations/20240817044438_edit_kedatangan/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:
- Added the required column `pembelianId` to the `Kedatangan` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Kedatangan" ADD COLUMN "pembelianId" INTEGER NOT NULL;

-- AddForeignKey
ALTER TABLE "Kedatangan" ADD CONSTRAINT "Kedatangan_pembelianId_fkey" FOREIGN KEY ("pembelianId") REFERENCES "Pembelian"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
30 changes: 30 additions & 0 deletions prisma/resetKedatangan.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Reset Kedatangan

const { PrismaClient } = require('@prisma/client')

const prisma = new PrismaClient()

async function main() {
try {
// Hapus semua data dari tabel Kedatangan detail dan Kedatangan
await prisma.kedatanganDetail.deleteMany({})
await prisma.kedatangan.deleteMany({})
console.log('Berhasil menghapus semua data di tabel Kedatangan Detail & Kedatangan.')

// Reset ID KedatanganDetail dan Kedatangan dari 1
await prisma.$executeRaw`ALTER SEQUENCE "KedatanganDetail_id_seq" RESTART WITH 1`
await prisma.$executeRaw`ALTER SEQUENCE "Kedatangan_id_seq" RESTART WITH 1`
console.log('Berhasil mereset ID di tabel Kedatangan Detail & Kedatangan.')

} catch (error) {
console.error('Error menghapus data dan reset ID Kedatangan Detail & Kedatangan :', error)
} finally {
await prisma.$disconnect()
}
}

main()
.catch((e) => {
console.error(e)
process.exit(1)
})
30 changes: 30 additions & 0 deletions prisma/resetPembelian.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Reset Pembelian

const { PrismaClient } = require('@prisma/client')

const prisma = new PrismaClient()

async function main() {
try {
// Hapus semua data dari tabel Pembelian detail dan Pembelian
await prisma.pembelianDetail.deleteMany({})
await prisma.pembelian.deleteMany({})
console.log('Berhasil menghapus semua data di tabel Pembelian Detail & Pembelian.')

// Reset ID PembelianDetail dan Pembelian dari 1
await prisma.$executeRaw`ALTER SEQUENCE "PembelianDetail_id_seq" RESTART WITH 1`
await prisma.$executeRaw`ALTER SEQUENCE "Pembelian_id_seq" RESTART WITH 1`
console.log('Berhasil mereset ID di tabel Pembelian Detail & Pembelian.')

} catch (error) {
console.error('Error menghapus data dan reset ID Pembelian Detail & Pembelian :', error)
} finally {
await prisma.$disconnect()
}
}

main()
.catch((e) => {
console.error(e)
process.exit(1)
})
Loading

0 comments on commit 4af0b3a

Please sign in to comment.