From 7d462a4dd32f6fe04f4c1956a59dee910d019d23 Mon Sep 17 00:00:00 2001 From: slid1amo2n3e4 Date: Tue, 8 Oct 2024 16:58:37 +0200 Subject: [PATCH] Fix formatting. --- backend/app/api/handlers/v1/controller.go | 20 +-- .../app/api/handlers/v1/v1_ctrl_actions.go | 56 +++--- backend/app/api/handlers/v1/v1_ctrl_assets.go | 14 +- backend/app/api/handlers/v1/v1_ctrl_auth.go | 46 ++--- backend/app/api/handlers/v1/v1_ctrl_group.go | 40 ++--- backend/app/api/handlers/v1/v1_ctrl_items.go | 164 +++++++++--------- .../handlers/v1/v1_ctrl_items_attachments.go | 68 ++++---- backend/app/api/handlers/v1/v1_ctrl_labels.go | 68 ++++---- .../app/api/handlers/v1/v1_ctrl_locations.go | 86 ++++----- .../api/handlers/v1/v1_ctrl_maint_entry.go | 28 +-- .../api/handlers/v1/v1_ctrl_maintenance.go | 40 ++--- .../app/api/handlers/v1/v1_ctrl_notifiers.go | 68 ++++---- backend/app/api/handlers/v1/v1_ctrl_qrcode.go | 14 +- .../app/api/handlers/v1/v1_ctrl_reporting.go | 12 +- .../app/api/handlers/v1/v1_ctrl_statistics.go | 52 +++--- backend/app/api/handlers/v1/v1_ctrl_user.go | 62 +++---- backend/app/api/main.go | 18 +- 17 files changed, 428 insertions(+), 428 deletions(-) diff --git a/backend/app/api/handlers/v1/controller.go b/backend/app/api/handlers/v1/controller.go index 135b1446b..436071138 100644 --- a/backend/app/api/handlers/v1/controller.go +++ b/backend/app/api/handlers/v1/controller.go @@ -111,11 +111,11 @@ func NewControllerV1(svc *services.AllServices, repos *repo.AllRepos, bus *event // HandleBase godoc // -// @Summary Application Info -// @Tags Base -// @Produce json -// @Success 200 {object} APISummary -// @Router /v1/status [GET] +// @Summary Application Info +// @Tags Base +// @Produce json +// @Success 200 {object} APISummary +// @Router /v1/status [GET] func (ctrl *V1Controller) HandleBase(ready ReadyFunc, build Build) errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { return server.JSON(w, http.StatusOK, APISummary{ @@ -131,11 +131,11 @@ func (ctrl *V1Controller) HandleBase(ready ReadyFunc, build Build) errchain.Hand // HandleCurrency godoc // -// @Summary Currency -// @Tags Base -// @Produce json -// @Success 200 {object} currencies.Currency -// @Router /v1/currency [GET] +// @Summary Currency +// @Tags Base +// @Produce json +// @Success 200 {object} currencies.Currency +// @Router /v1/currency [GET] func (ctrl *V1Controller) HandleCurrency() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { // Set Cache for 10 Minutes diff --git a/backend/app/api/handlers/v1/v1_ctrl_actions.go b/backend/app/api/handlers/v1/v1_ctrl_actions.go index 2ae25f023..a134e490b 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_actions.go +++ b/backend/app/api/handlers/v1/v1_ctrl_actions.go @@ -32,52 +32,52 @@ func actionHandlerFactory(ref string, fn func(context.Context, uuid.UUID) (int, // HandleEnsureAssetID godoc // -// @Summary Ensure Asset IDs -// @Description Ensures all items in the database have an asset ID -// @Tags Actions -// @Produce json -// @Success 200 {object} ActionAmountResult -// @Router /v1/actions/ensure-asset-ids [Post] -// @Security Bearer +// @Summary Ensure Asset IDs +// @Description Ensures all items in the database have an asset ID +// @Tags Actions +// @Produce json +// @Success 200 {object} ActionAmountResult +// @Router /v1/actions/ensure-asset-ids [Post] +// @Security Bearer func (ctrl *V1Controller) HandleEnsureAssetID() errchain.HandlerFunc { return actionHandlerFactory("ensure asset IDs", ctrl.svc.Items.EnsureAssetID) } // HandleEnsureImportRefs godoc // -// @Summary Ensures Import Refs -// @Description Ensures all items in the database have an import ref -// @Tags Actions -// @Produce json -// @Success 200 {object} ActionAmountResult -// @Router /v1/actions/ensure-import-refs [Post] -// @Security Bearer +// @Summary Ensures Import Refs +// @Description Ensures all items in the database have an import ref +// @Tags Actions +// @Produce json +// @Success 200 {object} ActionAmountResult +// @Router /v1/actions/ensure-import-refs [Post] +// @Security Bearer func (ctrl *V1Controller) HandleEnsureImportRefs() errchain.HandlerFunc { return actionHandlerFactory("ensure import refs", ctrl.svc.Items.EnsureImportRef) } // HandleItemDateZeroOut godoc // -// @Summary Zero Out Time Fields -// @Description Resets all item date fields to the beginning of the day -// @Tags Actions -// @Produce json -// @Success 200 {object} ActionAmountResult -// @Router /v1/actions/zero-item-time-fields [Post] -// @Security Bearer +// @Summary Zero Out Time Fields +// @Description Resets all item date fields to the beginning of the day +// @Tags Actions +// @Produce json +// @Success 200 {object} ActionAmountResult +// @Router /v1/actions/zero-item-time-fields [Post] +// @Security Bearer func (ctrl *V1Controller) HandleItemDateZeroOut() errchain.HandlerFunc { return actionHandlerFactory("zero out date time", ctrl.repo.Items.ZeroOutTimeFields) } // HandleSetPrimaryPhotos godoc // -// @Summary Set Primary Photos -// @Description Sets the first photo of each item as the primary photo -// @Tags Actions -// @Produce json -// @Success 200 {object} ActionAmountResult -// @Router /v1/actions/set-primary-photos [Post] -// @Security Bearer +// @Summary Set Primary Photos +// @Description Sets the first photo of each item as the primary photo +// @Tags Actions +// @Produce json +// @Success 200 {object} ActionAmountResult +// @Router /v1/actions/set-primary-photos [Post] +// @Security Bearer func (ctrl *V1Controller) HandleSetPrimaryPhotos() errchain.HandlerFunc { return actionHandlerFactory("ensure asset IDs", ctrl.repo.Items.SetPrimaryPhotos) } diff --git a/backend/app/api/handlers/v1/v1_ctrl_assets.go b/backend/app/api/handlers/v1/v1_ctrl_assets.go index 4b26467c5..4699b9d1b 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_assets.go +++ b/backend/app/api/handlers/v1/v1_ctrl_assets.go @@ -17,13 +17,13 @@ import ( // HandleAssetGet godocs // -// @Summary Get Item by Asset ID -// @Tags Items -// @Produce json -// @Param id path string true "Asset ID" -// @Success 200 {object} repo.PaginationResult[repo.ItemSummary]{} -// @Router /v1/assets/{id} [GET] -// @Security Bearer +// @Summary Get Item by Asset ID +// @Tags Items +// @Produce json +// @Param id path string true "Asset ID" +// @Success 200 {object} repo.PaginationResult[repo.ItemSummary]{} +// @Router /v1/assets/{id} [GET] +// @Security Bearer func (ctrl *V1Controller) HandleAssetGet() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { ctx := services.NewContext(r.Context()) diff --git a/backend/app/api/handlers/v1/v1_ctrl_auth.go b/backend/app/api/handlers/v1/v1_ctrl_auth.go index de5b6c2b7..945c6cfbf 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_auth.go +++ b/backend/app/api/handlers/v1/v1_ctrl_auth.go @@ -79,17 +79,17 @@ type AuthProvider interface { // HandleAuthLogin godoc // -// @Summary User Login -// @Tags Authentication -// @Accept x-www-form-urlencoded -// @Accept application/json -// @Param username formData string false "string" example(admin@admin.com) -// @Param password formData string false "string" example(admin) -// @Param payload body LoginForm true "Login Data" -// @Param provider query string false "auth provider" -// @Produce json -// @Success 200 {object} TokenResponse -// @Router /v1/users/login [POST] +// @Summary User Login +// @Tags Authentication +// @Accept x-www-form-urlencoded +// @Accept application/json +// @Param username formData string false "string" example(admin@admin.com) +// @Param password formData string false "string" example(admin) +// @Param payload body LoginForm true "Login Data" +// @Param provider query string false "auth provider" +// @Produce json +// @Success 200 {object} TokenResponse +// @Router /v1/users/login [POST] func (ctrl *V1Controller) HandleAuthLogin(ps ...AuthProvider) errchain.HandlerFunc { if len(ps) == 0 { panic("no auth providers provided") @@ -131,11 +131,11 @@ func (ctrl *V1Controller) HandleAuthLogin(ps ...AuthProvider) errchain.HandlerFu // HandleAuthLogout godoc // -// @Summary User Logout -// @Tags Authentication -// @Success 204 -// @Router /v1/users/logout [POST] -// @Security Bearer +// @Summary User Logout +// @Tags Authentication +// @Success 204 +// @Router /v1/users/logout [POST] +// @Security Bearer func (ctrl *V1Controller) HandleAuthLogout() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { token := services.UseTokenCtx(r.Context()) @@ -155,13 +155,13 @@ func (ctrl *V1Controller) HandleAuthLogout() errchain.HandlerFunc { // HandleAuthRefresh godoc // -// @Summary User Token Refresh -// @Description handleAuthRefresh returns a handler that will issue a new token from an existing token. -// @Description This does not validate that the user still exists within the database. -// @Tags Authentication -// @Success 200 -// @Router /v1/users/refresh [GET] -// @Security Bearer +// @Summary User Token Refresh +// @Description handleAuthRefresh returns a handler that will issue a new token from an existing token. +// @Description This does not validate that the user still exists within the database. +// @Tags Authentication +// @Success 200 +// @Router /v1/users/refresh [GET] +// @Security Bearer func (ctrl *V1Controller) HandleAuthRefresh() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { requestToken := services.UseTokenCtx(r.Context()) diff --git a/backend/app/api/handlers/v1/v1_ctrl_group.go b/backend/app/api/handlers/v1/v1_ctrl_group.go index 62de9165b..a29d2599c 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_group.go +++ b/backend/app/api/handlers/v1/v1_ctrl_group.go @@ -26,12 +26,12 @@ type ( // HandleGroupGet godoc // -// @Summary Get Group -// @Tags Group -// @Produce json -// @Success 200 {object} repo.Group -// @Router /v1/groups [Get] -// @Security Bearer +// @Summary Get Group +// @Tags Group +// @Produce json +// @Success 200 {object} repo.Group +// @Router /v1/groups [Get] +// @Security Bearer func (ctrl *V1Controller) HandleGroupGet() errchain.HandlerFunc { fn := func(r *http.Request) (repo.Group, error) { auth := services.NewContext(r.Context()) @@ -43,13 +43,13 @@ func (ctrl *V1Controller) HandleGroupGet() errchain.HandlerFunc { // HandleGroupUpdate godoc // -// @Summary Update Group -// @Tags Group -// @Produce json -// @Param payload body repo.GroupUpdate true "User Data" -// @Success 200 {object} repo.Group -// @Router /v1/groups [Put] -// @Security Bearer +// @Summary Update Group +// @Tags Group +// @Produce json +// @Param payload body repo.GroupUpdate true "User Data" +// @Success 200 {object} repo.Group +// @Router /v1/groups [Put] +// @Security Bearer func (ctrl *V1Controller) HandleGroupUpdate() errchain.HandlerFunc { fn := func(r *http.Request, body repo.GroupUpdate) (repo.Group, error) { auth := services.NewContext(r.Context()) @@ -69,13 +69,13 @@ func (ctrl *V1Controller) HandleGroupUpdate() errchain.HandlerFunc { // HandleGroupInvitationsCreate godoc // -// @Summary Create Group Invitation -// @Tags Group -// @Produce json -// @Param payload body GroupInvitationCreate true "User Data" -// @Success 200 {object} GroupInvitation -// @Router /v1/groups/invitations [Post] -// @Security Bearer +// @Summary Create Group Invitation +// @Tags Group +// @Produce json +// @Param payload body GroupInvitationCreate true "User Data" +// @Success 200 {object} GroupInvitation +// @Router /v1/groups/invitations [Post] +// @Security Bearer func (ctrl *V1Controller) HandleGroupInvitationsCreate() errchain.HandlerFunc { fn := func(r *http.Request, body GroupInvitationCreate) (GroupInvitation, error) { if body.ExpiresAt.IsZero() { diff --git a/backend/app/api/handlers/v1/v1_ctrl_items.go b/backend/app/api/handlers/v1/v1_ctrl_items.go index 1eddc0fc3..45790c90b 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_items.go +++ b/backend/app/api/handlers/v1/v1_ctrl_items.go @@ -21,18 +21,18 @@ import ( // HandleItemsGetAll godoc // -// @Summary Query All Items -// @Tags Items -// @Produce json -// @Param q query string false "search string" -// @Param page query int false "page number" -// @Param pageSize query int false "items per page" -// @Param labels query []string false "label Ids" collectionFormat(multi) -// @Param locations query []string false "location Ids" collectionFormat(multi) -// @Param parentIds query []string false "parent Ids" collectionFormat(multi) -// @Success 200 {object} repo.PaginationResult[repo.ItemSummary]{} -// @Router /v1/items [GET] -// @Security Bearer +// @Summary Query All Items +// @Tags Items +// @Produce json +// @Param q query string false "search string" +// @Param page query int false "page number" +// @Param pageSize query int false "items per page" +// @Param labels query []string false "label Ids" collectionFormat(multi) +// @Param locations query []string false "location Ids" collectionFormat(multi) +// @Param parentIds query []string false "parent Ids" collectionFormat(multi) +// @Success 200 {object} repo.PaginationResult[repo.ItemSummary]{} +// @Router /v1/items [GET] +// @Security Bearer func (ctrl *V1Controller) HandleItemsGetAll() errchain.HandlerFunc { extractQuery := func(r *http.Request) repo.ItemQuery { params := r.URL.Query() @@ -106,13 +106,13 @@ func (ctrl *V1Controller) HandleItemsGetAll() errchain.HandlerFunc { // HandleItemFullPath godoc // -// @Summary Get the full path of an item -// @Tags Items -// @Produce json -// @Param id path string true "Item ID" -// @Success 200 {object} []repo.ItemPath -// @Router /v1/items/{id}/path [GET] -// @Security Bearer +// @Summary Get the full path of an item +// @Tags Items +// @Produce json +// @Param id path string true "Item ID" +// @Success 200 {object} []repo.ItemPath +// @Router /v1/items/{id}/path [GET] +// @Security Bearer func (ctrl *V1Controller) HandleItemFullPath() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID) ([]repo.ItemPath, error) { auth := services.NewContext(r.Context()) @@ -148,13 +148,13 @@ func (ctrl *V1Controller) HandleItemFullPath() errchain.HandlerFunc { // HandleItemsCreate godoc // -// @Summary Create Item -// @Tags Items -// @Produce json -// @Param payload body repo.ItemCreate true "Item Data" -// @Success 201 {object} repo.ItemSummary -// @Router /v1/items [POST] -// @Security Bearer +// @Summary Create Item +// @Tags Items +// @Produce json +// @Param payload body repo.ItemCreate true "Item Data" +// @Success 201 {object} repo.ItemSummary +// @Router /v1/items [POST] +// @Security Bearer func (ctrl *V1Controller) HandleItemsCreate() errchain.HandlerFunc { fn := func(r *http.Request, body repo.ItemCreate) (repo.ItemOut, error) { return ctrl.svc.Items.Create(services.NewContext(r.Context()), body) @@ -165,13 +165,13 @@ func (ctrl *V1Controller) HandleItemsCreate() errchain.HandlerFunc { // HandleItemGet godocs // -// @Summary Get Item -// @Tags Items -// @Produce json -// @Param id path string true "Item ID" -// @Success 200 {object} repo.ItemOut -// @Router /v1/items/{id} [GET] -// @Security Bearer +// @Summary Get Item +// @Tags Items +// @Produce json +// @Param id path string true "Item ID" +// @Success 200 {object} repo.ItemOut +// @Router /v1/items/{id} [GET] +// @Security Bearer func (ctrl *V1Controller) HandleItemGet() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID) (repo.ItemOut, error) { auth := services.NewContext(r.Context()) @@ -184,13 +184,13 @@ func (ctrl *V1Controller) HandleItemGet() errchain.HandlerFunc { // HandleItemDelete godocs // -// @Summary Delete Item -// @Tags Items -// @Produce json -// @Param id path string true "Item ID" -// @Success 204 -// @Router /v1/items/{id} [DELETE] -// @Security Bearer +// @Summary Delete Item +// @Tags Items +// @Produce json +// @Param id path string true "Item ID" +// @Success 204 +// @Router /v1/items/{id} [DELETE] +// @Security Bearer func (ctrl *V1Controller) HandleItemDelete() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID) (any, error) { auth := services.NewContext(r.Context()) @@ -203,14 +203,14 @@ func (ctrl *V1Controller) HandleItemDelete() errchain.HandlerFunc { // HandleItemUpdate godocs // -// @Summary Update Item -// @Tags Items -// @Produce json -// @Param id path string true "Item ID" -// @Param payload body repo.ItemUpdate true "Item Data" -// @Success 200 {object} repo.ItemOut -// @Router /v1/items/{id} [PUT] -// @Security Bearer +// @Summary Update Item +// @Tags Items +// @Produce json +// @Param id path string true "Item ID" +// @Param payload body repo.ItemUpdate true "Item Data" +// @Success 200 {object} repo.ItemOut +// @Router /v1/items/{id} [PUT] +// @Security Bearer func (ctrl *V1Controller) HandleItemUpdate() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID, body repo.ItemUpdate) (repo.ItemOut, error) { auth := services.NewContext(r.Context()) @@ -224,14 +224,14 @@ func (ctrl *V1Controller) HandleItemUpdate() errchain.HandlerFunc { // HandleItemPatch godocs // -// @Summary Update Item -// @Tags Items -// @Produce json -// @Param id path string true "Item ID" -// @Param payload body repo.ItemPatch true "Item Data" -// @Success 200 {object} repo.ItemOut -// @Router /v1/items/{id} [Patch] -// @Security Bearer +// @Summary Update Item +// @Tags Items +// @Produce json +// @Param id path string true "Item ID" +// @Param payload body repo.ItemPatch true "Item Data" +// @Success 200 {object} repo.ItemOut +// @Router /v1/items/{id} [Patch] +// @Security Bearer func (ctrl *V1Controller) HandleItemPatch() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID, body repo.ItemPatch) (repo.ItemOut, error) { auth := services.NewContext(r.Context()) @@ -250,13 +250,13 @@ func (ctrl *V1Controller) HandleItemPatch() errchain.HandlerFunc { // HandleGetAllCustomFieldNames godocs // -// @Summary Get All Custom Field Names -// @Tags Items -// @Produce json -// @Success 200 -// @Router /v1/items/fields [GET] -// @Success 200 {object} []string -// @Security Bearer +// @Summary Get All Custom Field Names +// @Tags Items +// @Produce json +// @Success 200 +// @Router /v1/items/fields [GET] +// @Success 200 {object} []string +// @Security Bearer func (ctrl *V1Controller) HandleGetAllCustomFieldNames() errchain.HandlerFunc { fn := func(r *http.Request) ([]string, error) { auth := services.NewContext(r.Context()) @@ -268,13 +268,13 @@ func (ctrl *V1Controller) HandleGetAllCustomFieldNames() errchain.HandlerFunc { // HandleGetAllCustomFieldValues godocs // -// @Summary Get All Custom Field Values -// @Tags Items -// @Produce json -// @Success 200 -// @Router /v1/items/fields/values [GET] -// @Success 200 {object} []string -// @Security Bearer +// @Summary Get All Custom Field Values +// @Tags Items +// @Produce json +// @Success 200 +// @Router /v1/items/fields/values [GET] +// @Success 200 {object} []string +// @Security Bearer func (ctrl *V1Controller) HandleGetAllCustomFieldValues() errchain.HandlerFunc { type query struct { Field string `schema:"field" validate:"required"` @@ -290,13 +290,13 @@ func (ctrl *V1Controller) HandleGetAllCustomFieldValues() errchain.HandlerFunc { // HandleItemsImport godocs // -// @Summary Import Items -// @Tags Items -// @Produce json -// @Success 204 -// @Param csv formData file true "Image to upload" -// @Router /v1/items/import [Post] -// @Security Bearer +// @Summary Import Items +// @Tags Items +// @Produce json +// @Success 204 +// @Param csv formData file true "Image to upload" +// @Router /v1/items/import [Post] +// @Security Bearer func (ctrl *V1Controller) HandleItemsImport() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { err := r.ParseMultipartForm(ctrl.maxUploadSize << 20) @@ -325,11 +325,11 @@ func (ctrl *V1Controller) HandleItemsImport() errchain.HandlerFunc { // HandleItemsExport godocs // -// @Summary Export Items -// @Tags Items -// @Success 200 {string} string "text/csv" -// @Router /v1/items/export [GET] -// @Security Bearer +// @Summary Export Items +// @Tags Items +// @Success 200 {string} string "text/csv" +// @Router /v1/items/export [GET] +// @Security Bearer func (ctrl *V1Controller) HandleItemsExport() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { ctx := services.NewContext(r.Context()) diff --git a/backend/app/api/handlers/v1/v1_ctrl_items_attachments.go b/backend/app/api/handlers/v1/v1_ctrl_items_attachments.go index 61b3b9a59..007f6dde4 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_items_attachments.go +++ b/backend/app/api/handlers/v1/v1_ctrl_items_attachments.go @@ -23,17 +23,17 @@ type ( // HandleItemAttachmentCreate godocs // -// @Summary Create Item Attachment -// @Tags Items Attachments -// @Produce json -// @Param id path string true "Item ID" -// @Param file formData file true "File attachment" -// @Param type formData string true "Type of file" -// @Param name formData string true "name of the file including extension" -// @Success 200 {object} repo.ItemOut -// @Failure 422 {object} validate.ErrorResponse -// @Router /v1/items/{id}/attachments [POST] -// @Security Bearer +// @Summary Create Item Attachment +// @Tags Items Attachments +// @Produce json +// @Param id path string true "Item ID" +// @Param file formData file true "File attachment" +// @Param type formData string true "Type of file" +// @Param name formData string true "name of the file including extension" +// @Success 200 {object} repo.ItemOut +// @Failure 422 {object} validate.ErrorResponse +// @Router /v1/items/{id}/attachments [POST] +// @Security Bearer func (ctrl *V1Controller) HandleItemAttachmentCreate() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { err := r.ParseMultipartForm(ctrl.maxUploadSize << 20) @@ -104,41 +104,41 @@ func (ctrl *V1Controller) HandleItemAttachmentCreate() errchain.HandlerFunc { // HandleItemAttachmentGet godocs // -// @Summary Get Item Attachment -// @Tags Items Attachments -// @Produce application/octet-stream -// @Param id path string true "Item ID" -// @Param attachment_id path string true "Attachment ID" -// @Success 200 {object} ItemAttachmentToken -// @Router /v1/items/{id}/attachments/{attachment_id} [GET] -// @Security Bearer +// @Summary Get Item Attachment +// @Tags Items Attachments +// @Produce application/octet-stream +// @Param id path string true "Item ID" +// @Param attachment_id path string true "Attachment ID" +// @Success 200 {object} ItemAttachmentToken +// @Router /v1/items/{id}/attachments/{attachment_id} [GET] +// @Security Bearer func (ctrl *V1Controller) HandleItemAttachmentGet() errchain.HandlerFunc { return ctrl.handleItemAttachmentsHandler } // HandleItemAttachmentDelete godocs // -// @Summary Delete Item Attachment -// @Tags Items Attachments -// @Param id path string true "Item ID" -// @Param attachment_id path string true "Attachment ID" -// @Success 204 -// @Router /v1/items/{id}/attachments/{attachment_id} [DELETE] -// @Security Bearer +// @Summary Delete Item Attachment +// @Tags Items Attachments +// @Param id path string true "Item ID" +// @Param attachment_id path string true "Attachment ID" +// @Success 204 +// @Router /v1/items/{id}/attachments/{attachment_id} [DELETE] +// @Security Bearer func (ctrl *V1Controller) HandleItemAttachmentDelete() errchain.HandlerFunc { return ctrl.handleItemAttachmentsHandler } // HandleItemAttachmentUpdate godocs // -// @Summary Update Item Attachment -// @Tags Items Attachments -// @Param id path string true "Item ID" -// @Param attachment_id path string true "Attachment ID" -// @Param payload body repo.ItemAttachmentUpdate true "Attachment Update" -// @Success 200 {object} repo.ItemOut -// @Router /v1/items/{id}/attachments/{attachment_id} [PUT] -// @Security Bearer +// @Summary Update Item Attachment +// @Tags Items Attachments +// @Param id path string true "Item ID" +// @Param attachment_id path string true "Attachment ID" +// @Param payload body repo.ItemAttachmentUpdate true "Attachment Update" +// @Success 200 {object} repo.ItemOut +// @Router /v1/items/{id}/attachments/{attachment_id} [PUT] +// @Security Bearer func (ctrl *V1Controller) HandleItemAttachmentUpdate() errchain.HandlerFunc { return ctrl.handleItemAttachmentsHandler } diff --git a/backend/app/api/handlers/v1/v1_ctrl_labels.go b/backend/app/api/handlers/v1/v1_ctrl_labels.go index 888be19d4..1c23adbe0 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_labels.go +++ b/backend/app/api/handlers/v1/v1_ctrl_labels.go @@ -12,12 +12,12 @@ import ( // HandleLabelsGetAll godoc // -// @Summary Get All Labels -// @Tags Labels -// @Produce json -// @Success 200 {object} []repo.LabelOut -// @Router /v1/labels [GET] -// @Security Bearer +// @Summary Get All Labels +// @Tags Labels +// @Produce json +// @Success 200 {object} []repo.LabelOut +// @Router /v1/labels [GET] +// @Security Bearer func (ctrl *V1Controller) HandleLabelsGetAll() errchain.HandlerFunc { fn := func(r *http.Request) ([]repo.LabelSummary, error) { auth := services.NewContext(r.Context()) @@ -29,13 +29,13 @@ func (ctrl *V1Controller) HandleLabelsGetAll() errchain.HandlerFunc { // HandleLabelsCreate godoc // -// @Summary Create Label -// @Tags Labels -// @Produce json -// @Param payload body repo.LabelCreate true "Label Data" -// @Success 200 {object} repo.LabelSummary -// @Router /v1/labels [POST] -// @Security Bearer +// @Summary Create Label +// @Tags Labels +// @Produce json +// @Param payload body repo.LabelCreate true "Label Data" +// @Success 200 {object} repo.LabelSummary +// @Router /v1/labels [POST] +// @Security Bearer func (ctrl *V1Controller) HandleLabelsCreate() errchain.HandlerFunc { fn := func(r *http.Request, data repo.LabelCreate) (repo.LabelOut, error) { auth := services.NewContext(r.Context()) @@ -47,13 +47,13 @@ func (ctrl *V1Controller) HandleLabelsCreate() errchain.HandlerFunc { // HandleLabelDelete godocs // -// @Summary Delete Label -// @Tags Labels -// @Produce json -// @Param id path string true "Label ID" -// @Success 204 -// @Router /v1/labels/{id} [DELETE] -// @Security Bearer +// @Summary Delete Label +// @Tags Labels +// @Produce json +// @Param id path string true "Label ID" +// @Success 204 +// @Router /v1/labels/{id} [DELETE] +// @Security Bearer func (ctrl *V1Controller) HandleLabelDelete() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID) (any, error) { auth := services.NewContext(r.Context()) @@ -66,13 +66,13 @@ func (ctrl *V1Controller) HandleLabelDelete() errchain.HandlerFunc { // HandleLabelGet godocs // -// @Summary Get Label -// @Tags Labels -// @Produce json -// @Param id path string true "Label ID" -// @Success 200 {object} repo.LabelOut -// @Router /v1/labels/{id} [GET] -// @Security Bearer +// @Summary Get Label +// @Tags Labels +// @Produce json +// @Param id path string true "Label ID" +// @Success 200 {object} repo.LabelOut +// @Router /v1/labels/{id} [GET] +// @Security Bearer func (ctrl *V1Controller) HandleLabelGet() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID) (repo.LabelOut, error) { auth := services.NewContext(r.Context()) @@ -84,13 +84,13 @@ func (ctrl *V1Controller) HandleLabelGet() errchain.HandlerFunc { // HandleLabelUpdate godocs // -// @Summary Update Label -// @Tags Labels -// @Produce json -// @Param id path string true "Label ID" -// @Success 200 {object} repo.LabelOut -// @Router /v1/labels/{id} [PUT] -// @Security Bearer +// @Summary Update Label +// @Tags Labels +// @Produce json +// @Param id path string true "Label ID" +// @Success 200 {object} repo.LabelOut +// @Router /v1/labels/{id} [PUT] +// @Security Bearer func (ctrl *V1Controller) HandleLabelUpdate() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID, data repo.LabelUpdate) (repo.LabelOut, error) { auth := services.NewContext(r.Context()) diff --git a/backend/app/api/handlers/v1/v1_ctrl_locations.go b/backend/app/api/handlers/v1/v1_ctrl_locations.go index 3903bd928..f8099b7a7 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_locations.go +++ b/backend/app/api/handlers/v1/v1_ctrl_locations.go @@ -14,13 +14,13 @@ import ( // HandleLocationTreeQuery godoc // -// @Summary Get Locations Tree -// @Tags Locations -// @Produce json -// @Param withItems query bool false "include items in response tree" -// @Success 200 {object} []repo.TreeItem -// @Router /v1/locations/tree [GET] -// @Security Bearer +// @Summary Get Locations Tree +// @Tags Locations +// @Produce json +// @Param withItems query bool false "include items in response tree" +// @Success 200 {object} []repo.TreeItem +// @Router /v1/locations/tree [GET] +// @Security Bearer func (ctrl *V1Controller) HandleLocationTreeQuery() errchain.HandlerFunc { fn := func(r *http.Request, query repo.TreeQuery) ([]repo.TreeItem, error) { auth := services.NewContext(r.Context()) @@ -32,13 +32,13 @@ func (ctrl *V1Controller) HandleLocationTreeQuery() errchain.HandlerFunc { // HandleLocationGetAll godoc // -// @Summary Get All Locations -// @Tags Locations -// @Produce json -// @Param filterChildren query bool false "Filter locations with parents" -// @Success 200 {object} []repo.LocationOutCount -// @Router /v1/locations [GET] -// @Security Bearer +// @Summary Get All Locations +// @Tags Locations +// @Produce json +// @Param filterChildren query bool false "Filter locations with parents" +// @Success 200 {object} []repo.LocationOutCount +// @Router /v1/locations [GET] +// @Security Bearer func (ctrl *V1Controller) HandleLocationGetAll() errchain.HandlerFunc { fn := func(r *http.Request, q repo.LocationQuery) ([]repo.LocationOutCount, error) { auth := services.NewContext(r.Context()) @@ -50,13 +50,13 @@ func (ctrl *V1Controller) HandleLocationGetAll() errchain.HandlerFunc { // HandleLocationCreate godoc // -// @Summary Create Location -// @Tags Locations -// @Produce json -// @Param payload body repo.LocationCreate true "Location Data" -// @Success 200 {object} repo.LocationSummary -// @Router /v1/locations [POST] -// @Security Bearer +// @Summary Create Location +// @Tags Locations +// @Produce json +// @Param payload body repo.LocationCreate true "Location Data" +// @Success 200 {object} repo.LocationSummary +// @Router /v1/locations [POST] +// @Security Bearer func (ctrl *V1Controller) HandleLocationCreate() errchain.HandlerFunc { fn := func(r *http.Request, createData repo.LocationCreate) (repo.LocationOut, error) { auth := services.NewContext(r.Context()) @@ -68,13 +68,13 @@ func (ctrl *V1Controller) HandleLocationCreate() errchain.HandlerFunc { // HandleLocationDelete godoc // -// @Summary Delete Location -// @Tags Locations -// @Produce json -// @Param id path string true "Location ID" -// @Success 204 -// @Router /v1/locations/{id} [DELETE] -// @Security Bearer +// @Summary Delete Location +// @Tags Locations +// @Produce json +// @Param id path string true "Location ID" +// @Success 204 +// @Router /v1/locations/{id} [DELETE] +// @Security Bearer func (ctrl *V1Controller) HandleLocationDelete() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID) (any, error) { auth := services.NewContext(r.Context()) @@ -124,13 +124,13 @@ func (ctrl *V1Controller) GetLocationWithPrice(auth context.Context, gid uuid.UU // HandleLocationGet godoc // -// @Summary Get Location -// @Tags Locations -// @Produce json -// @Param id path string true "Location ID" -// @Success 200 {object} repo.LocationOut -// @Router /v1/locations/{id} [GET] -// @Security Bearer +// @Summary Get Location +// @Tags Locations +// @Produce json +// @Param id path string true "Location ID" +// @Success 200 {object} repo.LocationOut +// @Router /v1/locations/{id} [GET] +// @Security Bearer func (ctrl *V1Controller) HandleLocationGet() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID) (repo.LocationOut, error) { auth := services.NewContext(r.Context()) @@ -144,14 +144,14 @@ func (ctrl *V1Controller) HandleLocationGet() errchain.HandlerFunc { // HandleLocationUpdate godoc // -// @Summary Update Location -// @Tags Locations -// @Produce json -// @Param id path string true "Location ID" -// @Param payload body repo.LocationUpdate true "Location Data" -// @Success 200 {object} repo.LocationOut -// @Router /v1/locations/{id} [PUT] -// @Security Bearer +// @Summary Update Location +// @Tags Locations +// @Produce json +// @Param id path string true "Location ID" +// @Param payload body repo.LocationUpdate true "Location Data" +// @Success 200 {object} repo.LocationOut +// @Router /v1/locations/{id} [PUT] +// @Security Bearer func (ctrl *V1Controller) HandleLocationUpdate() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID, body repo.LocationUpdate) (repo.LocationOut, error) { auth := services.NewContext(r.Context()) diff --git a/backend/app/api/handlers/v1/v1_ctrl_maint_entry.go b/backend/app/api/handlers/v1/v1_ctrl_maint_entry.go index e9f1f97c0..aa1f3bb55 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_maint_entry.go +++ b/backend/app/api/handlers/v1/v1_ctrl_maint_entry.go @@ -12,13 +12,13 @@ import ( // HandleMaintenanceLogGet godoc // -// @Summary Get Maintenance Log -// @Tags Item Maintenance -// @Produce json -// @Param filters query repo.MaintenanceFilters false "which maintenance to retrieve" -// @Success 200 {array} repo.MaintenanceEntryWithDetails[] -// @Router /v1/items/{id}/maintenance [GET] -// @Security Bearer +// @Summary Get Maintenance Log +// @Tags Item Maintenance +// @Produce json +// @Param filters query repo.MaintenanceFilters false "which maintenance to retrieve" +// @Success 200 {array} repo.MaintenanceEntryWithDetails[] +// @Router /v1/items/{id}/maintenance [GET] +// @Security Bearer func (ctrl *V1Controller) HandleMaintenanceLogGet() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID, filters repo.MaintenanceFilters) ([]repo.MaintenanceEntryWithDetails, error) { auth := services.NewContext(r.Context()) @@ -30,13 +30,13 @@ func (ctrl *V1Controller) HandleMaintenanceLogGet() errchain.HandlerFunc { // HandleMaintenanceEntryCreate godoc // -// @Summary Create Maintenance Entry -// @Tags Item Maintenance -// @Produce json -// @Param payload body repo.MaintenanceEntryCreate true "Entry Data" -// @Success 201 {object} repo.MaintenanceEntry -// @Router /v1/items/{id}/maintenance [POST] -// @Security Bearer +// @Summary Create Maintenance Entry +// @Tags Item Maintenance +// @Produce json +// @Param payload body repo.MaintenanceEntryCreate true "Entry Data" +// @Success 201 {object} repo.MaintenanceEntry +// @Router /v1/items/{id}/maintenance [POST] +// @Security Bearer func (ctrl *V1Controller) HandleMaintenanceEntryCreate() errchain.HandlerFunc { fn := func(r *http.Request, itemID uuid.UUID, body repo.MaintenanceEntryCreate) (repo.MaintenanceEntry, error) { auth := services.NewContext(r.Context()) diff --git a/backend/app/api/handlers/v1/v1_ctrl_maintenance.go b/backend/app/api/handlers/v1/v1_ctrl_maintenance.go index 647bfa703..03145b0ac 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_maintenance.go +++ b/backend/app/api/handlers/v1/v1_ctrl_maintenance.go @@ -12,13 +12,13 @@ import ( // HandleMaintenanceGetAll godoc // -// @Summary Query All Maintenance -// @Tags Maintenance -// @Produce json -// @Param filters query repo.MaintenanceFilters false "which maintenance to retrieve" -// @Success 200 {array} repo.MaintenanceEntryWithDetails[] -// @Router /v1/maintenance [GET] -// @Security Bearer +// @Summary Query All Maintenance +// @Tags Maintenance +// @Produce json +// @Param filters query repo.MaintenanceFilters false "which maintenance to retrieve" +// @Success 200 {array} repo.MaintenanceEntryWithDetails[] +// @Router /v1/maintenance [GET] +// @Security Bearer func (ctrl *V1Controller) HandleMaintenanceGetAll() errchain.HandlerFunc { fn := func(r *http.Request, filters repo.MaintenanceFilters) ([]repo.MaintenanceEntryWithDetails, error) { auth := services.NewContext(r.Context()) @@ -30,13 +30,13 @@ func (ctrl *V1Controller) HandleMaintenanceGetAll() errchain.HandlerFunc { // HandleMaintenanceEntryUpdate godoc // -// @Summary Update Maintenance Entry -// @Tags Maintenance -// @Produce json -// @Param payload body repo.MaintenanceEntryUpdate true "Entry Data" -// @Success 200 {object} repo.MaintenanceEntry -// @Router /v1/maintenance/{id} [PUT] -// @Security Bearer +// @Summary Update Maintenance Entry +// @Tags Maintenance +// @Produce json +// @Param payload body repo.MaintenanceEntryUpdate true "Entry Data" +// @Success 200 {object} repo.MaintenanceEntry +// @Router /v1/maintenance/{id} [PUT] +// @Security Bearer func (ctrl *V1Controller) HandleMaintenanceEntryUpdate() errchain.HandlerFunc { fn := func(r *http.Request, entryID uuid.UUID, body repo.MaintenanceEntryUpdate) (repo.MaintenanceEntry, error) { auth := services.NewContext(r.Context()) @@ -48,12 +48,12 @@ func (ctrl *V1Controller) HandleMaintenanceEntryUpdate() errchain.HandlerFunc { // HandleMaintenanceEntryDelete godoc // -// @Summary Delete Maintenance Entry -// @Tags Maintenance -// @Produce json -// @Success 204 -// @Router /v1/maintenance/{id} [DELETE] -// @Security Bearer +// @Summary Delete Maintenance Entry +// @Tags Maintenance +// @Produce json +// @Success 204 +// @Router /v1/maintenance/{id} [DELETE] +// @Security Bearer func (ctrl *V1Controller) HandleMaintenanceEntryDelete() errchain.HandlerFunc { fn := func(r *http.Request, entryID uuid.UUID) (any, error) { auth := services.NewContext(r.Context()) diff --git a/backend/app/api/handlers/v1/v1_ctrl_notifiers.go b/backend/app/api/handlers/v1/v1_ctrl_notifiers.go index f46b9102c..3c48aa0c2 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_notifiers.go +++ b/backend/app/api/handlers/v1/v1_ctrl_notifiers.go @@ -13,12 +13,12 @@ import ( // HandleGetUserNotifiers godoc // -// @Summary Get Notifiers -// @Tags Notifiers -// @Produce json -// @Success 200 {object} []repo.NotifierOut -// @Router /v1/notifiers [GET] -// @Security Bearer +// @Summary Get Notifiers +// @Tags Notifiers +// @Produce json +// @Success 200 {object} []repo.NotifierOut +// @Router /v1/notifiers [GET] +// @Security Bearer func (ctrl *V1Controller) HandleGetUserNotifiers() errchain.HandlerFunc { fn := func(r *http.Request, _ struct{}) ([]repo.NotifierOut, error) { user := services.UseUserCtx(r.Context()) @@ -30,13 +30,13 @@ func (ctrl *V1Controller) HandleGetUserNotifiers() errchain.HandlerFunc { // HandleCreateNotifier godoc // -// @Summary Create Notifier -// @Tags Notifiers -// @Produce json -// @Param payload body repo.NotifierCreate true "Notifier Data" -// @Success 200 {object} repo.NotifierOut -// @Router /v1/notifiers [POST] -// @Security Bearer +// @Summary Create Notifier +// @Tags Notifiers +// @Produce json +// @Param payload body repo.NotifierCreate true "Notifier Data" +// @Success 200 {object} repo.NotifierOut +// @Router /v1/notifiers [POST] +// @Security Bearer func (ctrl *V1Controller) HandleCreateNotifier() errchain.HandlerFunc { fn := func(r *http.Request, in repo.NotifierCreate) (repo.NotifierOut, error) { auth := services.NewContext(r.Context()) @@ -48,12 +48,12 @@ func (ctrl *V1Controller) HandleCreateNotifier() errchain.HandlerFunc { // HandleDeleteNotifier godocs // -// @Summary Delete a Notifier -// @Tags Notifiers -// @Param id path string true "Notifier ID" -// @Success 204 -// @Router /v1/notifiers/{id} [DELETE] -// @Security Bearer +// @Summary Delete a Notifier +// @Tags Notifiers +// @Param id path string true "Notifier ID" +// @Success 204 +// @Router /v1/notifiers/{id} [DELETE] +// @Security Bearer func (ctrl *V1Controller) HandleDeleteNotifier() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID) (any, error) { auth := services.NewContext(r.Context()) @@ -65,13 +65,13 @@ func (ctrl *V1Controller) HandleDeleteNotifier() errchain.HandlerFunc { // HandleUpdateNotifier godocs // -// @Summary Update Notifier -// @Tags Notifiers -// @Param id path string true "Notifier ID" -// @Param payload body repo.NotifierUpdate true "Notifier Data" -// @Success 200 {object} repo.NotifierOut -// @Router /v1/notifiers/{id} [PUT] -// @Security Bearer +// @Summary Update Notifier +// @Tags Notifiers +// @Param id path string true "Notifier ID" +// @Param payload body repo.NotifierUpdate true "Notifier Data" +// @Success 200 {object} repo.NotifierOut +// @Router /v1/notifiers/{id} [PUT] +// @Security Bearer func (ctrl *V1Controller) HandleUpdateNotifier() errchain.HandlerFunc { fn := func(r *http.Request, ID uuid.UUID, in repo.NotifierUpdate) (repo.NotifierOut, error) { auth := services.NewContext(r.Context()) @@ -83,14 +83,14 @@ func (ctrl *V1Controller) HandleUpdateNotifier() errchain.HandlerFunc { // HandlerNotifierTest godoc // -// @Summary Test Notifier -// @Tags Notifiers -// @Produce json -// @Param id path string true "Notifier ID" -// @Param url query string true "URL" -// @Success 204 -// @Router /v1/notifiers/test [POST] -// @Security Bearer +// @Summary Test Notifier +// @Tags Notifiers +// @Produce json +// @Param id path string true "Notifier ID" +// @Param url query string true "URL" +// @Success 204 +// @Router /v1/notifiers/test [POST] +// @Security Bearer func (ctrl *V1Controller) HandlerNotifierTest() errchain.HandlerFunc { type body struct { URL string `json:"url" validate:"required"` diff --git a/backend/app/api/handlers/v1/v1_ctrl_qrcode.go b/backend/app/api/handlers/v1/v1_ctrl_qrcode.go index b348420a1..333f8d004 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_qrcode.go +++ b/backend/app/api/handlers/v1/v1_ctrl_qrcode.go @@ -20,13 +20,13 @@ var qrcodeLogo []byte // HandleGenerateQRCode godoc // -// @Summary Create QR Code -// @Tags Items -// @Produce json -// @Param data query string false "data to be encoded into qrcode" -// @Success 200 {string} string "image/jpeg" -// @Router /v1/qrcode [GET] -// @Security Bearer +// @Summary Create QR Code +// @Tags Items +// @Produce json +// @Param data query string false "data to be encoded into qrcode" +// @Success 200 {string} string "image/jpeg" +// @Router /v1/qrcode [GET] +// @Security Bearer func (ctrl *V1Controller) HandleGenerateQRCode() errchain.HandlerFunc { type query struct { // 4,296 characters is the maximum length of a QR code diff --git a/backend/app/api/handlers/v1/v1_ctrl_reporting.go b/backend/app/api/handlers/v1/v1_ctrl_reporting.go index d3b712f8e..6df58e178 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_reporting.go +++ b/backend/app/api/handlers/v1/v1_ctrl_reporting.go @@ -8,12 +8,12 @@ import ( // HandleBillOfMaterialsExport godoc // -// @Summary Export Bill of Materials -// @Tags Reporting -// @Produce json -// @Success 200 {string} string "text/csv" -// @Router /v1/reporting/bill-of-materials [GET] -// @Security Bearer +// @Summary Export Bill of Materials +// @Tags Reporting +// @Produce json +// @Success 200 {string} string "text/csv" +// @Router /v1/reporting/bill-of-materials [GET] +// @Security Bearer func (ctrl *V1Controller) HandleBillOfMaterialsExport() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { actor := services.UseUserCtx(r.Context()) diff --git a/backend/app/api/handlers/v1/v1_ctrl_statistics.go b/backend/app/api/handlers/v1/v1_ctrl_statistics.go index d66bd9086..980f44b05 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_statistics.go +++ b/backend/app/api/handlers/v1/v1_ctrl_statistics.go @@ -14,12 +14,12 @@ import ( // HandleGroupStatisticsLocations godoc // -// @Summary Get Location Statistics -// @Tags Statistics -// @Produce json -// @Success 200 {object} []repo.TotalsByOrganizer -// @Router /v1/groups/statistics/locations [GET] -// @Security Bearer +// @Summary Get Location Statistics +// @Tags Statistics +// @Produce json +// @Success 200 {object} []repo.TotalsByOrganizer +// @Router /v1/groups/statistics/locations [GET] +// @Security Bearer func (ctrl *V1Controller) HandleGroupStatisticsLocations() errchain.HandlerFunc { fn := func(r *http.Request) ([]repo.TotalsByOrganizer, error) { auth := services.NewContext(r.Context()) @@ -31,12 +31,12 @@ func (ctrl *V1Controller) HandleGroupStatisticsLocations() errchain.HandlerFunc // HandleGroupStatisticsLabels godoc // -// @Summary Get Label Statistics -// @Tags Statistics -// @Produce json -// @Success 200 {object} []repo.TotalsByOrganizer -// @Router /v1/groups/statistics/labels [GET] -// @Security Bearer +// @Summary Get Label Statistics +// @Tags Statistics +// @Produce json +// @Success 200 {object} []repo.TotalsByOrganizer +// @Router /v1/groups/statistics/labels [GET] +// @Security Bearer func (ctrl *V1Controller) HandleGroupStatisticsLabels() errchain.HandlerFunc { fn := func(r *http.Request) ([]repo.TotalsByOrganizer, error) { auth := services.NewContext(r.Context()) @@ -48,12 +48,12 @@ func (ctrl *V1Controller) HandleGroupStatisticsLabels() errchain.HandlerFunc { // HandleGroupStatistics godoc // -// @Summary Get Group Statistics -// @Tags Statistics -// @Produce json -// @Success 200 {object} repo.GroupStatistics -// @Router /v1/groups/statistics [GET] -// @Security Bearer +// @Summary Get Group Statistics +// @Tags Statistics +// @Produce json +// @Success 200 {object} repo.GroupStatistics +// @Router /v1/groups/statistics [GET] +// @Security Bearer func (ctrl *V1Controller) HandleGroupStatistics() errchain.HandlerFunc { fn := func(r *http.Request) (repo.GroupStatistics, error) { auth := services.NewContext(r.Context()) @@ -65,14 +65,14 @@ func (ctrl *V1Controller) HandleGroupStatistics() errchain.HandlerFunc { // HandleGroupStatisticsPriceOverTime godoc // -// @Summary Get Purchase Price Statistics -// @Tags Statistics -// @Produce json -// @Success 200 {object} repo.ValueOverTime -// @Param start query string false "start date" -// @Param end query string false "end date" -// @Router /v1/groups/statistics/purchase-price [GET] -// @Security Bearer +// @Summary Get Purchase Price Statistics +// @Tags Statistics +// @Produce json +// @Success 200 {object} repo.ValueOverTime +// @Param start query string false "start date" +// @Param end query string false "end date" +// @Router /v1/groups/statistics/purchase-price [GET] +// @Security Bearer func (ctrl *V1Controller) HandleGroupStatisticsPriceOverTime() errchain.HandlerFunc { parseDate := func(datestr string, defaultDate time.Time) (time.Time, error) { if datestr == "" { diff --git a/backend/app/api/handlers/v1/v1_ctrl_user.go b/backend/app/api/handlers/v1/v1_ctrl_user.go index 5704fd911..a99c7b869 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_user.go +++ b/backend/app/api/handlers/v1/v1_ctrl_user.go @@ -15,12 +15,12 @@ import ( // HandleUserRegistration godoc // -// @Summary Register New User -// @Tags User -// @Produce json -// @Param payload body services.UserRegistration true "User Data" -// @Success 204 -// @Router /v1/users/register [Post] +// @Summary Register New User +// @Tags User +// @Produce json +// @Param payload body services.UserRegistration true "User Data" +// @Success 204 +// @Router /v1/users/register [Post] func (ctrl *V1Controller) HandleUserRegistration() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { regData := services.UserRegistration{} @@ -46,12 +46,12 @@ func (ctrl *V1Controller) HandleUserRegistration() errchain.HandlerFunc { // HandleUserSelf godoc // -// @Summary Get User Self -// @Tags User -// @Produce json -// @Success 200 {object} Wrapped{item=repo.UserOut} -// @Router /v1/users/self [GET] -// @Security Bearer +// @Summary Get User Self +// @Tags User +// @Produce json +// @Success 200 {object} Wrapped{item=repo.UserOut} +// @Router /v1/users/self [GET] +// @Security Bearer func (ctrl *V1Controller) HandleUserSelf() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { token := services.UseTokenCtx(r.Context()) @@ -67,13 +67,13 @@ func (ctrl *V1Controller) HandleUserSelf() errchain.HandlerFunc { // HandleUserSelfUpdate godoc // -// @Summary Update Account -// @Tags User -// @Produce json -// @Param payload body repo.UserUpdate true "User Data" -// @Success 200 {object} Wrapped{item=repo.UserUpdate} -// @Router /v1/users/self [PUT] -// @Security Bearer +// @Summary Update Account +// @Tags User +// @Produce json +// @Param payload body repo.UserUpdate true "User Data" +// @Success 200 {object} Wrapped{item=repo.UserUpdate} +// @Router /v1/users/self [PUT] +// @Security Bearer func (ctrl *V1Controller) HandleUserSelfUpdate() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { updateData := repo.UserUpdate{} @@ -94,12 +94,12 @@ func (ctrl *V1Controller) HandleUserSelfUpdate() errchain.HandlerFunc { // HandleUserSelfDelete godoc // -// @Summary Delete Account -// @Tags User -// @Produce json -// @Success 204 -// @Router /v1/users/self [DELETE] -// @Security Bearer +// @Summary Delete Account +// @Tags User +// @Produce json +// @Success 204 +// @Router /v1/users/self [DELETE] +// @Security Bearer func (ctrl *V1Controller) HandleUserSelfDelete() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { if ctrl.isDemo { @@ -124,12 +124,12 @@ type ( // HandleUserSelfChangePassword godoc // -// @Summary Change Password -// @Tags User -// @Success 204 -// @Param payload body ChangePassword true "Password Payload" -// @Router /v1/users/change-password [PUT] -// @Security Bearer +// @Summary Change Password +// @Tags User +// @Success 204 +// @Param payload body ChangePassword true "Password Payload" +// @Router /v1/users/change-password [PUT] +// @Security Bearer func (ctrl *V1Controller) HandleUserSelfChangePassword() errchain.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) error { if ctrl.isDemo { diff --git a/backend/app/api/main.go b/backend/app/api/main.go index 6247fe6ad..96d0fdab9 100644 --- a/backend/app/api/main.go +++ b/backend/app/api/main.go @@ -46,15 +46,15 @@ func build() string { return fmt.Sprintf("%s, commit %s, built at %s", version, short, buildTime) } -// @title Homebox API -// @version 1.0 -// @description Track, Manage, and Organize your Things. -// @contact.name Don't -// @BasePath /api -// @securityDefinitions.apikey Bearer -// @in header -// @name Authorization -// @description "Type 'Bearer TOKEN' to correctly set the API Key" +// @title Homebox API +// @version 1.0 +// @description Track, Manage, and Organize your Things. +// @contact.name Don't +// @BasePath /api +// @securityDefinitions.apikey Bearer +// @in header +// @name Authorization +// @description "Type 'Bearer TOKEN' to correctly set the API Key" func main() { zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack