Skip to content

Commit

Permalink
Merge pull request #42 from richard483/feature/payment
Browse files Browse the repository at this point in the history
Feature/payment
  • Loading branch information
richard483 authored Dec 31, 2023
2 parents 53d7b59 + 4294650 commit 078acf2
Show file tree
Hide file tree
Showing 41 changed files with 1,249 additions and 155 deletions.
71 changes: 49 additions & 22 deletions package-lock.json

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

10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "8T-Auth",
"version": "1.0.1",
"name": "backend-8tech",
"version": "4.0.1",
"description": "",
"author": "8tech",
"private": true,
Expand Down Expand Up @@ -35,8 +35,9 @@
"@nestjs/passport": "^10.0.0",
"@nestjs/platform-express": "^9.4.3",
"@nestjs/swagger": "^7.1.14",
"@prisma/client": "^5.0.0",
"@prisma/client": "^5.7.1",
"ajv": "^6.12.6",
"axios": "^1.6.2",
"bcrypt": "^5.1.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
Expand All @@ -47,7 +48,8 @@
"passport-local": "^1.0.0",
"puppeteer": "^21.5.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.2.0"
"rxjs": "^7.2.0",
"xendit-node": "^4.0.0"
},
"devDependencies": {
"@golevelup/ts-jest": "^0.3.7",
Expand Down
52 changes: 0 additions & 52 deletions package.prod.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Warnings:
- Added the required column `bankAccountName` to the `Contract` table without a default value. This is not possible if the table is not empty.
- Added the required column `bankAccountNumber` to the `Contract` table without a default value. This is not possible if the table is not empty.
- Added the required column `bankName` to the `Contract` table without a default value. This is not possible if the table is not empty.
- Added the required column `paymentRate` to the `Contract` table without a default value. This is not possible if the table is not empty.
*/
-- CreateEnum
CREATE TYPE "Bank" AS ENUM ('BCA', 'BNI', 'BRI', 'MANDIRI', 'CIMB', 'MAYBANK');

-- CreateEnum
CREATE TYPE "ContractStatus" AS ENUM ('PENDING', 'ONGOING', 'ACCEPTED', 'REJECTED');

-- AlterTable
ALTER TABLE "Contract" ADD COLUMN "bankAccountName" TEXT NOT NULL,
ADD COLUMN "bankAccountNumber" BIGINT NOT NULL,
ADD COLUMN "bankName" "Bank" NOT NULL,
ADD COLUMN "paymentRate" BIGINT NOT NULL,
ADD COLUMN "status" "ContractStatus" NOT NULL DEFAULT 'PENDING';

-- AddForeignKey
ALTER TABLE "Contract" ADD CONSTRAINT "Contract_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- AlterTable
ALTER TABLE "Contract" ALTER COLUMN "bankAccountName" DROP NOT NULL,
ALTER COLUMN "bankAccountNumber" DROP NOT NULL,
ALTER COLUMN "bankName" DROP NOT NULL;
10 changes: 10 additions & 0 deletions prisma/migrations/20231209182609_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
Warnings:
- You are about to alter the column `bankAccountNumber` on the `Contract` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Integer`.
- You are about to alter the column `paymentRate` on the `Contract` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Integer`.
*/
-- AlterTable
ALTER TABLE "Contract" ALTER COLUMN "bankAccountNumber" SET DATA TYPE INTEGER,
ALTER COLUMN "paymentRate" SET DATA TYPE INTEGER;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
Warnings:
- You are about to drop the column `bankAccountName` on the `Contract` table. All the data in the column will be lost.
- You are about to drop the column `bankAccountNumber` on the `Contract` table. All the data in the column will be lost.
- You are about to drop the column `bankName` on the `Contract` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Contract" DROP COLUMN "bankAccountName",
DROP COLUMN "bankAccountNumber",
DROP COLUMN "bankName",
ADD COLUMN "paymentRequestId" TEXT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- CreateEnum
CREATE TYPE "PaymentStatus" AS ENUM ('PENDING', 'PAID', 'FAILED');

-- AlterEnum
ALTER TYPE "ContractStatus" ADD VALUE 'COMPLETED';

-- AlterTable
ALTER TABLE "Contract" ADD COLUMN "paymentStatus" "PaymentStatus";

-- DropEnum
DROP TYPE "Bank";
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- CreateEnum
CREATE TYPE "PayoutStatus" AS ENUM ('PENDING', 'VOIDED', 'FAILED', 'COMPLETED', 'EXPIRED');

-- AlterTable
ALTER TABLE "Contract" ADD COLUMN "payoutLinkId" TEXT,
ADD COLUMN "payoutStatus" "PayoutStatus";
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:
- You are about to drop the column `payoutStatus` on the `Contract` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Contract" DROP COLUMN "payoutStatus";

-- DropEnum
DROP TYPE "PayoutStatus";
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
Warnings:
- You are about to drop the column `paymentRate` on the `Contract` table. All the data in the column will be lost.
- You are about to drop the column `paymentRequestId` on the `Contract` table. All the data in the column will be lost.
- You are about to drop the column `paymentStatus` on the `Contract` table. All the data in the column will be lost.
- You are about to drop the column `payoutLinkId` on the `Contract` table. All the data in the column will be lost.
- A unique constraint covering the columns `[username]` on the table `User` will be added. If there are existing duplicate values, this will fail.
- Made the column `username` on table `User` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "Contract" DROP COLUMN "paymentRate",
DROP COLUMN "paymentRequestId",
DROP COLUMN "paymentStatus",
DROP COLUMN "payoutLinkId",
ADD COLUMN "paymentId" TEXT;

-- AlterTable
ALTER TABLE "User" ALTER COLUMN "username" SET NOT NULL;

-- CreateTable
CREATE TABLE "Payment" (
"id" TEXT NOT NULL,
"paymentRate" INTEGER NOT NULL,
"paymentRequestId" TEXT,
"paymentStatus" "PaymentStatus" DEFAULT 'PENDING',
"payoutLinkId" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");

-- AddForeignKey
ALTER TABLE "Contract" ADD CONSTRAINT "Contract_paymentId_fkey" FOREIGN KEY ("paymentId") REFERENCES "Payment"("id") ON DELETE SET NULL ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Warnings:
- You are about to drop the column `paymentRate` on the `Payment` table. All the data in the column will be lost.
- Added the required column `paymentRate` to the `Contract` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Contract" ADD COLUMN "paymentRate" INTEGER NOT NULL;

-- AlterTable
ALTER TABLE "Payment" DROP COLUMN "paymentRate";
Loading

0 comments on commit 078acf2

Please sign in to comment.