{"openapi":"3.1.0","info":{"title":"RichestHouse API","version":"0.1.0","description":"API contract for RichestHouse web and mobile clients."},"servers":[{"url":"https://api-rh.alonersoft.com","description":"Configured API server"}],"tags":[{"name":"System","description":"Platform health endpoints"},{"name":"Auth","description":"Development authentication endpoints"},{"name":"Dashboard","description":"Dashboard summaries and charts"},{"name":"Jobs","description":"Job listing, details, assignment and options"},{"name":"Check-ins","description":"Location check-in endpoints"},{"name":"Images","description":"Job image gallery and upload endpoints"}],"paths":{"/api/health":{"get":{"tags":["System"],"summary":"Check API health","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/db/health":{"get":{"tags":["System"],"summary":"Check SQL Server connectivity","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}},"503":{"description":"Database is unavailable or not configured"}}}},"/api/auth/login":{"post":{"tags":["Auth"],"summary":"Login with a legacy flowman account","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"type":"string"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/auth/logout":{"post":{"tags":["Auth"],"summary":"Logout current session","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/auth/me":{"get":{"tags":["Auth"],"summary":"Return current user","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/dashboard/summary":{"get":{"tags":["Dashboard"],"summary":"Get dashboard counters","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/dashboard/jobs/latest":{"get":{"tags":["Dashboard"],"summary":"Get latest jobs","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":10}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/dashboard/jobs/status-stats":{"get":{"tags":["Dashboard"],"summary":"Get job counts grouped by status","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/jobs":{"get":{"tags":["Jobs"],"summary":"List jobs with filters and pagination","parameters":[{"name":"keyword","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"array","items":{"type":"string"}}},{"name":"sort","in":"query","schema":{"type":"string","enum":["newest","oldest","due_soon"]}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"pageSize","in":"query","schema":{"type":"integer","default":25}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/jobs/{jobId}":{"get":{"tags":["Jobs"],"summary":"Get one job","parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/jobs/statuses":{"get":{"tags":["Jobs"],"summary":"List job statuses","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/flowmen":{"get":{"tags":["Jobs"],"summary":"List flowmen","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/processes":{"get":{"tags":["Images"],"summary":"List image process options","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/jobs/{jobId}/assignment":{"patch":{"tags":["Jobs"],"summary":"Assign a flowman to a job","parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["flowman"],"properties":{"flowman":{"type":"string"}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/checkins":{"post":{"tags":["Check-ins"],"summary":"Create a job check-in","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["jobId","latitude","longitude"],"properties":{"jobId":{"type":"integer"},"userId":{"type":"integer"},"latitude":{"type":"number"},"longitude":{"type":"number"},"address":{"type":"string"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/checkins/my-history":{"get":{"tags":["Check-ins"],"summary":"List current user's check-in history","parameters":[{"name":"userId","in":"query","schema":{"type":"integer"}},{"name":"page","in":"query","schema":{"type":"integer","default":1}},{"name":"pageSize","in":"query","schema":{"type":"integer","default":25}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/jobs/{jobId}/checkins":{"get":{"tags":["Check-ins"],"summary":"List check-ins for one job","parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/jobs/{jobId}/images":{"get":{"tags":["Images"],"summary":"List images for one job","parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"integer"}},{"name":"process","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}},"post":{"tags":["Images"],"summary":"Upload images for one job","parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ImageUploadRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}},"/api/images":{"delete":{"tags":["Images"],"summary":"Delete selected images","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"integer"}}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiResponse"}}}}}}}},"components":{"schemas":{"ApiResponse":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"},"data":{},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}},"ImageUploadRequest":{"type":"object","required":["process","images[]"],"properties":{"process":{"type":"string"},"images[]":{"type":"array","items":{"type":"string","format":"binary"}},"remark":{"type":"string"}}}}}}