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

Feature 28 create user controller and service #32

Merged
merged 23 commits into from
Oct 24, 2023

Conversation

Exochos
Copy link
Contributor

@Exochos Exochos commented Oct 11, 2023

nsc-events-nestjs_sprint2_Feature 28 create user controller and service

draft here. Postman works.

http://localhost:3000/api/auth/adminadduser
http://localhost:3000/api/auth/admindelete
http://localhost:3000/api/auth/adminupdateuser

Ali-7s and others added 6 commits October 6, 2023 19:07
added prettier definition to clear all the red from vs code
added routes to create a user and delete a user
Added the route to update a user to creator.
@taylorpapke
Copy link
Contributor

@theGaryLarson I'm noticing that on PR's where another push is made, CI is running Continuous-Integration / build-and-test and not completing. @Exochos I'm pretty sure if this PR is closed and reopened, it will run CI (on pull-request) / Continuous-Integration / build-and-test (pull_request) and complete. Perhaps something to look into more.

finished renaming the userAuth.model so it didn't break anything. As well as enabling the UserModel, also added the password prop to user.model to stop it breaking functionality
Removed admin routes from auth routes and added a working adminAddUser route to the user side. Also added a password to the user.module so that the admin add user route works.
Added a delete route for admins.
Further updated the user.control and user.services for an adminUpdate route
added mocked user tests for admin routes.
I refactored the admin code to use the create user dto and removed the test cases cause I can't get the relative path working.
@Exochos Exochos closed this Oct 21, 2023
@Exochos Exochos reopened this Oct 21, 2023
updated the service and controller to use the CreateUserDto.
@Exochos Exochos closed this Oct 21, 2023
@Exochos Exochos reopened this Oct 21, 2023
@theGaryLarson theGaryLarson reopened this Oct 24, 2023
@theGaryLarson
Copy link
Contributor

@theGaryLarson I'm noticing that on PR's where another push is made, CI is running Continuous-Integration / build-and-test and not completing. @Exochos I'm pretty sure if this PR is closed and reopened, it will run CI (on pull-request) / Continuous-Integration / build-and-test (pull_request) and complete. Perhaps something to look into more.

@taylorpapke Thanks for pointing this out. I noticed that opening and reopening doesn't retrigger the CI but a push does. Something I didn't really notice when it was my branches I was pushing too. I will have to tweak CI to trigger when PR is opened so we can trigger it on other's PRs.

Updated route names and removed extra routes
@Exochos
Copy link
Contributor Author

Exochos commented Oct 24, 2023

Lot to unpack here:
I started off by refactoring the /auth/schema/userAuthSchema into --> userAuth.model.
This was done so I could use the User routes as there was a naming conflict.
Next we un-commented all of the /user routes and and got them all running, along with refactoring some of the code to user the create-user.dto instead of structs which they had been using. Also added a couple of routes. Additionally I added a password field to the create-user.dto to allow the admin to add a password when creating a new user (before it would create a user but without a password which means they could never login.) I have added my postman tests below along with their corresponding local MongoDB database for comparison.

Adding a user.
adduserPostman

Updating a user.
updateUserPostman

Deleting a user.
deleteUserPostman

@Exochos Exochos marked this pull request as ready for review October 24, 2023 18:23
Copy link
Contributor

@theGaryLarson theGaryLarson left a comment

Choose a reason for hiding this comment

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

Looks good. I fixed the CodeFactor errors. there were three 2 were just minor styling adjustments and 1 was when renaming UserSchema to UserAuthSchema the import wasn't adjusted in the auth>schema or auth>module.

Also, I made some minor changes to the endpoints to follow the standards. pluralized user. Now users. and added find word to findById path e.g. users/find/:id

@theGaryLarson theGaryLarson merged commit 8d2c661 into main Oct 24, 2023
@theGaryLarson theGaryLarson deleted the feature-28-Create_User_controller_and_service branch October 24, 2023 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.