forked from Code-4-Community/scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 0
[SSF-64] Volunteer Backend Updates #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
50b0bc3
volunteer backend updates minus tests
amywng e54b6a3
review comments
amywng d892138
review comments
amywng 297797d
prettier
amywng 1bea938
add tests and prettier
amywng 50b174f
prettier
amywng 1a74893
review comments
amywng 38b0641
review comments
amywng 2db8cec
change to singular repo
amywng 8038102
change to singular repo
amywng b2d2642
remove unnecessary logic check
amywng 32fb226
add many to many relation and remove direct usage of pantry repo
amywng 5d83fb8
remove volunteer assignment route and assigning duplicate pantries
amywng 20e91e8
prettier
amywng b2a6074
switch colon to comma in migration
amywng 62e7416
update user service methods and frontend types
amywng 76c4a47
prettier
amywng 9d274e5
remove redundant validation
amywng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,19 +1,14 @@ | ||
| import { Module } from '@nestjs/common'; | ||
| import { TypeOrmModule } from '@nestjs/typeorm'; | ||
| import { PassportModule } from '@nestjs/passport'; | ||
|
|
||
| import { AuthController } from './auth.controller'; | ||
| import { AuthService } from './auth.service'; | ||
| import { UsersService } from '../users/users.service'; | ||
| import { User } from '../users/user.entity'; | ||
| import { JwtStrategy } from './jwt.strategy'; | ||
| import { UsersModule } from '../users/users.module'; | ||
|
|
||
| @Module({ | ||
| imports: [ | ||
| TypeOrmModule.forFeature([User]), | ||
| PassportModule.register({ defaultStrategy: 'jwt' }), | ||
| ], | ||
| imports: [UsersModule, PassportModule.register({ defaultStrategy: 'jwt' })], | ||
| controllers: [AuthController], | ||
| providers: [AuthService, UsersService, JwtStrategy], | ||
| providers: [AuthService, JwtStrategy], | ||
| }) | ||
| export class AuthModule {} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ export enum DonationStatus { | |
| AVAILABLE = 'available', | ||
| FULFILLED = 'fulfilled', | ||
| MATCHING = 'matching', | ||
| } | ||
| } | ||
This file contains hidden or 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
38 changes: 38 additions & 0 deletions
38
apps/backend/src/migrations/1760033134668-AddVolunteerPantryUniqueConstraint.ts
This file contains hidden or 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,38 @@ | ||
| import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
|
||
| export class AddVolunteerPantryUniqueConstraint1760033134668 | ||
| implements MigrationInterface | ||
| { | ||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(` | ||
| ALTER TABLE volunteer_assignments DROP COLUMN assignment_id; | ||
|
|
||
| ALTER TABLE volunteer_assignments | ||
| ADD PRIMARY KEY (volunteer_id, pantry_id); | ||
|
|
||
| ALTER TABLE volunteer_assignments DROP CONSTRAINT IF EXISTS fk_volunteer_id; | ||
|
|
||
| ALTER TABLE volunteer_assignments DROP CONSTRAINT IF EXISTS fk_pantry_id; | ||
|
|
||
| ALTER TABLE volunteer_assignments | ||
| ADD CONSTRAINT fk_volunteer_id FOREIGN KEY (volunteer_id) REFERENCES users(user_id) ON DELETE CASCADE, | ||
| ADD CONSTRAINT fk_pantry_id FOREIGN KEY (pantry_id) REFERENCES pantries(pantry_id) ON DELETE CASCADE; | ||
| `); | ||
| } | ||
|
|
||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(` | ||
| ALTER TABLE volunteer_assignments DROP CONSTRAINT fk_volunteer_id; | ||
|
|
||
| ALTER TABLE volunteer_assignments DROP CONSTRAINT fk_pantry_id; | ||
|
|
||
amywng marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ALTER TABLE volunteer_assignments DROP CONSTRAINT volunteer_assignments_pkey; | ||
|
|
||
| ALTER TABLE volunteer_assignments ADD COLUMN assignment_id SERIAL PRIMARY KEY; | ||
|
|
||
| ALTER TABLE volunteer_assignments | ||
| ADD CONSTRAINT fk_volunteer_id FOREIGN KEY(volunteer_id) REFERENCES users(user_id), | ||
| ADD CONSTRAINT fk_pantry_id FOREIGN KEY(pantry_id) REFERENCES pantries(pantry_id); | ||
| `); | ||
| } | ||
| } | ||
20 changes: 10 additions & 10 deletions
20
apps/backend/src/migrations/1763963056712-AllergyFriendlyToBoolType.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| import { MigrationInterface, QueryRunner } from "typeorm"; | ||
| import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
|
||
| export class AllergyFriendlyToBoolType1763963056712 implements MigrationInterface { | ||
|
|
||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(` | ||
| export class AllergyFriendlyToBoolType1763963056712 | ||
| implements MigrationInterface | ||
| { | ||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(` | ||
| ALTER TABLE pantries | ||
| ALTER COLUMN dedicated_allergy_friendly TYPE BOOLEAN USING (FALSE), | ||
| ALTER COLUMN dedicated_allergy_friendly SET NOT NULL; | ||
| `); | ||
| } | ||
| } | ||
|
|
||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(` | ||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(` | ||
| ALTER TABLE pantries | ||
| ALTER COLUMN dedicated_allergy_friendly TYPE VARCHAR(255), | ||
| ALTER COLUMN dedicated_allergy_friendly DROP NOT NULL; | ||
| `); | ||
| } | ||
|
|
||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,16 +1,14 @@ | ||
| import { Module } from '@nestjs/common'; | ||
| import { TypeOrmModule } from '@nestjs/typeorm'; | ||
| import { User } from '../users/user.entity'; | ||
| import { PantriesService } from './pantries.service'; | ||
| import { PantriesController } from './pantries.controller'; | ||
| import { JwtStrategy } from '../auth/jwt.strategy'; | ||
| import { AuthService } from '../auth/auth.service'; | ||
| import { Pantry } from './pantries.entity'; | ||
| import { OrdersModule } from '../orders/order.module'; | ||
|
|
||
| @Module({ | ||
| imports: [TypeOrmModule.forFeature([Pantry, User]), OrdersModule], | ||
| imports: [TypeOrmModule.forFeature([Pantry]), OrdersModule], | ||
| controllers: [PantriesController], | ||
| providers: [PantriesService, AuthService, JwtStrategy], | ||
| providers: [PantriesService], | ||
| exports: [PantriesService], | ||
| }) | ||
| export class PantriesModule {} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.