Skip to content
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

Features/team resources endpoints #27

Merged
merged 28 commits into from
Nov 1, 2023

Conversation

curtwl
Copy link
Collaborator

@curtwl curtwl commented Oct 25, 2023

Description

Create endpoints for team resources

Issue link

Fixes # 18

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested with Swagger and Postman.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Collaborator

@cherylli cherylli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can run yarn format to fix lint errors

src/resources/resources.service.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@jenny-alexander jenny-alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - great job taking in all comments and incorporating them into your code.
I tested endpoints locally.
Endpoints should be plural - we will take care of that in another task

Copy link
Contributor

@jenny-alexander jenny-alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed changes - looks good.
I tested 2 more random API endpoints within team resources to make sure they work as expected.

Only outstanding is the userId within body of resource DTO - will this be removed once auth is in?

@Dan-Y-Ko
Copy link
Collaborator

Dan-Y-Ko commented Oct 26, 2023

Reviewed changes - looks good. I tested 2 more random API endpoints within team resources to make sure they work as expected.

Only outstanding is the userId within body of resource DTO - will this be removed once auth is in?

That's correct.

I haven't looked into this in detail but I think it'd be good to name the folder voyage resources or something like that since we have this resources and the global resources. Idk what naming convention be team decided on but it looks like there's another folder using kebab casing, so voyage-resources? Something like that.

@cherylli
Copy link
Collaborator

Reviewed changes - looks good. I tested 2 more random API endpoints within team resources to make sure they work as expected.
Only outstanding is the userId within body of resource DTO - will this be removed once auth is in?

That's correct.

I haven't looked into this in detail but I think it'd be good to name the folder voyage resources or something like that since we have this resources and the global resources. Idk what naming convention be team decided on but it looks like there's another folder using kebab casing, so voyage-resources? Something like that.

yes nestjs use kebab case for files and folders

@cherylli cherylli self-requested a review October 26, 2023 11:25
Copy link
Collaborator

@cherylli cherylli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you are solely using teamMemberId, in this case, userId won't be required at all. But I've explained why I believe using userId + team Id to find teamMemberId in the backend would be better in another comment

src/resources/resources.controller.ts Outdated Show resolved Hide resolved
src/resources/resources.controller.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@jenny-alexander jenny-alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@jenny-alexander jenny-alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed approved

@smurph7894
Copy link
Contributor

Tested each of the endpoints and they are working an protect for creator only edits when required.

@smurph7894
Copy link
Contributor

Do we want to consider having a validator that a url is bring input? It looks like prisma does work with regex and other options. https://www.prisma.io/docs/concepts/components/prisma-client/custom-validation

@cherylli
Copy link
Collaborator

cherylli commented Nov 1, 2023

Do we want to consider having a validator that a url is bring input? It looks like prisma does work with regex and other options. https://www.prisma.io/docs/concepts/components/prisma-client/custom-validation

nestjs has a @IsUrl

@cherylli
Copy link
Collaborator

cherylli commented Nov 1, 2023

Looks good but missing some basic error handling for the POST and GET, like if TeamId doesn't exist it just returns a generic 500 error.

I also agree to adding something to validate it's a url, you could look at nestjs built in @IsUrl

and for GET, if the team doesn't exist it returns [] which should probably return an error, as opposed to returning [] when there's actually no votes

Copy link
Contributor

@kennytram kennytram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

We can always add error-handling in later especially when other api controllers will also need error-handling.

@jenny-alexander jenny-alexander merged commit 6d18dad into dev Nov 1, 2023
1 check passed
@jenny-alexander jenny-alexander deleted the features/team-resources-endpoints branch November 1, 2023 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants