-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat/(CUST-CPC-1075): Being Able To Add Customer To Website #632
feat/(CUST-CPC-1075): Being Able To Add Customer To Website #632
Conversation
Have to fix the positive test
all is DONE
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.
Very good we have a Post now !
…mer_To_The_Website
90e9d8a
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
JIRA: https://champlainsaintlambert.atlassian.net/browse/CPC-1075 ## Context: Added a v2 endpoint for being able to add a customer (as an admin). Adding a web form to input customer details, following the "Customer Profile Edit" form created previously. ## Changes - Added the "addOwner" v2 method to the CustomersServiceClient impoving the already existing "createOwner" method, since that one was not operational. - Created the endpoint to add an owner in the OwnerController - Created the TypeScript Model for "Owner" - Created the api call method to the new endpoint (addOwner.ts) - Based on the "Customer Profile Edit" form, created "Add Customer" form to conform to the addition of a customer. - Adding the routing for adding the customer in "router.tsx" - Fixing a small navigation issue in "Profile Edit" - Adding the path routes for the form created - Tested the "addOwner" method ## Before and After UI (Required for UI-impacting PRs) ![image](https://github.com/user-attachments/assets/5601b31f-f275-452a-81e4-2b11d4692aa7)
**JIRA:** https://champlainsaintlambert.atlassian.net/browse/CPC-1134 ## Context: Currently, users can access every page that the axiosErrorResponseHandler doesn't handle. This means that an admin or vet is able to access the customer profile edit page which only a customer should be able to see. ## Does this PR change the .vscode folder in petclinic-frontend?: Absolutely not. I hope. ## Changes - Created a hook to validate user roles (useHasRequiredRole.ts). Implemented it in the ProtectedRouteProps.tsx - Added the roles that are authorized to access ProfileEdit, AddingCustomer, and AllOwners. Other teams can implement it to their pages as well (see dev notes). - Created 4 additional functions that people can use in the UserContext.tsx - Refactored and reorganized the ProfileEdit.tsx. The update form is now a component in the newly created components folder in features/customers ## Before and After UI (Required for UI-impacting PRs) No change to the UI. Users will just be redirected to 403 Forbidden when they access pages they shouldn't see ## Dev notes (Optional) If you want to make a page accessible by roles, just take a look at router.tsx. Pages that trigger the axiosErrorResponseHandler will automatically redirect users to an error page. If you want to be consistent, then add roles to each page that would require it. ## Linked pull requests (Optional) Update Customer #622 Add Customer #632 Show all customers #634
**JIRA:** https://champlainsaintlambert.atlassian.net/browse/CPC-1134 Currently, users can access every page that the axiosErrorResponseHandler doesn't handle. This means that an admin or vet is able to access the customer profile edit page which only a customer should be able to see. Absolutely not. I hope. - Created a hook to validate user roles (useHasRequiredRole.ts). Implemented it in the ProtectedRouteProps.tsx - Added the roles that are authorized to access ProfileEdit, AddingCustomer, and AllOwners. Other teams can implement it to their pages as well (see dev notes). - Created 4 additional functions that people can use in the UserContext.tsx - Refactored and reorganized the ProfileEdit.tsx. The update form is now a component in the newly created components folder in features/customers No change to the UI. Users will just be redirected to 403 Forbidden when they access pages they shouldn't see If you want to make a page accessible by roles, just take a look at router.tsx. Pages that trigger the axiosErrorResponseHandler will automatically redirect users to an error page. If you want to be consistent, then add roles to each page that would require it. Update Customer #622 Add Customer #632 Show all customers #634
**JIRA:** https://champlainsaintlambert.atlassian.net/browse/CPC-1134 Currently, users can access every page that the axiosErrorResponseHandler doesn't handle. This means that an admin or vet is able to access the customer profile edit page which only a customer should be able to see. Absolutely not. I hope. - Created a hook to validate user roles (useHasRequiredRole.ts). Implemented it in the ProtectedRouteProps.tsx - Added the roles that are authorized to access ProfileEdit, AddingCustomer, and AllOwners. Other teams can implement it to their pages as well (see dev notes). - Created 4 additional functions that people can use in the UserContext.tsx - Refactored and reorganized the ProfileEdit.tsx. The update form is now a component in the newly created components folder in features/customers No change to the UI. Users will just be redirected to 403 Forbidden when they access pages they shouldn't see If you want to make a page accessible by roles, just take a look at router.tsx. Pages that trigger the axiosErrorResponseHandler will automatically redirect users to an error page. If you want to be consistent, then add roles to each page that would require it. Update Customer #622 Add Customer #632 Show all customers #634
**JIRA:** https://champlainsaintlambert.atlassian.net/browse/CPC-1134 Currently, users can access every page that the axiosErrorResponseHandler doesn't handle. This means that an admin or vet is able to access the customer profile edit page which only a customer should be able to see. Absolutely not. I hope. - Created a hook to validate user roles (useHasRequiredRole.ts). Implemented it in the ProtectedRouteProps.tsx - Added the roles that are authorized to access ProfileEdit, AddingCustomer, and AllOwners. Other teams can implement it to their pages as well (see dev notes). - Created 4 additional functions that people can use in the UserContext.tsx - Refactored and reorganized the ProfileEdit.tsx. The update form is now a component in the newly created components folder in features/customers No change to the UI. Users will just be redirected to 403 Forbidden when they access pages they shouldn't see If you want to make a page accessible by roles, just take a look at router.tsx. Pages that trigger the axiosErrorResponseHandler will automatically redirect users to an error page. If you want to be consistent, then add roles to each page that would require it. Update Customer #622 Add Customer #632 Show all customers #634
**JIRA:** https://champlainsaintlambert.atlassian.net/browse/CPC-1134 Currently, users can access every page that the axiosErrorResponseHandler doesn't handle. This means that an admin or vet is able to access the customer profile edit page which only a customer should be able to see. Absolutely not. I hope. - Created a hook to validate user roles (useHasRequiredRole.ts). Implemented it in the ProtectedRouteProps.tsx - Added the roles that are authorized to access ProfileEdit, AddingCustomer, and AllOwners. Other teams can implement it to their pages as well (see dev notes). - Created 4 additional functions that people can use in the UserContext.tsx - Refactored and reorganized the ProfileEdit.tsx. The update form is now a component in the newly created components folder in features/customers No change to the UI. Users will just be redirected to 403 Forbidden when they access pages they shouldn't see If you want to make a page accessible by roles, just take a look at router.tsx. Pages that trigger the axiosErrorResponseHandler will automatically redirect users to an error page. If you want to be consistent, then add roles to each page that would require it. Update Customer #622 Add Customer #632 Show all customers #634
**JIRA:** https://champlainsaintlambert.atlassian.net/browse/CPC-1134 Currently, users can access every page that the axiosErrorResponseHandler doesn't handle. This means that an admin or vet is able to access the customer profile edit page which only a customer should be able to see. Absolutely not. I hope. - Created a hook to validate user roles (useHasRequiredRole.ts). Implemented it in the ProtectedRouteProps.tsx - Added the roles that are authorized to access ProfileEdit, AddingCustomer, and AllOwners. Other teams can implement it to their pages as well (see dev notes). - Created 4 additional functions that people can use in the UserContext.tsx - Refactored and reorganized the ProfileEdit.tsx. The update form is now a component in the newly created components folder in features/customers No change to the UI. Users will just be redirected to 403 Forbidden when they access pages they shouldn't see If you want to make a page accessible by roles, just take a look at router.tsx. Pages that trigger the axiosErrorResponseHandler will automatically redirect users to an error page. If you want to be consistent, then add roles to each page that would require it. Update Customer #622 Add Customer #632 Show all customers #634
**JIRA:** https://champlainsaintlambert.atlassian.net/browse/CPC-1134 Currently, users can access every page that the axiosErrorResponseHandler doesn't handle. This means that an admin or vet is able to access the customer profile edit page which only a customer should be able to see. Absolutely not. I hope. - Created a hook to validate user roles (useHasRequiredRole.ts). Implemented it in the ProtectedRouteProps.tsx - Added the roles that are authorized to access ProfileEdit, AddingCustomer, and AllOwners. Other teams can implement it to their pages as well (see dev notes). - Created 4 additional functions that people can use in the UserContext.tsx - Refactored and reorganized the ProfileEdit.tsx. The update form is now a component in the newly created components folder in features/customers No change to the UI. Users will just be redirected to 403 Forbidden when they access pages they shouldn't see If you want to make a page accessible by roles, just take a look at router.tsx. Pages that trigger the axiosErrorResponseHandler will automatically redirect users to an error page. If you want to be consistent, then add roles to each page that would require it. Update Customer #622 Add Customer #632 Show all customers #634
JIRA: https://champlainsaintlambert.atlassian.net/browse/CPC-1075
Context:
Added a v2 endpoint for being able to add a customer (as an admin). Adding a web form to input customer details, following the "Customer Profile Edit" form created previously.
Changes
Before and After UI (Required for UI-impacting PRs)