From 662e74cec28015155a2dd3f6605aa17b2c7ca547 Mon Sep 17 00:00:00 2001 From: Justin Wang Date: Wed, 3 Dec 2025 22:01:00 -0500 Subject: [PATCH 1/3] Removing donation_items status and allocations status from code and db --- .../src/allocations/allocations.entity.ts | 3 --- .../src/allocations/allocations.service.ts | 1 - apps/backend/src/config/typeorm.ts | 2 ++ .../donationItems/donationItems.controller.ts | 3 --- .../src/donationItems/donationItems.entity.ts | 3 --- .../donationItems/donationItems.service.ts | 2 -- .../1764816885341-RemoveUnusedStatuses.ts | 25 +++++++++++++++++++ 7 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 apps/backend/src/migrations/1764816885341-RemoveUnusedStatuses.ts diff --git a/apps/backend/src/allocations/allocations.entity.ts b/apps/backend/src/allocations/allocations.entity.ts index 724af4bd..a5a3c734 100644 --- a/apps/backend/src/allocations/allocations.entity.ts +++ b/apps/backend/src/allocations/allocations.entity.ts @@ -30,7 +30,4 @@ export class Allocation { @Column({ name: 'fulfilled_at', type: 'timestamp' }) fulfilledAt: Date; - - @Column({ name: 'status', type: 'varchar', length: 255 }) - status: string; } diff --git a/apps/backend/src/allocations/allocations.service.ts b/apps/backend/src/allocations/allocations.service.ts index d5bbf460..b68b50ae 100644 --- a/apps/backend/src/allocations/allocations.service.ts +++ b/apps/backend/src/allocations/allocations.service.ts @@ -20,7 +20,6 @@ export class AllocationsService { allocatedQuantity: true, reservedAt: true, fulfilledAt: true, - status: true, }, }); } diff --git a/apps/backend/src/config/typeorm.ts b/apps/backend/src/config/typeorm.ts index dc992819..2f460a3c 100644 --- a/apps/backend/src/config/typeorm.ts +++ b/apps/backend/src/config/typeorm.ts @@ -23,6 +23,7 @@ import { RemoveOrdersDonationId1761500262238 } from '../migrations/1761500262238 import { AddVolunteerPantryUniqueConstraint1760033134668 } from '../migrations/1760033134668-AddVolunteerPantryUniqueConstraint'; import { AllergyFriendlyToBoolType1763963056712 } from '../migrations/1763963056712-AllergyFriendlyToBoolType'; import { UpdatePantryUserFieldsFixed1764350314832 } from '../migrations/1764350314832-UpdatePantryUserFieldsFixed'; +import { RemoveUnusedStatuses1764816885341 } from '../migrations/1764816885341-RemoveUnusedStatuses'; const config = { type: 'postgres', @@ -59,6 +60,7 @@ const config = { AddVolunteerPantryUniqueConstraint1760033134668, AllergyFriendlyToBoolType1763963056712, UpdatePantryUserFieldsFixed1764350314832, + RemoveUnusedStatuses1764816885341, ], }; diff --git a/apps/backend/src/donationItems/donationItems.controller.ts b/apps/backend/src/donationItems/donationItems.controller.ts index 96be5673..191b53fb 100644 --- a/apps/backend/src/donationItems/donationItems.controller.ts +++ b/apps/backend/src/donationItems/donationItems.controller.ts @@ -35,7 +35,6 @@ export class DonationItemsController { itemName: { type: 'string', example: 'Rice Noodles' }, quantity: { type: 'integer', example: 100 }, reservedQuantity: { type: 'integer', example: 0 }, - status: { type: 'string', example: 'available' }, ozPerItem: { type: 'integer', example: 5 }, estimatedValue: { type: 'integer', example: 100 }, foodType: { @@ -53,7 +52,6 @@ export class DonationItemsController { itemName: string; quantity: number; reservedQuantity: number; - status: string; ozPerItem: number; estimatedValue: number; foodType: FoodType; @@ -70,7 +68,6 @@ export class DonationItemsController { body.itemName, body.quantity, body.reservedQuantity, - body.status, body.ozPerItem, body.estimatedValue, body.foodType, diff --git a/apps/backend/src/donationItems/donationItems.entity.ts b/apps/backend/src/donationItems/donationItems.entity.ts index 3ae4ff6c..afd2c0c2 100644 --- a/apps/backend/src/donationItems/donationItems.entity.ts +++ b/apps/backend/src/donationItems/donationItems.entity.ts @@ -31,9 +31,6 @@ export class DonationItem { @Column({ name: 'reserved_quantity', type: 'int', default: 0 }) reservedQuantity: number; - @Column({ name: 'status', type: 'varchar', length: 25, default: 'avaliable' }) - status: string; - @Column({ name: 'oz_per_item', type: 'int', nullable: true }) ozPerItem: number; diff --git a/apps/backend/src/donationItems/donationItems.service.ts b/apps/backend/src/donationItems/donationItems.service.ts index f374855b..116742c6 100644 --- a/apps/backend/src/donationItems/donationItems.service.ts +++ b/apps/backend/src/donationItems/donationItems.service.ts @@ -23,7 +23,6 @@ export class DonationItemsService { itemName: string, quantity: number, reservedQuantity: number, - status: string, ozPerItem: number, estimatedValue: number, foodType: FoodType, @@ -37,7 +36,6 @@ export class DonationItemsService { itemName, quantity, reservedQuantity, - status, ozPerItem, estimatedValue, foodType, diff --git a/apps/backend/src/migrations/1764816885341-RemoveUnusedStatuses.ts b/apps/backend/src/migrations/1764816885341-RemoveUnusedStatuses.ts new file mode 100644 index 00000000..6419e233 --- /dev/null +++ b/apps/backend/src/migrations/1764816885341-RemoveUnusedStatuses.ts @@ -0,0 +1,25 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class RemoveUnusedStatuses1764816885341 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE allocations DROP COLUMN IF EXISTS status;` + ); + await queryRunner.query( + `ALTER TABLE donation_items DROP COLUMN IF EXISTS status;` + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + ALTER TABLE allocations + ADD COLUMN status VARCHAR(25) NOT NULL DEFAULT 'pending'; + `); + + await queryRunner.query(` + ALTER TABLE donation_items + ADD COLUMN status VARCHAR(25) NOT NULL DEFAULT 'available'; + `); + } +} From 8b59a9d2d2c5e1e416d9aa859db5797838795910 Mon Sep 17 00:00:00 2001 From: Justin Wang Date: Sun, 7 Dec 2025 10:38:16 -0500 Subject: [PATCH 2/3] updating frontend types for removed statuses --- apps/frontend/src/types/types.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/frontend/src/types/types.ts b/apps/frontend/src/types/types.ts index 6fe1ad33..f1f6d1c8 100644 --- a/apps/frontend/src/types/types.ts +++ b/apps/frontend/src/types/types.ts @@ -84,7 +84,6 @@ export interface DonationItem { itemName: string; quantity: number; reservedQuantity: number; - status: string; ozPerItem: number; estimatedValue: number; foodType: string; @@ -167,7 +166,6 @@ export interface Allocation { allocatedQuantity: number; reservedAt: string; fulfilledAt: string; - status: string; } export enum VolunteerType { From 2c79cac77b31b41ad9d7c828d76a164b2b472c8f Mon Sep 17 00:00:00 2001 From: Justin Wang Date: Sun, 7 Dec 2025 12:17:33 -0500 Subject: [PATCH 3/3] updating status to use enum types --- apps/frontend/src/types/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/frontend/src/types/types.ts b/apps/frontend/src/types/types.ts index 9e6c32b1..3925c28f 100644 --- a/apps/frontend/src/types/types.ts +++ b/apps/frontend/src/types/types.ts @@ -100,7 +100,7 @@ export interface PantryApplicationDto { export interface Donation { donationId: number; dateDonated: string; - status: string; + status: DonationStatus; totalItems: number; totalOz: number; totalEstimatedValue: number; @@ -162,7 +162,7 @@ export interface Order { pantryId: number; foodManufacturer: FoodManufacturer; shippedBy: number | null; - status: string; + status: OrderStatus; createdAt: string; shippedAt: string; deliveredAt: string;