-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55a1a9a
commit 2f50428
Showing
24 changed files
with
1,216 additions
and
169 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- CreateEnum | ||
CREATE TYPE "SupplyMeasure" AS ENUM ('Unit', 'Kg', 'Litters', 'Box', 'Piece'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "DonationOrderStatus" AS ENUM ('Pending', 'Canceled', 'Complete'); | ||
|
||
-- AlterTable | ||
ALTER TABLE "supplies" ADD COLUMN "measure" "SupplyMeasure" NOT NULL DEFAULT 'Unit'; | ||
|
||
-- CreateTable | ||
CREATE TABLE "donation_order_supplies" ( | ||
"id" TEXT NOT NULL, | ||
"donation_order_id" TEXT NOT NULL, | ||
"supply_id" TEXT NOT NULL, | ||
"quantity" INTEGER NOT NULL, | ||
"created_at" VARCHAR(32) NOT NULL, | ||
"updated_at" VARCHAR(32), | ||
|
||
CONSTRAINT "donation_order_supplies_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "donation_orders" ( | ||
"id" TEXT NOT NULL, | ||
"user_id" TEXT NOT NULL, | ||
"shelter_id" TEXT NOT NULL, | ||
"status" "DonationOrderStatus" NOT NULL DEFAULT 'Pending', | ||
"created_at" VARCHAR(32) NOT NULL, | ||
"updated_at" VARCHAR(32), | ||
|
||
CONSTRAINT "donation_orders_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "donation_order_supplies" ADD CONSTRAINT "donation_order_supplies_supply_id_fkey" FOREIGN KEY ("supply_id") REFERENCES "supplies"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "donation_order_supplies" ADD CONSTRAINT "donation_order_supplies_donation_order_id_fkey" FOREIGN KEY ("donation_order_id") REFERENCES "donation_orders"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "donation_orders" ADD CONSTRAINT "donation_orders_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "donation_orders" ADD CONSTRAINT "donation_orders_shelter_id_fkey" FOREIGN KEY ("shelter_id") REFERENCES "shelters"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
...es/dashboard/dashboard.controller.spec.ts → src/dashboard/dashboard.controller.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
12 changes: 11 additions & 1 deletion
12
...dules/dashboard/dashboard.service.spec.ts → src/dashboard/dashboard.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
|
||
import { DonationOrderController } from './donation-order.controller'; | ||
import { PrismaService } from '../prisma/prisma.service'; | ||
import { PrismaModule } from '../prisma/prisma.module'; | ||
import { DonationOrderService } from './donation-order.service'; | ||
|
||
describe('DonationOrderController', () => { | ||
let controller: DonationOrderController; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
imports: [PrismaModule], | ||
providers: [DonationOrderService], | ||
controllers: [DonationOrderController], | ||
}) | ||
.useMocker((token) => { | ||
if (token === PrismaService) { | ||
return {}; | ||
} | ||
}) | ||
.compile(); | ||
|
||
controller = module.get<DonationOrderController>(DonationOrderController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(controller).toBeDefined(); | ||
}); | ||
}); |
Oops, something went wrong.