From 9f8eab0fac36d99b74fa50db8683fb181ee1dfcb Mon Sep 17 00:00:00 2001 From: Jean Jacques Avril Date: Mon, 10 Mar 2025 22:40:10 +0000 Subject: [PATCH] feat: Update API routes and enhance Swagger documentation for activity handler --- backend/cmd/api/main.go | 2 +- backend/docs/docs.go | 4452 ++++++++++++++++- backend/docs/swagger.json | 4452 ++++++++++++++++- backend/docs/swagger.yaml | 2444 ++++++++- .../internal/api/handlers/activity_handler.go | 4 +- docu/swagger_documentation.md | 84 + 6 files changed, 11432 insertions(+), 6 deletions(-) create mode 100644 docu/swagger_documentation.md diff --git a/backend/cmd/api/main.go b/backend/cmd/api/main.go index 1219291..fefff99 100644 --- a/backend/cmd/api/main.go +++ b/backend/cmd/api/main.go @@ -54,7 +54,7 @@ func main() { r := gin.Default() // Basic route for health check - r.GET("/", helloHandler) + r.GET("/api", helloHandler) // Setup API routes routes.SetupRouter(r) diff --git a/backend/docs/docs.go b/backend/docs/docs.go index 2090165..9f7df14 100644 --- a/backend/docs/docs.go +++ b/backend/docs/docs.go @@ -32,6 +32,4456 @@ const docTemplate = `{ } } } + }, + "/activities": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all activities", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "activities" + ], + "summary": "Get all activities", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ActivityDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new activity", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "activities" + ], + "summary": "Create a new activity", + "parameters": [ + { + "description": "Activity data", + "name": "activity", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ActivityCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ActivityDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/activities/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get an activity by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "activities" + ], + "summary": "Get activity by ID", + "parameters": [ + { + "type": "string", + "description": "Activity ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ActivityDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing activity", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "activities" + ], + "summary": "Update an activity", + "parameters": [ + { + "type": "string", + "description": "Activity ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Activity data", + "name": "activity", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ActivityUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ActivityDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete an activity by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "activities" + ], + "summary": "Delete an activity", + "parameters": [ + { + "type": "string", + "description": "Activity ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/auth/login": { + "post": { + "description": "Authenticate a user and get a JWT token", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "auth" + ], + "summary": "Login", + "parameters": [ + { + "description": "Login credentials", + "name": "credentials", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.LoginDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.TokenDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/auth/me": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get the currently authenticated user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "auth" + ], + "summary": "Get current user", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.UserDto" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/companies": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all companies", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "companies" + ], + "summary": "Get all companies", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.CompanyDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new company", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "companies" + ], + "summary": "Create a new company", + "parameters": [ + { + "description": "Company data", + "name": "company", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.CompanyCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CompanyDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/companies/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a company by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "companies" + ], + "summary": "Get company by ID", + "parameters": [ + { + "type": "string", + "description": "Company ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CompanyDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing company", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "companies" + ], + "summary": "Update a company", + "parameters": [ + { + "type": "string", + "description": "Company ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Company data", + "name": "company", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.CompanyUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CompanyDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a company by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "companies" + ], + "summary": "Delete a company", + "parameters": [ + { + "type": "string", + "description": "Company ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/customers": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all customers", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Get all customers", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.CustomerDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new customer", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Create a new customer", + "parameters": [ + { + "description": "Customer data", + "name": "customer", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.CustomerCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CustomerDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/customers/company/{companyId}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of customers for a specific company", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Get customers by company ID", + "parameters": [ + { + "type": "integer", + "description": "Company ID", + "name": "companyId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.CustomerDto" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/customers/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a customer by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Get customer by ID", + "parameters": [ + { + "type": "string", + "description": "Customer ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CustomerDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing customer", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Update a customer", + "parameters": [ + { + "type": "string", + "description": "Customer ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Customer data", + "name": "customer", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.CustomerUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CustomerDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a customer by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Delete a customer", + "parameters": [ + { + "type": "string", + "description": "Customer ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/projects": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all projects", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Get all projects", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new project", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Create a new project", + "parameters": [ + { + "description": "Project data", + "name": "project", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ProjectCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/projects/customer/{customerId}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of projects for a specific customer", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Get projects by customer ID", + "parameters": [ + { + "type": "string", + "description": "Customer ID", + "name": "customerId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/projects/with-customers": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all projects with their associated customer information", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Get all projects with customer information", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/projects/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a project by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Get project by ID", + "parameters": [ + { + "type": "string", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing project", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Update a project", + "parameters": [ + { + "type": "string", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Project data", + "name": "project", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ProjectUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a project by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Delete a project", + "parameters": [ + { + "type": "string", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all time entries", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get all time entries", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new time entry", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Create a new time entry", + "parameters": [ + { + "description": "Time Entry data", + "name": "timeEntry", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.TimeEntryCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries/me": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of time entries for the currently authenticated user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get current user's time entries", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries/project/{projectId}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of time entries for a specific project", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get time entries by project ID", + "parameters": [ + { + "type": "string", + "description": "Project ID", + "name": "projectId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries/range": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of time entries within a specific date range", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get time entries by date range", + "parameters": [ + { + "type": "string", + "description": "Start date (ISO 8601 format)", + "name": "start", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "End date (ISO 8601 format)", + "name": "end", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries/user/{userId}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of time entries for a specific user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get time entries by user ID", + "parameters": [ + { + "type": "string", + "description": "User ID", + "name": "userId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a time entry by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get time entry by ID", + "parameters": [ + { + "type": "string", + "description": "Time Entry ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing time entry", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Update a time entry", + "parameters": [ + { + "type": "string", + "description": "Time Entry ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Time Entry data", + "name": "timeEntry", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.TimeEntryUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a time entry by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Delete a time entry", + "parameters": [ + { + "type": "string", + "description": "Time Entry ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/users": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all users", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "users" + ], + "summary": "Get all users", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.UserDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "users" + ], + "summary": "Create a new user", + "parameters": [ + { + "description": "User data", + "name": "user", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.UserCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.UserDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/users/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a user by their ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "users" + ], + "summary": "Get user by ID", + "parameters": [ + { + "type": "string", + "description": "User ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.UserDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "users" + ], + "summary": "Update a user", + "parameters": [ + { + "type": "string", + "description": "User ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "User data", + "name": "user", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.UserUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.UserDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a user by their ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "users" + ], + "summary": "Delete a user", + "parameters": [ + { + "type": "string", + "description": "User ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + } + }, + "definitions": { + "dto.ActivityCreateDto": { + "type": "object", + "properties": { + "billingRate": { + "type": "number" + }, + "name": { + "type": "string" + } + } + }, + "dto.ActivityDto": { + "type": "object", + "properties": { + "billingRate": { + "type": "number" + }, + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.ActivityUpdateDto": { + "type": "object", + "properties": { + "billingRate": { + "type": "number" + }, + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.CompanyCreateDto": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + } + }, + "dto.CompanyDto": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.CompanyUpdateDto": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.CustomerCreateDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "dto.CustomerDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.CustomerUpdateDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.LoginDto": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "dto.ProjectCreateDto": { + "type": "object", + "properties": { + "customerId": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "dto.ProjectDto": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "customerId": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.ProjectUpdateDto": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "customerId": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.TimeEntryCreateDto": { + "type": "object", + "properties": { + "activityId": { + "type": "integer" + }, + "billable": { + "description": "Percentage (0-100)", + "type": "integer" + }, + "description": { + "type": "string" + }, + "end": { + "type": "string" + }, + "projectId": { + "type": "integer" + }, + "start": { + "type": "string" + }, + "userId": { + "type": "integer" + } + } + }, + "dto.TimeEntryDto": { + "type": "object", + "properties": { + "activityId": { + "type": "integer" + }, + "billable": { + "description": "Percentage (0-100)", + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "end": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "projectId": { + "type": "integer" + }, + "start": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "userId": { + "type": "integer" + } + } + }, + "dto.TimeEntryUpdateDto": { + "type": "object", + "properties": { + "activityId": { + "type": "integer" + }, + "billable": { + "description": "Percentage (0-100)", + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "end": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "projectId": { + "type": "integer" + }, + "start": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "userId": { + "type": "integer" + } + } + }, + "dto.TokenDto": { + "type": "object", + "properties": { + "token": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/dto.UserDto" + } + } + }, + "dto.UserCreateDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "email": { + "type": "string" + }, + "hourlyRate": { + "type": "number" + }, + "password": { + "type": "string" + }, + "role": { + "type": "string" + } + } + }, + "dto.UserDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "email": { + "type": "string" + }, + "hourlyRate": { + "type": "number" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "role": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.UserUpdateDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "email": { + "type": "string" + }, + "hourlyRate": { + "type": "number" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "password": { + "type": "string" + }, + "role": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "utils.ErrorInfo": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "utils.Response": { + "type": "object", + "properties": { + "data": {}, + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + }, + "success": { + "type": "boolean" + } + } + } + }, + "securityDefinitions": { + "BearerAuth": { + "type": "apiKey", + "name": "Authorization", + "in": "header" } } }` @@ -40,7 +4490,7 @@ const docTemplate = `{ var SwaggerInfo = &swag.Spec{ Version: "1.0", Host: "localhost:8080", - BasePath: "/", + BasePath: "/api", Schemes: []string{}, Title: "Time Tracker API", Description: "This is a simple time tracker API.", diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index 07a18d4..158d343 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -7,7 +7,7 @@ "version": "1.0" }, "host": "localhost:8080", - "basePath": "/", + "basePath": "/api", "paths": { "/": { "get": { @@ -26,6 +26,4456 @@ } } } + }, + "/activities": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all activities", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "activities" + ], + "summary": "Get all activities", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ActivityDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new activity", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "activities" + ], + "summary": "Create a new activity", + "parameters": [ + { + "description": "Activity data", + "name": "activity", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ActivityCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ActivityDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/activities/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get an activity by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "activities" + ], + "summary": "Get activity by ID", + "parameters": [ + { + "type": "string", + "description": "Activity ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ActivityDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing activity", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "activities" + ], + "summary": "Update an activity", + "parameters": [ + { + "type": "string", + "description": "Activity ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Activity data", + "name": "activity", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ActivityUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ActivityDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete an activity by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "activities" + ], + "summary": "Delete an activity", + "parameters": [ + { + "type": "string", + "description": "Activity ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/auth/login": { + "post": { + "description": "Authenticate a user and get a JWT token", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "auth" + ], + "summary": "Login", + "parameters": [ + { + "description": "Login credentials", + "name": "credentials", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.LoginDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.TokenDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/auth/me": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get the currently authenticated user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "auth" + ], + "summary": "Get current user", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.UserDto" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/companies": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all companies", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "companies" + ], + "summary": "Get all companies", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.CompanyDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new company", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "companies" + ], + "summary": "Create a new company", + "parameters": [ + { + "description": "Company data", + "name": "company", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.CompanyCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CompanyDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/companies/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a company by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "companies" + ], + "summary": "Get company by ID", + "parameters": [ + { + "type": "string", + "description": "Company ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CompanyDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing company", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "companies" + ], + "summary": "Update a company", + "parameters": [ + { + "type": "string", + "description": "Company ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Company data", + "name": "company", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.CompanyUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CompanyDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a company by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "companies" + ], + "summary": "Delete a company", + "parameters": [ + { + "type": "string", + "description": "Company ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/customers": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all customers", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Get all customers", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.CustomerDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new customer", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Create a new customer", + "parameters": [ + { + "description": "Customer data", + "name": "customer", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.CustomerCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CustomerDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/customers/company/{companyId}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of customers for a specific company", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Get customers by company ID", + "parameters": [ + { + "type": "integer", + "description": "Company ID", + "name": "companyId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.CustomerDto" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/customers/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a customer by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Get customer by ID", + "parameters": [ + { + "type": "string", + "description": "Customer ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CustomerDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing customer", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Update a customer", + "parameters": [ + { + "type": "string", + "description": "Customer ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Customer data", + "name": "customer", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.CustomerUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.CustomerDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a customer by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "customers" + ], + "summary": "Delete a customer", + "parameters": [ + { + "type": "string", + "description": "Customer ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/projects": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all projects", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Get all projects", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new project", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Create a new project", + "parameters": [ + { + "description": "Project data", + "name": "project", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ProjectCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/projects/customer/{customerId}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of projects for a specific customer", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Get projects by customer ID", + "parameters": [ + { + "type": "string", + "description": "Customer ID", + "name": "customerId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/projects/with-customers": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all projects with their associated customer information", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Get all projects with customer information", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/projects/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a project by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Get project by ID", + "parameters": [ + { + "type": "string", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing project", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Update a project", + "parameters": [ + { + "type": "string", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Project data", + "name": "project", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.ProjectUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.ProjectDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a project by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "projects" + ], + "summary": "Delete a project", + "parameters": [ + { + "type": "string", + "description": "Project ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all time entries", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get all time entries", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new time entry", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Create a new time entry", + "parameters": [ + { + "description": "Time Entry data", + "name": "timeEntry", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.TimeEntryCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries/me": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of time entries for the currently authenticated user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get current user's time entries", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries/project/{projectId}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of time entries for a specific project", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get time entries by project ID", + "parameters": [ + { + "type": "string", + "description": "Project ID", + "name": "projectId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries/range": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of time entries within a specific date range", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get time entries by date range", + "parameters": [ + { + "type": "string", + "description": "Start date (ISO 8601 format)", + "name": "start", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "End date (ISO 8601 format)", + "name": "end", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries/user/{userId}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of time entries for a specific user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get time entries by user ID", + "parameters": [ + { + "type": "string", + "description": "User ID", + "name": "userId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/time-entries/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a time entry by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Get time entry by ID", + "parameters": [ + { + "type": "string", + "description": "Time Entry ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing time entry", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Update a time entry", + "parameters": [ + { + "type": "string", + "description": "Time Entry ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Time Entry data", + "name": "timeEntry", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.TimeEntryUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.TimeEntryDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a time entry by its ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "time-entries" + ], + "summary": "Delete a time entry", + "parameters": [ + { + "type": "string", + "description": "Time Entry ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/users": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a list of all users", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "users" + ], + "summary": "Get all users", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.UserDto" + } + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "post": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Create a new user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "users" + ], + "summary": "Create a new user", + "parameters": [ + { + "description": "User data", + "name": "user", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.UserCreateDto" + } + } + ], + "responses": { + "201": { + "description": "Created", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.UserDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + }, + "/users/{id}": { + "get": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Get a user by their ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "users" + ], + "summary": "Get user by ID", + "parameters": [ + { + "type": "string", + "description": "User ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.UserDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Update an existing user", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "users" + ], + "summary": "Update a user", + "parameters": [ + { + "type": "string", + "description": "User ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "User data", + "name": "user", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.UserUpdateDto" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/dto.UserDto" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "404": { + "description": "Not Found", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "Delete a user by their ID", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "users" + ], + "summary": "Delete a user", + "parameters": [ + { + "type": "string", + "description": "User ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "204": { + "description": "No Content", + "schema": { + "$ref": "#/definitions/utils.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/utils.Response" + }, + { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + } + } + } + ] + } + } + } + } + } + }, + "definitions": { + "dto.ActivityCreateDto": { + "type": "object", + "properties": { + "billingRate": { + "type": "number" + }, + "name": { + "type": "string" + } + } + }, + "dto.ActivityDto": { + "type": "object", + "properties": { + "billingRate": { + "type": "number" + }, + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.ActivityUpdateDto": { + "type": "object", + "properties": { + "billingRate": { + "type": "number" + }, + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.CompanyCreateDto": { + "type": "object", + "properties": { + "name": { + "type": "string" + } + } + }, + "dto.CompanyDto": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.CompanyUpdateDto": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.CustomerCreateDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "dto.CustomerDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.CustomerUpdateDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.LoginDto": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "dto.ProjectCreateDto": { + "type": "object", + "properties": { + "customerId": { + "type": "integer" + }, + "name": { + "type": "string" + } + } + }, + "dto.ProjectDto": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "customerId": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.ProjectUpdateDto": { + "type": "object", + "properties": { + "createdAt": { + "type": "string" + }, + "customerId": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.TimeEntryCreateDto": { + "type": "object", + "properties": { + "activityId": { + "type": "integer" + }, + "billable": { + "description": "Percentage (0-100)", + "type": "integer" + }, + "description": { + "type": "string" + }, + "end": { + "type": "string" + }, + "projectId": { + "type": "integer" + }, + "start": { + "type": "string" + }, + "userId": { + "type": "integer" + } + } + }, + "dto.TimeEntryDto": { + "type": "object", + "properties": { + "activityId": { + "type": "integer" + }, + "billable": { + "description": "Percentage (0-100)", + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "end": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "projectId": { + "type": "integer" + }, + "start": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "userId": { + "type": "integer" + } + } + }, + "dto.TimeEntryUpdateDto": { + "type": "object", + "properties": { + "activityId": { + "type": "integer" + }, + "billable": { + "description": "Percentage (0-100)", + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "end": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "projectId": { + "type": "integer" + }, + "start": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "userId": { + "type": "integer" + } + } + }, + "dto.TokenDto": { + "type": "object", + "properties": { + "token": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/dto.UserDto" + } + } + }, + "dto.UserCreateDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "email": { + "type": "string" + }, + "hourlyRate": { + "type": "number" + }, + "password": { + "type": "string" + }, + "role": { + "type": "string" + } + } + }, + "dto.UserDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "email": { + "type": "string" + }, + "hourlyRate": { + "type": "number" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "role": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "dto.UserUpdateDto": { + "type": "object", + "properties": { + "companyId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "email": { + "type": "string" + }, + "hourlyRate": { + "type": "number" + }, + "id": { + "type": "string" + }, + "lastEditorID": { + "type": "string" + }, + "password": { + "type": "string" + }, + "role": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "utils.ErrorInfo": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + } + } + }, + "utils.Response": { + "type": "object", + "properties": { + "data": {}, + "error": { + "$ref": "#/definitions/utils.ErrorInfo" + }, + "success": { + "type": "boolean" + } + } + } + }, + "securityDefinitions": { + "BearerAuth": { + "type": "apiKey", + "name": "Authorization", + "in": "header" } } } \ No newline at end of file diff --git a/backend/docs/swagger.yaml b/backend/docs/swagger.yaml index c3ef2db..374f3ee 100644 --- a/backend/docs/swagger.yaml +++ b/backend/docs/swagger.yaml @@ -1,4 +1,299 @@ -basePath: / +basePath: /api +definitions: + dto.ActivityCreateDto: + properties: + billingRate: + type: number + name: + type: string + type: object + dto.ActivityDto: + properties: + billingRate: + type: number + createdAt: + type: string + id: + type: string + lastEditorID: + type: string + name: + type: string + updatedAt: + type: string + type: object + dto.ActivityUpdateDto: + properties: + billingRate: + type: number + createdAt: + type: string + id: + type: string + lastEditorID: + type: string + name: + type: string + updatedAt: + type: string + type: object + dto.CompanyCreateDto: + properties: + name: + type: string + type: object + dto.CompanyDto: + properties: + createdAt: + type: string + id: + type: string + lastEditorID: + type: string + name: + type: string + updatedAt: + type: string + type: object + dto.CompanyUpdateDto: + properties: + createdAt: + type: string + id: + type: string + lastEditorID: + type: string + name: + type: string + updatedAt: + type: string + type: object + dto.CustomerCreateDto: + properties: + companyId: + type: integer + name: + type: string + type: object + dto.CustomerDto: + properties: + companyId: + type: integer + createdAt: + type: string + id: + type: string + lastEditorID: + type: string + name: + type: string + updatedAt: + type: string + type: object + dto.CustomerUpdateDto: + properties: + companyId: + type: integer + createdAt: + type: string + id: + type: string + lastEditorID: + type: string + name: + type: string + updatedAt: + type: string + type: object + dto.LoginDto: + properties: + email: + type: string + password: + type: string + type: object + dto.ProjectCreateDto: + properties: + customerId: + type: integer + name: + type: string + type: object + dto.ProjectDto: + properties: + createdAt: + type: string + customerId: + type: integer + id: + type: string + lastEditorID: + type: string + name: + type: string + updatedAt: + type: string + type: object + dto.ProjectUpdateDto: + properties: + createdAt: + type: string + customerId: + type: integer + id: + type: string + lastEditorID: + type: string + name: + type: string + updatedAt: + type: string + type: object + dto.TimeEntryCreateDto: + properties: + activityId: + type: integer + billable: + description: Percentage (0-100) + type: integer + description: + type: string + end: + type: string + projectId: + type: integer + start: + type: string + userId: + type: integer + type: object + dto.TimeEntryDto: + properties: + activityId: + type: integer + billable: + description: Percentage (0-100) + type: integer + createdAt: + type: string + description: + type: string + end: + type: string + id: + type: string + lastEditorID: + type: string + projectId: + type: integer + start: + type: string + updatedAt: + type: string + userId: + type: integer + type: object + dto.TimeEntryUpdateDto: + properties: + activityId: + type: integer + billable: + description: Percentage (0-100) + type: integer + createdAt: + type: string + description: + type: string + end: + type: string + id: + type: string + lastEditorID: + type: string + projectId: + type: integer + start: + type: string + updatedAt: + type: string + userId: + type: integer + type: object + dto.TokenDto: + properties: + token: + type: string + user: + $ref: '#/definitions/dto.UserDto' + type: object + dto.UserCreateDto: + properties: + companyId: + type: integer + email: + type: string + hourlyRate: + type: number + password: + type: string + role: + type: string + type: object + dto.UserDto: + properties: + companyId: + type: integer + createdAt: + type: string + email: + type: string + hourlyRate: + type: number + id: + type: string + lastEditorID: + type: string + role: + type: string + updatedAt: + type: string + type: object + dto.UserUpdateDto: + properties: + companyId: + type: integer + createdAt: + type: string + email: + type: string + hourlyRate: + type: number + id: + type: string + lastEditorID: + type: string + password: + type: string + role: + type: string + updatedAt: + type: string + type: object + utils.ErrorInfo: + properties: + code: + type: string + message: + type: string + type: object + utils.Response: + properties: + data: {} + error: + $ref: '#/definitions/utils.ErrorInfo' + success: + type: boolean + type: object host: localhost:8080 info: contact: {} @@ -18,4 +313,2151 @@ paths: schema: type: string summary: Say hello + /activities: + get: + consumes: + - application/json + description: Get a list of all activities + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.ActivityDto' + type: array + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get all activities + tags: + - activities + post: + consumes: + - application/json + description: Create a new activity + parameters: + - description: Activity data + in: body + name: activity + required: true + schema: + $ref: '#/definitions/dto.ActivityCreateDto' + produces: + - application/json + responses: + "201": + description: Created + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.ActivityDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Create a new activity + tags: + - activities + /activities/{id}: + delete: + consumes: + - application/json + description: Delete an activity by its ID + parameters: + - description: Activity ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "204": + description: No Content + schema: + $ref: '#/definitions/utils.Response' + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Delete an activity + tags: + - activities + get: + consumes: + - application/json + description: Get an activity by its ID + parameters: + - description: Activity ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.ActivityDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get activity by ID + tags: + - activities + put: + consumes: + - application/json + description: Update an existing activity + parameters: + - description: Activity ID + in: path + name: id + required: true + type: string + - description: Activity data + in: body + name: activity + required: true + schema: + $ref: '#/definitions/dto.ActivityUpdateDto' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.ActivityDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Update an activity + tags: + - activities + /auth/login: + post: + consumes: + - application/json + description: Authenticate a user and get a JWT token + parameters: + - description: Login credentials + in: body + name: credentials + required: true + schema: + $ref: '#/definitions/dto.LoginDto' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.TokenDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + summary: Login + tags: + - auth + /auth/me: + get: + consumes: + - application/json + description: Get the currently authenticated user + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.UserDto' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get current user + tags: + - auth + /companies: + get: + consumes: + - application/json + description: Get a list of all companies + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.CompanyDto' + type: array + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get all companies + tags: + - companies + post: + consumes: + - application/json + description: Create a new company + parameters: + - description: Company data + in: body + name: company + required: true + schema: + $ref: '#/definitions/dto.CompanyCreateDto' + produces: + - application/json + responses: + "201": + description: Created + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.CompanyDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Create a new company + tags: + - companies + /companies/{id}: + delete: + consumes: + - application/json + description: Delete a company by its ID + parameters: + - description: Company ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "204": + description: No Content + schema: + $ref: '#/definitions/utils.Response' + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Delete a company + tags: + - companies + get: + consumes: + - application/json + description: Get a company by its ID + parameters: + - description: Company ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.CompanyDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get company by ID + tags: + - companies + put: + consumes: + - application/json + description: Update an existing company + parameters: + - description: Company ID + in: path + name: id + required: true + type: string + - description: Company data + in: body + name: company + required: true + schema: + $ref: '#/definitions/dto.CompanyUpdateDto' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.CompanyDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Update a company + tags: + - companies + /customers: + get: + consumes: + - application/json + description: Get a list of all customers + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.CustomerDto' + type: array + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get all customers + tags: + - customers + post: + consumes: + - application/json + description: Create a new customer + parameters: + - description: Customer data + in: body + name: customer + required: true + schema: + $ref: '#/definitions/dto.CustomerCreateDto' + produces: + - application/json + responses: + "201": + description: Created + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.CustomerDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Create a new customer + tags: + - customers + /customers/{id}: + delete: + consumes: + - application/json + description: Delete a customer by its ID + parameters: + - description: Customer ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "204": + description: No Content + schema: + $ref: '#/definitions/utils.Response' + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Delete a customer + tags: + - customers + get: + consumes: + - application/json + description: Get a customer by its ID + parameters: + - description: Customer ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.CustomerDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get customer by ID + tags: + - customers + put: + consumes: + - application/json + description: Update an existing customer + parameters: + - description: Customer ID + in: path + name: id + required: true + type: string + - description: Customer data + in: body + name: customer + required: true + schema: + $ref: '#/definitions/dto.CustomerUpdateDto' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.CustomerDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Update a customer + tags: + - customers + /customers/company/{companyId}: + get: + consumes: + - application/json + description: Get a list of customers for a specific company + parameters: + - description: Company ID + in: path + name: companyId + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.CustomerDto' + type: array + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get customers by company ID + tags: + - customers + /projects: + get: + consumes: + - application/json + description: Get a list of all projects + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.ProjectDto' + type: array + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get all projects + tags: + - projects + post: + consumes: + - application/json + description: Create a new project + parameters: + - description: Project data + in: body + name: project + required: true + schema: + $ref: '#/definitions/dto.ProjectCreateDto' + produces: + - application/json + responses: + "201": + description: Created + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.ProjectDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Create a new project + tags: + - projects + /projects/{id}: + delete: + consumes: + - application/json + description: Delete a project by its ID + parameters: + - description: Project ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "204": + description: No Content + schema: + $ref: '#/definitions/utils.Response' + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Delete a project + tags: + - projects + get: + consumes: + - application/json + description: Get a project by its ID + parameters: + - description: Project ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.ProjectDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get project by ID + tags: + - projects + put: + consumes: + - application/json + description: Update an existing project + parameters: + - description: Project ID + in: path + name: id + required: true + type: string + - description: Project data + in: body + name: project + required: true + schema: + $ref: '#/definitions/dto.ProjectUpdateDto' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.ProjectDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Update a project + tags: + - projects + /projects/customer/{customerId}: + get: + consumes: + - application/json + description: Get a list of projects for a specific customer + parameters: + - description: Customer ID + in: path + name: customerId + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.ProjectDto' + type: array + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get projects by customer ID + tags: + - projects + /projects/with-customers: + get: + consumes: + - application/json + description: Get a list of all projects with their associated customer information + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.ProjectDto' + type: array + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get all projects with customer information + tags: + - projects + /time-entries: + get: + consumes: + - application/json + description: Get a list of all time entries + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.TimeEntryDto' + type: array + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get all time entries + tags: + - time-entries + post: + consumes: + - application/json + description: Create a new time entry + parameters: + - description: Time Entry data + in: body + name: timeEntry + required: true + schema: + $ref: '#/definitions/dto.TimeEntryCreateDto' + produces: + - application/json + responses: + "201": + description: Created + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.TimeEntryDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Create a new time entry + tags: + - time-entries + /time-entries/{id}: + delete: + consumes: + - application/json + description: Delete a time entry by its ID + parameters: + - description: Time Entry ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "204": + description: No Content + schema: + $ref: '#/definitions/utils.Response' + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Delete a time entry + tags: + - time-entries + get: + consumes: + - application/json + description: Get a time entry by its ID + parameters: + - description: Time Entry ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.TimeEntryDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get time entry by ID + tags: + - time-entries + put: + consumes: + - application/json + description: Update an existing time entry + parameters: + - description: Time Entry ID + in: path + name: id + required: true + type: string + - description: Time Entry data + in: body + name: timeEntry + required: true + schema: + $ref: '#/definitions/dto.TimeEntryUpdateDto' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.TimeEntryDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Update a time entry + tags: + - time-entries + /time-entries/me: + get: + consumes: + - application/json + description: Get a list of time entries for the currently authenticated user + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.TimeEntryDto' + type: array + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get current user's time entries + tags: + - time-entries + /time-entries/project/{projectId}: + get: + consumes: + - application/json + description: Get a list of time entries for a specific project + parameters: + - description: Project ID + in: path + name: projectId + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.TimeEntryDto' + type: array + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get time entries by project ID + tags: + - time-entries + /time-entries/range: + get: + consumes: + - application/json + description: Get a list of time entries within a specific date range + parameters: + - description: Start date (ISO 8601 format) + in: query + name: start + required: true + type: string + - description: End date (ISO 8601 format) + in: query + name: end + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.TimeEntryDto' + type: array + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get time entries by date range + tags: + - time-entries + /time-entries/user/{userId}: + get: + consumes: + - application/json + description: Get a list of time entries for a specific user + parameters: + - description: User ID + in: path + name: userId + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.TimeEntryDto' + type: array + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get time entries by user ID + tags: + - time-entries + /users: + get: + consumes: + - application/json + description: Get a list of all users + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + items: + $ref: '#/definitions/dto.UserDto' + type: array + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get all users + tags: + - users + post: + consumes: + - application/json + description: Create a new user + parameters: + - description: User data + in: body + name: user + required: true + schema: + $ref: '#/definitions/dto.UserCreateDto' + produces: + - application/json + responses: + "201": + description: Created + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.UserDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Create a new user + tags: + - users + /users/{id}: + delete: + consumes: + - application/json + description: Delete a user by their ID + parameters: + - description: User ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "204": + description: No Content + schema: + $ref: '#/definitions/utils.Response' + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Delete a user + tags: + - users + get: + consumes: + - application/json + description: Get a user by their ID + parameters: + - description: User ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.UserDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Get user by ID + tags: + - users + put: + consumes: + - application/json + description: Update an existing user + parameters: + - description: User ID + in: path + name: id + required: true + type: string + - description: User data + in: body + name: user + required: true + schema: + $ref: '#/definitions/dto.UserUpdateDto' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + data: + $ref: '#/definitions/dto.UserDto' + type: object + "400": + description: Bad Request + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "401": + description: Unauthorized + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "404": + description: Not Found + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + "500": + description: Internal Server Error + schema: + allOf: + - $ref: '#/definitions/utils.Response' + - properties: + error: + $ref: '#/definitions/utils.ErrorInfo' + type: object + security: + - BearerAuth: [] + summary: Update a user + tags: + - users +securityDefinitions: + BearerAuth: + in: header + name: Authorization + type: apiKey swagger: "2.0" diff --git a/backend/internal/api/handlers/activity_handler.go b/backend/internal/api/handlers/activity_handler.go index a30e220..339e69b 100644 --- a/backend/internal/api/handlers/activity_handler.go +++ b/backend/internal/api/handlers/activity_handler.go @@ -26,7 +26,7 @@ func NewActivityHandler() *ActivityHandler { // @Accept json // @Produce json // @Security BearerAuth -// @Success 200 {object} utils.Response{data=[]utils.ActivityResponse} +// @Success 200 {object} utils.Response{data=[]dto.ActivityDto} // @Failure 401 {object} utils.Response{error=utils.ErrorInfo} // @Failure 500 {object} utils.Response{error=utils.ErrorInfo} // @Router /activities [get] @@ -56,7 +56,7 @@ func (h *ActivityHandler) GetActivities(c *gin.Context) { // @Produce json // @Security BearerAuth // @Param id path string true "Activity ID" -// @Success 200 {object} utils.Response{data=utils.ActivityResponse} +// @Success 200 {object} utils.Response{data=dto.ActivityDto} // @Failure 400 {object} utils.Response{error=utils.ErrorInfo} // @Failure 401 {object} utils.Response{error=utils.ErrorInfo} // @Failure 404 {object} utils.Response{error=utils.ErrorInfo} diff --git a/docu/swagger_documentation.md b/docu/swagger_documentation.md new file mode 100644 index 0000000..9ad121e --- /dev/null +++ b/docu/swagger_documentation.md @@ -0,0 +1,84 @@ +# Swagger Documentation + +This document explains how to access and update the Swagger documentation for the Time Tracker API. + +## Accessing Swagger UI + +After starting the backend server, access the Swagger UI at: +``` +http://localhost:8080/swagger/index.html +``` + +This interactive interface allows you to: +- Browse all available API endpoints +- See request parameters and response formats +- Test API calls directly from the browser + +## Updating Swagger Documentation + +To update the Swagger documentation for the Time Tracker API, follow these steps: + +1. **Add or update Swagger annotations in your code** + - Annotations should be added as comments above handler functions + - Use the correct types in annotations (e.g., `dto.ActivityDto` instead of `utils.ActivityResponse`) + - Make sure all parameters, responses, and types are properly documented + +2. **Run the Swagger generation command** + ```bash + cd backend && swag init -g cmd/api/main.go --output docs + ``` + + This command: + - Uses `swag` CLI tool to parse your code + - Looks for the main entry point in `cmd/api/main.go` + - Outputs the generated files to the `docs` directory + +3. **Verify the generated files** + The command will generate or update three files: + - `docs/docs.go` - Go code for the Swagger documentation + - `docs/swagger.json` - JSON representation of the API + - `docs/swagger.yaml` - YAML representation of the API + +4. **Common issues and solutions** + - If you encounter "cannot find type definition" errors, check that you're using the correct type names in your annotations + - If endpoints are missing, ensure they have proper Swagger annotations + - If you change the base path or other global settings, update them in the `main.go` file annotations + +## Swagger Annotation Examples + +### Main API Information + +In `main.go`: +```go +// @title Time Tracker API +// @version 1.0 +// @description This is a simple time tracker API. +// @host localhost:8080 +// @BasePath /api +// @securityDefinitions.apikey BearerAuth +// @in header +// @name Authorization +``` + +### Endpoint Documentation + +Example from a handler function: +```go +// GetActivities handles GET /activities +// +// @Summary Get all activities +// @Description Get a list of all activities +// @Tags activities +// @Accept json +// @Produce json +// @Security BearerAuth +// @Success 200 {object} utils.Response{data=[]dto.ActivityDto} +// @Failure 401 {object} utils.Response{error=utils.ErrorInfo} +// @Failure 500 {object} utils.Response{error=utils.ErrorInfo} +// @Router /activities [get] +func (h *ActivityHandler) GetActivities(c *gin.Context) { + // Function implementation +} +``` + +Remember that the Swagger documentation is generated from the annotations in your code, so keeping these annotations up-to-date is essential for accurate API documentation.