diff --git a/backend/docs/docs.go b/backend/docs/docs.go index c103354..f0aca17 100644 --- a/backend/docs/docs.go +++ b/backend/docs/docs.go @@ -15,6 +15,194 @@ const docTemplate = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { + "/api/v1/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" + } + } + } + } + }, + "/api/v1/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" + } + } + } + } + }, + "/api/v1/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" + } + } + } + } + }, "/api/v1/auth/login": { "post": { "description": "Authenticates a user by email and password. Returns JWT and user info.", @@ -137,6 +325,239 @@ const docTemplate = `{ } } }, + "/api/v1/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" + } + } + } + } + }, + "/api/v1/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" + } + } + } + } + }, "/api/v1/storage/download-url": { "post": { "security": [ @@ -431,427 +852,6 @@ const docTemplate = `{ } } } - }, - "/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": { diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index d66b8d8..7eff63a 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -8,6 +8,194 @@ }, "basePath": "/", "paths": { + "/api/v1/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" + } + } + } + } + }, + "/api/v1/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" + } + } + } + } + }, + "/api/v1/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" + } + } + } + } + }, "/api/v1/auth/login": { "post": { "description": "Authenticates a user by email and password. Returns JWT and user info.", @@ -130,6 +318,239 @@ } } }, + "/api/v1/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" + } + } + } + } + }, + "/api/v1/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" + } + } + } + } + }, "/api/v1/storage/download-url": { "post": { "security": [ @@ -424,427 +845,6 @@ } } } - }, - "/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": { diff --git a/backend/docs/swagger.yaml b/backend/docs/swagger.yaml index 4ccc67b..3eeb934 100644 --- a/backend/docs/swagger.yaml +++ b/backend/docs/swagger.yaml @@ -400,6 +400,130 @@ info: 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}: + 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: @@ -481,6 +605,160 @@ paths: summary: Create Company (Tenant) 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 + "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/storage/download-url: post: consumes: @@ -667,282 +945,4 @@ paths: summary: Delete User tags: - Users - /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 - /applications/{id}: - 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 - /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 - /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 - "500": - description: Internal Server Error - schema: - type: string - summary: Create a new job - tags: - - Jobs - /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 swagger: "2.0" diff --git a/backend/internal/handlers/application_handler.go b/backend/internal/handlers/application_handler.go index cbe9b40..8b3559e 100644 --- a/backend/internal/handlers/application_handler.go +++ b/backend/internal/handlers/application_handler.go @@ -27,7 +27,7 @@ func NewApplicationHandler(service *services.ApplicationService) *ApplicationHan // @Success 201 {object} models.Application // @Failure 400 {string} string "Bad Request" // @Failure 500 {string} string "Internal Server Error" -// @Router /applications [post] +// @Router /api/v1/applications [post] func (h *ApplicationHandler) CreateApplication(w http.ResponseWriter, r *http.Request) { var req dto.CreateApplicationRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { @@ -56,7 +56,7 @@ func (h *ApplicationHandler) CreateApplication(w http.ResponseWriter, r *http.Re // @Success 200 {array} models.Application // @Failure 400 {string} string "Bad Request" // @Failure 500 {string} string "Internal Server Error" -// @Router /applications [get] +// @Router /api/v1/applications [get] func (h *ApplicationHandler) GetApplications(w http.ResponseWriter, r *http.Request) { // For now, simple get by Job ID query param jobIDStr := r.URL.Query().Get("jobId") @@ -90,7 +90,7 @@ func (h *ApplicationHandler) GetApplications(w http.ResponseWriter, r *http.Requ // @Success 200 {object} models.Application // @Failure 400 {string} string "Bad Request" // @Failure 404 {string} string "Not Found" -// @Router /applications/{id} [get] +// @Router /api/v1/applications/{id} [get] func (h *ApplicationHandler) GetApplicationByID(w http.ResponseWriter, r *http.Request) { idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) @@ -120,7 +120,7 @@ func (h *ApplicationHandler) GetApplicationByID(w http.ResponseWriter, r *http.R // @Success 200 {object} models.Application // @Failure 400 {string} string "Bad Request" // @Failure 500 {string} string "Internal Server Error" -// @Router /applications/{id}/status [put] +// @Router /api/v1/applications/{id}/status [put] func (h *ApplicationHandler) UpdateApplicationStatus(w http.ResponseWriter, r *http.Request) { idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) diff --git a/backend/internal/handlers/job_handler.go b/backend/internal/handlers/job_handler.go index f2bd057..71dc796 100755 --- a/backend/internal/handlers/job_handler.go +++ b/backend/internal/handlers/job_handler.go @@ -1,19 +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/models" - "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 + _ models.Job + _ models.JobWithCompany ) type JobHandler struct { @@ -36,7 +36,7 @@ func NewJobHandler(service *services.JobService) *JobHandler { // @Param featured query bool false "Filter by featured status" // @Success 200 {object} dto.PaginatedResponse // @Failure 500 {string} string "Internal Server Error" -// @Router /jobs [get] +// @Router /api/v1/jobs [get] func (h *JobHandler) GetJobs(w http.ResponseWriter, r *http.Request) { page, _ := strconv.Atoi(r.URL.Query().Get("page")) limit, _ := strconv.Atoi(r.URL.Query().Get("limit")) @@ -86,7 +86,7 @@ func (h *JobHandler) GetJobs(w http.ResponseWriter, r *http.Request) { // @Success 201 {object} models.Job // @Failure 400 {string} string "Bad Request" // @Failure 500 {string} string "Internal Server Error" -// @Router /jobs [post] +// @Router /api/v1/jobs [post] func (h *JobHandler) CreateJob(w http.ResponseWriter, r *http.Request) { var req dto.CreateJobRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { @@ -117,7 +117,7 @@ func (h *JobHandler) CreateJob(w http.ResponseWriter, r *http.Request) { // @Success 200 {object} models.Job // @Failure 400 {string} string "Bad Request" // @Failure 404 {string} string "Not Found" -// @Router /jobs/{id} [get] +// @Router /api/v1/jobs/{id} [get] func (h *JobHandler) GetJobByID(w http.ResponseWriter, r *http.Request) { idStr := r.PathValue("id") // Go 1.22+ routing @@ -148,7 +148,7 @@ func (h *JobHandler) GetJobByID(w http.ResponseWriter, r *http.Request) { // @Success 200 {object} models.Job // @Failure 400 {string} string "Bad Request" // @Failure 500 {string} string "Internal Server Error" -// @Router /jobs/{id} [put] +// @Router /api/v1/jobs/{id} [put] func (h *JobHandler) UpdateJob(w http.ResponseWriter, r *http.Request) { idStr := r.PathValue("id") id, err := strconv.Atoi(idStr) @@ -183,7 +183,7 @@ func (h *JobHandler) UpdateJob(w http.ResponseWriter, r *http.Request) { // @Success 204 "No Content" // @Failure 400 {string} string "Bad Request" // @Failure 500 {string} string "Internal Server Error" -// @Router /jobs/{id} [delete] +// @Router /api/v1/jobs/{id} [delete] func (h *JobHandler) DeleteJob(w http.ResponseWriter, r *http.Request) { idStr := r.PathValue("id") id, err := strconv.Atoi(idStr)