Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
60beb3c
Initial changes
dburkhart07 Nov 9, 2025
3e6fdeb
Initial testing changes
dburkhart07 Nov 11, 2025
9e62a9a
Commit
dburkhart07 Nov 11, 2025
0971ca1
added dummy data for testing
dburkhart07 Nov 15, 2025
80ce71f
Resolved merge conflicts
dburkhart07 Nov 21, 2025
92686b6
Resolved merge conflicts
dburkhart07 Nov 21, 2025
4d3d693
Completed proper pipeline for dummy testing data
dburkhart07 Nov 21, 2025
ec2fb63
Testing the action CI workflow
dburkhart07 Nov 21, 2025
c5c7b9b
Simplified workflow
dburkhart07 Nov 21, 2025
294e85e
Testing workflow with securing-safe-food-test deleted
dburkhart07 Nov 21, 2025
a474507
Updated README
dburkhart07 Nov 21, 2025
3cc1010
Restored theme.ts
dburkhart07 Nov 21, 2025
dc6aa8c
Final commit
dburkhart07 Nov 21, 2025
2f575a3
Moved migrations to constant file for easy refactoring
dburkhart07 Jan 30, 2026
85ff2df
prettier
dburkhart07 Jan 30, 2026
e7f9c02
Merged main
dburkhart07 Jan 30, 2026
5bd6ce2
Final commit
dburkhart07 Jan 30, 2026
4f0642c
prettier
dburkhart07 Jan 30, 2026
bfcb073
Changes, still working on getting testing working
dburkhart07 Feb 1, 2026
d09f888
prettier
dburkhart07 Feb 1, 2026
050c9aa
Readjusted testing approach
dburkhart07 Feb 2, 2026
365a6d3
final commit
dburkhart07 Feb 2, 2026
509a5dd
Fixed schema migrations
dburkhart07 Feb 2, 2026
64fcf76
added prettier
swarkewalia Feb 4, 2026
83edbbd
ran prettier write and committing prettier fixes
swarkewalia Feb 4, 2026
989fca2
Merge branch 'main' into sk/SSF-132-verify-prettier-check
swarkewalia Feb 4, 2026
39cf0e6
ran prettier write again
swarkewalia Feb 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ What steps did you take to verify your changes work? These should be clear enoug

Describe any new unit tests you added.

Provide screenshots of any new components, styling changes, or pages.
Provide screenshots of any new components, styling changes, or pages.

### 🏕️ (Optional) Future Work / Notes

Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/backend-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on: [push, pull_request]

jobs:
prettier-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: yarn install
- run: yarn prettier:check
backend-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: securing-safe-food-test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
env:
DATABASE_HOST: 127.0.0.1
DATABASE_PORT: 5432
DATABASE_NAME_TEST: securing-safe-food-test
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
NX_DAEMON: 'false'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: yarn install
- run: npx jest


113 changes: 0 additions & 113 deletions .github/workflows/ci-cd.yml

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ yarn install

To set up your backend, follow the backend-specific instructions [here](apps/backend/README.md).

*Note: you may need to prefix your `nx` commands with `npx`. For example, to serve the frontend, if:
\*Note: you may need to prefix your `nx` commands with `npx`. For example, to serve the frontend, if:

```
nx serve frontend
```
Expand All @@ -24,6 +25,7 @@ npx nx serve frontend
## Start the app

To start the development server, run one of the following commands:

- To run the frontend at http://localhost:4200/: `nx serve frontend`
- To run the backend at http://localhost:3000/: `nx serve backend`
- The homepage includes the Swagger API documentation.
Expand Down
14 changes: 11 additions & 3 deletions apps/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ You'll need to download:
Then, set up a database called `securing-safe-food`. If you're not familiar with how to do so, it's easy to do through PgAdmin

1. Open PgAdmin and configure your credentials (if necessary). Then, right click on the `Databases` dropdown (under `Servers` > `PostgreSQL [version]`)

![alt text](resources/pg-setup-1.png)

2. Enter "securing-safe-food" as the database name

![alt text](resources/pg-setup-2.png)

Next, create a file called `.env` in the **root directory** (under `ssf/`) and copy over the contents from `.env.example`. Replace `DATABASE_PASSWORD` with the password you entered for the `postgres` user (NOT necessarily your PgAdmin master password!)
Expand All @@ -25,4 +25,12 @@ You can check that your database connection details are correct by running `nx s
"LOG 🚀 Application is running on: http://localhost:3000/api"
```

Finally, run `yarn run typeorm:migrate` to load all the tables into your database. If everything is set up correctly, you should see "Migration ... has been executed successfully." in the terminal.
Finally, run `yarn run typeorm:migrate` to load all the tables into your database. If everything is set up correctly, you should see "Migration ... has been executed successfully." in the terminal.

### Running backend integration tests

1. Create a **separate** Postgres database (for example `securing-safe-food-test`).
2. Add a `DATABASE_NAME_TEST` entry (and optionally `DATABASE_HOST/PORT/USERNAME/PASSWORD`) to your `.env` so the test data source can connect to that database.
3. Run the backend test suite with `npx jest`.

Each spec truncates all data tables and runs the `PopulateDummyData1768501812134` migration so every test receives the same dataset while keeping the schema created by the regular migrations.
57 changes: 57 additions & 0 deletions apps/backend/src/config/migrations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { User1725726359198 } from '../migrations/1725726359198-User';
import { AddTables1726524792261 } from '../migrations/1726524792261-addTables';
import { ReviseTables1737522923066 } from '../migrations/1737522923066-reviseTables';
import { UpdateUserRole1737816745912 } from '../migrations/1737816745912-UpdateUserRole';
import { UpdatePantriesTable1737906317154 } from '../migrations/1737906317154-updatePantriesTable';
import { UpdateDonations1738697216020 } from '../migrations/1738697216020-updateDonations';
import { UpdateDonationColTypes1741708808976 } from '../migrations/1741708808976-UpdateDonationColTypes';
import { UpdatePantriesTable1738172265266 } from '../migrations/1738172265266-updatePantriesTable';
import { UpdatePantriesTable1739056029076 } from '../migrations/1739056029076-updatePantriesTable';
import { AssignmentsPantryIdNotUnique1758384669652 } from '../migrations/1758384669652-AssignmentsPantryIdNotUnique';
import { UpdateOrdersTable1740367964915 } from '../migrations/1740367964915-updateOrdersTable';
import { UpdateFoodRequests1744051370129 } from '../migrations/1744051370129-updateFoodRequests';
import { UpdateRequestTable1741571847063 } from '../migrations/1741571847063-updateRequestTable';
import { RemoveOrderIdFromRequests1744133526650 } from '../migrations/1744133526650-removeOrderIdFromRequests';
import { AddOrders1739496585940 } from '../migrations/1739496585940-addOrders';
import { AddingEnumValues1760538239997 } from '../migrations/1760538239997-AddingEnumValues';
import { UpdateColsToUseEnumType1760886499863 } from '../migrations/1760886499863-UpdateColsToUseEnumType';
import { UpdatePantriesTable1742739750279 } from '../migrations/1742739750279-updatePantriesTable';
import { RemoveOrdersDonationId1761500262238 } from '../migrations/1761500262238-RemoveOrdersDonationId';
import { AddVolunteerPantryUniqueConstraint1760033134668 } from '../migrations/1760033134668-AddVolunteerPantryUniqueConstraint';
import { AllergyFriendlyToBoolType1763963056712 } from '../migrations/1763963056712-AllergyFriendlyToBoolType';
import { UpdatePantryUserFieldsFixed1764350314832 } from '../migrations/1764350314832-UpdatePantryUserFieldsFixed';
import { RemoveMultipleVolunteerTypes1764811878152 } from '../migrations/1764811878152-RemoveMultipleVolunteerTypes';
import { RemoveUnusedStatuses1764816885341 } from '../migrations/1764816885341-RemoveUnusedStatuses';
import { UpdatePantryFields1763762628431 } from '../migrations/1763762628431-UpdatePantryFields';
import { PopulateDummyData1768501812134 } from '../migrations/1768501812134-populateDummyData';

const schemaMigrations = [
User1725726359198,
AddTables1726524792261,
ReviseTables1737522923066,
UpdateUserRole1737816745912,
UpdatePantriesTable1737906317154,
UpdateDonations1738697216020,
UpdateDonationColTypes1741708808976,
UpdatePantriesTable1738172265266,
UpdatePantriesTable1739056029076,
AssignmentsPantryIdNotUnique1758384669652,
AddOrders1739496585940,
UpdateOrdersTable1740367964915,
UpdateRequestTable1741571847063,
UpdateFoodRequests1744051370129,
RemoveOrderIdFromRequests1744133526650,
AddingEnumValues1760538239997,
UpdateColsToUseEnumType1760886499863,
UpdatePantriesTable1742739750279,
RemoveOrdersDonationId1761500262238,
UpdatePantryFields1763762628431,
AddVolunteerPantryUniqueConstraint1760033134668,
AllergyFriendlyToBoolType1763963056712,
UpdatePantryUserFieldsFixed1764350314832,
RemoveMultipleVolunteerTypes1764811878152,
RemoveUnusedStatuses1764816885341,
PopulateDummyData1768501812134,
];

export default schemaMigrations;
56 changes: 2 additions & 54 deletions apps/backend/src/config/typeorm.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
import { registerAs } from '@nestjs/config';
import { PluralNamingStrategy } from '../strategies/plural-naming.strategy';
import { DataSource, DataSourceOptions } from 'typeorm';
import { User1725726359198 } from '../migrations/1725726359198-User';
import { AddTables1726524792261 } from '../migrations/1726524792261-addTables';
import { ReviseTables1737522923066 } from '../migrations/1737522923066-reviseTables';
import { UpdateUserRole1737816745912 } from '../migrations/1737816745912-UpdateUserRole';
import { UpdatePantriesTable1737906317154 } from '../migrations/1737906317154-updatePantriesTable';
import { UpdateDonations1738697216020 } from '../migrations/1738697216020-updateDonations';
import { UpdateDonationColTypes1741708808976 } from '../migrations/1741708808976-UpdateDonationColTypes';
import { UpdatePantriesTable1738172265266 } from '../migrations/1738172265266-updatePantriesTable';
import { UpdatePantriesTable1739056029076 } from '../migrations/1739056029076-updatePantriesTable';
import { AssignmentsPantryIdNotUnique1758384669652 } from '../migrations/1758384669652-AssignmentsPantryIdNotUnique';
import { UpdateOrdersTable1740367964915 } from '../migrations/1740367964915-updateOrdersTable';
import { UpdateFoodRequests1744051370129 } from '../migrations/1744051370129-updateFoodRequests';
import { UpdateRequestTable1741571847063 } from '../migrations/1741571847063-updateRequestTable';
import { RemoveOrderIdFromRequests1744133526650 } from '../migrations/1744133526650-removeOrderIdFromRequests';
import { AddOrders1739496585940 } from '../migrations/1739496585940-addOrders';
import { AddingEnumValues1760538239997 } from '../migrations/1760538239997-AddingEnumValues';
import { UpdateColsToUseEnumType1760886499863 } from '../migrations/1760886499863-UpdateColsToUseEnumType';
import { UpdatePantriesTable1742739750279 } from '../migrations/1742739750279-updatePantriesTable';
import { RemoveOrdersDonationId1761500262238 } from '../migrations/1761500262238-RemoveOrdersDonationId';
import { AddVolunteerPantryUniqueConstraint1760033134668 } from '../migrations/1760033134668-AddVolunteerPantryUniqueConstraint';
import { AllergyFriendlyToBoolType1763963056712 } from '../migrations/1763963056712-AllergyFriendlyToBoolType';
import { UpdatePantryUserFieldsFixed1764350314832 } from '../migrations/1764350314832-UpdatePantryUserFieldsFixed';
import { RemoveMultipleVolunteerTypes1764811878152 } from '../migrations/1764811878152-RemoveMultipleVolunteerTypes';
import { RemoveUnusedStatuses1764816885341 } from '../migrations/1764816885341-RemoveUnusedStatuses';
import { UpdatePantryFields1763762628431 } from '../migrations/1763762628431-UpdatePantryFields';
import { PopulateDummyData1768501812134 } from '../migrations/1768501812134-populateDummyData';
import schemaMigrations from './migrations';

const config = {
type: 'postgres',
Expand All @@ -40,34 +15,7 @@ const config = {
namingStrategy: new PluralNamingStrategy(),
// Glob patterns (e.g. ../migrations/**.ts) are deprecated, so we have to manually specify each migration
// TODO: see if there's still a way to dynamically load all migrations
migrations: [
User1725726359198,
AddTables1726524792261,
ReviseTables1737522923066,
UpdateUserRole1737816745912,
UpdatePantriesTable1737906317154,
UpdateDonations1738697216020,
UpdateDonationColTypes1741708808976,
UpdatePantriesTable1738172265266,
UpdatePantriesTable1739056029076,
AssignmentsPantryIdNotUnique1758384669652,
AddOrders1739496585940,
UpdateOrdersTable1740367964915,
UpdateRequestTable1741571847063,
UpdateFoodRequests1744051370129,
RemoveOrderIdFromRequests1744133526650,
AddingEnumValues1760538239997,
UpdateColsToUseEnumType1760886499863,
UpdatePantriesTable1742739750279,
RemoveOrdersDonationId1761500262238,
UpdatePantryFields1763762628431,
AddVolunteerPantryUniqueConstraint1760033134668,
AllergyFriendlyToBoolType1763963056712,
UpdatePantryUserFieldsFixed1764350314832,
RemoveMultipleVolunteerTypes1764811878152,
RemoveUnusedStatuses1764816885341,
PopulateDummyData1768501812134,
],
migrations: [...schemaMigrations],
};

export default registerAs('typeorm', () => config);
Expand Down
36 changes: 36 additions & 0 deletions apps/backend/src/config/typeormTestDataSource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'dotenv/config';
import { DataSource, DataSourceOptions } from 'typeorm';
import { PluralNamingStrategy } from '../strategies/plural-naming.strategy';
import { Order } from '../orders/order.entity';
import { Pantry } from '../pantries/pantries.entity';
import { User } from '../users/user.entity';
import { Donation } from '../donations/donations.entity';
import { FoodManufacturer } from '../foodManufacturers/manufacturer.entity';
import { FoodRequest } from '../foodRequests/request.entity';
import { DonationItem } from '../donationItems/donationItems.entity';
import { Allocation } from '../allocations/allocations.entity';
import schemaMigrations from './migrations';

const testConfig: DataSourceOptions = {
type: 'postgres',
host: process.env.DATABASE_HOST ?? '127.0.0.1',
port: process.env.DATABASE_PORT ? parseInt(process.env.DATABASE_PORT) : 5432,
database: process.env.DATABASE_NAME_TEST ?? 'securing-safe-food-test',
username: process.env.DATABASE_USERNAME ?? 'postgres',
password: process.env.DATABASE_PASSWORD ?? 'postgres',
synchronize: false,
namingStrategy: new PluralNamingStrategy(),
entities: [
Order,
Pantry,
User,
Donation,
FoodManufacturer,
FoodRequest,
DonationItem,
Allocation,
],
migrations: schemaMigrations,
};

export const testDataSource = new DataSource(testConfig);
Loading