diff --git a/go.mod b/go.mod index 5b0b840..fcc2516 100644 --- a/go.mod +++ b/go.mod @@ -2,19 +2,27 @@ module jannex/admin-dashboard-backend go 1.20 +require ( + github.com/go-playground/validator/v10 v10.12.0 + github.com/gofiber/fiber/v2 v2.44.0 + github.com/gofiber/websocket/v2 v2.1.6 + github.com/google/uuid v1.3.0 + github.com/joho/godotenv v1.5.1 + github.com/rs/zerolog v1.29.1 + github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee + golang.org/x/crypto v0.7.0 + gorm.io/driver/mysql v1.5.0 + gorm.io/gorm v1.25.0 +) + require ( github.com/andybalholm/brotli v1.0.5 // indirect github.com/fasthttp/websocket v1.5.2 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.12.0 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect - github.com/gofiber/fiber/v2 v2.44.0 // indirect - github.com/gofiber/websocket/v2 v2.1.6 // indirect - github.com/google/uuid v1.3.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect - github.com/joho/godotenv v1.5.1 // indirect github.com/klauspost/compress v1.16.3 // indirect github.com/leodido/go-urn v1.2.2 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -22,16 +30,11 @@ require ( github.com/mattn/go-runewidth v0.0.14 // indirect github.com/philhofer/fwd v1.1.2 // indirect github.com/rivo/uniseg v0.2.0 // indirect - github.com/rs/zerolog v1.29.1 // indirect github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 // indirect - github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee // indirect github.com/tinylib/msgp v1.1.8 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.45.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect - golang.org/x/crypto v0.7.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect - gorm.io/driver/mysql v1.5.0 // indirect - gorm.io/gorm v1.25.0 // indirect ) diff --git a/go.sum b/go.sum index d652135..f4140d7 100644 --- a/go.sum +++ b/go.sum @@ -2,9 +2,11 @@ github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/ github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fasthttp/websocket v1.5.2 h1:KdCb0EpLpdJpfE3IPA5YLK/aYBO3dhZcvwxz6tXe2LQ= github.com/fasthttp/websocket v1.5.2/go.mod h1:S0KC1VBlx1SaXGXq7yi1wKz4jMub58qEnHQG9oHuqBw= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= @@ -43,6 +45,7 @@ github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -60,6 +63,7 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw= github.com/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0= @@ -124,6 +128,7 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/mysql v1.5.0 h1:6hSAT5QcyIaty0jfnff0z0CLDjyRgZ8mlMHLqSt7uXM= gorm.io/driver/mysql v1.5.0/go.mod h1:FFla/fJuCvyTi7rJQd27qlNX2v3L6deTR1GgTjSOLPo= diff --git a/main.go b/main.go index 099d650..cd333c9 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,9 @@ -// Package classification Jannex API Documentation. +// Package classification JNX Admin-Dashboard API Documentation. // // Schemes: https -// Host: janex +// Host: jannex // BasePath: /v1 -// Version: 0.0.1 +// Version: 1.0.0 // // Consumes: // - application/json diff --git a/modules/structs/api.go b/modules/structs/api.go deleted file mode 100644 index 1bf69ba..0000000 --- a/modules/structs/api.go +++ /dev/null @@ -1,10 +0,0 @@ -package structs - -import "encoding/json" - -type ApiGroupTaskRequest struct { - Category string - GroupId string - Description string - GlobalInputs json.RawMessage -} diff --git a/modules/structs/equipment.go b/modules/structs/equipment.go index 1acad6a..ab2549a 100644 --- a/modules/structs/equipment.go +++ b/modules/structs/equipment.go @@ -14,6 +14,7 @@ type Equipment struct { UpdatedAt time.Time } */ +// swagger:model EquipmentDocumentation type EquipmentDocumentation struct { Id string StockItemId string // stock item id of invex system @@ -34,6 +35,7 @@ type ApiGetDocumentationEquipmentRequest struct { DocumentationId string `json:"documentationId"` } +// swagger:model ApiCreateEquipmentDocumentationRequest type ApiCreateEquipmentDocumentationRequest struct { StockItemId string `json:"stockItemId"` Type uint8 `json:"type"` @@ -41,11 +43,13 @@ type ApiCreateEquipmentDocumentationRequest struct { Notes json.RawMessage `json:"notes"` } +// swagger:model ApiEquipmentDocumentationResponse type ApiEquipmentDocumentationResponse struct { Status int Documentations []EquipmentDocumentation } +// swagger:model ApiEditEquipmentDocumentationRequest type ApiEditEquipmentDocumentationRequest struct { DocumentationId string `json:"documentationId"` Type uint8 `json:"type"` diff --git a/modules/structs/grouptasks.go b/modules/structs/grouptasks.go index d67a939..f5c14d3 100644 --- a/modules/structs/grouptasks.go +++ b/modules/structs/grouptasks.go @@ -1,6 +1,7 @@ package structs import ( + "encoding/json" "time" ) @@ -94,3 +95,11 @@ type GroupTaskStepFile struct { OriginalFileName string // file name which was used by the python script SystemFileName string // file name which was set by this server } + +// swagger:model ApiGroupTaskRequest +type ApiGroupTaskRequest struct { + Category string + GroupId string + Description string + GlobalInputs json.RawMessage +} diff --git a/public/swagger/swagger.json b/public/swagger/swagger.json index 8947d5a..49d2b21 100644 --- a/public/swagger/swagger.json +++ b/public/swagger/swagger.json @@ -10,12 +10,240 @@ ], "swagger": "2.0", "info": { - "title": "Janex API Documentation.", - "version": "0.0.1" + "title": "JNX Admin-Dashboard API Documentation.", + "version": "1.0.0" }, - "host": "janex", + "host": "jannex", "basePath": "/v1", "paths": { + "/equipment/documentation/create": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "equipment" + ], + "summary": "Create a new equipment documentation", + "operationId": "equipmentCreateEquipmentDocumentation", + "parameters": [ + { + "description": "You can create a new api key in your user profile", + "name": "X-Api-Key", + "in": "header" + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/ApiCreateEquipmentDocumentationRequest" + } + } + ], + "responses": { + "200": { + "description": "New equipment documentation created successfully" + }, + "400": { + "description": "Invalid request body" + }, + "401": { + "description": "No permissions" + }, + "500": { + "description": "Failed to create equipment documentation" + } + } + } + }, + "/equipment/documentation/edit": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "equipment" + ], + "summary": "Edit equipment documentation", + "operationId": "equipmentEditEquipmentDocumentation", + "parameters": [ + { + "description": "You can create a new api key in your user profile", + "name": "X-Api-Key", + "in": "header" + }, + { + "name": "body", + "in": "body", + "schema": { + "$ref": "#/definitions/ApiEditEquipmentDocumentationRequest" + } + } + ], + "responses": { + "200": { + "description": "Equipment documentation edited successfully" + }, + "400": { + "description": "Invalid request body" + }, + "401": { + "description": "No permissions" + }, + "500": { + "description": "Failed to edit equipment documentation" + } + } + } + }, + "/equipment/documentation/{stockItemId}/{documentationId}": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "equipment" + ], + "summary": "Get equipment documentation", + "operationId": "equipmentGetEquipmentDocumentation", + "parameters": [ + { + "description": "You can create a new api key in your user profile", + "name": "X-Api-Key", + "in": "header" + }, + { + "type": "string", + "description": "Stock item id", + "name": "stockItemId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Documentation id", + "name": "documentationId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Equipment documentation", + "schema": { + "$ref": "#/definitions/EquipmentDocumentation" + } + }, + "400": { + "description": "Invalid request body" + }, + "401": { + "description": "No permissions" + }, + "500": { + "description": "Failed to get equipment documentation" + } + } + } + }, + "/equipment/documentations/{stockItemId}": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "equipment" + ], + "summary": "Get equipment documentations", + "operationId": "equipmentGetEquipmentDocumentations", + "parameters": [ + { + "description": "You can create a new api key in your user profile", + "name": "X-Api-Key", + "in": "header" + }, + { + "type": "string", + "description": "Stock item id", + "name": "stockItemId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Equipment documentations. Status 200 if equipment documentations found, status 404 if stock item not found on invex, status 401 if backend has no permissions to access invex", + "schema": { + "$ref": "#/definitions/ApiEquipmentDocumentationResponse" + } + }, + "400": { + "description": "Invalid request body" + }, + "401": { + "description": "No permissions" + }, + "500": { + "description": "Failed to get equipment documentations" + } + } + } + }, + "/equipment/thumbnail/{stockItemId}": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "equipment" + ], + "summary": "Get equipment thumbnail", + "operationId": "equipmentGetEquipmentThumbnail", + "parameters": [ + { + "description": "You can create a new api key in your user profile", + "name": "X-Api-Key", + "in": "header" + }, + { + "type": "string", + "description": "Stock item id", + "name": "stockItemId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Equipment thumbnail picture. Backend server is just proxying the request to invex server and returning the response" + }, + "400": { + "description": "Invalid request body" + }, + "401": { + "description": "No permissions" + }, + "500": { + "description": "Failed to get equipment thumbnail" + } + } + } + }, "/grouptasks/start": { "post": { "consumes": [ @@ -25,10 +253,10 @@ "application/json" ], "tags": [ - "grouptasks" + "grouptask" ], "summary": "Start a new group task", - "operationId": "grouptasksStart", + "operationId": "grouptaskStartGroupTask", "parameters": [ { "description": "You can create a new api key in your user profile", @@ -36,14 +264,16 @@ "in": "header" }, { - "description": "JSON -\u003e Category str, GroupId str, Description str, GlobalInputs [{key, value}, {...}]", "name": "body", - "in": "body" + "in": "body", + "schema": { + "$ref": "#/definitions/ApiGroupTaskRequest" + } } ], "responses": { "200": { - "description": "New group task created successfully" + "description": "New group task started successfully" }, "400": { "description": "Invalid request body" @@ -52,10 +282,128 @@ "description": "No permissions" }, "422": { - "description": "No group tasks in this category or provided global inputs incomplete" + "description": "Global inputs are not complete or no group tasks in this category" + }, + "500": { + "description": "Failed to start group task" } } } } + }, + "definitions": { + "ApiCreateEquipmentDocumentationRequest": { + "type": "object", + "properties": { + "notes": { + "type": "object", + "x-go-name": "Notes" + }, + "stockItemId": { + "type": "string", + "x-go-name": "StockItemId" + }, + "title": { + "type": "string", + "x-go-name": "Title" + }, + "type": { + "type": "integer", + "format": "uint8", + "x-go-name": "Type" + } + }, + "x-go-package": "jannex/admin-dashboard-backend/modules/structs" + }, + "ApiEditEquipmentDocumentationRequest": { + "type": "object", + "properties": { + "documentationId": { + "type": "string", + "x-go-name": "DocumentationId" + }, + "notes": { + "type": "object", + "x-go-name": "Notes" + }, + "title": { + "type": "string", + "x-go-name": "Title" + }, + "type": { + "type": "integer", + "format": "uint8", + "x-go-name": "Type" + } + }, + "x-go-package": "jannex/admin-dashboard-backend/modules/structs" + }, + "ApiEquipmentDocumentationResponse": { + "type": "object", + "properties": { + "Documentations": { + "type": "array", + "items": { + "$ref": "#/definitions/EquipmentDocumentation" + } + }, + "Status": { + "type": "integer", + "format": "int64" + } + }, + "x-go-package": "jannex/admin-dashboard-backend/modules/structs" + }, + "ApiGroupTaskRequest": { + "type": "object", + "properties": { + "Category": { + "type": "string" + }, + "Description": { + "type": "string" + }, + "GlobalInputs": { + "type": "object" + }, + "GroupId": { + "type": "string" + } + }, + "x-go-package": "jannex/admin-dashboard-backend/modules/structs" + }, + "EquipmentDocumentation": { + "type": "object", + "properties": { + "CreatedAt": { + "type": "string", + "format": "date-time" + }, + "CreatedByUserId": { + "type": "string" + }, + "Id": { + "type": "string" + }, + "Notes": { + "type": "string" + }, + "StockItemId": { + "type": "string" + }, + "Title": { + "type": "string" + }, + "Type": { + "type": "integer", + "format": "uint8" + }, + "UpdatedAt": { + "type": "string", + "format": "date-time" + } + }, + "x-go-package": "jannex/admin-dashboard-backend/modules/structs" + } } } \ No newline at end of file diff --git a/routers/router/api/v1/equipment/equipment.go b/routers/router/api/v1/equipment/equipment.go index 42eb5ea..7c09cf8 100644 --- a/routers/router/api/v1/equipment/equipment.go +++ b/routers/router/api/v1/equipment/equipment.go @@ -9,6 +9,31 @@ import ( ) func CreateEquipmentDocumentation(c *fiber.Ctx) error { + // swagger:operation POST /equipment/documentation/create equipment equipmentCreateEquipmentDocumentation + // --- + // summary: Create a new equipment documentation + // consumes: + // - application/json + // produces: + // - application/json + // parameters: + // - name: X-Api-Key + // in: header + // description: You can create a new api key in your user profile + // - name: body + // in: body + // schema: + // "$ref": "#/definitions/ApiCreateEquipmentDocumentationRequest" + // responses: + // '200': + // description: New equipment documentation created successfully + // '400': + // description: Invalid request body + // '401': + // description: No permissions + // '500': + // description: Failed to create equipment documentation + var body structs.ApiCreateEquipmentDocumentationRequest if err := utils.BodyParserHelper(c, &body); err != nil { @@ -19,6 +44,34 @@ func CreateEquipmentDocumentation(c *fiber.Ctx) error { } func GetEquipmentDocumentations(c *fiber.Ctx) error { + // swagger:operation GET /equipment/documentations/{stockItemId} equipment equipmentGetEquipmentDocumentations + // --- + // summary: Get equipment documentations + // consumes: + // - application/json + // produces: + // - application/json + // parameters: + // - name: X-Api-Key + // in: header + // description: You can create a new api key in your user profile + // - name: stockItemId + // in: path + // description: Stock item id + // required: true + // type: string + // responses: + // '200': + // description: Equipment documentations. Status 200 if equipment documentations found, status 404 if stock item not found on invex, status 401 if backend has no permissions to access invex + // schema: + // "$ref": "#/definitions/ApiEquipmentDocumentationResponse" + // '400': + // description: Invalid request body + // '401': + // description: No permissions + // '500': + // description: Failed to get equipment documentations + var params structs.ApiEquipmentRequest if err := utils.ParamsParserHelper(c, ¶ms); err != nil { @@ -29,6 +82,39 @@ func GetEquipmentDocumentations(c *fiber.Ctx) error { } func GetEquipmentDocumentation(c *fiber.Ctx) error { + // swagger:operation GET /equipment/documentation/{stockItemId}/{documentationId} equipment equipmentGetEquipmentDocumentation + // --- + // summary: Get equipment documentation + // consumes: + // - application/json + // produces: + // - application/json + // parameters: + // - name: X-Api-Key + // in: header + // description: You can create a new api key in your user profile + // - name: stockItemId + // in: path + // description: Stock item id + // required: true + // type: string + // - name: documentationId + // in: path + // description: Documentation id + // required: true + // type: string + // responses: + // '200': + // description: Equipment documentation + // schema: + // "$ref": "#/definitions/EquipmentDocumentation" + // '400': + // description: Invalid request body + // '401': + // description: No permissions + // '500': + // description: Failed to get equipment documentation + var params structs.ApiGetDocumentationEquipmentRequest if err := utils.ParamsParserHelper(c, ¶ms); err != nil { @@ -39,6 +125,31 @@ func GetEquipmentDocumentation(c *fiber.Ctx) error { } func EditEquipmentDocumentation(c *fiber.Ctx) error { + // swagger:operation POST /equipment/documentation/edit equipment equipmentEditEquipmentDocumentation + // --- + // summary: Edit equipment documentation + // consumes: + // - application/json + // produces: + // - application/json + // parameters: + // - name: X-Api-Key + // in: header + // description: You can create a new api key in your user profile + // - name: body + // in: body + // schema: + // "$ref": "#/definitions/ApiEditEquipmentDocumentationRequest" + // responses: + // '200': + // description: Equipment documentation edited successfully + // '400': + // description: Invalid request body + // '401': + // description: No permissions + // '500': + // description: Failed to edit equipment documentation + var body structs.ApiEditEquipmentDocumentationRequest if err := utils.BodyParserHelper(c, &body); err != nil { @@ -49,6 +160,32 @@ func EditEquipmentDocumentation(c *fiber.Ctx) error { } func GetEquipmentThumbnail(c *fiber.Ctx) error { + // swagger:operation GET /equipment/thumbnail/{stockItemId} equipment equipmentGetEquipmentThumbnail + // --- + // summary: Get equipment thumbnail + // consumes: + // - application/json + // produces: + // - application/json + // parameters: + // - name: X-Api-Key + // in: header + // description: You can create a new api key in your user profile + // - name: stockItemId + // in: path + // description: Stock item id + // required: true + // type: string + // responses: + // '200': + // description: Equipment thumbnail picture. Backend server is just proxying the request to invex server and returning the response + // '400': + // description: Invalid request body + // '401': + // description: No permissions + // '500': + // description: Failed to get equipment thumbnail + var params structs.ApiEquipmentRequest if err := utils.ParamsParserHelper(c, ¶ms); err != nil { diff --git a/routers/router/api/v1/grouptask/grouptask.go b/routers/router/api/v1/grouptask/grouptask.go index 5b0bf31..5aaa4df 100644 --- a/routers/router/api/v1/grouptask/grouptask.go +++ b/routers/router/api/v1/grouptask/grouptask.go @@ -13,7 +13,7 @@ import ( ) func StartGroupTask(c *fiber.Ctx) error { - // swagger:operation POST /grouptasks/start grouptasks grouptasksStart + // swagger:operation POST /grouptasks/start grouptask grouptaskStartGroupTask // --- // summary: Start a new group task // consumes: @@ -26,16 +26,19 @@ func StartGroupTask(c *fiber.Ctx) error { // description: You can create a new api key in your user profile // - name: body // in: body - // description: JSON -> Category str, GroupId str, Description str, GlobalInputs [{key, value}, {...}] + // schema: + // "$ref": "#/definitions/ApiGroupTaskRequest" // responses: // '200': - // description: New group task created successfully + // description: New group task started successfully // '400': // description: Invalid request body // '401': // description: No permissions // '422': - // description: No group tasks in this category or provided global inputs incomplete + // description: Global inputs are not complete or no group tasks in this category + // '500': + // description: Failed to start group task var body structs.ApiGroupTaskRequest diff --git a/routers/router/router.go b/routers/router/router.go index 698bf2d..11f862a 100644 --- a/routers/router/router.go +++ b/routers/router/router.go @@ -38,15 +38,11 @@ func SetupRoutes(app *fiber.App) { g.Post("/start", requestAccessValidation, grouptask.StartGroupTask) e := v1.Group("/equipment") - // TODO: add user session validation - //e.Get("/scanned/:stockItemId", requestAccessValidation, equipment.EquipmentScanned) - //e.Get("/", requestAccessValidation, equipment.GetEquipment) e.Get("/documentations/:stockItemId", requestAccessValidation, equipment.GetEquipmentDocumentations) e.Post("/documentation/create", requestAccessValidation, equipment.CreateEquipmentDocumentation) e.Get("/documentation/:stockItemId/:documentationId", requestAccessValidation, equipment.GetEquipmentDocumentation) e.Post("/documentation/edit", requestAccessValidation, equipment.EditEquipmentDocumentation) - // access validation here implemented as it would require to implement authorization on web client side on Avatar Component - e.Get("/thumbnail/:stockItemId", equipment.GetEquipmentThumbnail) + e.Get("/thumbnail/:stockItemId", requestAccessValidation, equipment.GetEquipmentThumbnail) app.Static("/", config.Cfg.FolderPaths.PublicStatic) }