{ "openapi": "3.0.3", "info": { "title": "Adopt Don't Shop API", "version": "1.0.0", "description": "Auto-generated API documentation from JSDoc comments" }, "servers": [ { "url": "http://localhost:5000", "description": "Development server" }, { "url": "https://api-staging.adoptdontshop.com", "description": "Staging server" }, { "url": "https://api.adoptdontshop.com", "description": "Production server" } ], "paths": { "/api/v1/metrics": { "get": { "tags": ["Admin Management"], "summary": "GET /api/v1/metrics", "description": "Handle GET request for /api/v1/metrics", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/metrics successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/analytics/usage": { "get": { "tags": ["Admin Management"], "summary": "GET /api/v1/analytics/usage", "description": "Handle GET request for /api/v1/analytics/usage", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/analytics/usage successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/system/health": { "get": { "tags": ["Admin Management"], "summary": "GET /api/v1/system/health", "description": "Handle GET request for /api/v1/system/health", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/system/health successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/system/config": { "get": { "tags": ["Admin Management"], "summary": "GET /api/v1/system/config", "description": "Handle GET request for /api/v1/system/config", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/system/config successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } }, "patch": { "tags": ["Admin Management"], "summary": "PATCH /api/v1/system/config", "description": "Handle PATCH request for /api/v1/system/config", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "200": { "description": "PATCH /api/v1/system/config successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "PATCH /api/v1/system/config successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/users": { "get": { "tags": ["Admin Management"], "summary": "GET /api/v1/users", "description": "Handle GET request for /api/v1/users", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/users successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/users/{userId}": { "get": { "tags": ["User Management"], "summary": "Get user by ID", "description": "Get detailed user information by ID. Users can view their own profile, admins can view any.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "User retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "user": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "email": { "type": "string", "format": "email" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "userType": { "type": "string" }, "phone": { "type": "string" }, "bio": { "type": "string" }, "isVerified": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } }, "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "User ID" } ] }, "put": { "tags": ["User Management"], "summary": "Update user profile by ID", "description": "Update user profile information by ID. Users can update their own profile, admins can update any.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "User ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "firstName": { "type": "string", "minLength": 2, "maxLength": 50, "example": "John" }, "lastName": { "type": "string", "minLength": 2, "maxLength": 50, "example": "Doe" }, "phone": { "type": "string", "example": "+1234567890" }, "bio": { "type": "string", "maxLength": 500, "example": "Animal lover with rescue experience" } } } } } }, "responses": { "200": { "description": "User updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "User updated successfully" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/users/{userId}/action": { "patch": { "tags": ["Admin Management"], "summary": "PATCH /api/v1/users/{userId}/action", "description": "Handle PATCH request for /api/v1/users/{userId}/action", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "200": { "description": "PATCH /api/v1/users/{userId}/action successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "PATCH /api/v1/users/{userId}/action successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/rescues": { "get": { "tags": ["Rescue Organizations"], "summary": "Search rescue organizations", "description": "Search and filter rescue organizations with pagination", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "Rescue organizations retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "rescues": { "type": "array", "items": { "type": "object", "properties": { "rescueId": { "type": "string", "format": "uuid" }, "name": { "type": "string", "example": "Golden Hearts Rescue" }, "location": { "type": "string", "example": "New York, NY" }, "description": { "type": "string" }, "website": { "type": "string", "format": "uri" }, "isVerified": { "type": "boolean" }, "petCount": { "type": "integer" } } } }, "pagination": { "type": "object", "properties": { "currentPage": { "type": "integer" }, "totalPages": { "type": "integer" }, "totalItems": { "type": "integer" } } } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } }, "parameters": [ { "in": "query", "name": "search", "schema": { "type": "string" }, "description": "Search term for rescue name or location", "example": "Golden Retriever Rescue" }, { "in": "query", "name": "status", "schema": { "type": "string", "enum": ["pending", "verified", "suspended", "inactive"] }, "description": "Filter by verification status" }, { "in": "query", "name": "location", "schema": { "type": "string" }, "description": "Filter by location", "example": "New York" }, { "in": "query", "name": "sortBy", "schema": { "type": "string", "enum": ["name", "createdAt", "verifiedAt"] }, "description": "Sort field" }, { "in": "query", "name": "sortOrder", "schema": { "type": "string", "enum": ["ASC", "DESC"] }, "description": "Sort order" }, { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1, "default": 1 }, "description": "Page number" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }, "description": "Items per page" } ] } }, "/api/v1/rescues/{rescueId}/moderate": { "patch": { "tags": ["Admin Management"], "summary": "PATCH /api/v1/rescues/{rescueId}/moderate", "description": "Handle PATCH request for /api/v1/rescues/{rescueId}/moderate", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "200": { "description": "PATCH /api/v1/rescues/{rescueId}/moderate successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "PATCH /api/v1/rescues/{rescueId}/moderate successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/audit-logs": { "get": { "tags": ["Admin Management"], "summary": "GET /api/v1/audit-logs", "description": "Handle GET request for /api/v1/audit-logs", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/audit-logs successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/applications": { "get": { "tags": ["Application Management"], "summary": "Get adoption applications", "description": "Get adoption applications with filtering and pagination", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "query", "name": "status", "schema": { "type": "string", "enum": ["DRAFT", "SUBMITTED", "UNDER_REVIEW", "APPROVED", "REJECTED", "WITHDRAWN"] }, "description": "Filter by application status" }, { "in": "query", "name": "petId", "schema": { "type": "string", "format": "uuid" }, "description": "Filter by pet ID" }, { "in": "query", "name": "userId", "schema": { "type": "string", "format": "uuid" }, "description": "Filter by user ID (admin/rescue staff only)" }, { "in": "query", "name": "rescueId", "schema": { "type": "string", "format": "uuid" }, "description": "Filter by rescue organization ID" }, { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1, "default": 1 }, "description": "Page number" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }, "description": "Items per page" } ], "responses": { "200": { "description": "Applications retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "applications": { "type": "array", "items": { "type": "object", "properties": { "applicationId": { "type": "string", "format": "uuid" }, "status": { "type": "string", "enum": [ "DRAFT", "SUBMITTED", "UNDER_REVIEW", "APPROVED", "REJECTED", "WITHDRAWN" ] }, "pet": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string" }, "breed": { "type": "string" } } }, "applicant": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "email": { "type": "string" } } }, "submittedAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } } } }, "pagination": { "type": "object", "properties": { "currentPage": { "type": "integer" }, "totalPages": { "type": "integer" }, "totalItems": { "type": "integer" } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } }, "post": { "tags": ["Application Management"], "summary": "Create new adoption application", "description": "Submit a new adoption application for a pet. Adopter role required.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["petId", "answers"], "properties": { "petId": { "type": "string", "format": "uuid", "description": "ID of the pet being applied for" }, "answers": { "type": "object", "description": "Application form answers based on rescue requirements", "example": { "experience": "5 years with dogs", "housing": "House with fenced yard", "otherPets": "One cat, friendly with dogs" } }, "notes": { "type": "string", "maxLength": 1000, "description": "Additional notes or comments", "example": "Very excited to provide a loving home" } } } } } }, "responses": { "201": { "description": "Application created successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Application created successfully" }, "applicationId": { "type": "string", "format": "uuid" }, "status": { "type": "string", "example": "DRAFT" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "409": { "description": "Application already exists for this pet" } } } }, "/api/v1/applications/{applicationId}": { "get": { "tags": ["Application Management"], "summary": "Get application details by ID", "description": "Get detailed information about a specific application", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "applicationId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Application ID" } ], "responses": { "200": { "description": "Application details retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "application": { "type": "object", "properties": { "applicationId": { "type": "string", "format": "uuid" }, "status": { "type": "string", "enum": [ "DRAFT", "SUBMITTED", "UNDER_REVIEW", "APPROVED", "REJECTED", "WITHDRAWN" ] }, "pet": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string" }, "breed": { "type": "string" }, "images": { "type": "array", "items": { "type": "string" } } } }, "applicant": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "email": { "type": "string" }, "phone": { "type": "string" } } }, "answers": { "type": "object", "description": "Application form answers" }, "notes": { "type": "string" }, "documents": { "type": "array", "items": { "type": "object", "properties": { "documentId": { "type": "string", "format": "uuid" }, "fileName": { "type": "string" }, "fileType": { "type": "string" }, "uploadedAt": { "type": "string", "format": "date-time" } } } }, "submittedAt": { "type": "string", "format": "date-time" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } }, "put": { "tags": ["Application Management"], "summary": "Update adoption application", "description": "Update application details. Only allowed for applications in DRAFT or SUBMITTED status by the owner.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "applicationId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Application ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "answers": { "type": "object", "description": "Updated application form answers" }, "notes": { "type": "string", "maxLength": 1000, "description": "Additional notes or comments" } } } } } }, "responses": { "200": { "description": "Application updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Application updated successfully" }, "application": { "$ref": "#/components/schemas/Application" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } }, "delete": { "tags": ["Application Management"], "summary": "Delete application", "description": "Permanently delete an application. Only the application owner can delete their own application, and only if it's in DRAFT status.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "applicationId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Application ID" } ], "responses": { "200": { "description": "Application deleted successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Application deleted successfully" } } } } } }, "400": { "description": "Application cannot be deleted (not in DRAFT status)" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/applications/{applicationId}/submit": { "post": { "tags": ["Application Management"], "summary": "Submit application for review", "description": "Submit a draft application for review by rescue staff. Only the application owner can submit their own application.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "applicationId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Application ID" } ], "responses": { "200": { "description": "Application submitted successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Application submitted for review" }, "status": { "type": "string", "example": "SUBMITTED" }, "submittedAt": { "type": "string", "format": "date-time" } } } } } }, "400": { "description": "Application cannot be submitted (not in DRAFT status)" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/applications/{applicationId}/status": { "patch": { "tags": ["Application Management"], "summary": "Update application status", "description": "Update the status of an application. Only rescue staff and admins can update application status.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "applicationId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Application ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["status"], "properties": { "status": { "type": "string", "enum": ["UNDER_REVIEW", "APPROVED", "REJECTED"], "description": "New application status" }, "reviewNotes": { "type": "string", "maxLength": 1000, "description": "Notes from the reviewer" }, "rejectionReason": { "type": "string", "description": "Reason for rejection (required if status is REJECTED)" } } } } } }, "responses": { "200": { "description": "Application status updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Application status updated" }, "status": { "type": "string", "example": "APPROVED" }, "reviewedAt": { "type": "string", "format": "date-time" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/applications/{applicationId}/withdraw": { "post": { "tags": ["Application Management"], "summary": "Withdraw application", "description": "Withdraw a submitted application. Only the application owner can withdraw their own application.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "applicationId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Application ID" } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "reason": { "type": "string", "maxLength": 500, "description": "Reason for withdrawing the application" } } } } } }, "responses": { "200": { "description": "Application withdrawn successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Application withdrawn successfully" }, "status": { "type": "string", "example": "WITHDRAWN" } } } } } }, "400": { "description": "Application cannot be withdrawn (invalid status)" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/applications/{applicationId}/documents": { "post": { "tags": ["Application Management"], "summary": "Add document to application", "description": "Upload and attach a document to an application. Only the application owner can add documents.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "applicationId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Application ID" } ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "required": ["document"], "properties": { "document": { "type": "string", "format": "binary", "description": "Document file (PDF, DOC, DOCX, JPG, PNG)" }, "documentType": { "type": "string", "enum": ["REFERENCE", "VETERINARY_RECORD", "PROOF_OF_RESIDENCE", "OTHER"], "description": "Type of document being uploaded" }, "description": { "type": "string", "maxLength": 255, "description": "Optional description of the document" } } } } } }, "responses": { "201": { "description": "Document uploaded successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Document uploaded successfully" }, "document": { "type": "object", "properties": { "documentId": { "type": "string", "format": "uuid" }, "fileName": { "type": "string" }, "fileType": { "type": "string" }, "uploadedAt": { "type": "string", "format": "date-time" } } } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" }, "413": { "description": "File too large" } } } }, "/api/v1/applications/{applicationId}/references": { "patch": { "tags": ["Application Management"], "summary": "Update reference status", "description": "Update the status of references for an application. Only rescue staff and admins can update reference status.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "applicationId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Application ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["referenceId", "status"], "properties": { "referenceId": { "type": "string", "format": "uuid", "description": "Reference ID to update" }, "status": { "type": "string", "enum": ["PENDING", "CONTACTED", "COMPLETED", "FAILED"], "description": "New reference status" }, "notes": { "type": "string", "maxLength": 1000, "description": "Notes about the reference check" }, "contactedAt": { "type": "string", "format": "date-time", "description": "When the reference was contacted" } } } } } }, "responses": { "200": { "description": "Reference status updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Reference status updated" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/applications/form-structure/{rescueId}": { "get": { "tags": ["Application Management"], "summary": "Get application form structure", "description": "Get the custom application form structure for a specific rescue organization", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "rescueId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Rescue organization ID" } ], "responses": { "200": { "description": "Form structure retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "formStructure": { "type": "object", "properties": { "sections": { "type": "array", "items": { "type": "object", "properties": { "sectionId": { "type": "string" }, "title": { "type": "string" }, "fields": { "type": "array", "items": { "type": "object", "properties": { "fieldId": { "type": "string" }, "type": { "type": "string", "enum": [ "text", "textarea", "select", "checkbox", "radio", "file" ] }, "label": { "type": "string" }, "required": { "type": "boolean" }, "options": { "type": "array", "items": { "type": "string" } } } } } } } } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/form-structure/{rescueId}": { "get": { "tags": ["Applications"], "summary": "GET /api/v1/form-structure/{rescueId}", "description": "Handle GET request for /api/v1/form-structure/{rescueId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/form-structure/{rescueId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/applications/validate/{rescueId}": { "post": { "tags": ["Application Management"], "summary": "Validate application answers", "description": "Validate application form answers against rescue-specific requirements before submission", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "rescueId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Rescue organization ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["answers"], "properties": { "answers": { "type": "object", "description": "Application form answers to validate", "additionalProperties": true }, "petId": { "type": "string", "format": "uuid", "description": "Optional pet ID for pet-specific validation" } } } } } }, "responses": { "200": { "description": "Validation completed", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "valid": { "type": "boolean", "description": "Whether all answers are valid" }, "errors": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" } } }, "description": "Validation errors (if any)" }, "warnings": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" } } }, "description": "Validation warnings (if any)" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/validate/{rescueId}": { "post": { "tags": ["Applications"], "summary": "POST /api/v1/validate/{rescueId}", "description": "Handle POST request for /api/v1/validate/{rescueId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "201": { "description": "POST /api/v1/validate/{rescueId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "POST /api/v1/validate/{rescueId} successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/applications/statistics": { "get": { "tags": ["Application Management"], "summary": "Get application statistics", "description": "Get statistical data about applications for dashboard and reporting. Only rescue staff and admins can access this data.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "query", "name": "rescueId", "schema": { "type": "string", "format": "uuid" }, "description": "Filter statistics by rescue organization" }, { "in": "query", "name": "startDate", "schema": { "type": "string", "format": "date" }, "description": "Start date for statistics period" }, { "in": "query", "name": "endDate", "schema": { "type": "string", "format": "date" }, "description": "End date for statistics period" } ], "responses": { "200": { "description": "Application statistics retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "statistics": { "type": "object", "properties": { "totalApplications": { "type": "integer", "description": "Total number of applications" }, "applicationsByStatus": { "type": "object", "properties": { "DRAFT": { "type": "integer" }, "SUBMITTED": { "type": "integer" }, "UNDER_REVIEW": { "type": "integer" }, "APPROVED": { "type": "integer" }, "REJECTED": { "type": "integer" }, "WITHDRAWN": { "type": "integer" } } }, "averageProcessingTime": { "type": "number", "description": "Average time to process applications (in days)" }, "approvalRate": { "type": "number", "description": "Percentage of applications approved" }, "trendsOverTime": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "format": "date" }, "count": { "type": "integer" } } } } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/applications/bulk-update": { "patch": { "tags": ["Application Management"], "summary": "Bulk update applications", "description": "Update multiple applications at once. Only admins can perform bulk updates.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["applicationIds", "updates"], "properties": { "applicationIds": { "type": "array", "items": { "type": "string", "format": "uuid" }, "description": "List of application IDs to update" }, "updates": { "type": "object", "properties": { "status": { "type": "string", "enum": ["UNDER_REVIEW", "APPROVED", "REJECTED", "WITHDRAWN"], "description": "New status for all selected applications" }, "reviewNotes": { "type": "string", "maxLength": 1000, "description": "Notes to add to all applications" } } }, "reason": { "type": "string", "maxLength": 500, "description": "Reason for bulk update" } } } } } }, "responses": { "200": { "description": "Applications updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Bulk update completed" }, "updated": { "type": "integer", "description": "Number of applications updated" }, "failed": { "type": "array", "items": { "type": "object", "properties": { "applicationId": { "type": "string", "format": "uuid" }, "error": { "type": "string" } } }, "description": "Applications that failed to update" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/applications/{applicationId}/history": { "get": { "tags": ["Application Management"], "summary": "Get application history", "description": "Get the history of changes and status updates for an application. Legacy endpoint for backwards compatibility.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "applicationId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Application ID" } ], "responses": { "200": { "description": "Application history retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "history": { "type": "array", "items": { "type": "object", "properties": { "eventId": { "type": "string", "format": "uuid" }, "eventType": { "type": "string", "enum": [ "CREATED", "UPDATED", "SUBMITTED", "STATUS_CHANGED", "DOCUMENT_ADDED", "WITHDRAWN" ] }, "timestamp": { "type": "string", "format": "date-time" }, "userId": { "type": "string", "format": "uuid" }, "details": { "type": "object", "description": "Event-specific details" }, "notes": { "type": "string" } } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/applications/{applicationId}/schedule-visit": { "post": { "tags": ["Application Management"], "summary": "Schedule home visit", "description": "Schedule a home visit for an approved application. Only rescue staff and admins can schedule visits.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "applicationId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Application ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["scheduledDate", "scheduledTime"], "properties": { "scheduledDate": { "type": "string", "format": "date", "description": "Date for the home visit" }, "scheduledTime": { "type": "string", "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$", "description": "Time for the home visit (HH:MM format)" }, "notes": { "type": "string", "maxLength": 500, "description": "Additional notes for the visit" }, "visitType": { "type": "string", "enum": ["PRE_ADOPTION", "POST_ADOPTION", "FOLLOW_UP"], "default": "PRE_ADOPTION", "description": "Type of visit being scheduled" } } } } } }, "responses": { "200": { "description": "Visit scheduled successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Home visit scheduled successfully" }, "visit": { "type": "object", "properties": { "visitId": { "type": "string", "format": "uuid" }, "scheduledDateTime": { "type": "string", "format": "date-time" }, "status": { "type": "string", "example": "SCHEDULED" } } } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/auth/register": { "post": { "tags": ["Authentication"], "summary": "Register a new user account", "description": "Create a new user account with email verification", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["email", "password", "firstName", "lastName", "userType"], "properties": { "email": { "type": "string", "format": "email", "example": "user@example.com" }, "password": { "type": "string", "minLength": 8, "example": "SecurePass123!" }, "firstName": { "type": "string", "minLength": 2, "maxLength": 50, "example": "John" }, "lastName": { "type": "string", "minLength": 2, "maxLength": 50, "example": "Doe" }, "userType": { "type": "string", "enum": ["ADOPTER", "RESCUE_STAFF", "ADMIN"], "example": "ADOPTER" }, "phone": { "type": "string", "example": "+1234567890" } } } } } }, "responses": { "201": { "description": "User registered successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Registration successful. Please check your email for verification." }, "userId": { "type": "string", "format": "uuid" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "409": { "description": "Email already exists" }, "429": { "description": "Rate limit exceeded" } } } }, "/api/v1/auth/login": { "post": { "tags": ["Authentication"], "summary": "Authenticate user and get access token", "description": "Login with email and password to receive JWT token", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["email", "password"], "properties": { "email": { "type": "string", "format": "email", "example": "user@example.com" }, "password": { "type": "string", "example": "SecurePass123!" }, "rememberMe": { "type": "boolean", "default": false, "example": true } } } } } }, "responses": { "200": { "description": "Login successful", "headers": { "Set-Cookie": { "description": "HTTP-only authentication cookie", "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Login successful" }, "accessToken": { "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }, "refreshToken": { "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }, "user": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "email": { "type": "string", "format": "email" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "userType": { "type": "string" } } } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "description": "Invalid credentials" }, "403": { "description": "Account not verified or suspended" }, "429": { "description": "Rate limit exceeded" } } } }, "/api/v1/auth/logout": { "post": { "tags": ["Authentication"], "summary": "Logout user and invalidate tokens", "description": "Invalidate refresh token and clear authentication cookies", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "Logout successful", "headers": { "Set-Cookie": { "description": "Cleared authentication cookie", "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Logout successful" } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/auth/refresh-token": { "post": { "tags": ["Authentication"], "summary": "Refresh access token", "description": "Get a new access token using refresh token", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["refreshToken"], "properties": { "refreshToken": { "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." } } } } } }, "responses": { "200": { "description": "Token refreshed successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "accessToken": { "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }, "refreshToken": { "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." } } } } } }, "400": { "description": "Invalid refresh token" }, "401": { "description": "Refresh token expired" }, "429": { "description": "Rate limit exceeded" } } } }, "/api/v1/auth/forgot-password": { "post": { "tags": ["Authentication"], "summary": "Request password reset", "description": "Send password reset email to user", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["email"], "properties": { "email": { "type": "string", "format": "email", "example": "user@example.com" } } } } } }, "responses": { "200": { "description": "Password reset email sent", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Password reset email sent" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "404": { "description": "User not found" }, "429": { "description": "Rate limit exceeded" } } } }, "/api/v1/auth/reset-password": { "post": { "tags": ["Authentication"], "summary": "Reset password with token", "description": "Reset user password using reset token from email", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["token", "password"], "properties": { "token": { "type": "string", "example": "abc123def456ghi789" }, "password": { "type": "string", "minLength": 8, "example": "NewSecurePass123!" } } } } } }, "responses": { "200": { "description": "Password reset successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Password reset successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "description": "Invalid or expired reset token" }, "429": { "description": "Rate limit exceeded" } } } }, "/api/v1/auth/verify-email/{token}": { "get": { "tags": ["Authentication"], "summary": "Verify email address", "description": "Verify user email address using verification token", "parameters": [ { "in": "path", "name": "token", "required": true, "schema": { "type": "string" }, "description": "Email verification token", "example": "abc123def456ghi789" } ], "responses": { "200": { "description": "Email verified successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Email verified successfully" } } } } } }, "400": { "description": "Invalid verification token" }, "401": { "description": "Verification token expired" }, "409": { "description": "Email already verified" } } } }, "/api/v1/auth/resend-verification": { "post": { "tags": ["Authentication"], "summary": "Resend email verification", "description": "Send new email verification link to user", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["email"], "properties": { "email": { "type": "string", "format": "email", "example": "user@example.com" } } } } } }, "responses": { "200": { "description": "Verification email sent", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Verification email sent" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "404": { "description": "User not found" }, "409": { "description": "Email already verified" }, "429": { "description": "Rate limit exceeded" } } } }, "/api/v1/auth/me": { "get": { "tags": ["Authentication"], "summary": "Get current user profile", "description": "Get authenticated user's profile information", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "User profile retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "user": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "email": { "type": "string", "format": "email" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "userType": { "type": "string", "enum": ["ADOPTER", "RESCUE_STAFF", "ADMIN"] }, "isVerified": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } }, "put": { "tags": ["Authentication"], "summary": "Update current user profile", "description": "Update authenticated user's profile information", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "firstName": { "type": "string", "minLength": 2, "maxLength": 50, "example": "John" }, "lastName": { "type": "string", "minLength": 2, "maxLength": 50, "example": "Doe" }, "phone": { "type": "string", "example": "+1234567890" }, "bio": { "type": "string", "maxLength": 500, "example": "Animal lover with 5 years of pet care experience" } } } } } }, "responses": { "200": { "description": "Profile updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Profile updated successfully" }, "user": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "email": { "type": "string", "format": "email" }, "firstName": { "type": "string" }, "lastName": { "type": "string" } } } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/": { "post": { "tags": ["Rescue Organizations"], "summary": "POST /api/v1/", "description": "Handle POST request for /api/v1/", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "201": { "description": "POST /api/v1/ successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "POST /api/v1/ successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } }, "get": { "tags": ["Rescue Organizations"], "summary": "GET /api/v1/", "description": "Handle GET request for /api/v1/", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/ successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/search": { "get": { "tags": ["User Management"], "summary": "GET /api/v1/search", "description": "Handle GET request for /api/v1/search", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/search successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{chatId}": { "get": { "tags": ["Messaging"], "summary": "GET /api/v1/{chatId}", "description": "Handle GET request for /api/v1/{chatId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/{chatId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } }, "patch": { "tags": ["Messaging"], "summary": "PATCH /api/v1/{chatId}", "description": "Handle PATCH request for /api/v1/{chatId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "200": { "description": "PATCH /api/v1/{chatId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "PATCH /api/v1/{chatId} successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } }, "delete": { "tags": ["Messaging"], "summary": "DELETE /api/v1/{chatId}", "description": "Handle DELETE request for /api/v1/{chatId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "DELETE /api/v1/{chatId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "DELETE /api/v1/{chatId} successful" } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{chatId}/messages": { "post": { "tags": ["Messaging"], "summary": "POST /api/v1/{chatId}/messages", "description": "Handle POST request for /api/v1/{chatId}/messages", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "201": { "description": "POST /api/v1/{chatId}/messages successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "POST /api/v1/{chatId}/messages successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } }, "get": { "tags": ["Messaging"], "summary": "GET /api/v1/{chatId}/messages", "description": "Handle GET request for /api/v1/{chatId}/messages", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/{chatId}/messages successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{chatId}/read": { "patch": { "tags": ["Messaging"], "summary": "PATCH /api/v1/{chatId}/read", "description": "Handle PATCH request for /api/v1/{chatId}/read", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "200": { "description": "PATCH /api/v1/{chatId}/read successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "PATCH /api/v1/{chatId}/read successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{chatId}/unread-count": { "get": { "tags": ["Messaging"], "summary": "GET /api/v1/{chatId}/unread-count", "description": "Handle GET request for /api/v1/{chatId}/unread-count", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/{chatId}/unread-count successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{chatId}/participants": { "post": { "tags": ["Messaging"], "summary": "POST /api/v1/{chatId}/participants", "description": "Handle POST request for /api/v1/{chatId}/participants", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "201": { "description": "POST /api/v1/{chatId}/participants successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "POST /api/v1/{chatId}/participants successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/{chatId}/participants/{userId}": { "delete": { "tags": ["Messaging"], "summary": "DELETE /api/v1/{chatId}/participants/{userId}", "description": "Handle DELETE request for /api/v1/{chatId}/participants/{userId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "DELETE /api/v1/{chatId}/participants/{userId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "DELETE /api/v1/{chatId}/participants/{userId} successful" } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/messages/{messageId}/reactions": { "post": { "tags": ["Messaging"], "summary": "POST /api/v1/messages/{messageId}/reactions", "description": "Handle POST request for /api/v1/messages/{messageId}/reactions", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "201": { "description": "POST /api/v1/messages/{messageId}/reactions successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "POST /api/v1/messages/{messageId}/reactions successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } }, "delete": { "tags": ["Messaging"], "summary": "DELETE /api/v1/messages/{messageId}/reactions", "description": "Handle DELETE request for /api/v1/messages/{messageId}/reactions", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "DELETE /api/v1/messages/{messageId}/reactions successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "DELETE /api/v1/messages/{messageId}/reactions successful" } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/health": { "get": { "tags": ["Discovery Service"], "summary": "GET /api/v1/health", "description": "Handle GET request for /api/v1/health", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/health successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/db-test": { "get": { "tags": ["Discovery Service"], "summary": "GET /api/v1/db-test", "description": "Handle GET request for /api/v1/db-test", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/db-test successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/test": { "get": { "tags": ["Pet Management"], "summary": "GET /api/v1/test", "description": "Handle GET request for /api/v1/test", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/test successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/email/templates": { "get": { "tags": ["Email Management"], "summary": "Get all email templates", "description": "Retrieve all email templates for administration. Only admins can access this endpoint.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "query", "name": "type", "schema": { "type": "string", "enum": [ "WELCOME", "APPLICATION_RECEIVED", "APPLICATION_APPROVED", "APPLICATION_REJECTED", "REMINDER", "NEWSLETTER" ] }, "description": "Filter templates by type" }, { "in": "query", "name": "active", "schema": { "type": "boolean" }, "description": "Filter by active status" } ], "responses": { "200": { "description": "Templates retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "templates": { "type": "array", "items": { "type": "object", "properties": { "templateId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string", "enum": [ "WELCOME", "APPLICATION_RECEIVED", "APPLICATION_APPROVED", "APPLICATION_REJECTED", "REMINDER", "NEWSLETTER" ] }, "subject": { "type": "string" }, "isActive": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" } } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } }, "post": { "tags": ["Email Management"], "summary": "Create new email template", "description": "Create a new email template. Only admins can create templates.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["name", "type", "subject", "htmlContent"], "properties": { "name": { "type": "string", "maxLength": 100, "description": "Template name" }, "type": { "type": "string", "enum": [ "WELCOME", "APPLICATION_RECEIVED", "APPLICATION_APPROVED", "APPLICATION_REJECTED", "REMINDER", "NEWSLETTER" ], "description": "Template type" }, "subject": { "type": "string", "maxLength": 255, "description": "Email subject line" }, "htmlContent": { "type": "string", "description": "HTML content with template variables" }, "textContent": { "type": "string", "description": "Plain text version" }, "variables": { "type": "array", "items": { "type": "string" }, "description": "Available template variables" }, "isActive": { "type": "boolean", "default": true, "description": "Whether template is active" } } } } } }, "responses": { "201": { "description": "Template created successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Template created successfully" }, "templateId": { "type": "string", "format": "uuid" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/email/templates/{templateId}": { "get": { "tags": ["Email Management"], "summary": "Get email template by ID", "description": "Retrieve a specific email template by ID. Only admins can access this endpoint.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "templateId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Template ID" } ], "responses": { "200": { "description": "Template retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "template": { "type": "object", "properties": { "templateId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string" }, "subject": { "type": "string" }, "htmlContent": { "type": "string" }, "textContent": { "type": "string" }, "variables": { "type": "array", "items": { "type": "string" } }, "isActive": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } }, "put": { "tags": ["Email Management"], "summary": "Update email template", "description": "Update an existing email template. Only admins can update templates.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "templateId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Template ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "maxLength": 100 }, "subject": { "type": "string", "maxLength": 255 }, "htmlContent": { "type": "string" }, "textContent": { "type": "string" }, "variables": { "type": "array", "items": { "type": "string" } }, "isActive": { "type": "boolean" } } } } } }, "responses": { "200": { "description": "Template updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Template updated successfully" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } }, "delete": { "tags": ["Email Management"], "summary": "Delete email template", "description": "Delete an email template. Only admins can delete templates.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "templateId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Template ID" } ], "responses": { "200": { "description": "Template deleted successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Template deleted successfully" } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/email/templates/{templateId}/preview": { "post": { "tags": ["Email Management"], "summary": "Preview email template", "description": "Generate a preview of an email template with sample data. Only admins can preview templates.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "templateId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Template ID" } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "variables": { "type": "object", "additionalProperties": true, "description": "Template variables for preview", "example": { "firstName": "John", "petName": "Buddy", "rescueName": "Golden Hearts Rescue" } } } } } } }, "responses": { "200": { "description": "Preview generated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "preview": { "type": "object", "properties": { "subject": { "type": "string" }, "htmlContent": { "type": "string" }, "textContent": { "type": "string" } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/email/templates/{templateId}/test": { "post": { "tags": ["Email Management"], "summary": "Send test email", "description": "Send a test email using a template to verify it works correctly. Only admins can send test emails.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "templateId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Template ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["testEmail"], "properties": { "testEmail": { "type": "string", "format": "email", "description": "Email address to send test to" }, "variables": { "type": "object", "additionalProperties": true, "description": "Template variables for test", "example": { "firstName": "Test User", "petName": "Test Pet" } } } } } } }, "responses": { "200": { "description": "Test email sent successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Test email sent successfully" }, "messageId": { "type": "string", "description": "Email service message ID" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/email/send": { "post": { "tags": ["Email Management"], "summary": "Send individual email", "description": "Send a single email using a template or custom content. Available to admins and rescue staff.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["to", "subject"], "properties": { "to": { "type": "string", "format": "email", "description": "Recipient email address" }, "templateId": { "type": "string", "format": "uuid", "description": "Template ID to use (optional if providing custom content)" }, "subject": { "type": "string", "maxLength": 255, "description": "Email subject" }, "htmlContent": { "type": "string", "description": "HTML content (required if no templateId)" }, "textContent": { "type": "string", "description": "Plain text content" }, "variables": { "type": "object", "additionalProperties": true, "description": "Template variables" }, "priority": { "type": "string", "enum": ["LOW", "NORMAL", "HIGH"], "default": "NORMAL", "description": "Email priority" } } } } } }, "responses": { "200": { "description": "Email sent successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Email sent successfully" }, "messageId": { "type": "string" }, "queueId": { "type": "string", "format": "uuid" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/email/send/bulk": { "post": { "tags": ["Email Management"], "summary": "Send bulk emails", "description": "Send emails to multiple recipients using a template. Only admins can send bulk emails.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["templateId", "recipients"], "properties": { "templateId": { "type": "string", "format": "uuid", "description": "Template ID to use" }, "recipients": { "type": "array", "maxItems": 1000, "items": { "type": "object", "required": ["email"], "properties": { "email": { "type": "string", "format": "email" }, "variables": { "type": "object", "additionalProperties": true } } }, "description": "List of recipients with personalized variables" }, "scheduleFor": { "type": "string", "format": "date-time", "description": "Optional scheduled send time" }, "priority": { "type": "string", "enum": ["LOW", "NORMAL", "HIGH"], "default": "NORMAL" } } } } } }, "responses": { "200": { "description": "Bulk email queued successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Bulk email queued successfully" }, "batchId": { "type": "string", "format": "uuid" }, "recipientCount": { "type": "integer" }, "estimatedSendTime": { "type": "string", "format": "date-time" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/email/queue": { "get": { "tags": ["Email Management"], "summary": "Get email queue status", "description": "Retrieve the current status of the email queue, including pending, processing, and failed emails. Only admins can access this endpoint.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "query", "name": "status", "schema": { "type": "string", "enum": ["PENDING", "PROCESSING", "SENT", "FAILED", "RETRY"] }, "description": "Filter by queue status" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }, "description": "Maximum number of queue items to return" }, { "in": "query", "name": "offset", "schema": { "type": "integer", "minimum": 0, "default": 0 }, "description": "Number of queue items to skip" } ], "responses": { "200": { "description": "Queue status retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "queue": { "type": "object", "properties": { "total": { "type": "integer", "description": "Total items in queue" }, "pending": { "type": "integer", "description": "Items waiting to be processed" }, "processing": { "type": "integer", "description": "Items currently being processed" }, "sent": { "type": "integer", "description": "Successfully sent items" }, "failed": { "type": "integer", "description": "Failed items" }, "items": { "type": "array", "items": { "type": "object", "properties": { "queueId": { "type": "string", "format": "uuid" }, "status": { "type": "string", "enum": ["PENDING", "PROCESSING", "SENT", "FAILED", "RETRY"] }, "to": { "type": "string", "format": "email" }, "subject": { "type": "string" }, "priority": { "type": "string", "enum": ["LOW", "NORMAL", "HIGH"] }, "createdAt": { "type": "string", "format": "date-time" }, "scheduledFor": { "type": "string", "format": "date-time" }, "attempts": { "type": "integer" }, "lastError": { "type": "string" } } } } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/email/queue/process": { "post": { "tags": ["Email Management"], "summary": "Process email queue", "description": "Manually trigger processing of pending emails in the queue. Only admins can trigger queue processing.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "priority": { "type": "string", "enum": ["LOW", "NORMAL", "HIGH"], "description": "Only process emails with this priority" }, "maxItems": { "type": "integer", "minimum": 1, "maximum": 500, "default": 100, "description": "Maximum number of emails to process" } } } } } }, "responses": { "200": { "description": "Queue processing initiated", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Queue processing initiated" }, "processedCount": { "type": "integer", "description": "Number of emails processed" }, "estimatedCompletion": { "type": "string", "format": "date-time" } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/email/queue/retry": { "post": { "tags": ["Email Management"], "summary": "Retry failed emails", "description": "Retry sending failed emails in the queue. Only admins can retry failed emails.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "queueIds": { "type": "array", "items": { "type": "string", "format": "uuid" }, "description": "Specific queue IDs to retry (optional - if not provided, retries all failed)" }, "maxRetries": { "type": "integer", "minimum": 1, "maximum": 5, "default": 3, "description": "Maximum retry attempts per email" } } } } } }, "responses": { "200": { "description": "Retry initiated for failed emails", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Retry initiated for failed emails" }, "retryCount": { "type": "integer", "description": "Number of emails queued for retry" } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/email/analytics": { "get": { "tags": ["Email Management"], "summary": "Get email analytics overview", "description": "Retrieve comprehensive email analytics including delivery rates, open rates, click rates, and bounce rates. Only admins can access analytics.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "query", "name": "startDate", "schema": { "type": "string", "format": "date" }, "description": "Start date for analytics period (ISO 8601 format)" }, { "in": "query", "name": "endDate", "schema": { "type": "string", "format": "date" }, "description": "End date for analytics period (ISO 8601 format)" }, { "in": "query", "name": "templateId", "schema": { "type": "string", "format": "uuid" }, "description": "Filter analytics by specific template" }, { "in": "query", "name": "groupBy", "schema": { "type": "string", "enum": ["day", "week", "month", "template", "recipient_domain"], "default": "day" }, "description": "Group analytics data by time period or category" } ], "responses": { "200": { "description": "Analytics retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "analytics": { "type": "object", "properties": { "summary": { "type": "object", "properties": { "totalSent": { "type": "integer", "description": "Total emails sent" }, "deliveryRate": { "type": "number", "format": "float", "minimum": 0, "maximum": 100, "description": "Delivery rate percentage" }, "openRate": { "type": "number", "format": "float", "minimum": 0, "maximum": 100, "description": "Open rate percentage" }, "clickRate": { "type": "number", "format": "float", "minimum": 0, "maximum": 100, "description": "Click-through rate percentage" }, "bounceRate": { "type": "number", "format": "float", "minimum": 0, "maximum": 100, "description": "Bounce rate percentage" }, "complaintRate": { "type": "number", "format": "float", "minimum": 0, "maximum": 100, "description": "Complaint rate percentage" } } }, "trends": { "type": "array", "items": { "type": "object", "properties": { "period": { "type": "string", "description": "Time period or category" }, "sent": { "type": "integer" }, "delivered": { "type": "integer" }, "opened": { "type": "integer" }, "clicked": { "type": "integer" }, "bounced": { "type": "integer" }, "complained": { "type": "integer" } } } }, "topTemplates": { "type": "array", "items": { "type": "object", "properties": { "templateId": { "type": "string", "format": "uuid" }, "templateName": { "type": "string" }, "sent": { "type": "integer" }, "openRate": { "type": "number", "format": "float" }, "clickRate": { "type": "number", "format": "float" } } } } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/email/analytics/{templateId}": { "get": { "tags": ["Email Management"], "summary": "Get template-specific analytics", "description": "Retrieve detailed analytics for a specific email template including performance metrics and recipient engagement. Only admins can access template analytics.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "templateId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Template ID" }, { "in": "query", "name": "startDate", "schema": { "type": "string", "format": "date" }, "description": "Start date for analytics period" }, { "in": "query", "name": "endDate", "schema": { "type": "string", "format": "date" }, "description": "End date for analytics period" }, { "in": "query", "name": "includeRecipients", "schema": { "type": "boolean", "default": false }, "description": "Include detailed recipient engagement data" } ], "responses": { "200": { "description": "Template analytics retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "analytics": { "type": "object", "properties": { "template": { "type": "object", "properties": { "templateId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string" } } }, "performance": { "type": "object", "properties": { "totalSent": { "type": "integer" }, "deliveryRate": { "type": "number", "format": "float" }, "openRate": { "type": "number", "format": "float" }, "clickRate": { "type": "number", "format": "float" }, "bounceRate": { "type": "number", "format": "float" }, "avgTimeToOpen": { "type": "integer", "description": "Average time to open in minutes" } } }, "timeline": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "format": "date" }, "sent": { "type": "integer" }, "opened": { "type": "integer" }, "clicked": { "type": "integer" } } } }, "recipients": { "type": "array", "items": { "type": "object", "properties": { "email": { "type": "string", "format": "email" }, "status": { "type": "string", "enum": [ "sent", "delivered", "opened", "clicked", "bounced", "complained" ] }, "sentAt": { "type": "string", "format": "date-time" }, "openedAt": { "type": "string", "format": "date-time" }, "clickedAt": { "type": "string", "format": "date-time" } } } } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/email/preferences/{userId}": { "get": { "tags": ["Email Management"], "summary": "Get user email preferences", "description": "Retrieve email notification preferences for a specific user. Users can access their own preferences, admins can access any user's preferences.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "User ID" } ], "responses": { "200": { "description": "User preferences retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "preferences": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "emailNotifications": { "type": "boolean" }, "applicationUpdates": { "type": "boolean" }, "rescueUpdates": { "type": "boolean" }, "newsletters": { "type": "boolean" }, "marketingEmails": { "type": "boolean" }, "frequency": { "type": "string", "enum": ["IMMEDIATE", "DAILY", "WEEKLY"] } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } }, "put": { "tags": ["Email Management"], "summary": "Update user email preferences", "description": "Update email notification preferences for a specific user. Users can update their own preferences, admins can update any user's preferences.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "User ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "emailNotifications": { "type": "boolean", "description": "Enable/disable all email notifications" }, "applicationUpdates": { "type": "boolean", "description": "Receive application status updates" }, "rescueUpdates": { "type": "boolean", "description": "Receive rescue organization updates" }, "newsletters": { "type": "boolean", "description": "Receive newsletters" }, "marketingEmails": { "type": "boolean", "description": "Receive marketing emails" }, "frequency": { "type": "string", "enum": ["IMMEDIATE", "DAILY", "WEEKLY"], "description": "Email frequency preference" } } } } } }, "responses": { "200": { "description": "Preferences updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Email preferences updated successfully" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/preferences/{userId}": { "get": { "tags": ["Email Management"], "summary": "GET /api/v1/preferences/{userId}", "description": "Handle GET request for /api/v1/preferences/{userId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/preferences/{userId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/email/unsubscribe/{token}": { "get": { "tags": ["Email Management"], "summary": "Unsubscribe user from emails", "description": "Unsubscribe a user from email notifications using a secure token. This is a public endpoint that doesn't require authentication.", "parameters": [ { "in": "path", "name": "token", "required": true, "schema": { "type": "string" }, "description": "Unsubscribe token" } ], "responses": { "200": { "description": "User unsubscribed successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "You have been successfully unsubscribed from all emails" } } } }, "text/html": { "schema": { "type": "string", "description": "HTML unsubscribe confirmation page" } } } }, "400": { "description": "Invalid or expired token", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "error": { "type": "string", "example": "Invalid or expired unsubscribe token" } } } } } }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/email/webhook/delivery": { "post": { "tags": ["Email Management"], "summary": "Handle email delivery webhook", "description": "Webhook endpoint for email service providers to report delivery status, bounces, and complaints. This is a public endpoint with provider-specific verification.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "description": "Webhook payload varies by email service provider", "properties": { "eventType": { "type": "string", "enum": ["delivered", "bounced", "complained", "opened", "clicked"], "description": "Type of email event" }, "messageId": { "type": "string", "description": "Original message identifier" }, "email": { "type": "string", "format": "email", "description": "Recipient email address" }, "timestamp": { "type": "string", "format": "date-time", "description": "Event timestamp" }, "reason": { "type": "string", "description": "Additional details for bounces/complaints" } } } } } }, "responses": { "200": { "description": "Webhook processed successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Webhook processed successfully" } } } } } }, "400": { "description": "Invalid webhook payload", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "error": { "type": "string", "example": "Invalid webhook payload" } } } } } }, "401": { "description": "Webhook verification failed", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "error": { "type": "string", "example": "Webhook verification failed" } } } } } } } } }, "/api/v1/dashboard": { "get": { "tags": ["Monitoring"], "summary": "GET /api/v1/dashboard", "description": "Handle GET request for /api/v1/dashboard", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/dashboard successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/api/health": { "get": { "tags": ["Monitoring"], "summary": "GET /api/v1/api/health", "description": "Handle GET request for /api/v1/api/health", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/api/health successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/api/health/database": { "get": { "tags": ["Monitoring"], "summary": "GET /api/v1/api/health/database", "description": "Handle GET request for /api/v1/api/health/database", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/api/health/database successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/api/health/email": { "get": { "tags": ["Monitoring"], "summary": "GET /api/v1/api/health/email", "description": "Handle GET request for /api/v1/api/health/email", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/api/health/email successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/api/health/storage": { "get": { "tags": ["Monitoring"], "summary": "GET /api/v1/api/health/storage", "description": "Handle GET request for /api/v1/api/health/storage", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/api/health/storage successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/api/health/system": { "get": { "tags": ["Monitoring"], "summary": "GET /api/v1/api/health/system", "description": "Handle GET request for /api/v1/api/health/system", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/api/health/system successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/api/email/provider-info": { "get": { "tags": ["Monitoring"], "summary": "GET /api/v1/api/email/provider-info", "description": "Handle GET request for /api/v1/api/email/provider-info", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/api/email/provider-info successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/unread/count": { "get": { "tags": ["Notifications"], "summary": "GET /api/v1/unread/count", "description": "Handle GET request for /api/v1/unread/count", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/unread/count successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/preferences": { "get": { "tags": ["User Management"], "summary": "GET /api/v1/preferences", "description": "Handle GET request for /api/v1/preferences", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/preferences successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } }, "put": { "tags": ["User Management"], "summary": "PUT /api/v1/preferences", "description": "Handle PUT request for /api/v1/preferences", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "200": { "description": "PUT /api/v1/preferences successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "PUT /api/v1/preferences successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/read-all": { "post": { "tags": ["Notifications"], "summary": "POST /api/v1/read-all", "description": "Handle POST request for /api/v1/read-all", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "201": { "description": "POST /api/v1/read-all successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "POST /api/v1/read-all successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/{notificationId}": { "get": { "tags": ["Notifications"], "summary": "GET /api/v1/{notificationId}", "description": "Handle GET request for /api/v1/{notificationId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/{notificationId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/pets": { "get": { "tags": ["Pet Management"], "summary": "Search pets", "description": "Search available pets with filters and pagination", "parameters": [ { "in": "query", "name": "search", "schema": { "type": "string" }, "description": "Search term for pet name or description", "example": "Golden Retriever" }, { "in": "query", "name": "type", "schema": { "type": "string", "enum": ["DOG", "CAT", "RABBIT", "BIRD", "OTHER"] }, "description": "Filter by pet type" }, { "in": "query", "name": "breed", "schema": { "type": "string" }, "description": "Filter by breed" }, { "in": "query", "name": "age", "schema": { "type": "string", "enum": ["PUPPY", "YOUNG", "ADULT", "SENIOR"] }, "description": "Filter by age group" }, { "in": "query", "name": "size", "schema": { "type": "string", "enum": ["SMALL", "MEDIUM", "LARGE", "EXTRA_LARGE"] }, "description": "Filter by size" }, { "in": "query", "name": "gender", "schema": { "type": "string", "enum": ["MALE", "FEMALE"] }, "description": "Filter by gender" }, { "in": "query", "name": "location", "schema": { "type": "string" }, "description": "Filter by location/zip code" }, { "in": "query", "name": "distance", "schema": { "type": "integer", "minimum": 1, "maximum": 500 }, "description": "Search radius in miles (requires location)" }, { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1, "default": 1 }, "description": "Page number" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }, "description": "Items per page" } ], "responses": { "200": { "description": "Pets retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "pets": { "type": "array", "items": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid" }, "name": { "type": "string", "example": "Buddy" }, "type": { "type": "string", "example": "DOG" }, "breed": { "type": "string", "example": "Golden Retriever" }, "age": { "type": "string", "example": "ADULT" }, "size": { "type": "string", "example": "LARGE" }, "gender": { "type": "string", "example": "MALE" }, "description": { "type": "string" }, "images": { "type": "array", "items": { "type": "string" } }, "rescue": { "type": "object", "properties": { "rescueId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "location": { "type": "string" } } } } } }, "pagination": { "type": "object", "properties": { "currentPage": { "type": "integer" }, "totalPages": { "type": "integer" }, "totalItems": { "type": "integer" }, "hasNext": { "type": "boolean" }, "hasPrev": { "type": "boolean" } } } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" } } } }, "/api/v1/pets/test": { "get": { "tags": ["Pet Management"], "summary": "Test endpoint", "description": "Simple test endpoint to verify pet routes are working", "responses": { "200": { "description": "Test successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Pet routes are working!" } } } } } } } } }, "/api/v1/pets/featured": { "get": { "tags": ["Pet Management"], "summary": "Get featured pets", "description": "Get a list of featured pets for homepage display", "responses": { "200": { "description": "Featured pets retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "pets": { "type": "array", "items": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string" }, "breed": { "type": "string" }, "images": { "type": "array", "items": { "type": "string" } }, "isFeatured": { "type": "boolean", "example": true } } } } } } } } } } } }, "/api/v1/featured": { "get": { "tags": ["Pet Management"], "summary": "GET /api/v1/featured", "description": "Handle GET request for /api/v1/featured", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/featured successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/pets/recent": { "get": { "tags": ["Pet Management"], "summary": "Get recently added pets", "description": "Get a list of recently added pets", "responses": { "200": { "description": "Recent pets retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "pets": { "type": "array", "items": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string" }, "breed": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" } } } } } } } } } } } }, "/api/v1/recent": { "get": { "tags": ["Pet Management"], "summary": "GET /api/v1/recent", "description": "Handle GET request for /api/v1/recent", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/recent successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/pets/types": { "get": { "tags": ["Pet Management"], "summary": "Get pet types", "description": "Get available pet types for filtering", "responses": { "200": { "description": "Pet types retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "types": { "type": "array", "items": { "type": "string" }, "example": ["DOG", "CAT", "RABBIT", "BIRD", "OTHER"] } } } } } } } } }, "/api/v1/types": { "get": { "tags": ["Pet Management"], "summary": "GET /api/v1/types", "description": "Handle GET request for /api/v1/types", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/types successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/pets/breeds/{type}": { "get": { "tags": ["Pet Management"], "summary": "Get breeds by pet type", "description": "Get available breeds for a specific pet type", "parameters": [ { "in": "path", "name": "type", "required": true, "schema": { "type": "string", "enum": ["DOG", "CAT", "RABBIT", "BIRD", "OTHER"] }, "description": "Pet type", "example": "DOG" } ], "responses": { "200": { "description": "Breeds retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "breeds": { "type": "array", "items": { "type": "string" }, "example": ["Golden Retriever", "Labrador", "German Shepherd"] } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" } } } }, "/api/v1/breeds/{type}": { "get": { "tags": ["Pet Management"], "summary": "GET /api/v1/breeds/{type}", "description": "Handle GET request for /api/v1/breeds/{type}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/breeds/{type} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/pets/statistics": { "get": { "tags": ["Pet Management"], "summary": "Get pet statistics", "description": "Get general pet statistics for the platform", "responses": { "200": { "description": "Pet statistics retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "statistics": { "type": "object", "properties": { "totalPets": { "type": "integer", "example": 2547 }, "availablePets": { "type": "integer", "example": 1823 }, "adoptedPets": { "type": "integer", "example": 724 }, "petsByType": { "type": "object", "properties": { "DOG": { "type": "integer", "example": 1200 }, "CAT": { "type": "integer", "example": 800 }, "RABBIT": { "type": "integer", "example": 300 } } } } } } } } } } } } }, "/api/v1/statistics": { "get": { "tags": ["User Management"], "summary": "GET /api/v1/statistics", "description": "Handle GET request for /api/v1/statistics", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/statistics successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/pets/rescue/{rescueId}": { "get": { "tags": ["Pet Management"], "summary": "Get pets by rescue organization", "description": "Get all pets from a specific rescue organization", "parameters": [ { "in": "path", "name": "rescueId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Rescue organization ID" } ], "responses": { "200": { "description": "Rescue pets retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "pets": { "type": "array", "items": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string" }, "breed": { "type": "string" }, "status": { "type": "string", "enum": ["AVAILABLE", "PENDING", "ADOPTED"] } } } } } } } } }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/rescue/{rescueId}": { "get": { "tags": ["Pet Management"], "summary": "GET /api/v1/rescue/{rescueId}", "description": "Handle GET request for /api/v1/rescue/{rescueId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/rescue/{rescueId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/pets/favorites/user": { "get": { "tags": ["Pet Management"], "summary": "Get user's favorite pets", "description": "Get all pets favorited by the authenticated user", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "User favorites retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "favorites": { "type": "array", "items": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string" }, "breed": { "type": "string" }, "images": { "type": "array", "items": { "type": "string" } }, "favoritedAt": { "type": "string", "format": "date-time" } } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/favorites/user": { "get": { "tags": ["Pet Management"], "summary": "GET /api/v1/favorites/user", "description": "Handle GET request for /api/v1/favorites/user", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/favorites/user successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/pets/{petId}": { "get": { "tags": ["Pet Management"], "summary": "Get pet details by ID", "description": "Get detailed information about a specific pet", "parameters": [ { "in": "path", "name": "petId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Pet ID" } ], "responses": { "200": { "description": "Pet details retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "pet": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid" }, "name": { "type": "string", "example": "Buddy" }, "type": { "type": "string", "example": "DOG" }, "breed": { "type": "string", "example": "Golden Retriever" }, "age": { "type": "string", "example": "ADULT" }, "size": { "type": "string", "example": "LARGE" }, "gender": { "type": "string", "example": "MALE" }, "description": { "type": "string" }, "specialNeeds": { "type": "string" }, "goodWithKids": { "type": "boolean" }, "goodWithPets": { "type": "boolean" }, "energyLevel": { "type": "string", "enum": ["LOW", "MODERATE", "HIGH"] }, "images": { "type": "array", "items": { "type": "string" } }, "status": { "type": "string", "enum": ["AVAILABLE", "PENDING", "ADOPTED"] }, "rescue": { "type": "object", "properties": { "rescueId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "location": { "type": "string" }, "contact": { "type": "object" } } }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } } } } } } } }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{petId}": { "get": { "tags": ["Pet Management"], "summary": "GET /api/v1/{petId}", "description": "Handle GET request for /api/v1/{petId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/{petId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/pets/{petId}/similar": { "get": { "tags": ["Pet Management"], "summary": "Get similar pets", "description": "Get pets similar to the specified pet based on breed, age, and size", "parameters": [ { "in": "path", "name": "petId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Pet ID" } ], "responses": { "200": { "description": "Similar pets retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "similarPets": { "type": "array", "items": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string" }, "breed": { "type": "string" }, "similarityScore": { "type": "number", "example": 0.85 } } } } } } } } }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{petId}/similar": { "get": { "tags": ["Pet Management"], "summary": "GET /api/v1/{petId}/similar", "description": "Handle GET request for /api/v1/{petId}/similar", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/{petId}/similar successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/pets/{petId}/activity": { "get": { "tags": ["Pet Management"], "summary": "Get pet activity history", "description": "Get activity history and statistics for a specific pet", "parameters": [ { "in": "path", "name": "petId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Pet ID" } ], "responses": { "200": { "description": "Pet activity retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "activity": { "type": "object", "properties": { "views": { "type": "integer", "example": 245 }, "favorites": { "type": "integer", "example": 23 }, "applications": { "type": "integer", "example": 5 }, "recentViews": { "type": "array", "items": { "type": "object", "properties": { "timestamp": { "type": "string", "format": "date-time" }, "userId": { "type": "string", "format": "uuid" } } } } } } } } } } }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/rescues/{rescueId}": { "get": { "tags": ["Rescue Organizations"], "summary": "Get rescue organization details", "description": "Get detailed information about a specific rescue organization", "parameters": [ { "in": "path", "name": "rescueId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Rescue organization ID" } ], "responses": { "200": { "description": "Rescue organization details retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "rescue": { "type": "object", "properties": { "rescueId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email" }, "phone": { "type": "string" }, "address": { "type": "string" }, "city": { "type": "string" }, "state": { "type": "string" }, "zipCode": { "type": "string" }, "country": { "type": "string" }, "website": { "type": "string", "format": "uri" }, "description": { "type": "string" }, "mission": { "type": "string" }, "isVerified": { "type": "boolean" }, "contactPerson": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" } } } } } } } }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{rescueId}": { "get": { "tags": ["Rescue Organizations"], "summary": "GET /api/v1/{rescueId}", "description": "Handle GET request for /api/v1/{rescueId}", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/{rescueId} successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/rescues/{rescueId}/pets": { "get": { "tags": ["Rescue Organizations"], "summary": "Get pets from rescue organization", "description": "Get all pets available from a specific rescue organization", "parameters": [ { "in": "path", "name": "rescueId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Rescue organization ID" } ], "responses": { "200": { "description": "Rescue pets retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "pets": { "type": "array", "items": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "type": { "type": "string" }, "breed": { "type": "string" }, "age": { "type": "string" }, "size": { "type": "string" }, "status": { "type": "string", "enum": ["AVAILABLE", "PENDING", "ADOPTED"] }, "images": { "type": "array", "items": { "type": "string" } } } } } } } } } }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{rescueId}/pets": { "get": { "tags": ["Rescue Organizations"], "summary": "GET /api/v1/{rescueId}/pets", "description": "Handle GET request for /api/v1/{rescueId}/pets", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/{rescueId}/pets successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/users/profile": { "get": { "tags": ["User Management"], "summary": "Get current user profile", "description": "Get the authenticated user's profile information", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "User profile retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "user": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "email": { "type": "string", "format": "email" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "userType": { "type": "string", "enum": ["ADOPTER", "RESCUE_STAFF", "ADMIN"] }, "phone": { "type": "string" }, "bio": { "type": "string" }, "isVerified": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } }, "put": { "tags": ["User Management"], "summary": "Update current user profile", "description": "Update the authenticated user's profile information", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "firstName": { "type": "string", "minLength": 2, "maxLength": 50, "example": "John" }, "lastName": { "type": "string", "minLength": 2, "maxLength": 50, "example": "Doe" }, "phone": { "type": "string", "example": "+1234567890" }, "bio": { "type": "string", "maxLength": 500, "example": "Animal lover with experience caring for rescue dogs" } } } } } }, "responses": { "200": { "description": "Profile updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Profile updated successfully" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/profile": { "get": { "tags": ["User Management"], "summary": "GET /api/v1/profile", "description": "Handle GET request for /api/v1/profile", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "GET /api/v1/profile successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } }, "put": { "tags": ["User Management"], "summary": "PUT /api/v1/profile", "description": "Handle PUT request for /api/v1/profile", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "200": { "description": "PUT /api/v1/profile successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "PUT /api/v1/profile successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/users/preferences": { "get": { "tags": ["User Management"], "summary": "Get user preferences", "description": "Get the authenticated user's notification and app preferences", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "User preferences retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "preferences": { "type": "object", "properties": { "emailNotifications": { "type": "boolean", "example": true }, "pushNotifications": { "type": "boolean", "example": false }, "marketingEmails": { "type": "boolean", "example": false }, "language": { "type": "string", "example": "en" }, "timezone": { "type": "string", "example": "America/New_York" } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } }, "put": { "tags": ["User Management"], "summary": "Update user preferences", "description": "Update the authenticated user's notification and app preferences", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "emailNotifications": { "type": "boolean", "example": true }, "pushNotifications": { "type": "boolean", "example": false }, "marketingEmails": { "type": "boolean", "example": false }, "language": { "type": "string", "example": "en" }, "timezone": { "type": "string", "example": "America/New_York" } } } } } }, "responses": { "200": { "description": "Preferences updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Preferences updated successfully" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/users/preferences/reset": { "post": { "tags": ["User Management"], "summary": "Reset user preferences to defaults", "description": "Reset all user preferences to their default values", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "Preferences reset successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Preferences reset to defaults" } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/preferences/reset": { "post": { "tags": ["User Management"], "summary": "POST /api/v1/preferences/reset", "description": "Handle POST request for /api/v1/preferences/reset", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "201": { "description": "POST /api/v1/preferences/reset successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "POST /api/v1/preferences/reset successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/users/account": { "delete": { "tags": ["User Management"], "summary": "Delete user account", "description": "Permanently delete the authenticated user's account and all associated data", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["reason"], "properties": { "reason": { "type": "string", "maxLength": 500, "example": "No longer need the service" }, "feedback": { "type": "string", "maxLength": 1000, "example": "Great service, but circumstances changed" } } } } } }, "responses": { "200": { "description": "Account deleted successfully", "headers": { "Set-Cookie": { "description": "Cleared authentication cookie", "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "Account deleted successfully" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/account": { "delete": { "tags": ["User Management"], "summary": "DELETE /api/v1/account", "description": "Handle DELETE request for /api/v1/account", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "DELETE /api/v1/account successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "DELETE /api/v1/account successful" } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/users/search": { "get": { "tags": ["User Management"], "summary": "Search users (Admin only)", "description": "Search and filter users with pagination. Admin access required.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "query", "name": "search", "schema": { "type": "string" }, "description": "Search term for name or email", "example": "john" }, { "in": "query", "name": "userType", "schema": { "type": "string", "enum": ["ADOPTER", "RESCUE_STAFF", "ADMIN"] }, "description": "Filter by user type" }, { "in": "query", "name": "isVerified", "schema": { "type": "boolean" }, "description": "Filter by verification status" }, { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1, "default": 1 }, "description": "Page number" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }, "description": "Items per page" } ], "responses": { "200": { "description": "Users retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "users": { "type": "array", "items": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "email": { "type": "string", "format": "email" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "userType": { "type": "string" }, "isVerified": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" } } } }, "pagination": { "type": "object", "properties": { "currentPage": { "type": "integer" }, "totalPages": { "type": "integer" }, "totalItems": { "type": "integer" }, "hasNext": { "type": "boolean" }, "hasPrev": { "type": "boolean" } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/users/statistics": { "get": { "tags": ["User Management"], "summary": "Get user statistics (Admin only)", "description": "Get comprehensive user statistics and metrics. Admin access required.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "responses": { "200": { "description": "User statistics retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "statistics": { "type": "object", "properties": { "totalUsers": { "type": "integer", "example": 1250 }, "verifiedUsers": { "type": "integer", "example": 1100 }, "usersByType": { "type": "object", "properties": { "ADOPTER": { "type": "integer", "example": 1000 }, "RESCUE_STAFF": { "type": "integer", "example": 200 }, "ADMIN": { "type": "integer", "example": 50 } } }, "newUsersThisMonth": { "type": "integer", "example": 45 }, "activeUsersLastWeek": { "type": "integer", "example": 300 } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } }, "/api/v1/users/{userId}/activity": { "get": { "tags": ["User Management"], "summary": "Get user activity summary", "description": "Get user's activity history and statistics. Users can view their own activity, admins can view any.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "User ID" } ], "responses": { "200": { "description": "User activity retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "activity": { "type": "object", "properties": { "applicationsSubmitted": { "type": "integer", "example": 5 }, "favoritePets": { "type": "integer", "example": 12 }, "messagesExchanged": { "type": "integer", "example": 34 }, "lastLogin": { "type": "string", "format": "date-time" }, "recentActions": { "type": "array", "items": { "type": "object", "properties": { "action": { "type": "string" }, "timestamp": { "type": "string", "format": "date-time" }, "details": { "type": "string" } } } } } } } } } } }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/users/{userId}/role": { "put": { "tags": ["User Management"], "summary": "Update user role (Admin only)", "description": "Update user's role/type. Admin access required.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "User ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["userType"], "properties": { "userType": { "type": "string", "enum": ["ADOPTER", "RESCUE_STAFF", "ADMIN"], "example": "RESCUE_STAFF" }, "reason": { "type": "string", "maxLength": 500, "example": "Promoted to rescue staff role" } } } } } }, "responses": { "200": { "description": "User role updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "User role updated successfully" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{userId}/role": { "put": { "tags": ["User Management"], "summary": "PUT /api/v1/{userId}/role", "description": "Handle PUT request for /api/v1/{userId}/role", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "200": { "description": "PUT /api/v1/{userId}/role successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "PUT /api/v1/{userId}/role successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/users/{userId}/deactivate": { "post": { "tags": ["User Management"], "summary": "Deactivate user (Admin only)", "description": "Deactivate a user account. Admin access required.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "User ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["reason"], "properties": { "reason": { "type": "string", "maxLength": 500, "example": "Policy violation" }, "notifyUser": { "type": "boolean", "default": true, "example": true } } } } } }, "responses": { "200": { "description": "User deactivated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "User deactivated successfully" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{userId}/deactivate": { "post": { "tags": ["User Management"], "summary": "POST /api/v1/{userId}/deactivate", "description": "Handle POST request for /api/v1/{userId}/deactivate", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "201": { "description": "POST /api/v1/{userId}/deactivate successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "POST /api/v1/{userId}/deactivate successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/users/{userId}/reactivate": { "post": { "tags": ["User Management"], "summary": "Reactivate user (Admin only)", "description": "Reactivate a deactivated user account. Admin access required.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "User ID" } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "type": "object", "properties": { "reason": { "type": "string", "maxLength": 500, "example": "Issue resolved" }, "notifyUser": { "type": "boolean", "default": true, "example": true } } } } } }, "responses": { "200": { "description": "User reactivated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "User reactivated successfully" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { "$ref": "#/components/responses/NotFoundError" } } } }, "/api/v1/{userId}/reactivate": { "post": { "tags": ["User Management"], "summary": "POST /api/v1/{userId}/reactivate", "description": "Handle POST request for /api/v1/{userId}/reactivate", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": null } } } }, "responses": { "201": { "description": "POST /api/v1/{userId}/reactivate successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "POST /api/v1/{userId}/reactivate successful" } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" } } } }, "/api/v1/users/bulk-update": { "post": { "tags": ["User Management"], "summary": "Bulk update users (Admin only)", "description": "Update multiple users at once. Admin access required.", "security": [ { "bearerAuth": [] }, { "cookieAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["userIds", "updates"], "properties": { "userIds": { "type": "array", "items": { "type": "string", "format": "uuid" }, "example": [ "123e4567-e89b-12d3-a456-426614174000", "987fcdeb-51a2-43d7-8f9e-123456789abc" ] }, "updates": { "type": "object", "properties": { "userType": { "type": "string", "enum": ["ADOPTER", "RESCUE_STAFF", "ADMIN"] }, "isActive": { "type": "boolean" }, "emailNotifications": { "type": "boolean" } } }, "reason": { "type": "string", "maxLength": 500, "example": "Bulk role update for rescue staff" } } } } } }, "responses": { "200": { "description": "Users updated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "5 users updated successfully" }, "updatedCount": { "type": "integer", "example": 5 }, "failedIds": { "type": "array", "items": { "type": "string", "format": "uuid" } } } } } } }, "400": { "$ref": "#/components/responses/ValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "403": { "$ref": "#/components/responses/ForbiddenError" } } } } }, "components": { "schemas": { "ApiResponse": { "type": "object", "properties": { "success": { "type": "boolean", "description": "Indicates if the request was successful" }, "message": { "type": "string", "description": "Human-readable message" }, "data": { "type": "object", "description": "Response data (varies by endpoint)" } }, "required": ["success"], "example": { "success": true, "message": "Operation completed successfully", "data": {} } }, "PaginationMeta": { "type": "object", "properties": { "page": { "type": "integer", "minimum": 1, "description": "Current page number" }, "limit": { "type": "integer", "minimum": 1, "maximum": 100, "description": "Items per page" }, "total": { "type": "integer", "minimum": 0, "description": "Total number of items" }, "totalPages": { "type": "integer", "minimum": 0, "description": "Total number of pages" }, "hasNext": { "type": "boolean", "description": "Whether there are more pages" }, "hasPrev": { "type": "boolean", "description": "Whether there are previous pages" } }, "required": ["page", "limit", "total", "totalPages", "hasNext", "hasPrev"] }, "PaginatedResponse": { "allOf": [ { "$ref": "#/components/schemas/ApiResponse" }, { "type": "object", "properties": { "pagination": { "$ref": "#/components/schemas/PaginationMeta" } } } ] }, "UserBase": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid", "description": "Unique user identifier" }, "email": { "type": "string", "format": "email", "description": "User's email address" }, "firstName": { "type": "string", "minLength": 2, "maxLength": 50, "description": "User's first name" }, "lastName": { "type": "string", "minLength": 2, "maxLength": 50, "description": "User's last name" }, "phone": { "type": "string", "pattern": "^[+]?[1-9]\\d{1,14}$", "description": "User's phone number (E.164 format)" }, "userType": { "type": "string", "enum": ["ADOPTER", "RESCUE_STAFF", "ADMIN"], "description": "Type of user account" }, "isEmailVerified": { "type": "boolean", "description": "Whether email is verified" }, "isPhoneVerified": { "type": "boolean", "description": "Whether phone is verified" }, "profilePicture": { "type": "string", "format": "uri", "description": "URL to profile picture" }, "createdAt": { "type": "string", "format": "date-time", "description": "Account creation timestamp" }, "lastLoginAt": { "type": "string", "format": "date-time", "description": "Last login timestamp" } }, "required": [ "userId", "email", "firstName", "lastName", "userType", "isEmailVerified", "isPhoneVerified", "createdAt" ] }, "CreateUserRequest": { "type": "object", "properties": { "email": { "type": "string", "format": "email" }, "password": { "type": "string", "minLength": 8, "description": "Must contain uppercase, lowercase, number, and special character" }, "firstName": { "type": "string", "minLength": 2, "maxLength": 50 }, "lastName": { "type": "string", "minLength": 2, "maxLength": 50 }, "userType": { "type": "string", "enum": ["ADOPTER", "RESCUE_STAFF", "ADMIN"] }, "phone": { "type": "string", "pattern": "^[+]?[1-9]\\d{1,14}$" } }, "required": ["email", "password", "firstName", "lastName", "userType"] }, "Pet": { "type": "object", "properties": { "petId": { "type": "string", "format": "uuid", "description": "Unique pet identifier" }, "name": { "type": "string", "minLength": 1, "maxLength": 100, "description": "Pet's name" }, "type": { "type": "string", "enum": ["DOG", "CAT", "RABBIT", "BIRD", "OTHER"], "description": "Type of pet" }, "breed": { "type": "string", "maxLength": 100, "description": "Pet's breed" }, "age": { "type": "string", "enum": ["PUPPY", "YOUNG", "ADULT", "SENIOR"], "description": "Age category" }, "ageYears": { "type": "integer", "minimum": 0, "maximum": 30, "description": "Age in years" }, "ageMonths": { "type": "integer", "minimum": 0, "maximum": 11, "description": "Additional months" }, "gender": { "type": "string", "enum": ["MALE", "FEMALE", "UNKNOWN"], "description": "Pet's gender" }, "size": { "type": "string", "enum": ["SMALL", "MEDIUM", "LARGE", "EXTRA_LARGE"], "description": "Pet's size category" }, "weight": { "type": "number", "minimum": 0, "description": "Pet's weight in pounds" }, "color": { "type": "string", "maxLength": 100, "description": "Pet's color/markings" }, "shortDescription": { "type": "string", "maxLength": 500, "description": "Brief description for listings" }, "longDescription": { "type": "string", "description": "Detailed description" }, "adoptionStatus": { "type": "string", "enum": ["AVAILABLE", "PENDING", "ADOPTED", "ON_HOLD", "NOT_AVAILABLE"], "description": "Current adoption status" }, "specialNeeds": { "type": "boolean", "description": "Whether pet has special needs" }, "specialNeedsDescription": { "type": "string", "description": "Details about special needs" }, "goodWithKids": { "type": "boolean", "description": "Whether pet is good with children" }, "goodWithDogs": { "type": "boolean", "description": "Whether pet is good with other dogs" }, "goodWithCats": { "type": "boolean", "description": "Whether pet is good with cats" }, "houseTrained": { "type": "boolean", "description": "Whether pet is house trained" }, "spayedNeutered": { "type": "boolean", "description": "Whether pet is spayed/neutered" }, "vaccinated": { "type": "boolean", "description": "Whether pet is up to date on vaccinations" }, "microchipped": { "type": "boolean", "description": "Whether pet is microchipped" }, "photos": { "type": "array", "items": { "type": "object", "properties": { "photoId": { "type": "string", "format": "uuid" }, "url": { "type": "string", "format": "uri" }, "isPrimary": { "type": "boolean" }, "caption": { "type": "string" } } } }, "rescue": { "type": "object", "properties": { "rescueId": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "location": { "type": "string" } } }, "location": { "type": "object", "properties": { "address": { "type": "string" }, "city": { "type": "string" }, "state": { "type": "string" }, "zipCode": { "type": "string" }, "latitude": { "type": "number" }, "longitude": { "type": "number" } } }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "required": [ "petId", "name", "type", "breed", "age", "gender", "size", "adoptionStatus", "createdAt", "updatedAt" ] }, "CreatePetRequest": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "type": { "type": "string", "enum": ["DOG", "CAT", "RABBIT", "BIRD", "OTHER"] }, "breed": { "type": "string", "maxLength": 100 }, "ageYears": { "type": "integer", "minimum": 0, "maximum": 30 }, "ageMonths": { "type": "integer", "minimum": 0, "maximum": 11 }, "gender": { "type": "string", "enum": ["MALE", "FEMALE", "UNKNOWN"] }, "size": { "type": "string", "enum": ["SMALL", "MEDIUM", "LARGE", "EXTRA_LARGE"] }, "weight": { "type": "number", "minimum": 0 }, "color": { "type": "string", "maxLength": 100 }, "shortDescription": { "type": "string", "minLength": 10, "maxLength": 500 }, "longDescription": { "type": "string" }, "specialNeeds": { "type": "boolean", "default": false }, "specialNeedsDescription": { "type": "string" }, "goodWithKids": { "type": "boolean" }, "goodWithDogs": { "type": "boolean" }, "goodWithCats": { "type": "boolean" }, "houseTrained": { "type": "boolean" }, "spayedNeutered": { "type": "boolean" }, "vaccinated": { "type": "boolean" }, "microchipped": { "type": "boolean" } }, "required": ["name", "type", "breed", "gender", "size"] }, "LoginRequest": { "type": "object", "properties": { "email": { "type": "string", "format": "email" }, "password": { "type": "string", "minLength": 8 } }, "required": ["email", "password"], "example": { "email": "user@example.com", "password": "SecurePass123!" } }, "AuthResponse": { "allOf": [ { "$ref": "#/components/schemas/ApiResponse" }, { "type": "object", "properties": { "data": { "type": "object", "properties": { "token": { "type": "string", "description": "JWT access token" }, "refreshToken": { "type": "string", "description": "JWT refresh token" }, "user": { "$ref": "#/components/schemas/UserBase" }, "expiresIn": { "type": "integer", "description": "Token expiration time in seconds" } }, "required": ["token", "user", "expiresIn"] } } } ] }, "Application": { "type": "object", "properties": { "applicationId": { "type": "string", "format": "uuid" }, "petId": { "type": "string", "format": "uuid" }, "adopterId": { "type": "string", "format": "uuid" }, "status": { "type": "string", "enum": ["SUBMITTED", "UNDER_REVIEW", "APPROVED", "REJECTED", "WITHDRAWN"] }, "submittedAt": { "type": "string", "format": "date-time" }, "reviewedAt": { "type": "string", "format": "date-time" }, "reviewedBy": { "type": "string", "format": "uuid" }, "notes": { "type": "string" }, "answers": { "type": "object", "additionalProperties": true } }, "required": ["applicationId", "petId", "adopterId", "status", "submittedAt"] }, "Rescue": { "type": "object", "properties": { "rescueId": { "type": "string", "format": "uuid" }, "name": { "type": "string", "minLength": 2, "maxLength": 100 }, "description": { "type": "string" }, "website": { "type": "string", "format": "uri" }, "email": { "type": "string", "format": "email" }, "phone": { "type": "string" }, "address": { "type": "object", "properties": { "street": { "type": "string" }, "city": { "type": "string" }, "state": { "type": "string" }, "zipCode": { "type": "string" }, "latitude": { "type": "number" }, "longitude": { "type": "number" } } }, "isVerified": { "type": "boolean" }, "logoUrl": { "type": "string", "format": "uri" }, "createdAt": { "type": "string", "format": "date-time" } }, "required": ["rescueId", "name", "email", "isVerified", "createdAt"] }, "Error": { "type": "object", "properties": { "error": { "type": "string", "description": "Error type/code" }, "message": { "type": "string", "description": "Human-readable error message" }, "details": { "type": "object", "description": "Additional error details" }, "timestamp": { "type": "string", "format": "date-time", "description": "Error timestamp" } }, "required": ["error", "message"], "example": { "error": "VALIDATION_ERROR", "message": "Invalid input data", "timestamp": "2024-01-01T12:00:00Z" } }, "ValidationError": { "allOf": [ { "$ref": "#/components/schemas/Error" }, { "type": "object", "properties": { "details": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string", "description": "Field that failed validation" }, "message": { "type": "string", "description": "Validation error message" }, "value": { "description": "Invalid value provided" } }, "required": ["field", "message"] } } } } ] } } }, "tags": [] }