Merge pull request #336 from RecentRunner/commenting-backend-desktop
comment backend and desktop
This commit was merged in pull request #336.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Main entry point for the pet shop backend application.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
|
||||
package com.petshop.backend;
|
||||
|
||||
import com.petshop.backend.config.BusinessProperties;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Starts the backend with Docker and auto-reload for development.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
|
||||
package com.petshop.backend;
|
||||
|
||||
import com.petshop.backend.config.FlywayContextInitializer;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Manages Docker Compose for the development database.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
|
||||
package com.petshop.backend;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Frees up a port by stopping whatever process is using it.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
|
||||
package com.petshop.backend;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Resets the development database by recreating the Docker container.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
|
||||
package com.petshop.backend;
|
||||
|
||||
public class ResetDatabaseApplication {
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Checks that required resources are on the classpath at startup.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
|
||||
package com.petshop.backend;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Logs write operations (POST, PUT, DELETE) to the activity log.
|
||||
* Skips GET requests and internal endpoints like health checks.
|
||||
* Builds a human-readable description for each action.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import com.petshop.backend.entity.User;
|
||||
@@ -77,11 +85,24 @@ public class ActivityLoggingFilter extends OncePerRequestFilter {
|
||||
activityLogService.record(userId, activity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns a request method + URL + status into a human-readable description
|
||||
* like "Created a new product" or "Failed login attempt".
|
||||
* Parses the URL as /api/v1/{resource}/{id?}/{sub?}/{subsub?} and matches
|
||||
* against known patterns.
|
||||
* @param method HTTP method (GET, POST, etc.)
|
||||
* @param rawUri the request URI, possibly with query params
|
||||
* @param status the HTTP response status code
|
||||
* @return a readable description, or null if we don't recognize the pattern
|
||||
*/
|
||||
private String describe(String method, String rawUri, int status) {
|
||||
// Strip query params so we only deal with the path
|
||||
String uri = rawUri.contains("?") ? rawUri.substring(0, rawUri.indexOf('?')) : rawUri;
|
||||
// Split into segments: [api, v1, resource, id/action, sub, ...]
|
||||
String[] parts = uri.replaceFirst("^/+", "").split("/");
|
||||
if (parts.length < 3) return null;
|
||||
|
||||
// parts[2] is the resource name (e.g. "products", "auth", "cart")
|
||||
String r = parts[2];
|
||||
String seg3 = parts.length > 3 ? parts[3] : null;
|
||||
String seg4 = parts.length > 4 ? parts[4] : null;
|
||||
@@ -89,6 +110,8 @@ public class ActivityLoggingFilter extends OncePerRequestFilter {
|
||||
|
||||
boolean seg3IsId = seg3 != null && seg3.matches("\\d+");
|
||||
boolean seg4IsId = seg4 != null && seg4.matches("\\d+");
|
||||
// Normalize: if seg3 is a numeric ID, treat seg4 as the sub-action
|
||||
// otherwise seg3 itself is the sub-action (like "login", "add", etc.)
|
||||
String id = seg3IsId ? seg3 : null;
|
||||
String sub = seg3IsId ? seg4 : seg3;
|
||||
String subsub = seg3IsId ? seg5 : seg4;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Registers the activity logging filter with the servlet container.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Runs once on startup to mark past appointments as completed.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import com.petshop.backend.service.AppointmentService;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Business settings loaded from application.yml (store hours,
|
||||
* slot intervals, image size limits, discount/loyalty config).
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Sets up Caffeine caching for the app. Currently used to cache
|
||||
* user auth lookups so the filter doesn't query the DB every time.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Creates default admin, staff, and customer accounts on startup
|
||||
* if they don't already exist. Also fills in missing fields on
|
||||
* existing accounts to keep them consistent.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import com.petshop.backend.entity.User;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Runs Flyway migrations before the app starts. Retries up to
|
||||
* 15 times so the app can wait for the database container to be ready.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import org.flywaydb.core.Flyway;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Adds extra pet and product seed data in the local dev profile
|
||||
* if the database only has the base seed rows.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import com.petshop.backend.repository.PetRepository;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Tells Tomcat to accept backslashes in URLs so the Android
|
||||
* and desktop clients don't get rejected for path issues.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Strips trailing slashes and normalizes paths so /api/pets/
|
||||
* and /api/pets both hit the same controller.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import jakarta.servlet.FilterChain;
|
||||
@@ -63,6 +70,12 @@ public class TrailingSlashNormalizationFilter extends OncePerRequestFilter {
|
||||
filterChain.doFilter(wrapper, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up a URL path by fixing backslashes, collapsing double slashes,
|
||||
* lowercasing API/WS paths, and stripping trailing slashes.
|
||||
* @param value the raw path string
|
||||
* @return the normalized path, or null if input was null
|
||||
*/
|
||||
private String normalizePath(String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
@@ -74,6 +87,7 @@ public class TrailingSlashNormalizationFilter extends OncePerRequestFilter {
|
||||
if (shouldLowercase(normalized)) {
|
||||
normalized = normalized.toLowerCase(java.util.Locale.ROOT);
|
||||
}
|
||||
// Strip trailing slashes but keep the root "/" intact
|
||||
int end = normalized.length();
|
||||
while (end > 1 && normalized.charAt(end - 1) == '/') {
|
||||
end--;
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Intercepts WebSocket messages to authenticate and authorize users.
|
||||
* Validates the token on CONNECT, then checks permissions on
|
||||
* SUBSCRIBE and SEND for chat topics.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import com.petshop.backend.entity.User;
|
||||
@@ -33,6 +41,14 @@ public class WebSocketAuthChannelInterceptor implements ChannelInterceptor {
|
||||
this.chatService = chatService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercepts every STOMP message before it's sent. On CONNECT it validates the
|
||||
* JWT and stores the authenticated user. On SUBSCRIBE/SEND it checks that the
|
||||
* user has access to the requested chat destination.
|
||||
* @param message the STOMP message being sent
|
||||
* @param channel the channel the message is going through
|
||||
* @return the original message if everything checks out
|
||||
*/
|
||||
@Override
|
||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||
StompHeaderAccessor accessor = StompHeaderAccessor.wrap(message);
|
||||
@@ -95,6 +111,14 @@ public class WebSocketAuthChannelInterceptor implements ChannelInterceptor {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to figure out who the user is from multiple sources: the principal on the
|
||||
* message, the session attributes (fallback for some STOMP clients), or by
|
||||
* re-parsing the token from headers as a last resort.
|
||||
* @param principal the principal attached to the message, may be null
|
||||
* @param accessor the STOMP header accessor for fallback lookups
|
||||
* @return the User entity, or null if unauthenticated
|
||||
*/
|
||||
private User resolveUser(Principal principal, StompHeaderAccessor accessor) {
|
||||
Principal currentPrincipal = principal;
|
||||
if (currentPrincipal == null && accessor.getSessionAttributes() != null) {
|
||||
@@ -136,6 +160,13 @@ public class WebSocketAuthChannelInterceptor implements ChannelInterceptor {
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user is allowed to subscribe to this destination.
|
||||
* Customers can only subscribe to their own conversations, not the
|
||||
* staff-wide conversation feed.
|
||||
* @param destination the STOMP destination being subscribed to
|
||||
* @param user the user trying to subscribe
|
||||
*/
|
||||
private void authorizeSubscription(String destination, User user) {
|
||||
destination = normalizeDestination(destination);
|
||||
if (destination == null || destination.startsWith("/user/queue/")) {
|
||||
@@ -157,6 +188,12 @@ public class WebSocketAuthChannelInterceptor implements ChannelInterceptor {
|
||||
throw new IllegalArgumentException("Not authorized to subscribe to destination");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user is allowed to send a message to this destination.
|
||||
* Only allows sending to conversation message endpoints that the user has access to.
|
||||
* @param destination the STOMP destination being sent to
|
||||
* @param user the user trying to send
|
||||
*/
|
||||
private void authorizeSend(String destination, User user) {
|
||||
destination = normalizeDestination(destination);
|
||||
Long conversationId = extractConversationId(destination, "/app/chat/conversations/");
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* WebSocket configuration for the live chat feature.
|
||||
* Registers STOMP endpoints and the auth interceptor.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles requests for viewing user activity logs.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.activity.ActivityLogResponse;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles pet adoption requests and approvals.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.adoption.AdoptionRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles AI-powered chat for getting pet care advice.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.ai.AiChatRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles dashboard analytics and sales reporting for staff and admins.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.analytics.DashboardResponse;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles booking and managing pet service appointments.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.appointment.AppointmentRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles user login, registration, password reset, and profile updates.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.auth.AvatarUploadResponse;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles shopping cart operations like adding and removing items.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.cart.*;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles managing product and pet categories.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.category.CategoryRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles chat conversations and messages between users.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.chat.ConversationRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles real-time chat messaging over WebSocket connections.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.config.WebSocketAuthChannelInterceptor;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles sending contact form messages from customers.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.entity.User;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles creating and managing discount coupons.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.common.BulkDeleteRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles staff and admin operations for managing customer accounts.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.common.BulkDeleteRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles providing dropdown menu options for forms across the app.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.common.DropdownOption;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles admin operations for managing employee accounts.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.user.UserRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles health check requests to verify the server is running.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles tracking product stock levels across store locations.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.common.BulkDeleteRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles customers viewing and managing their own pets.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.pet.MyPetRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles managing pets available in the shop.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.common.BulkDeleteRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles uploading, retrieving, and deleting pet images.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.pet.PetResponse;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles creating, updating, and browsing products in the shop.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.common.BulkDeleteRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles uploading, retrieving, and deleting product images.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.product.ProductResponse;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles linking products to their suppliers.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.productsupplier.BulkDeleteProductSupplierRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles purchase orders for restocking products from suppliers.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.purchaseorder.PurchaseOrderResponse;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles requesting and processing refunds for orders.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.refund.RefundRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles creating and viewing sales and customer orders.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.sale.SaleRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles managing pet services like grooming and veterinary care.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.common.BulkDeleteRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles managing store locations for the pet shop.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.common.BulkDeleteRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles managing suppliers who provide products to the shop.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.common.BulkDeleteRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles uploading, retrieving, and deleting user profile pictures.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.entity.User;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Handles admin operations for managing all user accounts.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.controller;
|
||||
|
||||
import com.petshop.backend.dto.common.BulkDeleteRequest;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Activity log entry returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.activity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when creating or updating an adoption.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.adoption;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Adoption record returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.adoption;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when a customer requests to adopt a pet.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.adoption;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when asking the AI chatbot a question.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.ai;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* AI chatbot reply returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.ai;
|
||||
|
||||
public class AiChatResponse {
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Dashboard analytics data returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.analytics;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when booking or updating an appointment.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.appointment;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Appointment details returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.appointment;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Avatar upload result returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when a user requests a password reset.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Forgot password result returned with a reset token.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
public class ForgotPasswordResponse {
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when a user logs in.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Login result returned to the client with a token.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when a user updates their profile.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when a new user registers an account.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Registration result returned to the client after signing up.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when a user sets a new password using a reset token.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Password reset confirmation returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
public class ResetPasswordResponse {
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Logged-in user profile data returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.auth;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when adding a product to the shopping cart.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.cart;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when applying a coupon code to the cart.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.cart;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Single cart item returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.cart;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Full shopping cart data returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.cart;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when a customer checks out their cart.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.cart;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Checkout result returned to the client after placing an order.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.cart;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when updating the quantity of a cart item.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.cart;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when creating or updating a category.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.category;
|
||||
|
||||
import com.petshop.backend.util.SafeContent;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Category data returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.category;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when starting a new conversation.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.chat;
|
||||
|
||||
public class ConversationRequest {
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Conversation details returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.chat;
|
||||
|
||||
import com.petshop.backend.entity.Conversation;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when sending a chat message.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.chat;
|
||||
|
||||
public class MessageRequest {
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Chat message returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.chat;
|
||||
|
||||
import com.petshop.backend.entity.Message;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when changing the status of a conversation.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.chat;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when deleting multiple records at once.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.common;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when creating or updating a coupon.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.common;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Coupon details returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.common;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Simple id and label pair used for dropdown menus.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.common;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when updating inventory for a product.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.inventory;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Inventory record returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.inventory;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when a customer adds or updates their own pet.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.pet;
|
||||
|
||||
import jakarta.validation.constraints.Max;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Customer's own pet data returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.pet;
|
||||
|
||||
public class MyPetResponse {
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when creating or updating a pet listing.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.pet;
|
||||
|
||||
import com.petshop.backend.util.SafeContent;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Pet data returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.pet;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when creating or updating a product.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.product;
|
||||
|
||||
import com.petshop.backend.util.SafeContent;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Product data returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.product;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when deleting multiple product-supplier links at once.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.productsupplier;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Composite key identifying a product-supplier relationship.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.productsupplier;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Data sent when linking a product to a supplier.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.productsupplier;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Product-supplier link data returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.productsupplier;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Purchase order data returned to the client.
|
||||
*
|
||||
* Author: Harkamal
|
||||
* Date: April 2026
|
||||
*/
|
||||
package com.petshop.backend.dto.purchaseorder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user