{ "openapi": "3.0.3", "info": { "title": "Academya Collab API", "version": "1.0.0", "license": { "name": "MIT", "url": "https://github.com/academya/collab/blob/main/LICENSE" } }, "servers": [ { "url": "http://localhost:3000", "description": "Local server" } ], "components": { "securitySchemes": { "TokenAuth": { "type": "apiKey", "in": "header", "name": "Authorization", "description": "Provide your access token directly as the value (without 'Bearer ')" } }, "schemas": { "RegisterUserRequest": { "type": "object", "properties": { "email": { "type": "string", "maxLength": 100 }, "password": { "type": "string", "maxLength": 100 }, "username": { "type": "string", "maxLength": 100 }, "grade_level": { "type": "string", "maxLength": 100 } }, "required": ["email", "password", "username"] }, "LoginUserRequest": { "type": "object", "properties": { "email": { "type": "string", "maxLength": 100 }, "password": { "type": "string", "maxLength": 100 } }, "required": ["email", "password"] }, "JobRequest": { "type": "object", "required": ["title", "description", "location"], "properties": { "title": { "type": "string", "maxLength": 100, "example": "Backend Developer" }, "position": { "type": "string", "maxLength": 100, "example": "Senior" }, "description": { "type": "string", "maxLength": 1000, "example": "Responsible for developing RESTful APIs and managing backend logic." }, "location": { "type": "string", "maxLength": 100, "example": "Jakarta, Indonesia" }, "salary": { "type": "integer", "example": 12000000 }, "skills": { "type": "array", "items": { "type": "string" }, "example": ["node.js", "laravel", "php"] } } }, "UserResponse": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email" }, "bio": { "type": "string" }, "address": { "type": "string" }, "role": { "type": "string" }, "avatar_url": { "type": "string" }, "token": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } }, "SkillResponse": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "skill_name": { "type": "string" } } }, "JobResponse": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "title": { "type": "string" }, "position": { "type": "string" }, "description": { "type": "string" }, "location": { "type": "string" }, "salary": { "type": "integer" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" }, "company": { "$ref": "#/components/schemas/UserResponse" }, "skills": { "type": "array", "items": { "$ref": "#/components/schemas/SkillResponse" } } } }, "PagingResponse": { "type": "object", "properties": { "page": { "type": "integer", "example": 1 }, "size": { "type": "integer", "example": 9 }, "total_item": { "type": "integer", "example": 3 }, "total_page": { "type": "integer", "example": 1 } }, "required": ["page", "size", "total_item", "total_page"] }, "ErrorResponse": { "type": "object", "properties": { "errors": { "type": "string" } } } } }, "paths": { "/api/users/register": { "post": { "summary": "Register a new user", "tags": ["User API"], "operationId": "registerUser", "security": [], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RegisterUserRequest" } } } }, "responses": { "200": { "description": "User created successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/UserResponse" } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Conflict, email already exists", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } } }, "/api/users/login": { "post": { "summary": "Login user", "operationId": "loginUser", "tags": ["User API"], "security": [], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginUserRequest" } } } }, "responses": { "200": { "description": "Success login", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "token": { "type": "string" } } } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized: wrong email/password", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } } }, "/api/users/current": { "get": { "summary": "Get current user data", "operationId": "getCurrentUser", "tags": ["User API"], "security": [ { "TokenAuth": [] } ], "responses": { "200": { "description": "Success get current user data", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/UserResponse" } } } } } }, "401": { "description": "Unauthorized: Token not valid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } } }, "/api/users/user/{id}": { "get": { "summary": "Get user by id", "operationId": "getUserById", "tags": ["User API"], "security": [], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success get user data by id", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/UserResponse" } } } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } } }, "/api/users/logout": { "post": { "summary": "Logout user", "operationId": "logoutUser", "tags": ["User API"], "security": [ { "TokenAuth": [] } ], "responses": { "200": { "description": "Success logout", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "boolean", "example": true } } } } } }, "401": { "description": "Unauthorized: Token not valid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } } }, "/api/admin/users": { "get": { "summary": "Get all users (admin only)", "operationId": "getAllUsers", "tags": ["User API"], "security": [ { "TokenAuth": [] } ], "parameters": [ { "in": "query", "name": "username", "schema": { "type": "string" }, "required": false }, { "in": "query", "name": "email", "schema": { "type": "string" }, "required": false }, { "in": "query", "name": "phone_number", "schema": { "type": "string" }, "required": false }, { "in": "query", "name": "grade_level", "schema": { "type": "integer" }, "required": false }, { "in": "query", "name": "birth_date", "schema": { "type": "string", "format": "date-time" }, "required": false }, { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1 }, "required": true }, { "in": "query", "name": "size", "schema": { "type": "integer", "minimum": 1, "maximum": 100 }, "required": true } ], "responses": { "200": { "description": "Success get all users", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/UserResponse" } }, "paging": { "$ref": "#/components/schemas/PagingResponse" } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized: Admin only", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } } }, "/api/admin/users/{id}": { "delete": { "summary": "Delete user using admin role", "operationId": "deleteUserForAdmin", "tags": ["User API"], "security": [ { "TokenAuth": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "description": "The ID of the user to delete", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success get all users", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/UserResponse" } } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized: Admin only", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } } }, "/api/jobs": { "get": { "summary": "Get all jobs", "operationId": "getAllJobs", "tags": ["Job API"], "security": [], "responses": { "200": { "description": "Success get all jobs", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/JobResponse" } }, "paging": { "$ref": "#/components/schemas/PagingResponse" } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "User not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized: Admin only", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } } }, "/api/jobs/{id}": { "get": { "summary": "Get job by id", "operationId": "getJobById", "tags": ["Job API"], "security": [], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success get job data by id", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/JobResponse" } } } } } }, "404": { "description": "Job not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } } }, "/api/company/jobs": { "post": { "summary": "Create new job using company role", "operationId": "createJob", "tags": ["Job API"], "security": [ { "TokenAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobRequest" } } } }, "responses": { "200": { "description": "Success create new job", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/JobResponse" } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Conflict, email already exists", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } }, "put": { "summary": "Update job using company role", "operationId": "updateJob", "tags": ["Job API"], "security": [ { "TokenAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JobRequest" } } } }, "responses": { "200": { "description": "Success update job", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/JobResponse" } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Job not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } }, "delete":{ "summary": "Delete job using company role", "operationId": "deleteJobForCompany", "tags": ["Job API"], "security": [ { "TokenAuth": [] } ], "responses": { "200": { "description": "Success delete job", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/JobResponse" } } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Job not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "Internal server error" } } } } } }