-
Notifications
You must be signed in to change notification settings - Fork 0
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
Pantry info endpoint (backend & frontend) #3
base: main
Are you sure you want to change the base?
Conversation
@Column() | ||
approved: boolean; | ||
|
||
@Column() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do @manytoone(() => User) @joincolumn({ name: 'ssf_representative_id' }) here instead of column
@Column() | ||
ssf_representative_id: number; | ||
|
||
@Column() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and @manytoone(() => User) @joincolumn({ name: 'pantry_representative_id' }) here instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey fanny, I implemented what you suggested in my latest commit, could you explain a little bit more what this does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Dennis, "@manytoone" helps indicate a many-to-one relationship between the Pantry and User tables (meaning that each pantry can only have one user as its SSF representative or pantry representative, but a user can be the representative for multiple pantries). The "(() => User)" explicitly states that the many-to-one relationship is with the User entity, which is better for type checking and indicates that pantry_representative_id / ssf_representative_id foreign key columns in pantry refer to the user table. The "@joincolumn" specifies the columns in the pantry table that store the foreign keys linking to the user table.
…mmunity/ssf into pantries-api-endpoints
2c5aad7
to
8771b38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Note: We may not want to merge this PR until the ESLint crash triggered by the changes to
apiClient.ts
is fixed. Otherwise, all future commits and pushes on branches that include the changes from this branch will fail the pre-commit/pre-push hooks. (The--no-verify
option was used to bypass these hooks for the last 2 commits on this branch, as the new API client function should not cause a linter crash.)ℹ️ Issue
Closes https://trello.com/c/U1mRqCo7
📝 Description
pantry-overview
page, based on the pantry ID in the URL✔️ Verification
Confirmed that Swagger contains the api endpoint:
Verified the endpoint with an existing pantry ID:
Verified the endpoint with a non-existing pantry ID: