445 lines
11 KiB
JSON
445 lines
11 KiB
JSON
{
|
|
"openapi": "3.0.3",
|
|
"info": {
|
|
"title": "Corrad AF 2024 API Platform",
|
|
"description": "Complete API reference for the Corrad AF 2024 API Platform project including authentication, business logic, development tools, and platform management endpoints.",
|
|
"version": "2.0.0",
|
|
"contact": {
|
|
"name": "API Support",
|
|
"email": "support@corradaf.com",
|
|
"url": "https://corradaf.com"
|
|
},
|
|
"license": {
|
|
"name": "MIT",
|
|
"url": "https://opensource.org/licenses/MIT"
|
|
}
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "{protocol}://{host}:{port}/api",
|
|
"description": "API Server",
|
|
"variables": {
|
|
"protocol": {
|
|
"enum": ["http", "https"],
|
|
"default": "http"
|
|
},
|
|
"host": {
|
|
"default": "localhost"
|
|
},
|
|
"port": {
|
|
"default": "3000"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
{
|
|
"name": "authentication",
|
|
"description": "Authentication and authorization operations"
|
|
},
|
|
{
|
|
"name": "business-logic",
|
|
"description": "Core business functionality"
|
|
},
|
|
{
|
|
"name": "api-platform",
|
|
"description": "API platform and proxy operations"
|
|
},
|
|
{
|
|
"name": "metabase",
|
|
"description": "Analytics and reporting integration"
|
|
},
|
|
{
|
|
"name": "devtool-users",
|
|
"description": "User management for development"
|
|
},
|
|
{
|
|
"name": "devtool-roles",
|
|
"description": "Role management for development"
|
|
},
|
|
{
|
|
"name": "devtool-menu",
|
|
"description": "Menu management for development"
|
|
},
|
|
{
|
|
"name": "devtool-orm",
|
|
"description": "Database and ORM management"
|
|
},
|
|
{
|
|
"name": "devtool-config",
|
|
"description": "Configuration management"
|
|
},
|
|
{
|
|
"name": "devtool-api",
|
|
"description": "API development tools"
|
|
},
|
|
{
|
|
"name": "devtool-content",
|
|
"description": "Content management tools"
|
|
}
|
|
],
|
|
"paths": {
|
|
"/auth/login": {
|
|
"post": {
|
|
"tags": ["authentication"],
|
|
"summary": "User Login",
|
|
"description": "Authenticate user and receive access/refresh tokens",
|
|
"operationId": "login",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string",
|
|
"description": "User's username"
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"format": "password",
|
|
"description": "User's password"
|
|
}
|
|
},
|
|
"required": ["username", "password"]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Login successful",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/LoginResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad request - missing username or password",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Invalid credentials",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "User not found",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/logout": {
|
|
"get": {
|
|
"tags": ["authentication"],
|
|
"summary": "User Logout",
|
|
"description": "Logout user and clear authentication cookies",
|
|
"operationId": "logout",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Logout successful",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/SuccessResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/validate": {
|
|
"get": {
|
|
"tags": ["authentication"],
|
|
"summary": "Validate Token",
|
|
"description": "Validate current authentication token",
|
|
"operationId": "validateToken",
|
|
"security": [
|
|
{
|
|
"bearerAuth": []
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Token is valid",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/SuccessResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Invalid or expired token",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/analyze-asnaf": {
|
|
"post": {
|
|
"tags": ["business-logic"],
|
|
"summary": "Analyze Asnaf Profile",
|
|
"description": "Analyze Asnaf profile using AI/OpenAI integration to determine eligibility and assistance recommendations",
|
|
"operationId": "analyzeAsnaf",
|
|
"security": [
|
|
{
|
|
"bearerAuth": []
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/AsnafAnalysisRequest"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Analysis completed successfully",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/AsnafAnalysisResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid request data",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Analysis failed",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"SuccessResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"statusCode": {
|
|
"type": "integer",
|
|
"example": 200
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"example": "Operation successful"
|
|
},
|
|
"data": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
},
|
|
"ErrorResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"statusCode": {
|
|
"type": "integer",
|
|
"example": 400
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"example": "Error message"
|
|
},
|
|
"errors": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"LoginResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"statusCode": {
|
|
"type": "integer",
|
|
"example": 200
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"example": "Login success"
|
|
},
|
|
"data": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string",
|
|
"example": "user@example.com"
|
|
},
|
|
"roles": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"example": ["admin", "user"]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"AsnafAnalysisRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"monthlyIncome": {
|
|
"type": "string",
|
|
"description": "Monthly income amount",
|
|
"example": "2000"
|
|
},
|
|
"otherIncome": {
|
|
"type": "string",
|
|
"description": "Other income sources",
|
|
"example": "500"
|
|
},
|
|
"totalIncome": {
|
|
"type": "string",
|
|
"description": "Total income amount",
|
|
"example": "2500"
|
|
},
|
|
"occupation": {
|
|
"type": "string",
|
|
"description": "Applicant's occupation",
|
|
"example": "Clerk"
|
|
},
|
|
"maritalStatus": {
|
|
"type": "string",
|
|
"description": "Marital status",
|
|
"example": "Married"
|
|
},
|
|
"dependents": {
|
|
"type": "array",
|
|
"description": "List of dependents",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"age": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": ["monthlyIncome", "totalIncome", "occupation", "maritalStatus"]
|
|
},
|
|
"AsnafAnalysisResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"hadKifayahPercentage": {
|
|
"type": "string",
|
|
"example": "75%"
|
|
},
|
|
"kategoriAsnaf": {
|
|
"type": "string",
|
|
"example": "Miskin"
|
|
},
|
|
"kategoriKeluarga": {
|
|
"type": "string",
|
|
"example": "Miskin (50-100% HK)"
|
|
},
|
|
"cadanganKategori": {
|
|
"type": "string",
|
|
"example": "Miskin"
|
|
},
|
|
"statusKelayakan": {
|
|
"type": "string",
|
|
"example": "Layak (Miskin)"
|
|
},
|
|
"cadanganBantuan": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"nama": {
|
|
"type": "string",
|
|
"example": "Bantuan Kewangan Bulanan"
|
|
},
|
|
"peratusan": {
|
|
"type": "string",
|
|
"example": "90%"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"ramalanJangkaMasaPulih": {
|
|
"type": "string",
|
|
"example": "6 bulan"
|
|
},
|
|
"rumusan": {
|
|
"type": "string",
|
|
"example": "Pemohon memerlukan perhatian segera."
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"securitySchemes": {
|
|
"bearerAuth": {
|
|
"type": "http",
|
|
"scheme": "bearer",
|
|
"bearerFormat": "JWT",
|
|
"description": "JWT Bearer token authentication"
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"bearerAuth": []
|
|
}
|
|
]
|
|
} |