Microservices(Full Stack), SpringBoot, KeyClock, JWT, MySql, RabbitMQ, WebSocket, Docker, React, TailwindCSS, Redux, Material-UI,Formik, Razor Pay, Stripe.
- npm i
- npm start
- run all microservices
- run keycloak server(user need to install docker for this)
then run keycloak
command : docker run -p 8080:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:26.1.0 start-dev
1. create client
2. change clientId, CLIENT_SECRET, CLIENT_ID, username, password in Keycloak user service
3. create admin => asign admin role (don't forgot off temporary option)
4. create client role=> CUSTOMER => SALON_OWNER
5. increase access token life span
Once keycloack setup is completed you can login, register on frontend and check all the functionality
-
π POST
/auth/signup
- π Description: Registers a new user with the provided signup details.
- π₯ Request Body:
- π
SignupDto
(contains user registration details).
- π
- π€ Response:
- π’ Success message: "User created successfully."
- π Authentication response object.
-
π POST
/auth/login
- π Description: Logs in a user using their email and password.
- π₯ Request Body:
- π§
LoginDto
(containsemail
andpassword
).
- π§
- π€ Response:
- π’ Success message: "User logged in successfully."
- π Authentication response object.
-
π GET
/auth/access-token/refresh-token/{refreshToken}
- π Description: Generates a new access token using a valid refresh token.
- π₯ Parameters:
- π
refreshToken
(PathVariable).
- π
- π€ Response:
- π’ Success message: "Refresh token received successfully."
- π Authentication response object.
-
π€ GET
/api/users/profile
- π Description: Retrieves the user profile based on the JWT token.
- π₯ Request Header:
- π
Authorization
(JWT token).
- π
- π€ Response:
- π
UserDTO
containing the user's profile information.
- π
- β
HTTP Status:
- π’
200 OK
on success.
- π’
-
π GET
/api/users/{userId}
- π Description: Retrieves user details based on their ID.
- π₯ Path Parameter:
- π
userId
(ID of the user to retrieve).
- π
- π€ Response:
- π
UserDTO
containing the user's details.
- π
- β
HTTP Status:
- π’
200 OK
on success. - β Throws a
UserException
if the user is not found.
- π’
Base URL: /api/salons
- π Description: Creates a new salon for the authenticated user.
- π Authorization:
- Header:
"Authorization"
β JWT token
- Header:
- π₯ Request Body:
SalonDTO
β Details of the salon to be created.
- π€ Response:
- Status:
201 Created
- Body:
SalonDTO
β Details of the newly created salon.
- Status:
- π Description: Updates an existing salon based on the given salon ID.
- π Path Parameter:
salonId
β ID of the salon to update.
- π₯ Request Body:
Salon
β Updated details of the salon.
- π€ Response:
- Status:
200 OK
- Body:
SalonDTO
β Updated details of the salon.
- Status:
- π Description: Retrieves a list of all salons.
- π€ Response:
- Status:
200 OK
- Body:
List<SalonDTO>
β A list of all salons with owner details.
- Status:
- π Description: Retrieves the details of a salon by its ID.
- π Path Parameter:
salonId
β ID of the salon.
- π€ Response:
- Status:
200 OK
- Body:
SalonDTO
β Details of the specified salon.
- Status:
- β Error Handling:
- Throws an exception if the salon does not exist.
- π Description: Searches for salons in a specific city.
- π Query Parameter:
city
β City name to search salons.
- π€ Response:
- Status:
200 OK
- Body:
List<SalonDTO>
β A list of salons matching the city criteria.
- Status:
- π Description: Retrieves the salon owned by the authenticated user.
- π Authorization:
- Header:
"Authorization"
β JWT token
- Header:
- π€ Response:
- Status:
200 OK
- Body:
Salon
β Details of the salon owned by the user.
- Status:
- Each endpoint is carefully integrated with
SalonService
andUserFeignClient
to ensure efficient data flow and mapping. - Custom exceptions like
UserException
handle user-related errors gracefully. - Simplified DTO mapping via
SalonMapper
.
Make sure the Authorization
header contains a valid JWT token for endpoints requiring user authentication. π‘
Base URL: /api/categories
Owner-Specific Base URL: /api/categories/salon-owner
- π Description: Fetches all available categories.
- π€ Response:
- Status:
200 OK
- Body:
List<Category>
β List of all categories.
- Status:
- π Description: Retrieves categories associated with a specific salon.
- π Path Parameter:
id
β ID of the salon.
- π Header Parameter:
"Authorization"
β JWT token of the user.
- π€ Response:
- Status:
200 OK
- Body:
Set<Category>
β List of categories linked to the salon.
- Status:
- π Feign Clients:
UserFeignClient
β Validates the user's JWT token.SalonFeignClient
β Fetches salon details by ID.
- π Description: Retrieves a single category by its ID.
- π Path Parameter:
id
β ID of the category.
- π€ Response:
- Status:
200 OK
β If the category is found.404 Not Found
β If the category does not exist.
- Body:
Category
β Details of the category.
- Status:
- π Description: Deletes a category by its ID.
- π Path Parameter:
id
β ID of the category.
- π€ Response:
- Status:
204 No Content
β If deletion is successful.404 Not Found
β If the category does not exist.
- Status:
- π Description: Allows a salon owner to create a new category for their salon.
- π Header Parameter:
"Authorization"
β JWT token of the salon owner.
- π₯ Request Body:
Category
β Details of the new category.
- π€ Response:
- Status:
201 Created
- Body:
Category
β Details of the newly created category.
- Status:
- π Feign Clients:
SalonFeignClient
β Validates salon ownership via JWT token.
- **Role-Specific Endpoints:**Separate APIs for all users and salon owners.
- Integrated Feign Clients:
UserFeignClient
β Authenticates user requests.SalonFeignClient
β Ensures salon-owner-specific operations are secure.
- Comprehensive Error Handling:
404 Not Found
for non-existent resources.- Graceful handling of invalid requests.
- **Enhanced Security:**JWT-based authorization ensures secure access to salon-owner-specific features.
Ensure that JWT tokens are passed in the "Authorization"
header for both salon-owner-specific and category-fetching operations. This guarantees proper authentication and data access.
Base URL: /api/service-offering
Owner-Specific Base URL: /api/service-offering/salon-owner
- π Description: Retrieves all services offered by a specific salon, with an optional filter by category.
- π Path Parameter:
salonId
β ID of the salon.
- π Query Parameter (Optional):
categoryId
β ID of the category to filter services.
- π€ Response:
- Status:
200 OK
- Body:
Set<ServiceOffering>
β List of services offered by the salon.
- Status:
- π Description: Retrieves details of a specific service by its ID.
- π Path Parameter:
serviceId
β ID of the service.
- π€ Response:
- Status:
200 OK
- Body:
ServiceOffering
β Details of the service.
- Status:
- β Error Handling:
- Throws an exception if the service does not exist.
- π Description: Retrieves details of multiple services by their IDs.
- π Path Parameter:
ids
β A set of service IDs (comma-separated).
- π€ Response:
- Status:
200 OK
- Body:
Set<ServiceOffering>
β List of services matching the provided IDs.
- Status:
- π Description: Allows a salon owner to create a new service under their salon.
- π Authorization:
- Header:
"Authorization"
β JWT token.
- Header:
- π₯ Request Body:
ServiceDTO
β Details of the service to be created.
- π€ Response:
- Status:
201 Created
- Body:
ServiceOffering
β Details of the newly created service.
- Status:
- π Feign Clients:
SalonFeignClient
β Retrieves salon details by the owner's JWT.CategoryFeignClient
β Fetches the category details.
- π Description: Allows a salon owner to update an existing service.
- π Path Parameter:
serviceId
β ID of the service to update.
- π₯ Request Body:
ServiceOffering
β Updated service details.
- π€ Response:
- Status:
200 OK
β On successful update.404 Not Found
β If the service does not exist.
- Status:
- **Service Segmentation:**Separate endpoints for all users and salon owners.
- Integrated Feign Clients:
SalonFeignClient
β Ensures salon owner is authenticated.CategoryFeignClient
β Validates category data.
- **Error Handling:**Custom exceptions and status codes provide clear responses for invalid requests.
- **Flexibility:**Query parameter support enables dynamic filtering for services.
Ensure proper JWT tokens are provided in the Authorization
header for all salon-owner-specific operations.
Base URL: /api/bookings
- π Description: Creates a new booking for a salon and generates a payment link.
- π Header Parameters:
Authorization
β JWT token of the user.
- π Query Parameters:
salonId
β ID of the salon.paymentMethod
β Payment method (e.g.,CARD
,CASH
).
- π₯ Request Body:
BookingRequest
β Details of the booking (e.g.,serviceIds
,startTime
,endTime
).
- π€ Response:
- Status:
201 Created
- Body:
PaymentLinkResponse
β Payment link and details.
- Status:
- π Feign Clients:
UserFeignClient
β Validates the user using JWT.SalonFeignClient
β Verifies the salon ID.ServiceOfferingFeignClient
β Retrieves services by their IDs.PaymentFeignClient
β Generates the payment link.
- π Description: Retrieves all bookings associated with a customer.
- π Header Parameters:
Authorization
β JWT token of the customer.
- π€ Response:
- Status:
200 OK
- Body:
Set<BookingDTO>
β List of customer bookings.
- Status:
- π Feign Clients:
UserFeignClient
β Validates the user.
- π Description: Retrieves all bookings for a salon owned by the authenticated user.
- π Header Parameters:
Authorization
β JWT token of the salon owner.
- π€ Response:
- Status:
200 OK
- Body:
Set<BookingDTO>
β List of salon bookings.
- Status:
- π Feign Clients:
UserFeignClient
β Validates the user.SalonFeignClient
β Retrieves salon information by owner.
- π Description: Retrieves a report of all bookings for the salon owned by the authenticated user.
- π Header Parameters:
Authorization
β JWT token of the salon owner.
- π€ Response:
- Status:
200 OK
- Body:
SalonReport
β Report details for the salon.
- Status:
- π Description: Retrieves booked slots for a salon on a specific date.
- π Path Parameters:
salonId
β ID of the salon.date
β Date for which slots are requested (format:YYYY-MM-DD
).
- π Header Parameters:
Authorization
β JWT token of the user.
- π€ Response:
- Status:
200 OK
- Body:
List<BookedSlotsDTO>
β List of booked slots.
- Status:
- π Description: Retrieves details of a booking by its ID.
- π Path Parameter:
bookingId
β ID of the booking.
- π€ Response:
- Status:
200 OK
- Body:
BookingDTO
β Details of the booking.
- Status:
- π Description: Updates the status of a booking (e.g.,
CONFIRMED
,CANCELLED
). - π Path Parameter:
bookingId
β ID of the booking.
- π Query Parameter:
status
β New status for the booking.
- π€ Response:
- Status:
200 OK
- Body:
BookingDTO
β Updated booking details.
- Status:
- Role-Specific Endpoints:
- Separate APIs for customers and salon owners.
- Integrated Feign Clients:
UserFeignClient
β Validates user requests.SalonFeignClient
β Ensures secure access to salon-related data.ServiceOfferingFeignClient
β Retrieves service details.
- Error Handling:
404 Not Found
β If the resource does not exist.400 Bad Request
β For invalid input or state.
- Enhanced Security:
- JWT-based authorization for all sensitive operations.
- Flexible Bookings Management:
- Support for creating, updating, and querying bookings efficiently.
The Payment Controller handles APIs related to payment processing, including creating payment links, retrieving payment orders, and proceeding with payments.
Creates a payment link for the specified booking using the given payment method.
- Authorization: Bearer token of the user (
String
) (Required)
- BookingDTO: The details of the booking for which payment is being initiated.
- paymentMethod: The payment method to use (e.g.,
CREDIT_CARD
,DEBIT_CARD
,UPI
, etc.)
-
200 OK: Returns the payment link details.
{ "id": "string", "link": "string", "status": "string" }
-
400 Bad Request: If required parameters are missing or invalid.
-
500 Internal Server Error: If an error occurs while creating the payment link.
Fetches a payment order by its unique ID.
- paymentOrderId: The ID of the payment order (
Long
) (Required)
-
200 OK: Returns the payment order details.
{ "id": "Long", "amount": "Double", "status": "String", "createdAt": "String", "updatedAt": "String" }
-
404 Not Found: If the payment order with the specified ID does not exist.
Processes a payment for the specified payment order.
- paymentId: The unique ID of the payment made by the user (
String
) (Required) - paymentLinkId: The unique ID of the payment link (
String
) (Required)
-
200 OK: Returns
true
if the payment was processed successfully.true
-
400 Bad Request: If the payment ID or link ID is invalid.
-
500 Internal Server Error: If an error occurs while processing the payment.
- Thrown when there is an issue with user authentication or user-related data.
- Thrown for issues related to Razorpay integration, such as link creation failures.
- 400 Bad Request: For invalid input or missing data.
- 500 Internal Server Error: For any unexpected server-side errors.
- The controller relies on the following services:
- PaymentService: To handle payment-related logic.
- UserFeignClient: To fetch user details from a remote service.
- Supported payment methods include Razorpay integrations.