{"openapi":"3.0.0","paths":{"/api/health":{"get":{"description":"Public liveness endpoint verifying the API service is running.","operationId":"AppController_getHealth","parameters":[],"responses":{"200":{"description":"Service is healthy.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"status":"ok","service":"Reasse Agency Internal Management System API","timestamp":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"summary":"Check API health status","tags":["App","Health"]}},"/api/storage/presigned-upload":{"post":{"description":"Authenticated endpoint (all roles). Returns a unique object_key and temporary PUT URL for direct client-to-MinIO upload. Store only object_key in MongoDB.","operationId":"StorageController_createPresignedUpload","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePresignedUploadDto"}}}},"responses":{"201":{"description":"Presigned upload URL generated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"object_key":"tasks/550e8400-e29b-41d4-a716-446655440000.pdf","upload_url":"https://s3-api.example.com/reasse/tasks/550e8400.pdf?X-Amz-Signature=..."},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_category_or_filename":{"summary":"Invalid category or unsafe file_name characters","value":{"success":false,"statusCode":400,"message":["category must be one of the following values: avatars, attendances, tasks, meetings","file_name may only contain letters, numbers, dots, underscores, and hyphens"],"error":"Bad Request","errors":[{"field":"category","constraints":["category must be one of the following values: avatars, attendances, tasks, meetings"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/storage/presigned-upload"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Generate a presigned MinIO upload URL","tags":["Storage"]}},"/api/storage/presigned-download":{"get":{"description":"Authenticated endpoint (all roles). Validates object key prefix and rejects path traversal (\"..\" or leading \"/\").","operationId":"StorageController_getPresignedDownload","parameters":[{"name":"key","required":true,"in":"query","description":"MinIO object key stored in MongoDB (must start with an allowed category prefix and must not contain \"..\").","schema":{"minLength":3,"maxLength":255,"example":"tasks/550e8400-e29b-41d4-a716-446655440000.pdf","type":"string"}}],"responses":{"200":{"description":"Presigned download URL generated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"object_key":"tasks/550e8400-e29b-41d4-a716-446655440000.pdf","download_url":"https://s3-api.example.com/reasse/tasks/550e8400.pdf?X-Amz-Signature=..."},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"path_traversal_or_prefix":{"summary":"Path traversal attempt or unsupported category prefix","value":{"success":false,"statusCode":400,"message":"Invalid object key path","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/storage/presigned-download?key=tasks/../secret.txt"}},"missing_key_query":{"summary":"Missing required key query parameter","value":{"success":false,"statusCode":400,"message":["key should not be empty"],"error":"Bad Request","errors":[{"field":"key","constraints":["key should not be empty"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/storage/presigned-download"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Generate a presigned MinIO download URL","tags":["Storage"]}},"/api/auth/google":{"get":{"description":"Public endpoint. Redirects browser to Google OAuth2 consent screen requesting email and profile scopes.","operationId":"AuthController_googleLogin","parameters":[],"responses":{"302":{"description":"Redirects to Google OAuth2 authorization URL."},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"summary":"Initiate Google OAuth2 login flow","tags":["Auth"]}},"/api/auth/google/callback":{"get":{"description":"Public OAuth2 callback. Matches Google email against pre-registered active users, populates google_id on first login, sets httpOnly refresh cookie, and redirects to FRONTEND_AUTH_REDIRECT_URL.","operationId":"AuthController_googleCallback","parameters":[],"responses":{"302":{"description":"Sets httpOnly refresh token cookie and redirects to FRONTEND_AUTH_REDIRECT_URL."},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"unregistered_or_inactive":{"summary":"Email is not pre-registered or user is inactive","value":{"success":false,"statusCode":401,"message":"Account is not registered or is inactive","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/auth/google/callback"}},"google_account_mismatch":{"summary":"Google subject ID does not match stored google_id","value":{"success":false,"statusCode":401,"message":"Google account mismatch","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/auth/google/callback"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"summary":"Handle Google OAuth2 callback and set refresh cookie","tags":["Auth"]}},"/api/auth/refresh":{"post":{"description":"Public endpoint requiring valid httpOnly refresh cookie (call with credentials: \"include\"). Rotates refresh_token_hash and returns short-lived JWT access_token in JSON for in-memory storage.","operationId":"AuthController_refresh","parameters":[],"responses":{"200":{"description":"Access token issued and refresh cookie rotated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...","user":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","email":"budi@reasse.com","full_name":"Budi Santoso","role":"employee","employment_type":"staff","division_id":"674f1a2b3c4d5e6f7a8b9c01","job_title":"Backend Developer","work_mode_policy":"hybrid","is_active":true}},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_cookie":{"summary":"Refresh token cookie is absent","value":{"success":false,"statusCode":401,"message":"Refresh token is missing","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/auth/refresh"}},"invalid_or_expired":{"summary":"Refresh JWT signature invalid or expired","value":{"success":false,"statusCode":401,"message":"Invalid or expired refresh token","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/auth/refresh"}},"revoked_or_reused":{"summary":"Token revoked on logout, user inactive, or token reuse detected","value":{"success":false,"statusCode":401,"message":"Refresh token has been revoked","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/auth/refresh"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"cookie":[]}],"summary":"Rotate refresh cookie and issue a new access token","tags":["Auth"]}},"/api/auth/logout":{"post":{"description":"Authenticated endpoint. Clears users.refresh_token_hash in MongoDB and clears the httpOnly refresh cookie.","operationId":"AuthController_logout","parameters":[],"responses":{"200":{"description":"Session revoked and cookie cleared.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"logged_out":true},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Revoke active session and clear refresh cookie","tags":["Auth"]}},"/api/auth/me":{"get":{"description":"Returns the active user document for the current Bearer access token.","operationId":"AuthController_getMe","parameters":[],"responses":{"200":{"description":"Current user profile retrieved.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","email":"budi@reasse.com","full_name":"Budi Santoso","phone_number":"+6281234567890","avatar_key":null,"role":"employee","employment_type":"staff","division_id":"674f1a2b3c4d5e6f7a8b9c01","job_title":"Backend Developer","work_schedule_id":"674f1a2b3c4d5e6f7a8b9c02","work_mode_policy":"hybrid","internship_period":null,"is_active":true},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Get authenticated user profile","tags":["Auth"]}},"/api/divisions":{"post":{"description":"Owner/Admin only. Creates an active division. If head_user_id is supplied, assigns the head inside a MongoDB transaction and promotes employee -> head_of_division.","operationId":"DivisionsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDivisionDto"}}}},"responses":{"201":{"description":"Division created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c01","name":"Engineering","head_user_id":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","full_name":"Andi Pratama","email":"andi@reasse.com","job_title":"Lead Engineer","role":"head_of_division"},"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"validation_error":{"summary":"Invalid name length or malformed head_user_id","value":{"success":false,"statusCode":400,"message":["name must be longer than or equal to 2 characters"],"error":"Bad Request","errors":[{"field":"name","constraints":["name must be longer than or equal to 2 characters"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester role is not owner or admin","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"head_user_not_found":{"summary":"Provided head_user_id does not exist or is inactive","value":{"success":false,"statusCode":404,"message":"Target active user not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions"}}}}}},"409":{"description":"Resource state conflict or unique constraint violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"duplicate_division_name":{"summary":"Active division with the same name already exists","value":{"success":false,"statusCode":409,"message":"Duplicate value for name","error":"Conflict","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions"}},"head_already_leads_other_division":{"summary":"Target user already leads another active division","value":{"success":false,"statusCode":409,"message":"User is already head of another active division","error":"ConflictException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/674f1a2b3c4d5e6f7a8b9c01/head"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Create a division","tags":["Divisions"]},"get":{"description":"All authenticated roles. Supports optional filtering by is_active.","operationId":"DivisionsController_findAll","parameters":[{"name":"is_active","required":false,"in":"query","description":"Filter divisions by active status (true or false).","schema":{"example":true,"type":"boolean"}}],"responses":{"200":{"description":"Array of divisions sorted alphabetically.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":[{"_id":"674f1a2b3c4d5e6f7a8b9c01","name":"Engineering","head_user_id":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","full_name":"Andi Pratama","email":"andi@reasse.com","job_title":"Lead Engineer","role":"head_of_division"},"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"}],"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_query":{"summary":"Invalid is_active boolean or unknown query key","value":{"success":false,"statusCode":400,"message":["is_active must be a boolean value"],"error":"Bad Request","errors":[{"field":"is_active","constraints":["is_active must be a boolean value"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions?is_active=invalid"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"List all divisions","tags":["Divisions"]}},"/api/divisions/{id}":{"get":{"description":"All authenticated roles. Returns division with populated head_user_id summary.","operationId":"DivisionsController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Division ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Division details.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c01","name":"Engineering","head_user_id":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","full_name":"Andi Pratama","email":"andi@reasse.com","job_title":"Lead Engineer","role":"head_of_division"},"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid division ObjectId format","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"division_not_found":{"summary":"Division ID does not exist","value":{"success":false,"statusCode":404,"message":"Division not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/674f1a2b3c4d5e6f7a8b9c01"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Get division detail by ID","tags":["Divisions"]},"patch":{"description":"Owner/Admin only. Runs inside a MongoDB transaction if head_user_id is included.","operationId":"DivisionsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Division ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDivisionDto"}}}},"responses":{"200":{"description":"Division updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c01","name":"Engineering","head_user_id":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","full_name":"Andi Pratama","email":"andi@reasse.com","job_title":"Lead Engineer","role":"head_of_division"},"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"inactive_division_head":{"summary":"Validation error or assigning head to an inactive division","value":{"success":false,"statusCode":400,"message":"Cannot assign head to an inactive division","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/674f1a2b3c4d5e6f7a8b9c01"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester role is not owner or admin","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"division_not_found":{"summary":"Division ID does not exist","value":{"success":false,"statusCode":404,"message":"Division not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/674f1a2b3c4d5e6f7a8b9c01"}}}}}},"409":{"description":"Resource state conflict or unique constraint violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"duplicate_division_name":{"summary":"Active division with the same name already exists","value":{"success":false,"statusCode":409,"message":"Duplicate value for name","error":"Conflict","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions"}},"head_already_leads_other_division":{"summary":"Target user already leads another active division","value":{"success":false,"statusCode":409,"message":"User is already head of another active division","error":"ConflictException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/674f1a2b3c4d5e6f7a8b9c01/head"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Update division metadata or head","tags":["Divisions"]},"delete":{"description":"Owner/Admin only. Sets is_active = false and unassigns/demotes head_user_id inside a MongoDB transaction.","operationId":"DivisionsController_deactivate","parameters":[{"name":"id","required":true,"in":"path","description":"Division ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Division deactivated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c01","name":"Engineering","head_user_id":null,"is_active":false,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid division ObjectId format","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester role is not owner or admin","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"division_not_found":{"summary":"Division ID does not exist","value":{"success":false,"statusCode":404,"message":"Division not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/674f1a2b3c4d5e6f7a8b9c01"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Soft-deactivate division","tags":["Divisions"]}},"/api/divisions/{id}/head":{"patch":{"description":"Owner/Admin only. Atomically demotes the previous head (head_of_division -> employee), promotes the new head (employee -> head_of_division), updates user.division_id, and updates division.head_user_id.","operationId":"DivisionsController_assignHead","parameters":[{"name":"id","required":true,"in":"path","description":"Division ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignHeadDto"}}}},"responses":{"200":{"description":"Division head updated atomically.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c01","name":"Engineering","head_user_id":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","full_name":"Andi Pratama","email":"andi@reasse.com","job_title":"Lead Engineer","role":"head_of_division"},"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_payload":{"summary":"Missing head_user_id or malformed ObjectId","value":{"success":false,"statusCode":400,"message":["head_user_id must be a mongodb id"],"error":"Bad Request","errors":[{"field":"head_user_id","constraints":["head_user_id must be a mongodb id"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/674f1a2b3c4d5e6f7a8b9c01/head"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester role is not owner or admin","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"division_or_user_not_found":{"summary":"Active division or target active user not found","value":{"success":false,"statusCode":404,"message":"Active division not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/674f1a2b3c4d5e6f7a8b9c01/head"}}}}}},"409":{"description":"Resource state conflict or unique constraint violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"head_already_assigned_elsewhere":{"summary":"Target user already leads another active division","value":{"success":false,"statusCode":409,"message":"User is already head of another active division","error":"ConflictException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/divisions/674f1a2b3c4d5e6f7a8b9c01/head"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Assign or unassign Head of Division (MongoDB Transaction)","tags":["Divisions"]}},"/api/work-schedules":{"post":{"description":"Owner/Admin only. Validates work_days (1..7 unique), HH:mm order (end_time > start_time), and valid IANA timezone via Luxon.","operationId":"WorkSchedulesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkScheduleDto"}}}},"responses":{"201":{"description":"Work schedule created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c02","name":"Regular Staff Schedule","employment_type":"staff","work_days":[1,2,3,4,5],"start_time":"09:00","end_time":"17:00","timezone":"Asia/Jakarta","late_tolerance_minutes":15,"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"validation_or_timezone_error":{"summary":"Invalid DTO fields, invalid IANA timezone, or end_time <= start_time","value":{"success":false,"statusCode":400,"message":"end_time must be later than start_time","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules"}},"invalid_iana_timezone":{"summary":"Unrecognized IANA timezone string","value":{"success":false,"statusCode":400,"message":"Invalid IANA timezone: Mars/Olympus","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester role is not owner or admin","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Create a work schedule template","tags":["Work Schedules"]},"get":{"description":"All authenticated roles. Optional filters by employment_type and is_active.","operationId":"WorkSchedulesController_findAll","parameters":[{"name":"employment_type","required":false,"in":"query","description":"Filter work schedules by employment type.","schema":{"type":"string","enum":["staff","intern"]}},{"name":"is_active","required":false,"in":"query","description":"Filter work schedules by active status (true or false).","schema":{"example":true,"type":"boolean"}}],"responses":{"200":{"description":"List of work schedules.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":[{"_id":"674f1a2b3c4d5e6f7a8b9c02","name":"Regular Staff Schedule","employment_type":"staff","work_days":[1,2,3,4,5],"start_time":"09:00","end_time":"17:00","timezone":"Asia/Jakarta","late_tolerance_minutes":15,"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"}],"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_query":{"summary":"Invalid employment_type enum, is_active boolean, or unknown query key","value":{"success":false,"statusCode":400,"message":["employment_type must be one of the following values: staff, intern"],"error":"Bad Request","errors":[{"field":"employment_type","constraints":["employment_type must be one of the following values: staff, intern"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules?employment_type=invalid"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"List work schedules","tags":["Work Schedules"]}},"/api/work-schedules/{id}":{"get":{"description":"All authenticated roles.","operationId":"WorkSchedulesController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"WorkSchedule ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Work schedule details.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c02","name":"Regular Staff Schedule","employment_type":"staff","work_days":[1,2,3,4,5],"start_time":"09:00","end_time":"17:00","timezone":"Asia/Jakarta","late_tolerance_minutes":15,"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid ObjectId format","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"schedule_not_found":{"summary":"Work schedule ID does not exist","value":{"success":false,"statusCode":404,"message":"Work schedule not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules/674f1a2b3c4d5e6f7a8b9c02"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Get work schedule by ID","tags":["Work Schedules"]},"patch":{"description":"Owner/Admin only. Re-validates timezone and ensures end_time remains strictly later than start_time.","operationId":"WorkSchedulesController_update","parameters":[{"name":"id","required":true,"in":"path","description":"WorkSchedule ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWorkScheduleDto"}}}},"responses":{"200":{"description":"Work schedule updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c02","name":"Regular Staff Schedule","employment_type":"staff","work_days":[1,2,3,4,5],"start_time":"09:00","end_time":"17:00","timezone":"Asia/Jakarta","late_tolerance_minutes":20,"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_time_or_timezone":{"summary":"Invalid DTO payload, timezone, or time range","value":{"success":false,"statusCode":400,"message":"end_time must be later than start_time","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules/674f1a2b3c4d5e6f7a8b9c02"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester role is not owner or admin","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"schedule_not_found":{"summary":"Work schedule ID does not exist","value":{"success":false,"statusCode":404,"message":"Work schedule not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules/674f1a2b3c4d5e6f7a8b9c02"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Update work schedule","tags":["Work Schedules"]},"delete":{"description":"Owner/Admin only. Sets is_active = false without breaking historical attendance references.","operationId":"WorkSchedulesController_deactivate","parameters":[{"name":"id","required":true,"in":"path","description":"WorkSchedule ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Work schedule deactivated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c02","name":"Regular Staff Schedule","employment_type":"staff","work_days":[1,2,3,4,5],"start_time":"09:00","end_time":"17:00","timezone":"Asia/Jakarta","late_tolerance_minutes":15,"is_active":false,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid ObjectId format","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester role is not owner or admin","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"schedule_not_found":{"summary":"Work schedule ID does not exist","value":{"success":false,"statusCode":404,"message":"Work schedule not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/work-schedules/674f1a2b3c4d5e6f7a8b9c02"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Soft-deactivate work schedule","tags":["Work Schedules"]}},"/api/users":{"post":{"description":"Owner/Admin only. Pre-registers email for Google OAuth2 login. Enforces internship_period when employment_type is intern (end_date > start_date) and validates division_id & work_schedule_id.","operationId":"UsersController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserDto"}}}},"responses":{"201":{"description":"User created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","email":"budi.santoso@reasse.com","full_name":"Budi Santoso","phone_number":"+6281234567890","avatar_key":null,"role":"employee","employment_type":"staff","division_id":"674f1a2b3c4d5e6f7a8b9c01","job_title":"Backend Developer","work_schedule_id":"674f1a2b3c4d5e6f7a8b9c02","work_mode_policy":"hybrid","internship_period":null,"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"dto_validation_failed":{"summary":"Field validation failure (e.g. invalid email or phone E.164)","value":{"success":false,"statusCode":400,"message":["email must be an email"],"error":"Bad Request","errors":[{"field":"email","constraints":["email must be an email"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}},"missing_intern_period":{"summary":"Intern user missing required internship_period or invalid date order","value":{"success":false,"statusCode":400,"message":["internship_period is required when employment_type is intern"],"error":"Bad Request","errors":[{"field":"internship_period","constraints":["internship_period is required when employment_type is intern"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}},"invalid_reference":{"summary":"Referenced division_id or work_schedule_id does not exist or is inactive","value":{"success":false,"statusCode":400,"message":"Referenced active division not found","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester lacks Owner/Admin (or Head) permissions","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}}}}}},"409":{"description":"Resource state conflict or unique constraint violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"duplicate_email":{"summary":"Email already registered in users collection","value":{"success":false,"statusCode":409,"message":"Duplicate value for email","error":"Conflict","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Create/pre-register a team member","tags":["Users"]},"get":{"description":"Owner/Admin see all users; Head of Division is automatically scoped to their own division_id.","operationId":"UsersController_findAll","parameters":[{"name":"page","required":false,"in":"query","description":"1-based page number for paginated results.","schema":{"minimum":1,"default":1,"example":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of records returned per page.","schema":{"minimum":1,"maximum":100,"default":20,"example":20,"type":"number"}},{"name":"division_id","required":false,"in":"query","description":"Filter users by division ObjectId (ignored for head_of_division, who is scoped to own division).","schema":{"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d","type":"string"}},{"name":"employment_type","required":false,"in":"query","description":"Filter by employment type.","schema":{"type":"string","enum":["staff","intern"]}},{"name":"role","required":false,"in":"query","description":"Filter by RBAC role.","schema":{"type":"string","enum":["owner","admin","head_of_division","employee"]}},{"name":"is_active","required":false,"in":"query","description":"Filter by active status.","schema":{"example":true,"type":"boolean"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive substring search across full_name, email, and job_title.","schema":{"maxLength":100,"example":"budi","type":"string"}}],"responses":{"200":{"description":"Paginated user list.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"items":[{"_id":"674f1a2b3c4d5e6f7a8b9c0d","email":"budi.santoso@reasse.com","full_name":"Budi Santoso","phone_number":"+6281234567890","avatar_key":null,"role":"employee","employment_type":"staff","division_id":"674f1a2b3c4d5e6f7a8b9c01","job_title":"Backend Developer","work_schedule_id":"674f1a2b3c4d5e6f7a8b9c02","work_mode_policy":"hybrid","internship_period":null,"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"}],"total":1,"page":1,"limit":20},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_query":{"summary":"Invalid query parameter format","value":{"success":false,"statusCode":400,"message":["division_id must be a mongodb id"],"error":"Bad Request","errors":[{"field":"division_id","constraints":["division_id must be a mongodb id"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users?division_id=invalid"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester lacks Owner/Admin (or Head) permissions","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"List team members with pagination and filters","tags":["Users"]}},"/api/users/{id}":{"get":{"description":"Owner/Admin can view any user; Head of Division can view users in their division; Employee can view only self.","operationId":"UsersController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"User ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"User profile details.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","email":"budi.santoso@reasse.com","full_name":"Budi Santoso","phone_number":"+6281234567890","avatar_key":null,"role":"employee","employment_type":"staff","division_id":"674f1a2b3c4d5e6f7a8b9c01","job_title":"Backend Developer","work_schedule_id":"674f1a2b3c4d5e6f7a8b9c02","work_mode_policy":"hybrid","internship_period":null,"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid user ObjectId","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"cross_user_or_division":{"summary":"Requester cannot view this user outside their scope","value":{"success":false,"statusCode":403,"message":"You do not have permission to view this user","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users/674f1a2b3c4d5e6f7a8b9c0d"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"user_not_found":{"summary":"User ID does not exist","value":{"success":false,"statusCode":404,"message":"User not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users/674f1a2b3c4d5e6f7a8b9c0d"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Get user profile by ID","tags":["Users"]},"patch":{"description":"Owner/Admin only. Setting is_active to false immediately clears refresh_token_hash to revoke active sessions.","operationId":"UsersController_update","parameters":[{"name":"id","required":true,"in":"path","description":"User ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserDto"}}}},"responses":{"200":{"description":"User updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","email":"budi.santoso@reasse.com","full_name":"Budi Santoso","phone_number":"+6281234567890","avatar_key":null,"role":"employee","employment_type":"staff","division_id":"674f1a2b3c4d5e6f7a8b9c01","job_title":"Senior Backend Developer","work_schedule_id":"674f1a2b3c4d5e6f7a8b9c02","work_mode_policy":"hybrid","internship_period":null,"is_active":true,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"dto_validation_failed":{"summary":"Field validation failure (e.g. invalid email or phone E.164)","value":{"success":false,"statusCode":400,"message":["email must be an email"],"error":"Bad Request","errors":[{"field":"email","constraints":["email must be an email"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}},"missing_intern_period":{"summary":"Intern user missing required internship_period or invalid date order","value":{"success":false,"statusCode":400,"message":["internship_period is required when employment_type is intern"],"error":"Bad Request","errors":[{"field":"internship_period","constraints":["internship_period is required when employment_type is intern"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}},"invalid_reference":{"summary":"Referenced division_id or work_schedule_id does not exist or is inactive","value":{"success":false,"statusCode":400,"message":"Referenced active division not found","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester lacks Owner/Admin (or Head) permissions","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"user_not_found":{"summary":"User ID does not exist","value":{"success":false,"statusCode":404,"message":"User not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users/674f1a2b3c4d5e6f7a8b9c0d"}}}}}},"409":{"description":"Resource state conflict or unique constraint violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"duplicate_email":{"summary":"Email already registered in users collection","value":{"success":false,"statusCode":409,"message":"Duplicate value for email","error":"Conflict","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Update user details or active status","tags":["Users"]},"delete":{"description":"Owner/Admin only. Sets is_active = false and clears refresh_token_hash so existing JWT and refresh cookies stop working immediately.","operationId":"UsersController_deactivate","parameters":[{"name":"id","required":true,"in":"path","description":"User ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"User deactivated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","email":"budi.santoso@reasse.com","full_name":"Budi Santoso","phone_number":"+6281234567890","avatar_key":null,"role":"employee","employment_type":"staff","division_id":"674f1a2b3c4d5e6f7a8b9c01","job_title":"Backend Developer","work_schedule_id":"674f1a2b3c4d5e6f7a8b9c02","work_mode_policy":"hybrid","internship_period":null,"is_active":false,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid user ObjectId","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester lacks Owner/Admin (or Head) permissions","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"user_not_found":{"summary":"User ID does not exist","value":{"success":false,"statusCode":404,"message":"User not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/users/674f1a2b3c4d5e6f7a8b9c0d"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Soft-deactivate user and revoke session","tags":["Users"]}},"/api/attendances/check-in":{"post":{"description":"All authenticated users with an active work schedule. Computes local date and lateness using work_schedules.timezone via Luxon, validates work_mode against user.work_mode_policy, and locks status (present | late).","operationId":"AttendancesController_checkIn","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckInDto"}}}},"responses":{"201":{"description":"Check-in recorded and status locked.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c21","user_id":"674f1a2b3c4d5e6f7a8b9c0d","date":"2026-12-04","work_mode":"remote","check_in_at":"2026-12-04T02:05:00.000Z","check_out_at":null,"status":"present","notes":"Working remotely on API documentation","attachment_key":null,"remote_verification":{"lat":-6.2,"lng":106.816666},"recorded_by":null,"created_at":"2026-12-04T02:05:00.000Z","updated_at":"2026-12-04T02:05:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"no_schedule_assigned":{"summary":"User has no active work schedule assigned","value":{"success":false,"statusCode":400,"message":"No work schedule assigned to this user","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/check-in"}},"remote_verification_on_onsite":{"summary":"remote_verification supplied while work_mode is onsite","value":{"success":false,"statusCode":400,"message":"remote_verification is only allowed for remote check-in","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/check-in"}},"dto_validation_failed":{"summary":"Invalid work_mode enum or remote_verification coordinates","value":{"success":false,"statusCode":400,"message":["work_mode must be one of the following values: onsite, remote"],"error":"Bad Request","errors":[{"field":"work_mode","constraints":["work_mode must be one of the following values: onsite, remote"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/check-in"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"policy_mismatch_onsite":{"summary":"User work_mode_policy is onsite-only but requested remote","value":{"success":false,"statusCode":403,"message":"Your work mode policy requires onsite check-in","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/check-in"}},"policy_mismatch_remote":{"summary":"User work_mode_policy is remote-only but requested onsite","value":{"success":false,"statusCode":403,"message":"Your work mode policy requires remote check-in","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/check-in"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"active_user_not_found":{"summary":"User not found or inactive","value":{"success":false,"statusCode":404,"message":"Active user not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/check-in"}}}}}},"409":{"description":"Resource state conflict or unique constraint violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"already_checked_in_today":{"summary":"Attendance already exists for today in schedule timezone","value":{"success":false,"statusCode":409,"message":"Attendance already recorded for 2026-12-04","error":"ConflictException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/check-in"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Daily check-in","tags":["Attendances"]}},"/api/attendances/check-out":{"post":{"description":"Records check_out_at on today attendance record (computed in work_schedules.timezone).","operationId":"AttendancesController_checkOut","parameters":[],"responses":{"200":{"description":"Check-out timestamp saved.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c21","user_id":"674f1a2b3c4d5e6f7a8b9c0d","date":"2026-12-04","work_mode":"remote","check_in_at":"2026-12-04T02:05:00.000Z","check_out_at":"2026-12-04T10:05:00.000Z","status":"present","notes":"Working remotely on API documentation","attachment_key":null,"remote_verification":{"lat":-6.2,"lng":106.816666},"recorded_by":null,"created_at":"2026-12-04T02:05:00.000Z","updated_at":"2026-12-04T02:05:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"no_check_in_timestamp":{"summary":"Attendance record exists (e.g. sick/leave/absent) without check_in_at","value":{"success":false,"statusCode":400,"message":"Cannot check out for an attendance entry without check-in","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/check-out"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"no_check_in_today":{"summary":"No check-in found for today","value":{"success":false,"statusCode":404,"message":"No check-in record found for 2026-12-04","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/check-out"}}}}}},"409":{"description":"Resource state conflict or unique constraint violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"already_checked_out":{"summary":"User already checked out today","value":{"success":false,"statusCode":409,"message":"Already checked out for today","error":"ConflictException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/check-out"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Daily check-out","tags":["Attendances"]}},"/api/attendances/me":{"get":{"description":"Returns paginated attendance logs for the currently authenticated user.","operationId":"AttendancesController_getMyAttendances","parameters":[{"name":"page","required":false,"in":"query","description":"1-based page number for paginated results.","schema":{"minimum":1,"default":1,"example":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of records returned per page.","schema":{"minimum":1,"maximum":100,"default":20,"example":20,"type":"number"}}],"responses":{"200":{"description":"Paginated own attendance records.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"items":[{"_id":"674f1a2b3c4d5e6f7a8b9c21","user_id":"674f1a2b3c4d5e6f7a8b9c0d","date":"2026-12-04","work_mode":"remote","check_in_at":"2026-12-04T02:05:00.000Z","check_out_at":null,"status":"present","notes":"Working remotely on API documentation","attachment_key":null,"remote_verification":{"lat":-6.2,"lng":106.816666},"recorded_by":null,"created_at":"2026-12-04T02:05:00.000Z","updated_at":"2026-12-04T02:05:00.000Z"}],"total":1,"page":1,"limit":20},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"List own attendance history","tags":["Attendances"]}},"/api/attendances/manual":{"post":{"description":"Owner/Admin only. Records absent, leave, sick, or manual present/late entries with recorded_by set to Admin ID. Automatically sets work_mode/check-in/out/remote_verification to null for absent/leave/sick.","operationId":"AttendancesController_upsertManual","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualAttendanceDto"}}}},"responses":{"201":{"description":"Manual attendance recorded.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c21","user_id":"674f1a2b3c4d5e6f7a8b9c0d","date":"2026-12-04","work_mode":null,"check_in_at":null,"check_out_at":null,"status":"sick","notes":"Doctor note attached for fever","attachment_key":null,"remote_verification":null,"recorded_by":"674f1a2b3c4d5e6f7a8b9c0a","created_at":"2026-12-04T02:05:00.000Z","updated_at":"2026-12-04T02:05:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"missing_work_mode_for_present":{"summary":"status is present or late without work_mode","value":{"success":false,"statusCode":400,"message":"work_mode is required when status is present or late","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/manual"}},"invalid_date_or_enum":{"summary":"Invalid YYYY-MM-DD date or status enum","value":{"success":false,"statusCode":400,"message":["date must use YYYY-MM-DD format"],"error":"Bad Request","errors":[{"field":"date","constraints":["date must use YYYY-MM-DD format"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/manual"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester role is not owner or admin","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/manual"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"target_user_not_found":{"summary":"Target user_id does not exist","value":{"success":false,"statusCode":404,"message":"Target user not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/manual"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Record or upsert manual attendance","tags":["Attendances"]}},"/api/attendances/{id}":{"patch":{"description":"Owner/Admin only. Updates status/times/notes/attachment and sets recorded_by.","operationId":"AttendancesController_updateAttendance","parameters":[{"name":"id","required":true,"in":"path","description":"Attendance ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAttendanceDto"}}}},"responses":{"200":{"description":"Attendance record corrected.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c21","user_id":"674f1a2b3c4d5e6f7a8b9c0d","date":"2026-12-04","work_mode":null,"check_in_at":"2026-12-04T02:05:00.000Z","check_out_at":null,"status":"leave","notes":"Working remotely on API documentation","attachment_key":null,"remote_verification":{"lat":-6.2,"lng":106.816666},"recorded_by":null,"created_at":"2026-12-04T02:05:00.000Z","updated_at":"2026-12-04T02:05:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"missing_work_mode_for_present":{"summary":"status is present or late without work_mode","value":{"success":false,"statusCode":400,"message":"work_mode is required when status is present or late","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/manual"}},"invalid_date_or_enum":{"summary":"Invalid YYYY-MM-DD date or status enum","value":{"success":false,"statusCode":400,"message":["date must use YYYY-MM-DD format"],"error":"Bad Request","errors":[{"field":"date","constraints":["date must use YYYY-MM-DD format"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/manual"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Requester role is not owner or admin","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/674f1a2b3c4d5e6f7a8b9c21"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"attendance_not_found":{"summary":"Attendance record ID does not exist","value":{"success":false,"statusCode":404,"message":"Attendance record not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/674f1a2b3c4d5e6f7a8b9c21"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Correct an existing attendance record","tags":["Attendances"]}},"/api/attendances/report":{"get":{"description":"Owner/Admin/Head of Division. Joins users and divisions via MongoDB $lookup. Filterable by employment_type (staff | intern), division_id, status, user_id, start_date, and end_date. Head of Division is scoped to own division.","operationId":"AttendancesController_getReport","parameters":[{"name":"page","required":false,"in":"query","description":"1-based page number for paginated results.","schema":{"minimum":1,"default":1,"example":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of records returned per page.","schema":{"minimum":1,"maximum":100,"default":20,"example":20,"type":"number"}},{"name":"employment_type","required":false,"in":"query","description":"Filter report by employment type.","schema":{"type":"string","enum":["staff","intern"]}},{"name":"division_id","required":false,"in":"query","description":"Filter report by division ObjectId (head_of_division is always scoped to own division).","schema":{"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d","type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter report by attendance status.","schema":{"type":"string","enum":["present","late","absent","leave","sick"]}},{"name":"user_id","required":false,"in":"query","description":"Filter report for a specific user ObjectId.","schema":{"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0e","type":"string"}},{"name":"start_date","required":false,"in":"query","description":"Inclusive start date in YYYY-MM-DD format.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-01","type":"string"}},{"name":"end_date","required":false,"in":"query","description":"Inclusive end date in YYYY-MM-DD format.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-31","type":"string"}}],"responses":{"200":{"description":"Paginated attendance report with joined user & division fields.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"items":[{"_id":"674f1a2b3c4d5e6f7a8b9c21","user_id":"674f1a2b3c4d5e6f7a8b9c0d","date":"2026-12-04","work_mode":"remote","check_in_at":"2026-12-04T02:05:00.000Z","check_out_at":null,"status":"present","notes":"Working remotely on API documentation","attachment_key":null,"remote_verification":{"lat":-6.2,"lng":106.816666},"recorded_by":null,"created_at":"2026-12-04T02:05:00.000Z","updated_at":"2026-12-04T02:05:00.000Z","user":{"_id":"674f1a2b3c4d5e6f7a8b9c0d","full_name":"Budi Santoso","email":"budi@reasse.com","employment_type":"staff","job_title":"Backend Developer","division_id":"674f1a2b3c4d5e6f7a8b9c01"},"division":{"_id":"674f1a2b3c4d5e6f7a8b9c01","name":"Engineering"}}],"total":1,"page":1,"limit":20},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_report_query":{"summary":"Invalid date range or filter parameter","value":{"success":false,"statusCode":400,"message":["start_date must use YYYY-MM-DD format"],"error":"Bad Request","errors":[{"field":"start_date","constraints":["start_date must use YYYY-MM-DD format"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/report?start_date=invalid"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"employee_forbidden":{"summary":"Employee role cannot access team attendance report","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/attendances/report"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Query attendance report with $lookup filters","tags":["Attendances"]}},"/api/projects":{"post":{"description":"Owner/Admin only. Plots a project assigned to an active division.","operationId":"ProjectsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectDto"}}}},"responses":{"201":{"description":"Project created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c0f","title":"Q4 Internal Portal Revamp","description":"Rebuild core attendance and task dashboards.","division_id":"674f1a2b3c4d5e6f7a8b9c01","created_by":"674f1a2b3c4d5e6f7a8b9c0a","deadline":"2026-12-31T23:59:59.000Z","status":"active","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"validation_or_division_error":{"summary":"DTO validation error or inactive/missing division_id","value":{"success":false,"statusCode":400,"message":"Referenced active division not found","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Only Owner or Admin can create, edit, or archive projects","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Create a division-level project","tags":["Projects"]},"get":{"description":"Owner/Admin see all projects; Head of Division and Employee are scoped to their own division_id.","operationId":"ProjectsController_findAll","parameters":[{"name":"page","required":false,"in":"query","description":"1-based page number for paginated results.","schema":{"minimum":1,"default":1,"example":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of records returned per page.","schema":{"minimum":1,"maximum":100,"default":20,"example":20,"type":"number"}},{"name":"division_id","required":false,"in":"query","description":"Filter by division ObjectId (head_of_division and employee are automatically scoped to their own division).","schema":{"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d","type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by project lifecycle status.","schema":{"type":"string","enum":["active","completed","archived"]}}],"responses":{"200":{"description":"Paginated project list.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"items":[{"_id":"674f1a2b3c4d5e6f7a8b9c0f","title":"Q4 Internal Portal Revamp","description":"Rebuild core attendance and task dashboards.","division_id":"674f1a2b3c4d5e6f7a8b9c01","created_by":"674f1a2b3c4d5e6f7a8b9c0a","deadline":"2026-12-31T23:59:59.000Z","status":"active","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"}],"total":1,"page":1,"limit":20},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_query":{"summary":"Invalid filter query parameter","value":{"success":false,"statusCode":400,"message":["status must be one of the following values: active, completed, archived"],"error":"Bad Request","errors":[{"field":"status","constraints":["status must be one of the following values: active, completed, archived"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects?status=invalid"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"List projects","tags":["Projects"]}},"/api/projects/{id}":{"get":{"description":"Owner/Admin can view any project; Head/Employee can view projects in their division.","operationId":"ProjectsController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Project ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Project details.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c0f","title":"Q4 Internal Portal Revamp","description":"Rebuild core attendance and task dashboards.","division_id":"674f1a2b3c4d5e6f7a8b9c01","created_by":"674f1a2b3c4d5e6f7a8b9c0a","deadline":"2026-12-31T23:59:59.000Z","status":"active","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid project ObjectId","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"cross_division_access":{"summary":"Project belongs to a different division","value":{"success":false,"statusCode":403,"message":"You do not have access to this project","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects/674f1a2b3c4d5e6f7a8b9c0f"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"project_not_found":{"summary":"Project ID does not exist","value":{"success":false,"statusCode":404,"message":"Project not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects/674f1a2b3c4d5e6f7a8b9c0f"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Get project by ID","tags":["Projects"]},"patch":{"description":"Owner/Admin only.","operationId":"ProjectsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Project ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProjectDto"}}}},"responses":{"200":{"description":"Project updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c0f","title":"Q4 Internal Portal Revamp","description":"Rebuild core attendance and task dashboards.","division_id":"674f1a2b3c4d5e6f7a8b9c01","created_by":"674f1a2b3c4d5e6f7a8b9c0a","deadline":"2026-12-31T23:59:59.000Z","status":"active","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_payload_or_division":{"summary":"DTO validation failure or inactive division_id","value":{"success":false,"statusCode":400,"message":"Referenced active division not found","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects/674f1a2b3c4d5e6f7a8b9c0f"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Only Owner or Admin can create, edit, or archive projects","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"project_not_found":{"summary":"Project ID does not exist","value":{"success":false,"statusCode":404,"message":"Project not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects/674f1a2b3c4d5e6f7a8b9c0f"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Update project","tags":["Projects"]},"delete":{"description":"Owner/Admin only. Sets project status to archived.","operationId":"ProjectsController_archive","parameters":[{"name":"id","required":true,"in":"path","description":"Project ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Project archived.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c0f","title":"Q4 Internal Portal Revamp","description":"Rebuild core attendance and task dashboards.","division_id":"674f1a2b3c4d5e6f7a8b9c01","created_by":"674f1a2b3c4d5e6f7a8b9c0a","deadline":"2026-12-31T23:59:59.000Z","status":"archived","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid project ObjectId","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_role":{"summary":"Only Owner or Admin can create, edit, or archive projects","value":{"success":false,"statusCode":403,"message":"Insufficient role permissions","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"project_not_found":{"summary":"Project ID does not exist","value":{"success":false,"statusCode":404,"message":"Project not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/projects/674f1a2b3c4d5e6f7a8b9c0f"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Archive project","tags":["Projects"]}},"/api/tasks":{"post":{"description":"Owner/Admin/Head of Division. Head can only assign inside their own division. Sends task_assigned notification.","operationId":"TasksController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskDto"}}}},"responses":{"201":{"description":"Task created in todo status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c10","project_id":"674f1a2b3c4d5e6f7a8b9c0f","division_id":"674f1a2b3c4d5e6f7a8b9c01","assigned_to":"674f1a2b3c4d5e6f7a8b9c0d","assigned_by":"674f1a2b3c4d5e6f7a8b9c0c","title":"Implement attendance report endpoint","description":"Build MongoDB aggregation report with date range and division filters.","instructions":"Use $lookup on users and divisions collections.","target_output":"Working API endpoint with Swagger documentation","deadline":"2026-12-15T17:00:00.000Z","status":"todo","revision_count":0,"submission":null,"review":null,"completed_at":null,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"assignee_wrong_division":{"summary":"Assigned user does not belong to division_id or project division mismatch","value":{"success":false,"statusCode":400,"message":"Assigned user must belong to the task division","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks"}},"dto_validation_failed":{"summary":"Missing or invalid DTO fields","value":{"success":false,"statusCode":400,"message":["title must be longer than or equal to 2 characters"],"error":"Bad Request","errors":[{"field":"title","constraints":["title must be longer than or equal to 2 characters"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"head_other_division":{"summary":"Head of Division attempted to create task in another division","value":{"success":false,"statusCode":403,"message":"Head of Division can only assign tasks in their division","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Create and assign a task","tags":["Tasks"]},"get":{"description":"Employee sees only own assigned tasks; Head of Division sees tasks in own division; Owner/Admin see all.","operationId":"TasksController_findAll","parameters":[{"name":"page","required":false,"in":"query","description":"1-based page number for paginated results.","schema":{"minimum":1,"default":1,"example":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of records returned per page.","schema":{"minimum":1,"maximum":100,"default":20,"example":20,"type":"number"}},{"name":"division_id","required":false,"in":"query","description":"Filter by division ObjectId (Owner/Admin only).","schema":{"pattern":"^[a-fA-F0-9]{24}$","type":"string"}},{"name":"project_id","required":false,"in":"query","description":"Filter by project ObjectId.","schema":{"pattern":"^[a-fA-F0-9]{24}$","type":"string"}},{"name":"assigned_to","required":false,"in":"query","description":"Filter by assignee user ObjectId (Employee is always scoped to self).","schema":{"pattern":"^[a-fA-F0-9]{24}$","type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by task workflow status.","schema":{"type":"string","enum":["todo","in_progress","review","revision","done"]}}],"responses":{"200":{"description":"Paginated task list.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"items":[{"_id":"674f1a2b3c4d5e6f7a8b9c10","project_id":"674f1a2b3c4d5e6f7a8b9c0f","division_id":"674f1a2b3c4d5e6f7a8b9c01","assigned_to":"674f1a2b3c4d5e6f7a8b9c0d","assigned_by":"674f1a2b3c4d5e6f7a8b9c0c","title":"Implement attendance report endpoint","description":"Build MongoDB aggregation report with date range and division filters.","instructions":"Use $lookup on users and divisions collections.","target_output":"Working API endpoint with Swagger documentation","deadline":"2026-12-15T17:00:00.000Z","status":"todo","revision_count":0,"submission":null,"review":null,"completed_at":null,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"}],"total":1,"page":1,"limit":20},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_query":{"summary":"Invalid filter query parameter","value":{"success":false,"statusCode":400,"message":["status must be one of the following values: todo, in_progress, review, revision, done"],"error":"Bad Request","errors":[{"field":"status","constraints":["status must be one of the following values: todo, in_progress, review, revision, done"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks?status=bad"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"List tasks","tags":["Tasks"]}},"/api/tasks/{id}":{"get":{"description":"Scoped to assignee (Employee), division (Head), or any (Owner/Admin).","operationId":"TasksController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Task ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Task details.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c10","project_id":"674f1a2b3c4d5e6f7a8b9c0f","division_id":"674f1a2b3c4d5e6f7a8b9c01","assigned_to":"674f1a2b3c4d5e6f7a8b9c0d","assigned_by":"674f1a2b3c4d5e6f7a8b9c0c","title":"Implement attendance report endpoint","description":"Build MongoDB aggregation report with date range and division filters.","instructions":"Use $lookup on users and divisions collections.","target_output":"Working API endpoint with Swagger documentation","deadline":"2026-12-15T17:00:00.000Z","status":"todo","revision_count":0,"submission":null,"review":null,"completed_at":null,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid task ObjectId","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"access_denied":{"summary":"Requester is not the assignee, division head, or admin/owner","value":{"success":false,"statusCode":403,"message":"You do not have access to this task","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"task_not_found":{"summary":"Task ID does not exist","value":{"success":false,"statusCode":404,"message":"Task not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Get task detail by ID","tags":["Tasks"]},"patch":{"description":"Owner/Admin/Head of own division.","operationId":"TasksController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Task ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTaskDto"}}}},"responses":{"200":{"description":"Task updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c10","project_id":"674f1a2b3c4d5e6f7a8b9c0f","division_id":"674f1a2b3c4d5e6f7a8b9c01","assigned_to":"674f1a2b3c4d5e6f7a8b9c0d","assigned_by":"674f1a2b3c4d5e6f7a8b9c0c","title":"Implement attendance report endpoint","description":"Build MongoDB aggregation report with date range and division filters.","instructions":"Use $lookup on users and divisions collections.","target_output":"Working API endpoint with Swagger documentation","deadline":"2026-12-15T17:00:00.000Z","status":"todo","revision_count":0,"submission":null,"review":null,"completed_at":null,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"assignee_wrong_division":{"summary":"Assigned user does not belong to division_id or project division mismatch","value":{"success":false,"statusCode":400,"message":"Assigned user must belong to the task division","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks"}},"dto_validation_failed":{"summary":"Missing or invalid DTO fields","value":{"success":false,"statusCode":400,"message":["title must be longer than or equal to 2 characters"],"error":"Bad Request","errors":[{"field":"title","constraints":["title must be longer than or equal to 2 characters"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"cross_division_or_role":{"summary":"Employee role or Head of Division acting outside own division","value":{"success":false,"statusCode":403,"message":"Insufficient permissions for this division task","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"task_not_found":{"summary":"Task ID does not exist","value":{"success":false,"statusCode":404,"message":"Task not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Update task details or reassignment","tags":["Tasks"]},"delete":{"description":"Owner/Admin/Head of own division. Removes task and cleans up submission file_keys in MinIO.","operationId":"TasksController_remove","parameters":[{"name":"id","required":true,"in":"path","description":"Task ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Task deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"deleted":true},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid task ObjectId","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"cross_division_or_role":{"summary":"Employee role or Head of Division acting outside own division","value":{"success":false,"statusCode":403,"message":"Insufficient permissions for this division task","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"task_not_found":{"summary":"Task ID does not exist","value":{"success":false,"statusCode":404,"message":"Task not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Delete a task and its MinIO attachments","tags":["Tasks"]}},"/api/tasks/{id}/start":{"patch":{"description":"Assigned user only. Moves task status from todo or revision to in_progress.","operationId":"TasksController_startTask","parameters":[{"name":"id","required":true,"in":"path","description":"Task ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Task moved to in_progress.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c10","project_id":"674f1a2b3c4d5e6f7a8b9c0f","division_id":"674f1a2b3c4d5e6f7a8b9c01","assigned_to":"674f1a2b3c4d5e6f7a8b9c0d","assigned_by":"674f1a2b3c4d5e6f7a8b9c0c","title":"Implement attendance report endpoint","description":"Build MongoDB aggregation report with date range and division filters.","instructions":"Use $lookup on users and divisions collections.","target_output":"Working API endpoint with Swagger documentation","deadline":"2026-12-15T17:00:00.000Z","status":"in_progress","revision_count":0,"submission":null,"review":null,"completed_at":null,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_transition":{"summary":"Task is not in todo or revision status","value":{"success":false,"statusCode":400,"message":"Cannot move task from done to in_progress","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10/start"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"not_assignee":{"summary":"Only assigned employee can start task","value":{"success":false,"statusCode":403,"message":"Only the assigned employee can start this task","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10/start"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"task_not_found":{"summary":"Task ID does not exist","value":{"success":false,"statusCode":404,"message":"Task not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Start working on a task (todo | revision -> in_progress)","tags":["Tasks"]}},"/api/tasks/{id}/submit":{"post":{"description":"Assigned user only. Requires at least one of file_keys, external_link, or notes. Automatically deletes replaced old MinIO file_keys on re-submission.","operationId":"TasksController_submitTask","parameters":[{"name":"id","required":true,"in":"path","description":"Task ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitTaskDto"}}}},"responses":{"200":{"description":"Task submitted for review.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c10","project_id":"674f1a2b3c4d5e6f7a8b9c0f","division_id":"674f1a2b3c4d5e6f7a8b9c01","assigned_to":"674f1a2b3c4d5e6f7a8b9c0d","assigned_by":"674f1a2b3c4d5e6f7a8b9c0c","title":"Implement attendance report endpoint","description":"Build MongoDB aggregation report with date range and division filters.","instructions":"Use $lookup on users and divisions collections.","target_output":"Working API endpoint with Swagger documentation","deadline":"2026-12-15T17:00:00.000Z","status":"review","revision_count":0,"submission":{"file_keys":["tasks/550e8400-e29b-41d4-a716-446655440000.pdf"],"notes":"Implemented aggregation and added Swagger responses.","submitted_at":"2026-12-04T02:35:00.000Z"},"review":null,"completed_at":null,"created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_transition":{"summary":"Task must be in_progress or revision before submission","value":{"success":false,"statusCode":400,"message":"Task must be in_progress or revision before submission (current: todo)","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10/submit"}},"empty_submission":{"summary":"None of file_keys, external_link, or notes provided","value":{"success":false,"statusCode":400,"message":"Submission requires at least one of file_keys, external_link, or notes","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10/submit"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"not_assignee":{"summary":"Only assigned employee can submit task","value":{"success":false,"statusCode":403,"message":"Only the assigned employee can submit this task","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10/submit"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"task_not_found":{"summary":"Task ID does not exist","value":{"success":false,"statusCode":404,"message":"Task not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Submit task deliverable (in_progress | revision -> review)","tags":["Tasks"]}},"/api/tasks/{id}/review":{"post":{"description":"Owner/Admin/Head of own division. \"revision\" atomically increments revision_count by 1; \"done\" sets completed_at. Sends task_reviewed notification.","operationId":"TasksController_reviewTask","parameters":[{"name":"id","required":true,"in":"path","description":"Task ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewTaskDto"}}}},"responses":{"200":{"description":"Task reviewed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c10","project_id":"674f1a2b3c4d5e6f7a8b9c0f","division_id":"674f1a2b3c4d5e6f7a8b9c01","assigned_to":"674f1a2b3c4d5e6f7a8b9c0d","assigned_by":"674f1a2b3c4d5e6f7a8b9c0c","title":"Implement attendance report endpoint","description":"Build MongoDB aggregation report with date range and division filters.","instructions":"Use $lookup on users and divisions collections.","target_output":"Working API endpoint with Swagger documentation","deadline":"2026-12-15T17:00:00.000Z","status":"done","revision_count":0,"submission":null,"review":{"reviewed_by":"674f1a2b3c4d5e6f7a8b9c0c","feedback":"Output meets requirements.","reviewed_at":"2026-12-04T03:00:00.000Z"},"completed_at":"2026-12-04T03:00:00.000Z","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"not_in_review":{"summary":"Task status is not review","value":{"success":false,"statusCode":400,"message":"Only tasks in review status can be reviewed (current: in_progress)","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10/review"}},"invalid_decision":{"summary":"decision must be revision or done","value":{"success":false,"statusCode":400,"message":["decision must be one of the following values: revision, done"],"error":"Bad Request","errors":[{"field":"decision","constraints":["decision must be one of the following values: revision, done"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10/review"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"cross_division_or_role":{"summary":"Employee role or Head of Division acting outside own division","value":{"success":false,"statusCode":403,"message":"Insufficient permissions for this division task","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"task_not_found":{"summary":"Task ID does not exist","value":{"success":false,"statusCode":404,"message":"Task not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/tasks/674f1a2b3c4d5e6f7a8b9c10"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Review submitted task (review -> revision | done)","tags":["Tasks"]}},"/api/notifications":{"get":{"description":"Returns paginated in-app notifications ordered newest first along with unread_count.","operationId":"NotificationsController_listForUser","parameters":[{"name":"page","required":false,"in":"query","description":"1-based page number for paginated results.","schema":{"minimum":1,"default":1,"example":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of records returned per page.","schema":{"minimum":1,"maximum":100,"default":20,"example":20,"type":"number"}},{"name":"is_read","required":false,"in":"query","description":"Filter notifications by read status (true = read, false = unread).","schema":{"example":false,"type":"boolean"}}],"responses":{"200":{"description":"Paginated notifications list.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"items":[{"_id":"674f1a2b3c4d5e6f7a8b9c11","user_id":"674f1a2b3c4d5e6f7a8b9c0d","type":"task_assigned","title":"New task assigned: Implement attendance report endpoint","message":"You have been assigned \"Implement attendance report endpoint\".","reference_type":"task","reference_id":"674f1a2b3c4d5e6f7a8b9c10","channels":["in_app","email"],"is_read":false,"created_at":"2026-12-04T02:30:00.000Z"}],"total":1,"unread_count":1,"page":1,"limit":20},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_query":{"summary":"Invalid pagination or is_read query value","value":{"success":false,"statusCode":400,"message":["is_read must be a boolean value"],"error":"Bad Request","errors":[{"field":"is_read","constraints":["is_read must be a boolean value"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/notifications?is_read=abc"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"List notifications for current user","tags":["Notifications"]}},"/api/notifications/read-all":{"patch":{"description":"Marks every unread notification belonging to the current user as read.","operationId":"NotificationsController_markAllAsRead","parameters":[],"responses":{"200":{"description":"All unread notifications marked as read.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"updated_count":3},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Mark all notifications as read","tags":["Notifications"]}},"/api/notifications/{id}/read":{"patch":{"description":"Marks one notification owned by the current user as read.","operationId":"NotificationsController_markAsRead","parameters":[{"name":"id","required":true,"in":"path","description":"Notification ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Notification marked as read.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c11","is_read":true},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid notification ObjectId","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/notifications/bad-id/read"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"notification_not_found":{"summary":"Notification not found for current user","value":{"success":false,"statusCode":404,"message":"Notification not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/notifications/674f1a2b3c4d5e6f7a8b9c11/read"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Mark a single notification as read","tags":["Notifications"]}},"/api/meetings":{"post":{"description":"Owner/Admin/Head of Division. Supports manual meeting_link or automatic Zoom API creation (use_zoom_api: true). Sends meeting_invite notifications.","operationId":"MeetingsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMeetingDto"}}}},"responses":{"201":{"description":"Meeting scheduled and invites dispatched.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c20","title":"Weekly Sprint Sync","agenda":"1. Sprint review\n2. Blockers","organizer_id":"674f1a2b3c4d5e6f7a8b9c0c","division_id":"674f1a2b3c4d5e6f7a8b9c01","scheduled_at":"2026-12-05T03:00:00.000Z","duration_minutes":60,"meeting_link":"https://zoom.us/j/1234567890","zoom_meeting_id":"1234567890","participants":[{"user_id":"674f1a2b3c4d5e6f7a8b9c0d","rsvp_status":"pending","rsvp_at":null}],"reminder_offsets_minutes":[60,15],"sent_reminders":[],"mom":null,"status":"scheduled","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_participants":{"summary":"One or more participant_ids are invalid or inactive","value":{"success":false,"statusCode":400,"message":"One or more participants are invalid or inactive","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings"}},"missing_meeting_link_or_zoom":{"summary":"Missing meeting_link when use_zoom_api is false, or Zoom API failed","value":{"success":false,"statusCode":400,"message":["meeting_link must be a URL address"],"error":"Bad Request","errors":[{"field":"meeting_link","constraints":["meeting_link must be a URL address"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"head_other_division":{"summary":"Head of Division scheduled a meeting for another division","value":{"success":false,"statusCode":403,"message":"Head of Division can only schedule meetings for their division","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Schedule a meeting","tags":["Meetings"]},"get":{"description":"Employee sees meetings where they are participant/organizer; Head sees own division + participating; Owner/Admin see all.","operationId":"MeetingsController_findAll","parameters":[{"name":"page","required":false,"in":"query","description":"1-based page number for paginated results.","schema":{"minimum":1,"default":1,"example":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of records returned per page.","schema":{"minimum":1,"maximum":100,"default":20,"example":20,"type":"number"}},{"name":"status","required":false,"in":"query","description":"Filter by meeting status.","schema":{"type":"string","enum":["scheduled","completed","cancelled"]}},{"name":"division_id","required":false,"in":"query","description":"Filter by division ObjectId (Owner/Admin only).","schema":{"pattern":"^[a-fA-F0-9]{24}$","type":"string"}},{"name":"from","required":false,"in":"query","description":"Inclusive lower bound for scheduled_at (ISO 8601).","schema":{"format":"date-time","example":"2026-12-01T00:00:00.000Z","type":"string"}},{"name":"to","required":false,"in":"query","description":"Inclusive upper bound for scheduled_at (ISO 8601).","schema":{"format":"date-time","example":"2026-12-31T23:59:59.000Z","type":"string"}}],"responses":{"200":{"description":"Paginated meeting list.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"items":[{"_id":"674f1a2b3c4d5e6f7a8b9c20","title":"Weekly Sprint Sync","agenda":"1. Sprint review\n2. Blockers","organizer_id":"674f1a2b3c4d5e6f7a8b9c0c","division_id":"674f1a2b3c4d5e6f7a8b9c01","scheduled_at":"2026-12-05T03:00:00.000Z","duration_minutes":60,"meeting_link":"https://zoom.us/j/1234567890","zoom_meeting_id":"1234567890","participants":[{"user_id":"674f1a2b3c4d5e6f7a8b9c0d","rsvp_status":"pending","rsvp_at":null}],"reminder_offsets_minutes":[60,15],"sent_reminders":[],"mom":null,"status":"scheduled","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"}],"total":1,"page":1,"limit":20},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_query":{"summary":"Invalid filter query parameter","value":{"success":false,"statusCode":400,"message":["status must be one of the following values: scheduled, completed, cancelled"],"error":"Bad Request","errors":[{"field":"status","constraints":["status must be one of the following values: scheduled, completed, cancelled"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings?status=invalid"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"List meetings","tags":["Meetings"]}},"/api/meetings/{id}":{"get":{"description":"Accessible to participants, organizer, division head, or Owner/Admin.","operationId":"MeetingsController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Meeting ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Meeting details.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c20","title":"Weekly Sprint Sync","agenda":"1. Sprint review\n2. Blockers","organizer_id":"674f1a2b3c4d5e6f7a8b9c0c","division_id":"674f1a2b3c4d5e6f7a8b9c01","scheduled_at":"2026-12-05T03:00:00.000Z","duration_minutes":60,"meeting_link":"https://zoom.us/j/1234567890","zoom_meeting_id":"1234567890","participants":[{"user_id":"674f1a2b3c4d5e6f7a8b9c0d","rsvp_status":"pending","rsvp_at":null}],"reminder_offsets_minutes":[60,15],"sent_reminders":[],"mom":null,"status":"scheduled","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid meeting ObjectId","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"access_denied":{"summary":"Requester is not invited or authorized for this meeting","value":{"success":false,"statusCode":403,"message":"You do not have access to this meeting","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"meeting_not_found":{"summary":"Meeting ID does not exist","value":{"success":false,"statusCode":404,"message":"Meeting not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Get meeting detail by ID","tags":["Meetings"]},"patch":{"description":"Owner/Admin/Organizer/Division Head. Changing scheduled_at automatically resets sent_reminders to [] and syncs Zoom meeting if zoom_meeting_id exists.","operationId":"MeetingsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Meeting ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMeetingDto"}}}},"responses":{"200":{"description":"Meeting updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c20","title":"Weekly Sprint Sync","agenda":"1. Sprint review\n2. Blockers","organizer_id":"674f1a2b3c4d5e6f7a8b9c0c","division_id":"674f1a2b3c4d5e6f7a8b9c01","scheduled_at":"2026-12-05T03:00:00.000Z","duration_minutes":60,"meeting_link":"https://zoom.us/j/1234567890","zoom_meeting_id":"1234567890","participants":[{"user_id":"674f1a2b3c4d5e6f7a8b9c0d","rsvp_status":"pending","rsvp_at":null}],"reminder_offsets_minutes":[60,15],"sent_reminders":[],"mom":null,"status":"scheduled","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_participants":{"summary":"One or more participant_ids are invalid or inactive","value":{"success":false,"statusCode":400,"message":"One or more participants are invalid or inactive","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings"}},"missing_meeting_link_or_zoom":{"summary":"Missing meeting_link when use_zoom_api is false, or Zoom API failed","value":{"success":false,"statusCode":400,"message":["meeting_link must be a URL address"],"error":"Bad Request","errors":[{"field":"meeting_link","constraints":["meeting_link must be a URL address"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_permissions":{"summary":"Requester cannot modify this meeting","value":{"success":false,"statusCode":403,"message":"Insufficient permissions to modify this meeting","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"meeting_not_found":{"summary":"Meeting ID does not exist","value":{"success":false,"statusCode":404,"message":"Meeting not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Update meeting schedule or details","tags":["Meetings"]},"delete":{"description":"Owner/Admin/Organizer/Division Head. Sets status = cancelled and deletes Zoom meeting if zoom_meeting_id exists.","operationId":"MeetingsController_cancel","parameters":[{"name":"id","required":true,"in":"path","description":"Meeting ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"responses":{"200":{"description":"Meeting cancelled.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c20","title":"Weekly Sprint Sync","agenda":"1. Sprint review\n2. Blockers","organizer_id":"674f1a2b3c4d5e6f7a8b9c0c","division_id":"674f1a2b3c4d5e6f7a8b9c01","scheduled_at":"2026-12-05T03:00:00.000Z","duration_minutes":60,"meeting_link":"https://zoom.us/j/1234567890","zoom_meeting_id":"1234567890","participants":[{"user_id":"674f1a2b3c4d5e6f7a8b9c0d","rsvp_status":"pending","rsvp_at":null}],"reminder_offsets_minutes":[60,15],"sent_reminders":[],"mom":null,"status":"cancelled","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_object_id":{"summary":"Invalid meeting ObjectId","value":{"success":false,"statusCode":400,"message":"Invalid ObjectId: bad-id","error":"BadRequestException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/bad-id"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"insufficient_permissions":{"summary":"Requester cannot cancel this meeting","value":{"success":false,"statusCode":403,"message":"Insufficient permissions to modify this meeting","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"meeting_not_found":{"summary":"Meeting ID does not exist","value":{"success":false,"statusCode":404,"message":"Meeting not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Cancel a meeting","tags":["Meetings"]}},"/api/meetings/{id}/rsvp":{"patch":{"description":"Invited participants only. Updates rsvp_status and rsvp_at for the logged-in user.","operationId":"MeetingsController_updateRsvp","parameters":[{"name":"id","required":true,"in":"path","description":"Meeting ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRsvpDto"}}}},"responses":{"200":{"description":"RSVP updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c20","title":"Weekly Sprint Sync","agenda":"1. Sprint review\n2. Blockers","organizer_id":"674f1a2b3c4d5e6f7a8b9c0c","division_id":"674f1a2b3c4d5e6f7a8b9c01","scheduled_at":"2026-12-05T03:00:00.000Z","duration_minutes":60,"meeting_link":"https://zoom.us/j/1234567890","zoom_meeting_id":"1234567890","participants":[{"user_id":"674f1a2b3c4d5e6f7a8b9c0d","rsvp_status":"accepted","rsvp_at":"2026-12-04T02:40:00.000Z"}],"reminder_offsets_minutes":[60,15],"sent_reminders":[],"mom":null,"status":"scheduled","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_rsvp_status":{"summary":"Invalid rsvp_status enum value","value":{"success":false,"statusCode":400,"message":["rsvp_status must be one of the following values: pending, accepted, declined"],"error":"Bad Request","errors":[{"field":"rsvp_status","constraints":["rsvp_status must be one of the following values: pending, accepted, declined"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20/rsvp"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"not_a_participant":{"summary":"User is not listed in meeting participants","value":{"success":false,"statusCode":403,"message":"You are not a participant of this meeting","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20/rsvp"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"meeting_not_found":{"summary":"Meeting ID does not exist","value":{"success":false,"statusCode":404,"message":"Meeting not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Update own RSVP status for a meeting","tags":["Meetings"]}},"/api/meetings/{id}/mom":{"patch":{"description":"Accessible to participants, organizer, division head, or Owner/Admin. Deletes replaced old attachment_keys from MinIO.","operationId":"MeetingsController_updateMom","parameters":[{"name":"id","required":true,"in":"path","description":"Meeting ObjectId","schema":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","minLength":24,"maxLength":24,"example":"674f1a2b3c4d5e6f7a8b9c0d"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMomDto"}}}},"responses":{"200":{"description":"MoM updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"_id":"674f1a2b3c4d5e6f7a8b9c20","title":"Weekly Sprint Sync","agenda":"1. Sprint review\n2. Blockers","organizer_id":"674f1a2b3c4d5e6f7a8b9c0c","division_id":"674f1a2b3c4d5e6f7a8b9c01","scheduled_at":"2026-12-05T03:00:00.000Z","duration_minutes":60,"meeting_link":"https://zoom.us/j/1234567890","zoom_meeting_id":"1234567890","participants":[{"user_id":"674f1a2b3c4d5e6f7a8b9c0d","rsvp_status":"pending","rsvp_at":null}],"reminder_offsets_minutes":[60,15],"sent_reminders":[],"mom":{"summary":"Agreed on API v1 release timeline.","attachment_keys":["meetings/550e8400-e29b-41d4-a716-446655440000.pdf"],"updated_by":"674f1a2b3c4d5e6f7a8b9c0d","updated_at":"2026-12-04T04:00:00.000Z"},"status":"scheduled","created_at":"2026-12-04T02:30:00.000Z","updated_at":"2026-12-04T02:30:00.000Z"},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_mom_payload":{"summary":"attachment_keys exceeds 5 items or summary exceeds 5000 chars","value":{"success":false,"statusCode":400,"message":["attachment_keys must contain no more than 5 elements"],"error":"Bad Request","errors":[{"field":"attachment_keys","constraints":["attachment_keys must contain no more than 5 elements"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20/mom"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"403":{"description":"Forbidden due to insufficient role or division/resource scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"access_denied":{"summary":"User does not have access to this meeting","value":{"success":false,"statusCode":403,"message":"You do not have access to this meeting","error":"ForbiddenException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20/mom"}}}}}},"404":{"description":"Target resource not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"meeting_not_found":{"summary":"Meeting ID does not exist","value":{"success":false,"statusCode":404,"message":"Meeting not found","error":"NotFoundException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/meetings/674f1a2b3c4d5e6f7a8b9c20"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Update Minutes of Meeting (MoM)","tags":["Meetings"]}},"/api/dashboard/overview":{"get":{"description":"Read-only aggregation returning upcoming scheduled meetings (up to 10), today attendance status in user schedule timezone, active task summary + upcoming deadlines, and unread notification count.","operationId":"DashboardController_getOverview","parameters":[],"responses":{"200":{"description":"User dashboard overview.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"upcoming_meetings":[{"_id":"674f1a2b3c4d5e6f7a8b9c20","title":"Weekly Sprint Sync","scheduled_at":"2026-12-05T03:00:00.000Z","duration_minutes":60,"meeting_link":"https://zoom.us/j/1234567890"}],"today_attendance":{"_id":"674f1a2b3c4d5e6f7a8b9c21","date":"2026-12-04","status":"present","work_mode":"remote"},"active_tasks":{"by_status":[{"_id":"in_progress","count":2}],"upcoming_deadlines":[]},"unread_notifications":1},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Get logged-in user dashboard overview","tags":["Dashboard"]}},"/api/dashboard/attendance-summary":{"get":{"description":"Read-only aggregation grouped by employment_type (staff vs intern) with totals for present, late, absent, leave, sick, onsite, and remote. Scoped by RBAC (Employee -> self; Head -> own division; Owner/Admin -> all/filtered).","operationId":"DashboardController_getAttendanceSummary","parameters":[{"name":"employment_type","required":false,"in":"query","description":"Filter aggregation by employment type (staff vs intern).","schema":{"type":"string","enum":["staff","intern"]}},{"name":"division_id","required":false,"in":"query","description":"Filter aggregation by division ObjectId (Owner/Admin only; Head is scoped to own division).","schema":{"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d","type":"string"}},{"name":"start_date","required":false,"in":"query","description":"Inclusive start date in YYYY-MM-DD format.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-01","type":"string"}},{"name":"end_date","required":false,"in":"query","description":"Inclusive end date in YYYY-MM-DD format.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-31","type":"string"}},{"name":"user_id","required":false,"in":"query","description":"Filter aggregation for a specific user ObjectId (Employee is always scoped to self).","schema":{"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0e","type":"string"}}],"responses":{"200":{"description":"Attendance summary grouped by employment_type and overall totals.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":{"by_employment_type":[{"employment_type":"staff","total":20,"present":16,"late":2,"absent":1,"leave":1,"sick":0,"onsite":10,"remote":8}],"totals":{"total":20,"present":16,"late":2,"absent":1,"leave":1,"sick":0,"onsite":10,"remote":8}},"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_filter_query":{"summary":"Invalid date format or ObjectId filter","value":{"success":false,"statusCode":400,"message":["start_date must use YYYY-MM-DD format"],"error":"Bad Request","errors":[{"field":"start_date","constraints":["start_date must use YYYY-MM-DD format"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/dashboard/attendance-summary?start_date=04-12-2026"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Get attendance summary analytics","tags":["Dashboard"]}},"/api/dashboard/employee-performance":{"get":{"description":"Read-only MongoDB aggregation across users, tasks, and attendances returning completion_rate, on_time_count (completed_at <= deadline), overdue_count, average_revision_count, and attendance recap. Scoped by RBAC.","operationId":"DashboardController_getEmployeePerformance","parameters":[{"name":"employment_type","required":false,"in":"query","description":"Filter aggregation by employment type (staff vs intern).","schema":{"type":"string","enum":["staff","intern"]}},{"name":"division_id","required":false,"in":"query","description":"Filter aggregation by division ObjectId (Owner/Admin only; Head is scoped to own division).","schema":{"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d","type":"string"}},{"name":"start_date","required":false,"in":"query","description":"Inclusive start date in YYYY-MM-DD format.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-01","type":"string"}},{"name":"end_date","required":false,"in":"query","description":"Inclusive end date in YYYY-MM-DD format.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2026-12-31","type":"string"}},{"name":"user_id","required":false,"in":"query","description":"Filter aggregation for a specific user ObjectId (Employee is always scoped to self).","schema":{"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0e","type":"string"}}],"responses":{"200":{"description":"Per-employee task and attendance performance metrics.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"},"timestamp":{"type":"string","format":"date-time","example":"2026-12-04T02:30:00.000Z"}}},"example":{"success":true,"data":[{"user_id":"674f1a2b3c4d5e6f7a8b9c0d","full_name":"Budi Santoso","email":"budi@reasse.com","employment_type":"staff","job_title":"Backend Developer","division_name":"Engineering","tasks":{"total_tasks":10,"completed_tasks":8,"completion_rate":80,"on_time_count":7,"overdue_count":1,"average_revision_count":0.5},"attendance":{"total_days":20,"present":18,"late":1,"absent":0,"leave":1,"sick":0}}],"timestamp":"2026-12-04T02:30:00.000Z"}}}},"400":{"description":"Validation error, invalid parameter, or business rule violation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorResponseDto"},"examples":{"invalid_filter_query":{"summary":"Invalid division_id or date query filter","value":{"success":false,"statusCode":400,"message":["division_id must be a mongodb id"],"error":"Bad Request","errors":[{"field":"division_id","constraints":["division_id must be a mongodb id"]}],"timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/dashboard/employee-performance?division_id=bad"}}}}}},"401":{"description":"Authentication required or session invalid/inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"examples":{"missing_or_invalid_token":{"summary":"Missing, expired, or invalid Bearer access token","value":{"success":false,"statusCode":401,"message":"Unauthorized","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}},"inactive_account":{"summary":"User account deactivated (is_active = false)","value":{"success":false,"statusCode":401,"message":"User account is inactive or does not exist","error":"UnauthorizedException","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}}},"500":{"description":"Unexpected internal server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"},"example":{"success":false,"statusCode":500,"message":"Internal server error","error":"Internal Server Error","timestamp":"2026-12-04T02:30:00.000Z","path":"/api/v1/resource"}}}}},"security":[{"bearer":[]}],"summary":"Get employee performance analytics","tags":["Dashboard"]}}},"info":{"title":"Reasse Agency - Internal Management System API","description":"REST API for Reasse Agency Internal Company Management System.\n\n### Authentication Flow\n1. Redirect browser to `GET /auth/google` (Google OAuth2 matched against pre-registered active `users.email`).\n2. Callback sets `httpOnly` refresh cookie and redirects to `FRONTEND_AUTH_REDIRECT_URL`.\n3. Frontend calls `POST /auth/refresh` with `credentials: \"include\"` to obtain short-lived JWT `access_token` in memory.\n4. Send `Authorization: Bearer <access_token>` on protected routes; refresh silently on `401`.","version":"1.0.0","contact":{}},"tags":[{"name":"Health","description":""},{"name":"Auth","description":""},{"name":"Divisions","description":""},{"name":"Work Schedules","description":""},{"name":"Users","description":""},{"name":"Attendances","description":""},{"name":"Projects","description":""},{"name":"Tasks","description":""},{"name":"Meetings","description":""},{"name":"Notifications","description":""},{"name":"Storage","description":""},{"name":"Dashboard","description":""}],"servers":[],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"},"cookie":{"type":"apiKey","in":"cookie","name":"refresh_token"}},"schemas":{"CreatePresignedUploadDto":{"type":"object","properties":{"category":{"type":"string","description":"Target storage bucket subfolder matching the domain module.","enum":["avatars","attendances","tasks","meetings"],"example":"tasks"},"file_name":{"type":"string","description":"Original file name (alphanumeric, dots, underscores, and hyphens only; no spaces or slashes).","minLength":1,"maxLength":180,"pattern":"^[a-zA-Z0-9._-]+$","example":"sprint-report.pdf"}},"required":["category","file_name"]},"CreateDivisionDto":{"type":"object","properties":{"name":{"type":"string","description":"Unique division name among active divisions.","minLength":2,"maxLength":100,"example":"Engineering"},"head_user_id":{"type":"string","description":"Optional active user ObjectId to promote as Head of Division inside a MongoDB transaction.","nullable":true,"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d"}},"required":["name"]},"UpdateDivisionDto":{"type":"object","properties":{"name":{"type":"string","description":"Updated unique division name among active divisions.","minLength":2,"maxLength":100,"example":"Product Engineering"},"head_user_id":{"type":"string","description":"User ObjectId to assign as Head of Division, or null to unassign the current head.","nullable":true,"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d"},"is_active":{"type":"boolean","description":"Soft-active flag for the division.","example":true}}},"AssignHeadDto":{"type":"object","properties":{"head_user_id":{"type":"string","description":"Active user ObjectId to promote to Head of Division, or null to unassign the current head (atomically updates division and user role in a transaction).","nullable":true,"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d"}},"required":["head_user_id"]},"CreateWorkScheduleDto":{"type":"object","properties":{"name":{"type":"string","description":"Human-readable schedule template name.","minLength":2,"maxLength":100,"example":"Regular Staff Schedule"},"employment_type":{"type":"string","description":"Target employment category for this schedule.","enum":["staff","intern"],"example":"staff"},"work_days":{"description":"Active working days in ISO weekday numbering (1 = Monday through 7 = Sunday).","minItems":1,"maxItems":7,"uniqueItems":true,"example":[1,2,3,4,5],"type":"array","items":{"type":"number"}},"start_time":{"type":"string","description":"Shift start time in 24-hour HH:mm format (relative to schedule timezone).","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","minLength":5,"maxLength":5,"example":"09:00"},"end_time":{"type":"string","description":"Shift end time in 24-hour HH:mm format (must be strictly later than start_time).","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","minLength":5,"maxLength":5,"example":"17:00"},"timezone":{"type":"string","description":"Valid IANA timezone identifier used to compute local attendance dates and lateness.","default":"Asia/Jakarta","maxLength":50,"example":"Asia/Jakarta"},"late_tolerance_minutes":{"type":"number","description":"Grace period in minutes after start_time before check-in is marked late.","default":15,"minimum":0,"maximum":120,"example":15}},"required":["name","employment_type","work_days","start_time","end_time"]},"UpdateWorkScheduleDto":{"type":"object","properties":{"name":{"type":"string","description":"Human-readable schedule template name.","minLength":2,"maxLength":100,"example":"Regular Staff Schedule"},"employment_type":{"type":"string","description":"Target employment category for this schedule.","enum":["staff","intern"],"example":"staff"},"work_days":{"description":"Active working days in ISO weekday numbering (1 = Monday through 7 = Sunday).","minItems":1,"maxItems":7,"uniqueItems":true,"example":[1,2,3,4,5],"type":"array","items":{"type":"number"}},"start_time":{"type":"string","description":"Shift start time in 24-hour HH:mm format (relative to schedule timezone).","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","minLength":5,"maxLength":5,"example":"09:00"},"end_time":{"type":"string","description":"Shift end time in 24-hour HH:mm format (must be strictly later than start_time).","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","minLength":5,"maxLength":5,"example":"17:00"},"timezone":{"type":"string","description":"Valid IANA timezone identifier used to compute local attendance dates and lateness.","default":"Asia/Jakarta","maxLength":50,"example":"Asia/Jakarta"},"late_tolerance_minutes":{"type":"number","description":"Grace period in minutes after start_time before check-in is marked late.","default":15,"minimum":0,"maximum":120,"example":15},"is_active":{"type":"boolean","description":"Soft-active flag for this work schedule.","example":true}}},"InternshipPeriodDto":{"type":"object","properties":{"start_date":{"format":"date-time","type":"string","description":"Internship start timestamp in ISO 8601 format.","example":"2026-12-01T00:00:00.000Z"},"end_date":{"format":"date-time","type":"string","description":"Internship end timestamp in ISO 8601 format (must be strictly after start_date).","example":"2027-05-31T23:59:59.000Z"}},"required":["start_date","end_date"]},"CreateUserDto":{"type":"object","properties":{"email":{"type":"string","description":"Unique Google Workspace email address allowed to log in via Google OAuth2.","format":"email","maxLength":255,"example":"budi.santoso@reasse.com"},"full_name":{"type":"string","description":"Full display name of the team member.","minLength":2,"maxLength":120,"example":"Budi Santoso"},"phone_number":{"type":"string","description":"Optional phone number in E.164 international format.","nullable":true,"pattern":"^\\+?[1-9]\\d{7,18}$","maxLength":20,"example":"+6281234567890"},"avatar_key":{"type":"string","description":"Optional MinIO object key for profile avatar.","nullable":true,"maxLength":255,"example":"avatars/550e8400-e29b-41d4-a716-446655440000.png"},"role":{"type":"string","description":"RBAC role determining access permissions.","enum":["owner","admin","head_of_division","employee"],"example":"employee"},"employment_type":{"type":"string","description":"Employment classification (staff or intern).","enum":["staff","intern"],"example":"staff"},"division_id":{"type":"string","description":"Active division ObjectId (nullable for cross-division Owner/Admin).","nullable":true,"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d"},"job_title":{"type":"string","description":"Specific role/job title within the company.","minLength":2,"maxLength":100,"example":"Backend Developer"},"work_schedule_id":{"type":"string","description":"Active work schedule ObjectId used for attendance check-in/out.","nullable":true,"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0e"},"work_mode_policy":{"type":"string","description":"Attendance work mode policy (onsite, remote, or hybrid).","enum":["onsite","remote","hybrid"],"example":"hybrid"},"internship_period":{"description":"Required when employment_type is \"intern\" (forced to null when employment_type is \"staff\").","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/InternshipPeriodDto"}]}},"required":["email","full_name","role","employment_type","job_title","work_mode_policy"]},"UpdateUserDto":{"type":"object","properties":{"email":{"type":"string","description":"Unique Google Workspace email address allowed to log in via Google OAuth2.","format":"email","maxLength":255,"example":"budi.santoso@reasse.com"},"full_name":{"type":"string","description":"Full display name of the team member.","minLength":2,"maxLength":120,"example":"Budi Santoso"},"phone_number":{"type":"string","description":"Optional phone number in E.164 international format.","nullable":true,"pattern":"^\\+?[1-9]\\d{7,18}$","maxLength":20,"example":"+6281234567890"},"avatar_key":{"type":"string","description":"Optional MinIO object key for profile avatar.","nullable":true,"maxLength":255,"example":"avatars/550e8400-e29b-41d4-a716-446655440000.png"},"role":{"type":"string","description":"RBAC role determining access permissions.","enum":["owner","admin","head_of_division","employee"],"example":"employee"},"employment_type":{"type":"string","description":"Employment classification (staff or intern).","enum":["staff","intern"],"example":"staff"},"division_id":{"type":"string","description":"Active division ObjectId (nullable for cross-division Owner/Admin).","nullable":true,"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d"},"job_title":{"type":"string","description":"Specific role/job title within the company.","minLength":2,"maxLength":100,"example":"Backend Developer"},"work_schedule_id":{"type":"string","description":"Active work schedule ObjectId used for attendance check-in/out.","nullable":true,"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0e"},"work_mode_policy":{"type":"string","description":"Attendance work mode policy (onsite, remote, or hybrid).","enum":["onsite","remote","hybrid"],"example":"hybrid"},"internship_period":{"description":"Internship period (required if final employment_type is intern; nulled for staff).","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/InternshipPeriodDto"}]},"is_active":{"type":"boolean","description":"Account active status. Setting to false immediately revokes refresh_token_hash and blocks all requests.","example":true}}},"RemoteVerificationDto":{"type":"object","properties":{"lat":{"type":"number","description":"Optional GPS latitude (-90 to 90).","minimum":-90,"maximum":90,"example":-6.2},"lng":{"type":"number","description":"Optional GPS longitude (-180 to 180).","minimum":-180,"maximum":180,"example":106.816666},"activity_proof_key":{"type":"string","description":"Optional MinIO object key for remote work activity proof.","maxLength":255,"example":"attendances/550e8400-e29b-41d4-a716-446655440000.png"}}},"CheckInDto":{"type":"object","properties":{"work_mode":{"type":"string","description":"Selected work mode for today. Must match user work_mode_policy (onsite and remote are locked; hybrid allows either).","enum":["onsite","remote"],"example":"remote"},"remote_verification":{"description":"Optional verification metadata (allowed only when work_mode is \"remote\").","allOf":[{"$ref":"#/components/schemas/RemoteVerificationDto"}]},"notes":{"type":"string","description":"Optional daily check-in note.","maxLength":500,"example":"Working remotely on API documentation"}},"required":["work_mode"]},"ManualAttendanceDto":{"type":"object","properties":{"user_id":{"type":"string","description":"Target employee user ObjectId.","pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d"},"date":{"type":"string","description":"Local attendance date in YYYY-MM-DD format.","pattern":"^\\d{4}-\\d{2}-\\d{2}$","minLength":10,"maxLength":10,"example":"2026-12-04"},"status":{"type":"string","description":"Attendance status. If absent/leave/sick, work_mode, check_in_at, check_out_at, and remote_verification are forced to null.","enum":["present","late","absent","leave","sick"],"example":"sick"},"work_mode":{"type":"string","description":"Required when status is present or late; forced to null for absent/leave/sick.","enum":["onsite","remote"],"nullable":true,"example":null},"check_in_at":{"format":"date-time","type":"string","description":"Optional check-in ISO timestamp (only relevant for present/late).","nullable":true,"example":null},"check_out_at":{"format":"date-time","type":"string","description":"Optional check-out ISO timestamp (only relevant for present/late).","nullable":true,"example":null},"notes":{"type":"string","description":"Reason for leave/sick or Admin correction notes.","maxLength":500,"nullable":true,"example":"Doctor note attached for fever"},"attachment_key":{"type":"string","description":"MinIO object key for supporting document (e.g. medical certificate).","maxLength":255,"nullable":true,"example":"attendances/550e8400-e29b-41d4-a716-446655440000.pdf"}},"required":["user_id","date","status"]},"UpdateAttendanceDto":{"type":"object","properties":{"status":{"type":"string","description":"Updated attendance status.","enum":["present","late","absent","leave","sick"],"example":"leave"},"work_mode":{"type":"string","description":"Work mode (required if final status is present or late; nulled for absent/leave/sick).","enum":["onsite","remote"],"nullable":true,"example":null},"check_in_at":{"format":"date-time","type":"string","description":"Corrected check-in ISO timestamp.","nullable":true},"check_out_at":{"format":"date-time","type":"string","description":"Corrected check-out ISO timestamp.","nullable":true},"notes":{"type":"string","description":"Correction notes.","maxLength":500,"nullable":true,"example":"Approved annual leave"},"attachment_key":{"type":"string","description":"MinIO object key for supporting document.","maxLength":255,"nullable":true}}},"CreateProjectDto":{"type":"object","properties":{"title":{"type":"string","description":"Division-level project title.","minLength":2,"maxLength":150,"example":"Q4 Internal Portal Revamp"},"description":{"type":"string","description":"Detailed scope and objectives for the project.","minLength":3,"maxLength":2000,"example":"Rebuild core attendance and task dashboards."},"division_id":{"type":"string","description":"Target active division ObjectId responsible for delivering the project.","pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d"},"deadline":{"format":"date-time","type":"string","description":"Project deadline in ISO 8601 format.","example":"2026-12-31T23:59:59.000Z"},"status":{"type":"string","description":"Initial project lifecycle status.","enum":["active","completed","archived"],"default":"active","example":"active"}},"required":["title","description","division_id","deadline"]},"UpdateProjectDto":{"type":"object","properties":{"title":{"type":"string","description":"Division-level project title.","minLength":2,"maxLength":150,"example":"Q4 Internal Portal Revamp"},"description":{"type":"string","description":"Detailed scope and objectives for the project.","minLength":3,"maxLength":2000,"example":"Rebuild core attendance and task dashboards."},"division_id":{"type":"string","description":"Target active division ObjectId responsible for delivering the project.","pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d"},"deadline":{"format":"date-time","type":"string","description":"Project deadline in ISO 8601 format.","example":"2026-12-31T23:59:59.000Z"},"status":{"type":"string","description":"Initial project lifecycle status.","enum":["active","completed","archived"],"default":"active","example":"active"}}},"CreateTaskDto":{"type":"object","properties":{"project_id":{"type":"string","description":"Optional parent project ObjectId (must belong to division_id if provided; null for ad-hoc tasks).","nullable":true,"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0f"},"division_id":{"type":"string","description":"Division ObjectId owning the task (head_of_division must match own division).","pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d"},"assigned_to":{"type":"string","description":"Active assignee user ObjectId (must belong to division_id).","pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0e"},"title":{"type":"string","description":"Short task title.","minLength":2,"maxLength":150,"example":"Implement attendance report endpoint"},"description":{"type":"string","description":"Detailed work description.","minLength":3,"maxLength":2000,"example":"Build MongoDB aggregation report with date range and division filters."},"instructions":{"type":"string","description":"Optional technical guidelines or step-by-step instructions.","maxLength":2000,"nullable":true,"example":"Use $lookup on users and divisions collections."},"target_output":{"type":"string","description":"Expected deliverable definition.","minLength":2,"maxLength":500,"example":"Working API endpoint with Swagger documentation"},"deadline":{"format":"date-time","type":"string","description":"Task completion deadline in ISO 8601 format.","example":"2026-12-15T17:00:00.000Z"}},"required":["division_id","assigned_to","title","description","target_output","deadline"]},"UpdateTaskDto":{"type":"object","properties":{"project_id":{"type":"string","description":"Parent project ObjectId (must belong to task division) or null.","nullable":true,"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0f"},"assigned_to":{"type":"string","description":"Reassign task to another active user within the same division.","pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0e"},"title":{"type":"string","description":"Updated task title.","minLength":2,"maxLength":150,"example":"Implement attendance report endpoint v2"},"description":{"type":"string","description":"Updated task description.","minLength":3,"maxLength":2000},"instructions":{"type":"string","description":"Updated technical guidelines.","maxLength":2000,"nullable":true},"target_output":{"type":"string","description":"Updated deliverable expectation.","minLength":2,"maxLength":500},"deadline":{"format":"date-time","type":"string","description":"Updated task deadline in ISO 8601 format."}}},"SubmitTaskDto":{"type":"object","properties":{"file_keys":{"description":"MinIO object keys for uploaded deliverables (at least one of file_keys, external_link, or notes is required; replaced old keys are removed from MinIO).","maxItems":5,"uniqueItems":true,"example":["tasks/550e8400-e29b-41d4-a716-446655440000.pdf"],"type":"array","items":{"type":"string"}},"external_link":{"type":"string","description":"External deliverable link (must include http:// or https://).","format":"uri","maxLength":500,"example":"https://github.com/Reasse-Agency/backend/pull/12"},"notes":{"type":"string","description":"Optional submission notes for the reviewer.","maxLength":1000,"example":"Implemented aggregation and added Swagger responses."}}},"ReviewTaskDto":{"type":"object","properties":{"decision":{"type":"string","description":"Review decision. \"revision\" atomically increments revision_count by 1; \"done\" sets completed_at.","enum":["revision","done"],"example":"done"},"feedback":{"type":"string","description":"Optional review feedback or revision instructions.","maxLength":1000,"example":"Output meets requirements and passes validation."}},"required":["decision"]},"CreateMeetingDto":{"type":"object","properties":{"title":{"type":"string","description":"Meeting title/subject.","minLength":2,"maxLength":150,"example":"Weekly Sprint Sync"},"agenda":{"type":"string","description":"Optional meeting agenda or discussion points.","maxLength":2000,"nullable":true,"example":"1. Sprint review\n2. Blockers\n3. Next week targets"},"division_id":{"type":"string","description":"Target division ObjectId, or null for cross-division / all-hands meeting.","nullable":true,"pattern":"^[a-fA-F0-9]{24}$","example":"674f1a2b3c4d5e6f7a8b9c0d"},"scheduled_at":{"format":"date-time","type":"string","description":"Meeting start timestamp in ISO 8601 format.","example":"2026-12-05T03:00:00.000Z"},"duration_minutes":{"type":"number","description":"Estimated meeting duration in minutes.","minimum":5,"maximum":480,"example":60},"meeting_link":{"type":"string","description":"Manual Zoom/Google Meet URL (required unless use_zoom_api is true; must include http:// or https://).","format":"uri","maxLength":500,"example":"https://zoom.us/j/1234567890"},"use_zoom_api":{"type":"boolean","description":"When true, automatically creates a Zoom meeting via Zoom Server-to-Server OAuth and populates meeting_link & zoom_meeting_id.","default":false,"example":false},"zoom_meeting_id":{"type":"string","description":"Optional external Zoom Meeting ID if created manually.","maxLength":50,"nullable":true,"example":"97415206740"},"participant_ids":{"description":"Array of unique active user ObjectIds invited to the meeting.","minItems":1,"maxItems":200,"uniqueItems":true,"example":["674f1a2b3c4d5e6f7a8b9c0e"],"type":"array","items":{"type":"string"}},"reminder_offsets_minutes":{"description":"Reminder trigger offsets in minutes before scheduled_at.","default":[60,15],"maxItems":3,"uniqueItems":true,"example":[60,15],"type":"array","items":{"type":"number"}}},"required":["title","scheduled_at","duration_minutes","participant_ids"]},"UpdateMeetingDto":{"type":"object","properties":{"title":{"type":"string","description":"Updated meeting title.","minLength":2,"maxLength":150,"example":"Weekly Sprint Sync (Rescheduled)"},"agenda":{"type":"string","description":"Updated meeting agenda.","maxLength":2000,"nullable":true},"division_id":{"type":"string","description":"Updated division ObjectId or null.","nullable":true,"pattern":"^[a-fA-F0-9]{24}$"},"scheduled_at":{"format":"date-time","type":"string","description":"Updated start timestamp. Changing this automatically resets sent_reminders to [].","example":"2026-12-06T03:00:00.000Z"},"duration_minutes":{"type":"number","description":"Updated duration in minutes.","minimum":5,"maximum":480,"example":45},"meeting_link":{"type":"string","description":"Updated meeting URL.","format":"uri","maxLength":500},"participant_ids":{"description":"Updated list of unique active participant user ObjectIds.","minItems":1,"maxItems":200,"uniqueItems":true,"type":"array","items":{"type":"string"}},"reminder_offsets_minutes":{"description":"Updated reminder offsets in minutes (5-1440, max 3 items).","maxItems":3,"uniqueItems":true,"type":"array","items":{"type":"number"}},"status":{"type":"string","description":"Updated meeting lifecycle status.","enum":["scheduled","completed","cancelled"]}}},"UpdateRsvpDto":{"type":"object","properties":{"rsvp_status":{"type":"string","description":"Participant RSVP confirmation status.","enum":["pending","accepted","declined"],"example":"accepted"}},"required":["rsvp_status"]},"UpdateMomDto":{"type":"object","properties":{"summary":{"type":"string","description":"Minutes of Meeting summary and follow-up action items.","maxLength":5000,"example":"Agreed on API v1 release timeline and QA checklist."},"attachment_keys":{"description":"MinIO object keys for meeting documentation files (replaced old keys are deleted from MinIO).","maxItems":5,"uniqueItems":true,"example":["meetings/550e8400-e29b-41d4-a716-446655440000.pdf"],"type":"array","items":{"type":"string"}}}},"FieldValidationErrorDto":{"type":"object","properties":{"field":{"type":"string","description":"Dot-notation field path that failed validation.","example":"email"},"constraints":{"description":"List of violated validation constraint messages for this field.","example":["email must be an email","email should not be empty"],"type":"array","items":{"type":"string"}}},"required":["field","constraints"]},"ErrorResponseDto":{"type":"object","properties":{"success":{"type":"boolean","example":false},"statusCode":{"type":"number","example":400},"message":{"description":"Human-readable error message or array of validation messages.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"example":"Validation failed"},"error":{"type":"string","example":"Bad Request"},"errors":{"description":"Per-field validation breakdown (present on DTO validation errors).","type":"array","items":{"$ref":"#/components/schemas/FieldValidationErrorDto"}},"timestamp":{"type":"string","example":"2026-12-04T02:30:00.000Z","format":"date-time"},"path":{"type":"string","example":"/api/v1/users"}},"required":["success","statusCode","message","error","timestamp","path"]},"ValidationErrorResponseDto":{"type":"object","properties":{"success":{"type":"boolean","example":false},"statusCode":{"type":"number","example":400},"message":{"example":["email must be an email"],"type":"array","items":{"type":"string"}},"error":{"type":"string","example":"Bad Request"},"errors":{"description":"Per-field validation breakdown.","example":[{"field":"email","constraints":["email must be an email"]}],"type":"array","items":{"$ref":"#/components/schemas/FieldValidationErrorDto"}},"timestamp":{"type":"string","example":"2026-12-04T02:30:00.000Z","format":"date-time"},"path":{"type":"string","example":"/api/v1/users"}},"required":["success","statusCode","message","error","errors","timestamp","path"]}}}}