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

feat/(CUST-CPC-1075): Being Able To Add Customer To Website #632

Merged

Conversation

NotZagreus
Copy link
Collaborator

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

Have to fix the positive test
all is DONE
@NotZagreus NotZagreus added the CUST CUST (Customer) service label Sep 14, 2024
Linting (help me)
flyindonut
flyindonut previously approved these changes Sep 14, 2024
Copy link
Collaborator

@flyindonut flyindonut 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 to me!

AndrewBadIdea
AndrewBadIdea previously approved these changes Sep 14, 2024
Copy link
Collaborator

@AndrewBadIdea AndrewBadIdea left a 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 !

@NotZagreus NotZagreus merged commit 10b1205 into main Sep 15, 2024
14 checks passed
@NotZagreus NotZagreus deleted the feat/CUST-CPC-1075_Being_Able_To_Add_A_Customer_To_The_Website branch September 15, 2024 02:30
Copy link
Collaborator

@AlejandroBrnab AlejandroBrnab 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 to me

viktorkuts pushed a commit that referenced this pull request Sep 17, 2024
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)
flyindonut added a commit that referenced this pull request Sep 18, 2024
**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
hristoiv11 pushed a commit that referenced this pull request Sep 20, 2024
**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
hristoiv11 pushed a commit that referenced this pull request Sep 20, 2024
**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
hristoiv11 pushed a commit that referenced this pull request Sep 20, 2024
**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
hristoiv11 pushed a commit that referenced this pull request Sep 20, 2024
**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
hristoiv11 pushed a commit that referenced this pull request Sep 21, 2024
**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
hristoiv11 pushed a commit that referenced this pull request Sep 22, 2024
**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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CUST CUST (Customer) service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants