diff --git a/backend/docs/docs.go b/backend/docs/docs.go index d02f33f..53876f8 100644 --- a/backend/docs/docs.go +++ b/backend/docs/docs.go @@ -148,6 +148,45 @@ const docTemplate = `{ } } } + }, + "delete": { + "description": "Remove an application by ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Applications" + ], + "summary": "Delete Application", + "parameters": [ + { + "type": "string", + "description": "Application 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/applications/{id}/status": { @@ -415,6 +454,12 @@ const docTemplate = `{ "type": "string" } }, + "401": { + "description": "Unauthorized", + "schema": { + "type": "string" + } + }, "500": { "description": "Internal Server Error", "schema": { @@ -582,7 +627,7 @@ const docTemplate = `{ "schema": { "type": "array", "items": { - "$ref": "#/definitions/models.Notification" + "type": "object" } } }, @@ -672,6 +717,122 @@ const docTemplate = `{ } } }, + "/api/v1/payments/create-checkout": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a Stripe checkout session for job posting payment", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Create checkout session", + "parameters": [ + { + "description": "Checkout request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.CreateCheckoutRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.CreateCheckoutResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "string" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/payments/status/{id}": { + "get": { + "description": "Get the status of a job posting payment", + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Get payment status", + "parameters": [ + { + "type": "string", + "description": "Payment ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "Not Found", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/payments/webhook": { + "post": { + "description": "Process Stripe webhook events (payment success, failure, etc.)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Handle Stripe webhook", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "string" + } + } + } + } + }, "/api/v1/storage/download-url": { "post": { "security": [ @@ -844,7 +1005,7 @@ const docTemplate = `{ "schema": { "type": "array", "items": { - "$ref": "#/definitions/models.Ticket" + "type": "object" } } }, @@ -888,7 +1049,7 @@ const docTemplate = `{ "201": { "description": "Created", "schema": { - "$ref": "#/definitions/models.Ticket" + "type": "object" } }, "400": { @@ -995,7 +1156,7 @@ const docTemplate = `{ "201": { "description": "Created", "schema": { - "$ref": "#/definitions/models.TicketMessage" + "type": "object" } }, "400": { @@ -1122,6 +1283,52 @@ const docTemplate = `{ } } }, + "/api/v1/users/me": { + "get": { + "security": [ + { + "BearerAuth": [] + }, + { + "BearerAuth": [] + } + ], + "description": "Returns the profile of the authenticated user.\nReturns the profile of the authenticated user.", + "consumes": [ + "application/json", + "application/json" + ], + "produces": [ + "application/json", + "application/json" + ], + "tags": [ + "Users", + "Users" + ], + "summary": "Get My Profile", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.User" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "type": "string" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "string" + } + } + } + } + }, "/api/v1/users/me/avatar": { "post": { "security": [ @@ -1609,6 +1816,63 @@ const docTemplate = `{ } } }, + "dto.User": { + "type": "object", + "properties": { + "companyId": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "role": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "handlers.CreateCheckoutRequest": { + "type": "object", + "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" + } + } + }, + "handlers.CreateCheckoutResponse": { + "type": "object", + "properties": { + "checkoutUrl": { + "type": "string" + }, + "sessionId": { + "type": "string" + } + } + }, "handlers.DownloadURLRequest": { "type": "object", "properties": { @@ -1816,87 +2080,6 @@ const docTemplate = `{ "type": "string" } } - }, - "models.Notification": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "id": { - "type": "string" - }, - "link": { - "type": "string" - }, - "message": { - "type": "string" - }, - "readAt": { - "type": "string" - }, - "title": { - "type": "string" - }, - "type": { - "description": "info, success, warning, error", - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "userId": { - "type": "integer" - } - } - }, - "models.Ticket": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "id": { - "type": "string" - }, - "priority": { - "description": "low, medium, high", - "type": "string" - }, - "status": { - "description": "open, in_progress, closed", - "type": "string" - }, - "subject": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "userId": { - "type": "integer" - } - } - }, - "models.TicketMessage": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "id": { - "type": "string" - }, - "message": { - "type": "string" - }, - "ticketId": { - "type": "string" - }, - "userId": { - "type": "integer" - } - } } } }` diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index 03706eb..8cef1b2 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -141,6 +141,45 @@ } } } + }, + "delete": { + "description": "Remove an application by ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Applications" + ], + "summary": "Delete Application", + "parameters": [ + { + "type": "string", + "description": "Application 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/applications/{id}/status": { @@ -408,6 +447,12 @@ "type": "string" } }, + "401": { + "description": "Unauthorized", + "schema": { + "type": "string" + } + }, "500": { "description": "Internal Server Error", "schema": { @@ -575,7 +620,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/models.Notification" + "type": "object" } } }, @@ -665,6 +710,122 @@ } } }, + "/api/v1/payments/create-checkout": { + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a Stripe checkout session for job posting payment", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Create checkout session", + "parameters": [ + { + "description": "Checkout request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/handlers.CreateCheckoutRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/handlers.CreateCheckoutResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "string" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/payments/status/{id}": { + "get": { + "description": "Get the status of a job posting payment", + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Get payment status", + "parameters": [ + { + "type": "string", + "description": "Payment ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "additionalProperties": true + } + }, + "404": { + "description": "Not Found", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/payments/webhook": { + "post": { + "description": "Process Stripe webhook events (payment success, failure, etc.)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Payments" + ], + "summary": "Handle Stripe webhook", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "type": "string" + } + } + } + } + }, "/api/v1/storage/download-url": { "post": { "security": [ @@ -837,7 +998,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/models.Ticket" + "type": "object" } } }, @@ -881,7 +1042,7 @@ "201": { "description": "Created", "schema": { - "$ref": "#/definitions/models.Ticket" + "type": "object" } }, "400": { @@ -988,7 +1149,7 @@ "201": { "description": "Created", "schema": { - "$ref": "#/definitions/models.TicketMessage" + "type": "object" } }, "400": { @@ -1115,6 +1276,52 @@ } } }, + "/api/v1/users/me": { + "get": { + "security": [ + { + "BearerAuth": [] + }, + { + "BearerAuth": [] + } + ], + "description": "Returns the profile of the authenticated user.\nReturns the profile of the authenticated user.", + "consumes": [ + "application/json", + "application/json" + ], + "produces": [ + "application/json", + "application/json" + ], + "tags": [ + "Users", + "Users" + ], + "summary": "Get My Profile", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.User" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "type": "string" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "type": "string" + } + } + } + } + }, "/api/v1/users/me/avatar": { "post": { "security": [ @@ -1602,6 +1809,63 @@ } } }, + "dto.User": { + "type": "object", + "properties": { + "companyId": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "role": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "handlers.CreateCheckoutRequest": { + "type": "object", + "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" + } + } + }, + "handlers.CreateCheckoutResponse": { + "type": "object", + "properties": { + "checkoutUrl": { + "type": "string" + }, + "sessionId": { + "type": "string" + } + } + }, "handlers.DownloadURLRequest": { "type": "object", "properties": { @@ -1809,87 +2073,6 @@ "type": "string" } } - }, - "models.Notification": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "id": { - "type": "string" - }, - "link": { - "type": "string" - }, - "message": { - "type": "string" - }, - "readAt": { - "type": "string" - }, - "title": { - "type": "string" - }, - "type": { - "description": "info, success, warning, error", - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "userId": { - "type": "integer" - } - } - }, - "models.Ticket": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "id": { - "type": "string" - }, - "priority": { - "description": "low, medium, high", - "type": "string" - }, - "status": { - "description": "open, in_progress, closed", - "type": "string" - }, - "subject": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "userId": { - "type": "integer" - } - } - }, - "models.TicketMessage": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "id": { - "type": "string" - }, - "message": { - "type": "string" - }, - "ticketId": { - "type": "string" - }, - "userId": { - "type": "integer" - } - } } } } \ No newline at end of file diff --git a/backend/docs/swagger.yaml b/backend/docs/swagger.yaml index 405a1aa..09dbbf8 100644 --- a/backend/docs/swagger.yaml +++ b/backend/docs/swagger.yaml @@ -204,6 +204,44 @@ definitions: 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: @@ -345,60 +383,6 @@ definitions: workingHours: type: string type: object - models.Notification: - properties: - createdAt: - type: string - id: - type: string - link: - type: string - message: - type: string - readAt: - type: string - title: - type: string - type: - description: info, success, warning, error - type: string - updatedAt: - type: string - userId: - type: integer - type: object - models.Ticket: - properties: - createdAt: - type: string - id: - type: string - priority: - description: low, medium, high - type: string - status: - description: open, in_progress, closed - type: string - subject: - type: string - updatedAt: - type: string - userId: - type: integer - type: object - models.TicketMessage: - properties: - createdAt: - type: string - id: - type: string - message: - type: string - ticketId: - type: string - userId: - type: integer - type: object info: contact: {} description: API for GoHorseJobs recruitment platform. @@ -466,6 +450,32 @@ paths: 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 @@ -668,6 +678,10 @@ paths: description: Bad Request schema: type: string + "401": + description: Unauthorized + schema: + type: string "500": description: Internal Server Error schema: @@ -776,7 +790,7 @@ paths: description: OK schema: items: - $ref: '#/definitions/models.Notification' + type: object type: array "500": description: Internal Server Error @@ -835,6 +849,81 @@ paths: 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: @@ -940,7 +1029,7 @@ paths: description: OK schema: items: - $ref: '#/definitions/models.Ticket' + type: object type: array "500": description: Internal Server Error @@ -968,7 +1057,7 @@ paths: "201": description: Created schema: - $ref: '#/definitions/models.Ticket' + type: object "400": description: Invalid Request schema: @@ -1036,7 +1125,7 @@ paths: "201": description: Created schema: - $ref: '#/definitions/models.TicketMessage' + type: object "400": description: Invalid Request schema: @@ -1186,6 +1275,37 @@ paths: 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: