Merge pull request #1 from rede5/codex/verificar-ausencia-da-rota-jobs

Expose job endpoints in Swagger docs
This commit is contained in:
Tiago Yamamoto 2025-12-14 16:42:35 -03:00 committed by GitHub
commit 390cdf0ffd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 923 additions and 776 deletions

View file

@ -15,9 +15,9 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/auth/login": {
"post": {
"description": "Authenticates a user by email and password. Returns JWT and user info.",
"/jobs": {
"get": {
"description": "Get a paginated list of job postings with optional filters",
"consumes": [
"application/json"
],
@ -25,63 +25,40 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Auth"
"Jobs"
],
"summary": "User Login",
"summary": "List all jobs",
"parameters": [
{
"description": "Login Credentials",
"name": "login",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.LoginRequest"
}
"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/github_com_rede5_gohorsejobs_backend_internal_core_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/github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse"
}
"$ref": "#/definitions/dto.PaginatedResponse"
}
},
"500": {
@ -93,7 +70,7 @@ const docTemplate = `{
}
},
"post": {
"description": "Registers a new company and creates an initial admin user.",
"description": "Create a new job posting",
"consumes": [
"application/json"
],
@ -101,29 +78,29 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Companies"
"Jobs"
],
"summary": "Create Company (Tenant)",
"summary": "Create a new job",
"parameters": [
{
"description": "Company Details",
"name": "company",
"description": "Job data",
"name": "job",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateCompanyRequest"
"$ref": "#/definitions/dto.CreateJobRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse"
"$ref": "#/definitions/models.Job"
}
},
"400": {
"description": "Invalid Request",
"description": "Bad Request",
"schema": {
"type": "string"
}
@ -137,14 +114,9 @@ const docTemplate = `{
}
}
},
"/api/v1/users": {
"/jobs/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns a list of users belonging to the authenticated tenant.",
"description": "Get a single job posting by its ID",
"consumes": [
"application/json"
],
@ -152,111 +124,13 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Users"
"Jobs"
],
"summary": "List Users",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_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",
"summary": "Get job by ID",
"parameters": [
{
"description": "User Details",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateUserRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_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",
"type": "integer",
"description": "Job ID",
"name": "id",
"in": "path",
"required": true
@ -264,13 +138,103 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "User deleted",
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Job"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"403": {
"description": "Forbidden",
"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"
}
@ -286,105 +250,262 @@ const docTemplate = `{
}
},
"definitions": {
"github_com_rede5_gohorsejobs_backend_internal_core_dto.AuthResponse": {
"dto.CreateJobRequest": {
"type": "object",
"required": [
"companyId",
"description",
"title"
],
"properties": {
"token": {
"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"
},
"user": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.UserResponse"
"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"
}
}
},
"github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse": {
"dto.PaginatedResponse": {
"type": "object",
"properties": {
"created_at": {
"data": {},
"pagination": {
"$ref": "#/definitions/dto.Pagination"
}
}
},
"dto.Pagination": {
"type": "object",
"properties": {
"limit": {
"type": "integer"
},
"page": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"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"
}
}
},
"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"
},
"name": {
"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": {
"type": "string"
}
}
},
"github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateCompanyRequest": {
"type": "object",
"properties": {
"admin_email": {
"description": "Status",
"type": "string"
},
"contact": {
"title": {
"description": "Job Details",
"type": "string"
},
"document": {
"updatedAt": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateUserRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
"visaSupport": {
"description": "Visa \u0026 Language",
"type": "boolean"
},
"name": {
"type": "string"
},
"password": {
"type": "string"
},
"roles": {
"description": "e.g. [\"RECRUITER\"]",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"github_com_rede5_gohorsejobs_backend_internal_core_dto.LoginRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"github_com_rede5_gohorsejobs_backend_internal_core_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": {
"workingHours": {
"type": "string"
}
}

View file

@ -6,281 +6,15 @@
"contact": {},
"version": "1.0"
},
"host": "localhost:8521",
"host": "localhost:8080",
"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/github_com_rede5_gohorsejobs_backend_internal_core_dto.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_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/github_com_rede5_gohorsejobs_backend_internal_core_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/github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateCompanyRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse"
}
},
"400": {
"description": "Invalid 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/github_com_rede5_gohorsejobs_backend_internal_core_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/github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateUserRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_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"
}
}
}
}
},
"/jobs": {
"get": {
"description": "Get a paginated list of job postings with optional filters",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@ -291,13 +25,13 @@
"parameters": [
{
"type": "integer",
"description": "Page number",
"description": "Page number (default: 1)",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Items per page",
"description": "Items per page (default: 10, max: 100)",
"name": "limit",
"in": "query"
},
@ -306,13 +40,19 @@
"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": {
"type": "object"
"$ref": "#/definitions/dto.PaginatedResponse"
}
},
"500": {
@ -335,11 +75,22 @@
"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": {
"type": "object"
"$ref": "#/definitions/models.Job"
}
},
"400": {
@ -360,6 +111,9 @@
"/jobs/{id}": {
"get": {
"description": "Get a single job posting by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@ -380,7 +134,7 @@
"200": {
"description": "OK",
"schema": {
"type": "object"
"$ref": "#/definitions/models.Job"
}
},
"400": {
@ -416,13 +170,22 @@
"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": {
"type": "object"
"$ref": "#/definitions/models.Job"
}
},
"400": {
@ -441,6 +204,9 @@
},
"delete": {
"description": "Delete a job posting",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
@ -478,105 +244,262 @@
}
},
"definitions": {
"github_com_rede5_gohorsejobs_backend_internal_core_dto.AuthResponse": {
"dto.CreateJobRequest": {
"type": "object",
"required": [
"companyId",
"description",
"title"
],
"properties": {
"token": {
"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"
},
"user": {
"$ref": "#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.UserResponse"
"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"
}
}
},
"github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse": {
"dto.PaginatedResponse": {
"type": "object",
"properties": {
"created_at": {
"data": {},
"pagination": {
"$ref": "#/definitions/dto.Pagination"
}
}
},
"dto.Pagination": {
"type": "object",
"properties": {
"limit": {
"type": "integer"
},
"page": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"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"
}
}
},
"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"
},
"name": {
"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": {
"type": "string"
}
}
},
"github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateCompanyRequest": {
"type": "object",
"properties": {
"admin_email": {
"description": "Status",
"type": "string"
},
"contact": {
"title": {
"description": "Job Details",
"type": "string"
},
"document": {
"updatedAt": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateUserRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
"visaSupport": {
"description": "Visa \u0026 Language",
"type": "boolean"
},
"name": {
"type": "string"
},
"password": {
"type": "string"
},
"roles": {
"description": "e.g. [\"RECRUITER\"]",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"github_com_rede5_gohorsejobs_backend_internal_core_dto.LoginRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"github_com_rede5_gohorsejobs_backend_internal_core_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": {
"workingHours": {
"type": "string"
}
}

View file

@ -1,70 +1,186 @@
basePath: /
definitions:
github_com_rede5_gohorsejobs_backend_internal_core_dto.AuthResponse:
dto.CreateJobRequest:
properties:
token:
benefits:
additionalProperties: true
type: object
cityId:
type: integer
companyId:
type: integer
description:
minLength: 20
type: string
user:
$ref: '#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.UserResponse'
type: object
github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse:
properties:
created_at:
employmentType:
enum:
- full-time
- part-time
- dispatch
- contract
type: string
id:
languageLevel:
type: string
name:
location:
type: string
regionId:
type: integer
requirements:
additionalProperties: true
type: object
salaryMax:
type: number
salaryMin:
type: number
salaryType:
enum:
- hourly
- monthly
- yearly
type: string
status:
enum:
- draft
- open
- closed
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.UpdateJobRequest:
properties:
benefits:
additionalProperties: true
type: object
cityId:
type: integer
description:
minLength: 20
type: string
employmentType:
enum:
- full-time
- part-time
- dispatch
- contract
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
- monthly
- yearly
type: string
status:
enum:
- draft
- open
- closed
type: string
title:
maxLength: 255
minLength: 5
type: string
visaSupport:
type: boolean
workingHours:
type: string
type: object
github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateCompanyRequest:
properties:
admin_email:
type: string
contact:
type: string
document:
type: string
name:
type: string
models.JSONMap:
additionalProperties: true
type: object
github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateUserRequest:
models.Job:
properties:
email:
benefits:
$ref: '#/definitions/models.JSONMap'
cityId:
type: integer
companyId:
type: integer
createdAt:
description: Metadata
type: string
name:
createdBy:
type: integer
description:
type: string
password:
type: string
roles:
description: e.g. ["RECRUITER"]
items:
type: string
type: array
type: object
github_com_rede5_gohorsejobs_backend_internal_core_dto.LoginRequest:
properties:
email:
type: string
password:
type: string
type: object
github_com_rede5_gohorsejobs_backend_internal_core_dto.UserResponse:
properties:
created_at:
type: string
email:
employmentType:
description: Employment
type: string
id:
type: integer
isFeatured:
description: Featured job flag
type: boolean
languageLevel:
description: N5-N1, beginner, none
type: string
name:
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, monthly, yearly
type: string
roles:
items:
type: string
type: array
status:
description: Status
type: string
title:
description: Job Details
type: string
updatedAt:
type: string
visaSupport:
description: Visa & Language
type: boolean
workingHours:
type: string
type: object
host: localhost:8080
@ -74,178 +190,158 @@ info:
title: GoHorseJobs API
version: "1.0"
paths:
/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:
$ref: '#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.LoginRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.AuthResponse'
"400":
description: Invalid Request
schema:
type: string
"401":
description: Unauthorized
schema:
type: string
summary: User Login
tags:
- Auth
/api/v1/companies:
/jobs:
get:
consumes:
- application/json
description: Returns a list of all companies.
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:
items:
$ref: '#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse'
type: array
$ref: '#/definitions/dto.PaginatedResponse'
"500":
description: Internal Server Error
schema:
type: string
summary: List Companies
summary: List all jobs
tags:
- Companies
- Jobs
post:
consumes:
- application/json
description: Registers a new company and creates an initial admin user.
description: Create a new job posting
parameters:
- description: Company Details
- description: Job data
in: body
name: company
name: job
required: true
schema:
$ref: '#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateCompanyRequest'
$ref: '#/definitions/dto.CreateJobRequest'
produces:
- application/json
responses:
"200":
description: OK
"201":
description: Created
schema:
$ref: '#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CompanyResponse'
$ref: '#/definitions/models.Job'
"400":
description: Invalid Request
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
summary: Create Company (Tenant)
summary: Create a new job
tags:
- Companies
/api/v1/users:
get:
consumes:
- application/json
description: Returns a list of users belonging to the authenticated tenant.
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.UserResponse'
type: array
"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:
$ref: '#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.CreateUserRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/github_com_rede5_gohorsejobs_backend_internal_core_dto.UserResponse'
"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}:
- Jobs
/jobs/{id}:
delete:
consumes:
- application/json
description: Deletes a user by ID. Must belong to the same tenant.
description: Delete a job posting
parameters:
- description: User ID
- description: Job ID
in: path
name: id
required: true
type: string
type: integer
produces:
- application/json
responses:
"200":
description: User deleted
schema:
type: string
"403":
description: Forbidden
"204":
description: No Content
"400":
description: Bad Request
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- BearerAuth: []
summary: Delete User
summary: Delete a job
tags:
- Users
- 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
swagger: "2.0"

View file

@ -1,12 +1,19 @@
package handlers
import (
"encoding/json"
"net/http"
"strconv"
"encoding/json"
"net/http"
"strconv"
"github.com/rede5/gohorsejobs/backend/internal/dto"
"github.com/rede5/gohorsejobs/backend/internal/services"
"github.com/rede5/gohorsejobs/backend/internal/dto"
"github.com/rede5/gohorsejobs/backend/internal/models"
"github.com/rede5/gohorsejobs/backend/internal/services"
)
// swaggerTypes ensures swagger can resolve referenced response models.
var (
_ models.Job
_ models.JobWithCompany
)
type JobHandler struct {