gohorsejobs/backend/docs/swagger.yaml

1399 lines
31 KiB
YAML

basePath: /
definitions:
dto.CreateApplicationRequest:
properties:
documents:
additionalProperties: true
type: object
email:
type: string
jobId:
type: string
lineId:
type: string
message:
type: string
name:
type: string
phone:
type: string
resumeUrl:
type: string
userId:
type: string
whatsapp:
type: string
required:
- jobId
type: object
dto.CreateJobRequest:
properties:
benefits:
additionalProperties: true
type: object
cityId:
type: integer
companyId:
type: string
currency:
enum:
- BRL
- USD
- EUR
- GBP
- JPY
type: string
description:
minLength: 20
type: string
employmentType:
enum:
- full-time
- part-time
- dispatch
- contract
- temporary
- training
- voluntary
- permanent
type: string
languageLevel:
type: string
location:
type: string
regionId:
type: integer
requirements:
additionalProperties: true
type: object
salaryMax:
type: number
salaryMin:
type: number
salaryType:
enum:
- hourly
- daily
- weekly
- monthly
- yearly
type: string
status:
enum:
- draft
- open
- closed
- review
- published
- paused
- expired
- archived
- reported
type: string
title:
maxLength: 255
minLength: 5
type: string
visaSupport:
type: boolean
workingHours:
type: string
required:
- companyId
- description
- title
type: object
dto.PaginatedResponse:
properties:
data: {}
pagination:
$ref: '#/definitions/dto.Pagination'
type: object
dto.Pagination:
properties:
limit:
type: integer
page:
type: integer
total:
type: integer
type: object
dto.UpdateApplicationStatusRequest:
properties:
notes:
type: string
status:
enum:
- pending
- reviewed
- shortlisted
- rejected
- hired
type: string
required:
- status
type: object
dto.UpdateJobRequest:
properties:
benefits:
additionalProperties: true
type: object
cityId:
type: integer
currency:
enum:
- BRL
- USD
- EUR
- GBP
- JPY
type: string
description:
minLength: 20
type: string
employmentType:
enum:
- full-time
- part-time
- dispatch
- contract
- temporary
- training
- voluntary
- permanent
type: string
languageLevel:
type: string
location:
type: string
regionId:
type: integer
requirements:
additionalProperties: true
type: object
salaryMax:
type: number
salaryMin:
type: number
salaryType:
enum:
- hourly
- daily
- weekly
- monthly
- yearly
type: string
status:
enum:
- draft
- open
- closed
- review
- published
- paused
- expired
- archived
- reported
type: string
title:
maxLength: 255
minLength: 5
type: string
visaSupport:
type: boolean
workingHours:
type: string
type: object
dto.User:
properties:
companyId:
type: string
createdAt:
type: string
email:
type: string
id:
type: string
name:
type: string
role:
type: string
status:
type: string
type: object
handlers.CreateCheckoutRequest:
properties:
cancelUrl:
description: URL after cancel
type: string
jobId:
type: integer
priceId:
description: Stripe Price ID
type: string
successUrl:
description: URL after success
type: string
type: object
handlers.CreateCheckoutResponse:
properties:
checkoutUrl:
type: string
sessionId:
type: string
type: object
handlers.DownloadURLRequest:
properties:
key:
type: string
type: object
handlers.DownloadURLResponse:
properties:
downloadUrl:
type: string
expiresIn:
description: seconds
type: integer
type: object
handlers.UploadURLRequest:
properties:
contentType:
type: string
filename:
type: string
folder:
description: 'Optional: logos, resumes, documents'
type: string
type: object
handlers.UploadURLResponse:
properties:
expiresIn:
description: seconds
type: integer
key:
type: string
publicUrl:
type: string
uploadUrl:
type: string
type: object
models.Application:
properties:
createdAt:
description: Metadata
type: string
documents:
allOf:
- $ref: '#/definitions/models.JSONMap'
description: Array of {type, url}
email:
type: string
id:
type: string
jobId:
type: string
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 & Notes
type: string
updatedAt:
type: string
userId:
description: NULL for guest applications
type: string
whatsapp:
type: string
type: object
models.JSONMap:
additionalProperties: true
type: object
models.Job:
properties:
benefits:
$ref: '#/definitions/models.JSONMap'
cityId:
type: integer
companyId:
type: string
createdAt:
description: Metadata
type: string
createdBy:
type: string
currency:
description: BRL, USD, EUR, GBP, JPY
type: string
description:
type: string
employmentType:
description: Employment
type: string
id:
type: string
isFeatured:
description: Featured job flag
type: boolean
languageLevel:
description: N5-N1, beginner, none
type: string
location:
description: Location
type: string
regionId:
type: integer
requirements:
allOf:
- $ref: '#/definitions/models.JSONMap'
description: Requirements & Benefits (JSONB arrays)
salaryMax:
type: number
salaryMin:
description: Salary
type: number
salaryType:
description: hourly, daily, weekly, monthly, yearly
type: string
status:
description: Status
type: string
title:
description: Job Details
type: string
updatedAt:
type: string
visaSupport:
description: Visa & Language
type: boolean
workMode:
description: onsite, hybrid, remote
type: string
workingHours:
type: string
type: object
info:
contact: {}
description: API for GoHorseJobs recruitment platform.
title: GoHorseJobs API
version: "1.0"
paths:
/api/v1/applications:
get:
consumes:
- application/json
description: List all applications for a job
parameters:
- description: Filter applications by job ID
in: query
name: jobId
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/models.Application'
type: array
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: List Applications
tags:
- Applications
post:
consumes:
- application/json
description: Submit a new job application for a posting
parameters:
- description: Application data
in: body
name: application
required: true
schema:
$ref: '#/definitions/dto.CreateApplicationRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/models.Application'
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Create Application
tags:
- Applications
/api/v1/applications/{id}:
delete:
consumes:
- application/json
description: Remove an application by ID
parameters:
- description: Application ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Delete Application
tags:
- Applications
get:
consumes:
- application/json
description: Retrieve a job application by its ID
parameters:
- description: Application ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Application'
"400":
description: Bad Request
schema:
type: string
"404":
description: Not Found
schema:
type: string
summary: Get Application
tags:
- Applications
/api/v1/applications/{id}/status:
put:
consumes:
- application/json
description: Update the status of a job application
parameters:
- description: Application ID
in: path
name: id
required: true
type: integer
- description: Status update
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.UpdateApplicationStatusRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Application'
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Update Application Status
tags:
- Applications
/api/v1/auth/login:
post:
consumes:
- application/json
description: Authenticates a user by email and password. Returns JWT and user
info.
parameters:
- description: Login Credentials
in: body
name: login
required: true
schema:
type: object
produces:
- application/json
responses:
"200":
description: OK
schema:
type: object
"400":
description: Invalid Request
schema:
type: string
"401":
description: Unauthorized
schema:
type: string
summary: User Login
tags:
- Auth
/api/v1/companies:
get:
consumes:
- application/json
description: Returns a list of all companies.
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
type: object
type: array
"500":
description: Internal Server Error
schema:
type: string
summary: List Companies
tags:
- Companies
post:
consumes:
- application/json
description: Registers a new company and creates an initial admin user.
parameters:
- description: Company Details
in: body
name: company
required: true
schema:
type: object
produces:
- application/json
responses:
"200":
description: OK
schema:
type: object
"400":
description: Invalid Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Create Company (Tenant)
tags:
- Companies
/api/v1/companies/{id}:
get:
consumes:
- application/json
description: Retrieves a company by its ID.
parameters:
- description: Company ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: object
"404":
description: Not Found
schema:
type: string
summary: Get Company
tags:
- Companies
/api/v1/jobs:
get:
consumes:
- application/json
description: Get a paginated list of job postings with optional filters
parameters:
- description: 'Page number (default: 1)'
in: query
name: page
type: integer
- description: 'Items per page (default: 10, max: 100)'
in: query
name: limit
type: integer
- description: Filter by company ID
in: query
name: companyId
type: integer
- description: Filter by featured status
in: query
name: featured
type: boolean
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.PaginatedResponse'
"500":
description: Internal Server Error
schema:
type: string
summary: List all jobs
tags:
- Jobs
post:
consumes:
- application/json
description: Create a new job posting
parameters:
- description: Job data
in: body
name: job
required: true
schema:
$ref: '#/definitions/dto.CreateJobRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/models.Job'
"400":
description: Bad Request
schema:
type: string
"401":
description: Unauthorized
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Create a new job
tags:
- Jobs
/api/v1/jobs/{id}:
delete:
consumes:
- application/json
description: Delete a job posting
parameters:
- description: Job ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Delete a job
tags:
- Jobs
get:
consumes:
- application/json
description: Get a single job posting by its ID
parameters:
- description: Job ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Job'
"400":
description: Bad Request
schema:
type: string
"404":
description: Not Found
schema:
type: string
summary: Get job by ID
tags:
- Jobs
put:
consumes:
- application/json
description: Update an existing job posting
parameters:
- description: Job ID
in: path
name: id
required: true
type: integer
- description: Updated job data
in: body
name: job
required: true
schema:
$ref: '#/definitions/dto.UpdateJobRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Job'
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Update a job
tags:
- Jobs
/api/v1/notifications:
get:
consumes:
- application/json
description: Returns a list of notifications for the current user.
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
type: object
type: array
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: List Notifications
tags:
- Notifications
/api/v1/notifications/{id}/read:
patch:
consumes:
- application/json
description: Marks a notification as read.
parameters:
- description: Notification ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Marked as read
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Mark Notification Read
tags:
- Notifications
/api/v1/notifications/read-all:
patch:
consumes:
- application/json
description: Marks all notifications as read.
produces:
- application/json
responses:
"200":
description: All marked as read
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Mark All Notifications Read
tags:
- Notifications
/api/v1/payments/create-checkout:
post:
consumes:
- application/json
description: Create a Stripe checkout session for job posting payment
parameters:
- description: Checkout request
in: body
name: request
required: true
schema:
$ref: '#/definitions/handlers.CreateCheckoutRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.CreateCheckoutResponse'
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Create checkout session
tags:
- Payments
/api/v1/payments/status/{id}:
get:
description: Get the status of a job posting payment
parameters:
- description: Payment ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"404":
description: Not Found
schema:
type: string
summary: Get payment status
tags:
- Payments
/api/v1/payments/webhook:
post:
consumes:
- application/json
description: Process Stripe webhook events (payment success, failure, etc.)
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
"400":
description: Bad Request
schema:
type: string
summary: Handle Stripe webhook
tags:
- Payments
/api/v1/storage/download-url:
post:
consumes:
- application/json
description: Generate a pre-signed URL to download a private file from S3
parameters:
- description: Download request
in: body
name: request
required: true
schema:
$ref: '#/definitions/handlers.DownloadURLRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.DownloadURLResponse'
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Generate download URL
tags:
- Storage
/api/v1/storage/files:
delete:
consumes:
- application/json
description: Delete a stored file by key
parameters:
- description: File key
in: query
name: key
required: true
type: string
produces:
- application/json
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Delete file
tags:
- Storage
/api/v1/storage/upload-url:
post:
consumes:
- application/json
description: Generate a pre-signed URL to upload a file to S3
parameters:
- description: Upload request
in: body
name: request
required: true
schema:
$ref: '#/definitions/handlers.UploadURLRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.UploadURLResponse'
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Generate upload URL
tags:
- Storage
/api/v1/support/tickets:
get:
consumes:
- application/json
description: Returns a list of tickets for the current user.
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
type: object
type: array
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: List Tickets
tags:
- Support
post:
consumes:
- application/json
description: Creates a new support ticket.
parameters:
- description: Ticket Details
in: body
name: ticket
required: true
schema:
type: object
produces:
- application/json
responses:
"201":
description: Created
schema:
type: object
"400":
description: Invalid Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Create Ticket
tags:
- Support
/api/v1/support/tickets/{id}:
get:
consumes:
- application/json
description: Returns ticket details and chat history.
parameters:
- description: Ticket ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
type: object
"404":
description: Not Found
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Get Ticket Details
tags:
- Support
/api/v1/support/tickets/{id}/messages:
post:
consumes:
- application/json
description: Adds a message to an existing ticket.
parameters:
- description: Ticket ID
in: path
name: id
required: true
type: string
- description: Message
in: body
name: message
required: true
schema:
type: object
produces:
- application/json
responses:
"201":
description: Created
schema:
type: object
"400":
description: Invalid Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Add Ticket Message
tags:
- Support
/api/v1/users:
get:
consumes:
- application/json
description: Returns a list of users belonging to the authenticated tenant.
parameters:
- description: 'Page number (default: 1)'
in: query
name: page
type: integer
- description: 'Items per page (default: 10, max: 100)'
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
type: object
"403":
description: Forbidden
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: List Users
tags:
- Users
post:
consumes:
- application/json
description: Creates a new user under the current tenant. Requires Admin role.
parameters:
- description: User Details
in: body
name: user
required: true
schema:
type: object
produces:
- application/json
responses:
"200":
description: OK
schema:
type: object
"400":
description: Invalid Request
schema:
type: string
"403":
description: Forbidden
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Create User
tags:
- Users
/api/v1/users/{id}:
delete:
consumes:
- application/json
description: Deletes a user by ID. Must belong to the same tenant.
parameters:
- description: User ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: User deleted
schema:
type: string
"403":
description: Forbidden
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Delete User
tags:
- Users
patch:
consumes:
- application/json
description: Updates user details (Name, Email, Active Status)
parameters:
- description: User ID
in: path
name: id
required: true
type: string
- description: User Updates
in: body
name: user
required: true
schema:
type: object
produces:
- application/json
responses:
"200":
description: OK
schema:
type: object
"403":
description: Forbidden
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Update User
tags:
- Users
/api/v1/users/me:
get:
consumes:
- application/json
- application/json
description: |-
Returns the profile of the authenticated user.
Returns the profile of the authenticated user.
produces:
- application/json
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.User'
"401":
description: Unauthorized
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
- BearerAuth: []
summary: Get My Profile
tags:
- Users
- Users
/api/v1/users/me/avatar:
post:
consumes:
- multipart/form-data
description: Uploads a profile picture for the current user.
parameters:
- description: Avatar File
in: formData
name: file
required: true
type: file
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Invalid Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Upload Avatar
tags:
- Users
/api/v1/users/me/profile:
patch:
consumes:
- application/json
description: Updates the current user's profile.
parameters:
- description: Profile Details
in: body
name: user
required: true
schema:
type: object
produces:
- application/json
responses:
"200":
description: OK
schema:
type: object
"400":
description: Invalid Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Update My Profile
tags:
- Users
swagger: "2.0"