gohorsejobs/backend/docs/swagger.json

1426 lines
No EOL
45 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "API for GoHorseJobs recruitment platform.",
"title": "GoHorseJobs API",
"contact": {},
"version": "1.0"
},
"basePath": "/",
"paths": {
"/api/v1/auth/login": {
"post": {
"description": "Authenticates a user by email and password. Returns JWT and user info.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "User Login",
"parameters": [
{
"description": "Login Credentials",
"name": "login",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.AuthResponse"
}
},
"400": {
"description": "Invalid Request",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/companies": {
"get": {
"description": "Returns a list of all companies.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Companies"
],
"summary": "List Companies",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.CompanyResponse"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"description": "Registers a new company and creates an initial admin user.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Companies"
],
"summary": "Create Company (Tenant)",
"parameters": [
{
"description": "Company Details",
"name": "company",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CreateCompanyRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.CompanyResponse"
}
},
"400": {
"description": "Invalid Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/storage/download-url": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Generate a pre-signed URL to download a private file from S3",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Storage"
],
"summary": "Generate download URL",
"parameters": [
{
"description": "Download request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.DownloadURLRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.DownloadURLResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/storage/files": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete a stored file by key",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Storage"
],
"summary": "Delete file",
"parameters": [
{
"type": "string",
"description": "File key",
"name": "key",
"in": "query",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/storage/upload-url": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Generate a pre-signed URL to upload a file to S3",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Storage"
],
"summary": "Generate upload URL",
"parameters": [
{
"description": "Upload request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.UploadURLRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.UploadURLResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/users": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns a list of users belonging to the authenticated tenant.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "List Users",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.UserResponse"
}
}
},
"403": {
"description": "Forbidden",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Creates a new user under the current tenant. Requires Admin role.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Create User",
"parameters": [
{
"description": "User Details",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CreateUserRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.UserResponse"
}
},
"400": {
"description": "Invalid Request",
"schema": {
"type": "string"
}
},
"403": {
"description": "Forbidden",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/users/{id}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Deletes a user by ID. Must belong to the same tenant.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Delete User",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "User deleted",
"schema": {
"type": "string"
}
},
"403": {
"description": "Forbidden",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/applications": {
"get": {
"description": "List all applications for a job",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Applications"
],
"summary": "List Applications",
"parameters": [
{
"type": "integer",
"description": "Filter applications by job ID",
"name": "jobId",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Application"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"description": "Submit a new job application for a posting",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Applications"
],
"summary": "Create Application",
"parameters": [
{
"description": "Application data",
"name": "application",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CreateApplicationRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/models.Application"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/applications/{id}": {
"get": {
"description": "Retrieve a job application by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Applications"
],
"summary": "Get Application",
"parameters": [
{
"type": "integer",
"description": "Application ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Application"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/applications/{id}/status": {
"put": {
"description": "Update the status of a job application",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Applications"
],
"summary": "Update Application Status",
"parameters": [
{
"type": "integer",
"description": "Application ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Status update",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UpdateApplicationStatusRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Application"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/jobs": {
"get": {
"description": "Get a paginated list of job postings with optional filters",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Jobs"
],
"summary": "List all jobs",
"parameters": [
{
"type": "integer",
"description": "Page number (default: 1)",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Items per page (default: 10, max: 100)",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Filter by company ID",
"name": "companyId",
"in": "query"
},
{
"type": "boolean",
"description": "Filter by featured status",
"name": "featured",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.PaginatedResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"post": {
"description": "Create a new job posting",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Jobs"
],
"summary": "Create a new job",
"parameters": [
{
"description": "Job data",
"name": "job",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CreateJobRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/models.Job"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/jobs/{id}": {
"get": {
"description": "Get a single job posting by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Jobs"
],
"summary": "Get job by ID",
"parameters": [
{
"type": "integer",
"description": "Job ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Job"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
},
"put": {
"description": "Update an existing job posting",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Jobs"
],
"summary": "Update a job",
"parameters": [
{
"type": "integer",
"description": "Job ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Updated job data",
"name": "job",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UpdateJobRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Job"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
},
"delete": {
"description": "Delete a job posting",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Jobs"
],
"summary": "Delete a job",
"parameters": [
{
"type": "integer",
"description": "Job ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
}
},
"definitions": {
"dto.AuthResponse": {
"type": "object",
"properties": {
"token": {
"type": "string"
},
"user": {
"$ref": "#/definitions/dto.UserResponse"
}
}
},
"dto.CompanyResponse": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"dto.CreateApplicationRequest": {
"type": "object",
"required": [
"jobId"
],
"properties": {
"documents": {
"type": "object",
"additionalProperties": true
},
"email": {
"type": "string"
},
"jobId": {
"type": "integer"
},
"lineId": {
"type": "string"
},
"message": {
"type": "string"
},
"name": {
"type": "string"
},
"phone": {
"type": "string"
},
"resumeUrl": {
"type": "string"
},
"userId": {
"type": "integer"
},
"whatsapp": {
"type": "string"
}
}
},
"dto.CreateCompanyRequest": {
"type": "object",
"required": [
"name",
"slug"
],
"properties": {
"address": {
"type": "string"
},
"cityId": {
"type": "integer"
},
"description": {
"type": "string"
},
"document": {
"type": "string"
},
"email": {
"type": "string"
},
"logoUrl": {
"type": "string"
},
"name": {
"type": "string",
"maxLength": 255,
"minLength": 3
},
"phone": {
"type": "string"
},
"regionId": {
"type": "integer"
},
"slug": {
"type": "string",
"maxLength": 255,
"minLength": 3
},
"type": {
"type": "string"
},
"website": {
"type": "string"
}
}
},
"dto.CreateJobRequest": {
"type": "object",
"required": [
"companyId",
"description",
"title"
],
"properties": {
"benefits": {
"type": "object",
"additionalProperties": true
},
"cityId": {
"type": "integer"
},
"companyId": {
"type": "integer"
},
"description": {
"type": "string",
"minLength": 20
},
"employmentType": {
"type": "string",
"enum": [
"full-time",
"part-time",
"dispatch",
"contract"
]
},
"languageLevel": {
"type": "string"
},
"location": {
"type": "string"
},
"regionId": {
"type": "integer"
},
"requirements": {
"type": "object",
"additionalProperties": true
},
"salaryMax": {
"type": "number"
},
"salaryMin": {
"type": "number"
},
"salaryType": {
"type": "string",
"enum": [
"hourly",
"monthly",
"yearly"
]
},
"status": {
"type": "string",
"enum": [
"draft",
"open",
"closed"
]
},
"title": {
"type": "string",
"maxLength": 255,
"minLength": 5
},
"visaSupport": {
"type": "boolean"
},
"workingHours": {
"type": "string"
}
}
},
"dto.CreateUserRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"password": {
"type": "string"
},
"roles": {
"description": "e.g. [\"RECRUITER\"]",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"dto.LoginRequest": {
"type": "object",
"required": [
"identifier",
"password"
],
"properties": {
"identifier": {
"type": "string",
"minLength": 3
},
"password": {
"type": "string",
"minLength": 8
}
}
},
"dto.PaginatedResponse": {
"type": "object",
"properties": {
"data": {},
"pagination": {
"$ref": "#/definitions/dto.Pagination"
}
}
},
"dto.Pagination": {
"type": "object",
"properties": {
"limit": {
"type": "integer"
},
"page": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"dto.UpdateApplicationStatusRequest": {
"type": "object",
"required": [
"status"
],
"properties": {
"notes": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"pending",
"reviewed",
"shortlisted",
"rejected",
"hired"
]
}
}
},
"dto.UpdateJobRequest": {
"type": "object",
"properties": {
"benefits": {
"type": "object",
"additionalProperties": true
},
"cityId": {
"type": "integer"
},
"description": {
"type": "string",
"minLength": 20
},
"employmentType": {
"type": "string",
"enum": [
"full-time",
"part-time",
"dispatch",
"contract"
]
},
"languageLevel": {
"type": "string"
},
"location": {
"type": "string"
},
"regionId": {
"type": "integer"
},
"requirements": {
"type": "object",
"additionalProperties": true
},
"salaryMax": {
"type": "number"
},
"salaryMin": {
"type": "number"
},
"salaryType": {
"type": "string",
"enum": [
"hourly",
"monthly",
"yearly"
]
},
"status": {
"type": "string",
"enum": [
"draft",
"open",
"closed"
]
},
"title": {
"type": "string",
"maxLength": 255,
"minLength": 5
},
"visaSupport": {
"type": "boolean"
},
"workingHours": {
"type": "string"
}
}
},
"dto.UserResponse": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"email": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"roles": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string"
}
}
},
"handlers.DownloadURLRequest": {
"type": "object",
"properties": {
"key": {
"type": "string"
}
}
},
"handlers.DownloadURLResponse": {
"type": "object",
"properties": {
"downloadUrl": {
"type": "string"
},
"expiresIn": {
"description": "seconds",
"type": "integer"
}
}
},
"handlers.UploadURLRequest": {
"type": "object",
"properties": {
"contentType": {
"type": "string"
},
"filename": {
"type": "string"
},
"folder": {
"description": "Optional: logos, resumes, documents",
"type": "string"
}
}
},
"handlers.UploadURLResponse": {
"type": "object",
"properties": {
"expiresIn": {
"description": "seconds",
"type": "integer"
},
"key": {
"type": "string"
},
"publicUrl": {
"type": "string"
},
"uploadUrl": {
"type": "string"
}
}
},
"models.Application": {
"type": "object",
"properties": {
"createdAt": {
"description": "Metadata",
"type": "string"
},
"documents": {
"description": "Array of {type, url}",
"allOf": [
{
"$ref": "#/definitions/models.JSONMap"
}
]
},
"email": {
"type": "string"
},
"id": {
"type": "integer"
},
"jobId": {
"type": "integer"
},
"lineId": {
"type": "string"
},
"message": {
"description": "Application Content",
"type": "string"
},
"name": {
"description": "Applicant Info (for guest applications)",
"type": "string"
},
"notes": {
"type": "string"
},
"phone": {
"type": "string"
},
"resumeUrl": {
"type": "string"
},
"status": {
"description": "Status \u0026 Notes",
"type": "string"
},
"updatedAt": {
"type": "string"
},
"userId": {
"description": "NULL for guest applications",
"type": "integer"
},
"whatsapp": {
"type": "string"
}
}
},
"models.JSONMap": {
"type": "object",
"additionalProperties": true
},
"models.Job": {
"type": "object",
"properties": {
"benefits": {
"$ref": "#/definitions/models.JSONMap"
},
"cityId": {
"type": "integer"
},
"companyId": {
"type": "integer"
},
"createdAt": {
"description": "Metadata",
"type": "string"
},
"createdBy": {
"type": "integer"
},
"description": {
"type": "string"
},
"employmentType": {
"description": "Employment",
"type": "string"
},
"id": {
"type": "integer"
},
"isFeatured": {
"description": "Featured job flag",
"type": "boolean"
},
"languageLevel": {
"description": "N5-N1, beginner, none",
"type": "string"
},
"location": {
"description": "Location",
"type": "string"
},
"regionId": {
"type": "integer"
},
"requirements": {
"description": "Requirements \u0026 Benefits (JSONB arrays)",
"allOf": [
{
"$ref": "#/definitions/models.JSONMap"
}
]
},
"salaryMax": {
"type": "number"
},
"salaryMin": {
"description": "Salary",
"type": "number"
},
"salaryType": {
"description": "hourly, monthly, yearly",
"type": "string"
},
"status": {
"description": "Status",
"type": "string"
},
"title": {
"description": "Job Details",
"type": "string"
},
"updatedAt": {
"type": "string"
},
"visaSupport": {
"description": "Visa \u0026 Language",
"type": "boolean"
},
"workingHours": {
"type": "string"
}
}
}
}
}