- Added createWallet, updateWallet, deleteWallet, depositWallet, transferWallet, and listMovements handlers. - Created corresponding routes for wallet operations. - Developed frontend components for wallet management including dialogs for creating, editing, depositing, adjusting balance, transferring, and viewing movements. - Integrated wallet management into the authenticated routes.
35 lines
1.1 KiB
SQL
35 lines
1.1 KiB
SQL
-- CreateTable
|
|
CREATE TABLE "wallets" (
|
|
"id" SERIAL NOT NULL,
|
|
"name" VARCHAR(100) NOT NULL,
|
|
"currency" VARCHAR(10) NOT NULL,
|
|
"balance" DECIMAL(14,4) NOT NULL,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
|
|
CONSTRAINT "wallets_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "wallet_movements" (
|
|
"id" SERIAL NOT NULL,
|
|
"walletId" INTEGER NOT NULL,
|
|
"type" VARCHAR(20) NOT NULL,
|
|
"amount" DECIMAL(14,4) NOT NULL,
|
|
"description" VARCHAR(255),
|
|
"referenceWalletId" INTEGER,
|
|
"transferGroupId" UUID,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT "wallet_movements_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "wallet_movements_walletId_idx" ON "wallet_movements"("walletId");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "wallet_movements_transferGroupId_idx" ON "wallet_movements"("transferGroupId");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "wallet_movements" ADD CONSTRAINT "wallet_movements_walletId_fkey" FOREIGN KEY ("walletId") REFERENCES "wallets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|