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

Adding the users' crud endpoints #19

Merged
merged 9 commits into from
Aug 29, 2024
Merged

Adding the users' crud endpoints #19

merged 9 commits into from
Aug 29, 2024

Conversation

Dkrisztan
Copy link
Contributor

So far this is only a sketch, not everything is implemented, authorization and authentication annotations are not yet used.

Let me know if changes are needed in these files etc.

@mozsarmate mozsarmate requested a review from Isti01 August 16, 2024 21:52
@mozsarmate mozsarmate linked an issue Aug 17, 2024 that may be closed by this pull request
Copy link
Member

@Tschonti Tschonti left a comment

Choose a reason for hiding this comment

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

doesn't quite complete the issue at this point, /users/me endpoint and authorization missing

apps/backend/src/user/user.controller.ts Outdated Show resolved Hide resolved
apps/backend/src/user/user.controller.ts Outdated Show resolved Hide resolved
apps/backend/src/user/user.service.ts Outdated Show resolved Hide resolved
apps/backend/src/user/user.service.ts Outdated Show resolved Hide resolved
apps/backend/src/user/user.service.ts Outdated Show resolved Hide resolved
Copy link

vercel bot commented Aug 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
schbody-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 29, 2024 4:42pm

@Dkrisztan
Copy link
Contributor Author

Did some refactors here and there. I've got some questions: which roles can use the specific endpoints? And where should the decorators be used? In the controller or the service, because in Bujdi's PR I saw they were used in the service

apps/backend/src/user/dto/create-user.dto.ts Outdated Show resolved Hide resolved
@Patch(':id')
@UseGuards(AuthGuard('jwt'), RolesGuard)
@Roles(Role.BODY_ADMIN)
async update(@Param('id') id: string, @Body() updateUserDto: UpdateUserDto) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to add the option for the user to update their own profile also. For eg nickname or profile description should be for sure editable. But on the other hand, schresident and vik student should be managed by admins.

Copy link
Member

Choose a reason for hiding this comment

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

But these are only for schbody members, right? No point in regular users having nicknames and stuff

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohh, that is fair. I forgot about that

Copy link
Member

Choose a reason for hiding this comment

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

so @Dkrisztan I think body members should be able to edit their own nickname and description
and body members and admins should be able to edit the schResident and vikStudent fields (if this is what they'll use during belépőosztás. or maybe I'm confused)

Copy link
Contributor Author

@Dkrisztan Dkrisztan Aug 26, 2024

Choose a reason for hiding this comment

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

The first part makes sense, the second not really 😅 . So body members can edit nickname desc and resident and vikstudent fields as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are not able to check who lives in the dorm and who does not, we agreed on all users will be able to edit their email, sch-status (room number also) as some kind of a self-declaration. Or at least, it is what I remember.
Now the profile page also has a nickname field (for all users), it is very useful for the symetry of the UI :), do you think it is unneccessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. makes sense I just didn't understand the difference between the admin and member role, regarding this update. This fix will be up later this day.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see the point of a nickname and description for regular users, their profile won't even be public, right? or are we planning on turning this app into a workout social network? xd

makes sense that the user can set their schStatus and roomNumber, but then the body members should be able to edit another flag that the sch residency was approved during the belepoosztas. Or I guess that could be unnecessary, they just simply don't give them their pass if it wasn't approved

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes

@Dkrisztan
Copy link
Contributor Author

Did some refactors here and there. I've got some questions: which roles can use the specific endpoints? And where should the decorators be used? In the controller or the service, because in Bujdi's PR I saw they were used in the service

still waiting for a reply on this one 😅 not sure what should be followed

@Tschonti
Copy link
Member

Did some refactors here and there. I've got some questions: which roles can use the specific endpoints? And where should the decorators be used? In the controller or the service, because in Bujdi's PR I saw they were used in the service

still waiting for a reply on this one 😅 not sure what should be followed

decorators are only used in the controller, Bujdi's PR had comments to remove them from the service xd
honestly I'm lost with the roles

@mozsarmate
Copy link
Contributor

Did some refactors here and there. I've got some questions: which roles can use the specific endpoints? And where should the decorators be used? In the controller or the service, because in Bujdi's PR I saw they were used in the service
still waiting for a reply on this one 😅 not sure what should be followed

I would put the decorators in the controller, as well
The privileges (determined by the decorators) look good to me, except the update one; the user should be able to update their own profile! (Of course not the VikStatusField, etc..., but the contact_email, nick_name, schStatus, roomNumber data should be editable for their users!

@mozsarmate
Copy link
Contributor

oh maaan, Samu was quicker than me

@@ -21,6 +21,7 @@
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.3.8",
"@prisma/client": "^5.13.0",
"class-transformer": "^0.5.1",
Copy link
Member

Choose a reason for hiding this comment

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

lmao why was this missing

Copy link
Member

@Tschonti Tschonti left a comment

Choose a reason for hiding this comment

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

én már elvesztem de most már biztos jó

@mozsarmate mozsarmate dismissed FearsomeRover’s stale review August 29, 2024 16:24

to be able to merge

@mozsarmate mozsarmate merged commit 357e629 into main Aug 29, 2024
3 of 4 checks passed
@mozsarmate mozsarmate deleted the feat/5-user-crud branch August 29, 2024 16:40
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.

User CRUD endpoints on backend
4 participants