feat: Notifiers CRUD (#337)

* introduce scaffold for new models

* wip: shoutrrr wrapper (may remove)

* update schema files

* gen: ent code

* gen: migrations

* go mod tidy

* add group_id to notifier

* db migration

* new mapper helpers

* notifier repo

* introduce experimental adapter pattern for hdlrs

* refactor adapters to fit more common use cases

* new routes for notifiers

* update errors to fix validation panic

* go tidy

* reverse checkbox label display

* wip: notifiers UI

* use badges instead of text

* improve documentation

* add scaffold schema reference

* remove notifier service

* refactor schema folder

* support group edges via scaffold

* delete test file

* include link to API docs

* audit and update documentation + improve format

* refactor schema edges

* refactor

* add custom validator

* set validate + order fields by name

* fix failing tests
This commit is contained in:
Hayden 2023-03-06 21:18:58 -09:00 committed by GitHub
parent 2665b666f1
commit 23b5892aef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
100 changed files with 11437 additions and 2075 deletions

View file

@ -75,17 +75,18 @@ func NewControllerV1(svc *services.AllServices, repos *repo.AllRepos, options ..
}
// HandleBase godoc
// @Summary Retrieves the basic information about the API
// @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) server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
return server.Respond(w, http.StatusOK, ApiSummary{
Healthy: ready(),
Title: "Go API Template",
Message: "Welcome to the Go API Template Application!",
Title: "Homebox",
Message: "Track, Manage, and Organize your shit",
Build: build,
Demo: ctrl.isDemo,
AllowRegistration: ctrl.allowRegistration,

View file

@ -21,7 +21,7 @@ func (ctrl *V1Controller) routeID(r *http.Request) (uuid.UUID, error) {
func (ctrl *V1Controller) routeUUID(r *http.Request, key string) (uuid.UUID, error) {
ID, err := uuid.Parse(chi.URLParam(r, key))
if err != nil {
return uuid.Nil, validate.NewInvalidRouteKeyError(key)
return uuid.Nil, validate.NewRouteKeyError(key)
}
return ID, nil
}

View file

@ -29,35 +29,41 @@ func actionHandlerFactory(ref string, fn func(context.Context, uuid.UUID) (int,
}
}
// HandleGroupInvitationsCreate godoc
// @Summary Ensures all items in the database have an asset id
// @Tags Group
// @Produce json
// @Success 200 {object} ActionAmountResult
// @Router /v1/actions/ensure-asset-ids [Post]
// @Security Bearer
// 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
func (ctrl *V1Controller) HandleEnsureAssetID() server.HandlerFunc {
return actionHandlerFactory("ensure asset IDs", ctrl.svc.Items.EnsureAssetID)
}
// HandleEnsureImportRefs godoc
// @Summary Ensures all items in the database have an import ref
// @Tags Group
// @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() server.HandlerFunc {
return actionHandlerFactory("ensure import refs", ctrl.svc.Items.EnsureImportRef)
}
// HandleItemDateZeroOut godoc
// @Summary Resets all item date fields to the beginning of the day
// @Tags Group
// @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() server.HandlerFunc {
return actionHandlerFactory("zero out date time", ctrl.repo.Items.ZeroOutTimeFields)
}

View file

@ -14,14 +14,15 @@ import (
"github.com/rs/zerolog/log"
)
// HandleItemGet godocs
// @Summary Gets an item by Asset ID
// @Tags Assets
// @Produce json
// @Param id path string true "Asset ID"
// @Success 200 {object} repo.PaginationResult[repo.ItemSummary]{}
// @Router /v1/assets/{id} [GET]
// @Security Bearer
// 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
func (ctrl *V1Controller) HandleAssetGet() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
ctx := services.NewContext(r.Context())

View file

@ -26,15 +26,16 @@ type (
)
// 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)
// @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)
// @Produce json
// @Success 200 {object} TokenResponse
// @Router /v1/users/login [POST]
func (ctrl *V1Controller) HandleAuthLogin() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
loginForm := &LoginForm{}
@ -84,11 +85,12 @@ func (ctrl *V1Controller) HandleAuthLogin() server.HandlerFunc {
}
// 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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
token := services.UseTokenCtx(r.Context())
@ -106,13 +108,14 @@ func (ctrl *V1Controller) HandleAuthLogout() server.HandlerFunc {
}
// HandleAuthLogout 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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
requestToken := services.UseTokenCtx(r.Context())

View file

@ -25,24 +25,26 @@ type (
)
// HandleGroupGet godoc
// @Summary Get the current user's 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() server.HandlerFunc {
return ctrl.handleGroupGeneral()
}
// HandleGroupUpdate godoc
// @Summary Updates some fields of the current users 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() server.HandlerFunc {
return ctrl.handleGroupGeneral()
}
@ -81,13 +83,14 @@ func (ctrl *V1Controller) handleGroupGeneral() server.HandlerFunc {
}
// HandleGroupInvitationsCreate godoc
// @Summary Get the current user
// @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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
data := GroupInvitationCreate{}

View file

@ -15,17 +15,18 @@ import (
)
// HandleItemsGetAll godoc
// @Summary Get 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)
// @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)
// @Success 200 {object} repo.PaginationResult[repo.ItemSummary]{}
// @Router /v1/items [GET]
// @Security Bearer
func (ctrl *V1Controller) HandleItemsGetAll() server.HandlerFunc {
extractQuery := func(r *http.Request) repo.ItemQuery {
params := r.URL.Query()
@ -87,13 +88,14 @@ func (ctrl *V1Controller) HandleItemsGetAll() server.HandlerFunc {
}
// HandleItemsCreate godoc
// @Summary Create a new item
// @Tags Items
// @Produce json
// @Param payload body repo.ItemCreate true "Item Data"
// @Success 200 {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 200 {object} repo.ItemSummary
// @Router /v1/items [POST]
// @Security Bearer
func (ctrl *V1Controller) HandleItemsCreate() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
createData := repo.ItemCreate{}
@ -114,38 +116,41 @@ func (ctrl *V1Controller) HandleItemsCreate() server.HandlerFunc {
}
// HandleItemGet godocs
// @Summary Gets a item and fields
// @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() server.HandlerFunc {
return ctrl.handleItemsGeneral()
}
// HandleItemDelete godocs
// @Summary deletes a 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() server.HandlerFunc {
return ctrl.handleItemsGeneral()
}
// HandleItemUpdate godocs
// @Summary updates a 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() server.HandlerFunc {
return ctrl.handleItemsGeneral()
}
@ -193,13 +198,14 @@ func (ctrl *V1Controller) handleItemsGeneral() server.HandlerFunc {
}
// HandleGetAllCustomFieldNames godocs
// @Summary imports items into the database
// @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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
ctx := services.NewContext(r.Context())
@ -214,13 +220,14 @@ func (ctrl *V1Controller) HandleGetAllCustomFieldNames() server.HandlerFunc {
}
// HandleGetAllCustomFieldValues godocs
// @Summary imports items into the database
// @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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
ctx := services.NewContext(r.Context())
@ -235,13 +242,14 @@ func (ctrl *V1Controller) HandleGetAllCustomFieldValues() server.HandlerFunc {
}
// HandleItemsImport godocs
// @Summary imports items into the database
// @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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
err := r.ParseMultipartForm(ctrl.maxUploadSize << 20)
@ -268,12 +276,13 @@ func (ctrl *V1Controller) HandleItemsImport() server.HandlerFunc {
}
}
// HandleItemsImport godocs
// @Summary exports items into the database
// @Tags Items
// @Success 200 {string} string "text/csv"
// @Router /v1/items/export [GET]
// @Security Bearer
// HandleItemsExport godocs
//
// @Summary Export Items
// @Tags Items
// @Success 200 {string} string "text/csv"
// @Router /v1/items/export [GET]
// @Security Bearer
func (ctrl *V1Controller) HandleItemsExport() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
ctx := services.NewContext(r.Context())

View file

@ -18,18 +18,19 @@ type (
}
)
// HandleItemsImport godocs
// @Summary imports items into the database
// @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} server.ErrorResponse
// @Router /v1/items/{id}/attachments [POST]
// @Security Bearer
// 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} server.ErrorResponse
// @Router /v1/items/{id}/attachments [POST]
// @Security Bearer
func (ctrl *V1Controller) HandleItemAttachmentCreate() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
err := r.ParseMultipartForm(ctrl.maxUploadSize << 20)
@ -92,39 +93,42 @@ func (ctrl *V1Controller) HandleItemAttachmentCreate() server.HandlerFunc {
}
// HandleItemAttachmentGet godocs
// @Summary retrieves an attachment for an item
// @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() server.HandlerFunc {
return ctrl.handleItemAttachmentsHandler
}
// HandleItemAttachmentDelete godocs
// @Summary retrieves an attachment for an item
// @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() server.HandlerFunc {
return ctrl.handleItemAttachmentsHandler
}
// HandleItemAttachmentUpdate godocs
// @Summary retrieves an attachment for an item
// @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() server.HandlerFunc {
return ctrl.handleItemAttachmentsHandler
}

View file

@ -12,12 +12,13 @@ import (
)
// HandleLabelsGetAll godoc
// @Summary Get All Labels
// @Tags Labels
// @Produce json
// @Success 200 {object} server.Results{items=[]repo.LabelOut}
// @Router /v1/labels [GET]
// @Security Bearer
//
// @Summary Get All Labels
// @Tags Labels
// @Produce json
// @Success 200 {object} server.Results{items=[]repo.LabelOut}
// @Router /v1/labels [GET]
// @Security Bearer
func (ctrl *V1Controller) HandleLabelsGetAll() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
user := services.UseUserCtx(r.Context())
@ -31,13 +32,14 @@ func (ctrl *V1Controller) HandleLabelsGetAll() server.HandlerFunc {
}
// HandleLabelsCreate godoc
// @Summary Create a new 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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
createData := repo.LabelCreate{}
@ -58,37 +60,40 @@ func (ctrl *V1Controller) HandleLabelsCreate() server.HandlerFunc {
}
// HandleLabelDelete godocs
// @Summary deletes a 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() server.HandlerFunc {
return ctrl.handleLabelsGeneral()
}
// HandleLabelGet godocs
// @Summary Gets a label and fields
// @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() server.HandlerFunc {
return ctrl.handleLabelsGeneral()
}
// HandleLabelUpdate godocs
// @Summary updates a 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() server.HandlerFunc {
return ctrl.handleLabelsGeneral()
}

View file

@ -12,13 +12,14 @@ import (
)
// HandleLocationTreeQuery godoc
// @Summary Get All Locations
// @Tags Locations
// @Produce json
// @Param withItems query bool false "include items in response tree"
// @Success 200 {object} server.Results{items=[]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} server.Results{items=[]repo.TreeItem}
// @Router /v1/locations/tree [GET]
// @Security Bearer
func (ctrl *V1Controller) HandleLocationTreeQuery() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
user := services.UseUserCtx(r.Context())
@ -44,13 +45,14 @@ func (ctrl *V1Controller) HandleLocationTreeQuery() server.HandlerFunc {
}
// HandleLocationGetAll godoc
// @Summary Get All Locations
// @Tags Locations
// @Produce json
// @Param filterChildren query bool false "Filter locations with parents"
// @Success 200 {object} server.Results{items=[]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} server.Results{items=[]repo.LocationOutCount}
// @Router /v1/locations [GET]
// @Security Bearer
func (ctrl *V1Controller) HandleLocationGetAll() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
user := services.UseUserCtx(r.Context())
@ -72,13 +74,14 @@ func (ctrl *V1Controller) HandleLocationGetAll() server.HandlerFunc {
}
// HandleLocationCreate godoc
// @Summary Create a new 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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
createData := repo.LocationCreate{}
@ -99,38 +102,41 @@ func (ctrl *V1Controller) HandleLocationCreate() server.HandlerFunc {
}
// HandleLocationDelete godocs
// @Summary deletes a 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() server.HandlerFunc {
return ctrl.handleLocationGeneral()
}
// HandleLocationGet godocs
// @Summary Gets a location and fields
// @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() server.HandlerFunc {
return ctrl.handleLocationGeneral()
}
// HandleLocationUpdate godocs
// @Summary updates a 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() server.HandlerFunc {
return ctrl.handleLocationGeneral()
}

View file

@ -12,47 +12,51 @@ import (
)
// HandleMaintenanceGetLog godoc
// @Summary Get Maintenance Log
// @Tags Maintenance
// @Produce json
// @Success 200 {object} repo.MaintenanceLog
// @Router /v1/items/{id}/maintenance [GET]
// @Security Bearer
//
// @Summary Get Maintenance Log
// @Tags Maintenance
// @Produce json
// @Success 200 {object} repo.MaintenanceLog
// @Router /v1/items/{id}/maintenance [GET]
// @Security Bearer
func (ctrl *V1Controller) HandleMaintenanceLogGet() server.HandlerFunc {
return ctrl.handleMaintenanceLog()
}
// HandleMaintenanceEntryCreate godoc
// @Summary Create Maintenance Entry
// @Tags Maintenance
// @Produce json
// @Param payload body repo.MaintenanceEntryCreate true "Entry Data"
// @Success 200 {object} repo.MaintenanceEntry
// @Router /v1/items/{id}/maintenance [POST]
// @Security Bearer
//
// @Summary Create Maintenance Entry
// @Tags Maintenance
// @Produce json
// @Param payload body repo.MaintenanceEntryCreate true "Entry Data"
// @Success 200 {object} repo.MaintenanceEntry
// @Router /v1/items/{id}/maintenance [POST]
// @Security Bearer
func (ctrl *V1Controller) HandleMaintenanceEntryCreate() server.HandlerFunc {
return ctrl.handleMaintenanceLog()
}
// HandleMaintenanceEntryDelete godoc
// @Summary Delete Maintenance Entry
// @Tags Maintenance
// @Produce json
// @Success 204
// @Router /v1/items/{id}/maintenance/{entry_id} [DELETE]
// @Security Bearer
//
// @Summary Delete Maintenance Entry
// @Tags Maintenance
// @Produce json
// @Success 204
// @Router /v1/items/{id}/maintenance/{entry_id} [DELETE]
// @Security Bearer
func (ctrl *V1Controller) HandleMaintenanceEntryDelete() server.HandlerFunc {
return ctrl.handleMaintenanceLog()
}
// 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/items/{id}/maintenance/{entry_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/items/{id}/maintenance/{entry_id} [PUT]
// @Security Bearer
func (ctrl *V1Controller) HandleMaintenanceEntryUpdate() server.HandlerFunc {
return ctrl.handleMaintenanceLog()
}

View file

@ -0,0 +1,106 @@
package v1
import (
"context"
"net/http"
"github.com/containrrr/shoutrrr"
"github.com/google/uuid"
"github.com/hay-kot/homebox/backend/internal/core/services"
"github.com/hay-kot/homebox/backend/internal/data/repo"
"github.com/hay-kot/homebox/backend/internal/web/adapters"
"github.com/hay-kot/homebox/backend/pkgs/server"
)
// HandleGetUserNotifiers godoc
//
// @Summary Get Notifiers
// @Tags Notifiers
// @Produce json
// @Success 200 {object} server.Results{items=[]repo.NotifierOut}
// @Router /v1/notifiers [GET]
// @Security Bearer
func (ctrl *V1Controller) HandleGetUserNotifiers() server.HandlerFunc {
fn := func(ctx context.Context, _ struct{}) ([]repo.NotifierOut, error) {
user := services.UseUserCtx(ctx)
return ctrl.repo.Notifiers.GetByUser(ctx, user.ID)
}
return adapters.Query(fn, http.StatusOK)
}
// 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
func (ctrl *V1Controller) HandleCreateNotifier() server.HandlerFunc {
fn := func(ctx context.Context, in repo.NotifierCreate) (repo.NotifierOut, error) {
auth := services.NewContext(ctx)
return ctrl.repo.Notifiers.Create(ctx, auth.GID, auth.UID, in)
}
return adapters.Action(fn, http.StatusCreated)
}
// HandleDeleteNotifier godocs
//
// @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() server.HandlerFunc {
fn := func(ctx context.Context, ID uuid.UUID) (any, error) {
auth := services.NewContext(ctx)
return nil, ctrl.repo.Notifiers.Delete(ctx, auth.UID, ID)
}
return adapters.CommandID("id", fn, http.StatusNoContent)
}
// 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
func (ctrl *V1Controller) HandleUpdateNotifier() server.HandlerFunc {
fn := func(ctx context.Context, ID uuid.UUID, in repo.NotifierUpdate) (repo.NotifierOut, error) {
auth := services.NewContext(ctx)
return ctrl.repo.Notifiers.Update(ctx, auth.UID, ID, in)
}
return adapters.ActionID("id", fn, http.StatusOK)
}
// 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
func (ctrl *V1Controller) HandlerNotifierTest() server.HandlerFunc {
type body struct {
URL string `json:"url" validate:"required"`
}
fn := func(ctx context.Context, q body) (any, error) {
err := shoutrrr.Send(q.URL, "Test message from Homebox")
return nil, err
}
return adapters.Action(fn, http.StatusOK)
}

View file

@ -19,7 +19,7 @@ var qrcodeLogo []byte
// HandleGenerateQRCode godoc
//
// @Summary Encode data into QRCode
// @Summary Create QR Code
// @Tags Items
// @Produce json
// @Param data query string false "data to be encoded into qrcode"

View file

@ -9,7 +9,7 @@ import (
// HandleBillOfMaterialsExport godoc
//
// @Summary Generates a Bill of Materials CSV
// @Summary Export Bill of Materials
// @Tags Reporting
// @Produce json
// @Success 200 {string} string "text/csv"

View file

@ -10,12 +10,13 @@ import (
)
// HandleGroupGet godoc
// @Summary Get the current user's group 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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
ctx := services.NewContext(r.Context())
@ -29,13 +30,14 @@ func (ctrl *V1Controller) HandleGroupStatisticsLocations() server.HandlerFunc {
}
}
// HandleGroupGet godoc
// @Summary Get the current user's group statistics
// @Tags Statistics
// @Produce json
// @Success 200 {object} []repo.TotalsByOrganizer
// @Router /v1/groups/statistics/labels [GET]
// @Security Bearer
// HandleGroupStatisticsLabels godoc
//
// @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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
ctx := services.NewContext(r.Context())
@ -49,13 +51,14 @@ func (ctrl *V1Controller) HandleGroupStatisticsLabels() server.HandlerFunc {
}
}
// HandleGroupGet godoc
// @Summary Get the current user's group statistics
// @Tags Statistics
// @Produce json
// @Success 200 {object} repo.GroupStatistics
// @Router /v1/groups/statistics [GET]
// @Security Bearer
// HandleGroupStatistics godoc
//
// @Summary Get Group Statistics
// @Tags Statistics
// @Produce json
// @Success 200 {object} repo.GroupStatistics
// @Router /v1/groups/statistics [GET]
// @Security Bearer
func (ctrl *V1Controller) HandleGroupStatistics() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
ctx := services.NewContext(r.Context())
@ -69,15 +72,16 @@ func (ctrl *V1Controller) HandleGroupStatistics() server.HandlerFunc {
}
}
// HandleGroupGet godoc
// @Summary Queries the changes overtime of the purchase price over time
// @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
// 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
func (ctrl *V1Controller) HandleGroupStatisticsPriceOverTime() server.HandlerFunc {
parseDate := func(datestr string, defaultDate time.Time) (time.Time, error) {
if datestr == "" {

View file

@ -12,13 +12,14 @@ import (
"github.com/rs/zerolog/log"
)
// HandleUserSelf godoc
// @Summary Get the current user
// @Tags User
// @Produce json
// @Param payload body services.UserRegistration true "User Data"
// @Success 204
// @Router /v1/users/register [Post]
// 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]
func (ctrl *V1Controller) HandleUserRegistration() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
regData := services.UserRegistration{}
@ -43,12 +44,13 @@ func (ctrl *V1Controller) HandleUserRegistration() server.HandlerFunc {
}
// HandleUserSelf godoc
// @Summary Get the current user
// @Tags User
// @Produce json
// @Success 200 {object} server.Result{item=repo.UserOut}
// @Router /v1/users/self [GET]
// @Security Bearer
//
// @Summary Get User Self
// @Tags User
// @Produce json
// @Success 200 {object} server.Result{item=repo.UserOut}
// @Router /v1/users/self [GET]
// @Security Bearer
func (ctrl *V1Controller) HandleUserSelf() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
token := services.UseTokenCtx(r.Context())
@ -63,13 +65,14 @@ func (ctrl *V1Controller) HandleUserSelf() server.HandlerFunc {
}
// HandleUserSelfUpdate godoc
// @Summary Update the current user
// @Tags User
// @Produce json
// @Param payload body repo.UserUpdate true "User Data"
// @Success 200 {object} server.Result{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} server.Result{item=repo.UserUpdate}
// @Router /v1/users/self [PUT]
// @Security Bearer
func (ctrl *V1Controller) HandleUserSelfUpdate() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
updateData := repo.UserUpdate{}
@ -89,12 +92,13 @@ func (ctrl *V1Controller) HandleUserSelfUpdate() server.HandlerFunc {
}
// HandleUserSelfDelete godoc
// @Summary Deletes the user 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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
if ctrl.isDemo {
@ -118,12 +122,13 @@ type (
)
// HandleUserSelfChangePassword godoc
// @Summary Updates the users 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() server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
if ctrl.isDemo {

View file

@ -27,9 +27,9 @@ var (
buildTime = "now"
)
// @title Go API Templates
// @title Homebox API
// @version 1.0
// @description This is a simple Rest API Server Template that implements some basic User and Authentication patterns to help you get started and bootstrap your next project!.
// @description Track, Manage, and Organize your Shit.
// @contact.name Don't
// @license.name MIT
// @BasePath /api

View file

@ -126,6 +126,13 @@ func (a *app) mountRoutes(repos *repo.AllRepos) {
a.server.Get(v1Base("/asset/{id}"), v1Ctrl.HandleAssetGet(), userMW...)
// Notifiers
a.server.Get(v1Base("/notifiers"), v1Ctrl.HandleGetUserNotifiers(), userMW...)
a.server.Post(v1Base("/notifiers"), v1Ctrl.HandleCreateNotifier(), userMW...)
a.server.Put(v1Base("/notifiers/{id}"), v1Ctrl.HandleUpdateNotifier(), userMW...)
a.server.Delete(v1Base("/notifiers/{id}"), v1Ctrl.HandleDeleteNotifier(), userMW...)
a.server.Post(v1Base("/notifiers/test"), v1Ctrl.HandlerNotifierTest(), userMW...)
// Asset-Like endpoints
a.server.Get(
v1Base("/qrcode"),

View file

@ -28,13 +28,14 @@ const docTemplate = `{
"Bearer": []
}
],
"description": "Ensures all items in the database have an asset ID",
"produces": [
"application/json"
],
"tags": [
"Group"
"Actions"
],
"summary": "Ensures all items in the database have an asset id",
"summary": "Ensure Asset IDs",
"responses": {
"200": {
"description": "OK",
@ -52,13 +53,14 @@ const docTemplate = `{
"Bearer": []
}
],
"description": "Ensures all items in the database have an import ref",
"produces": [
"application/json"
],
"tags": [
"Group"
"Actions"
],
"summary": "Ensures all items in the database have an import ref",
"summary": "Ensures Import Refs",
"responses": {
"200": {
"description": "OK",
@ -76,13 +78,14 @@ const docTemplate = `{
"Bearer": []
}
],
"description": "Resets all item date fields to the beginning of the day",
"produces": [
"application/json"
],
"tags": [
"Group"
"Actions"
],
"summary": "Resets all item date fields to the beginning of the day",
"summary": "Zero Out Time Fields",
"responses": {
"200": {
"description": "OK",
@ -104,9 +107,9 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Assets"
"Items"
],
"summary": "Gets an item by Asset ID",
"summary": "Get Item by Asset ID",
"parameters": [
{
"type": "string",
@ -139,7 +142,7 @@ const docTemplate = `{
"tags": [
"Group"
],
"summary": "Get the current user's group",
"summary": "Get Group",
"responses": {
"200": {
"description": "OK",
@ -161,7 +164,7 @@ const docTemplate = `{
"tags": [
"Group"
],
"summary": "Updates some fields of the current users group",
"summary": "Update Group",
"parameters": [
{
"description": "User Data",
@ -196,7 +199,7 @@ const docTemplate = `{
"tags": [
"Group"
],
"summary": "Get the current user",
"summary": "Create Group Invitation",
"parameters": [
{
"description": "User Data",
@ -231,7 +234,7 @@ const docTemplate = `{
"tags": [
"Statistics"
],
"summary": "Get the current user's group statistics",
"summary": "Get Group Statistics",
"responses": {
"200": {
"description": "OK",
@ -255,7 +258,7 @@ const docTemplate = `{
"tags": [
"Statistics"
],
"summary": "Get the current user's group statistics",
"summary": "Get Label Statistics",
"responses": {
"200": {
"description": "OK",
@ -282,7 +285,7 @@ const docTemplate = `{
"tags": [
"Statistics"
],
"summary": "Get the current user's group statistics",
"summary": "Get Location Statistics",
"responses": {
"200": {
"description": "OK",
@ -309,7 +312,7 @@ const docTemplate = `{
"tags": [
"Statistics"
],
"summary": "Queries the changes overtime of the purchase price over time",
"summary": "Get Purchase Price Statistics",
"parameters": [
{
"type": "string",
@ -347,7 +350,7 @@ const docTemplate = `{
"tags": [
"Items"
],
"summary": "Get All Items",
"summary": "Query All Items",
"parameters": [
{
"type": "string",
@ -409,7 +412,7 @@ const docTemplate = `{
"tags": [
"Items"
],
"summary": "Create a new item",
"summary": "Create Item",
"parameters": [
{
"description": "Item Data",
@ -441,7 +444,7 @@ const docTemplate = `{
"tags": [
"Items"
],
"summary": "exports items into the database",
"summary": "Export Items",
"responses": {
"200": {
"description": "text/csv",
@ -465,7 +468,7 @@ const docTemplate = `{
"tags": [
"Items"
],
"summary": "imports items into the database",
"summary": "Get All Custom Field Names",
"responses": {
"200": {
"description": "OK",
@ -492,7 +495,7 @@ const docTemplate = `{
"tags": [
"Items"
],
"summary": "imports items into the database",
"summary": "Get All Custom Field Values",
"responses": {
"200": {
"description": "OK",
@ -519,7 +522,7 @@ const docTemplate = `{
"tags": [
"Items"
],
"summary": "imports items into the database",
"summary": "Import Items",
"parameters": [
{
"type": "file",
@ -549,7 +552,7 @@ const docTemplate = `{
"tags": [
"Items"
],
"summary": "Gets a item and fields",
"summary": "Get Item",
"parameters": [
{
"type": "string",
@ -580,7 +583,7 @@ const docTemplate = `{
"tags": [
"Items"
],
"summary": "updates a item",
"summary": "Update Item",
"parameters": [
{
"type": "string",
@ -620,7 +623,7 @@ const docTemplate = `{
"tags": [
"Items"
],
"summary": "deletes a item",
"summary": "Delete Item",
"parameters": [
{
"type": "string",
@ -650,7 +653,7 @@ const docTemplate = `{
"tags": [
"Items Attachments"
],
"summary": "imports items into the database",
"summary": "Create Item Attachment",
"parameters": [
{
"type": "string",
@ -710,7 +713,7 @@ const docTemplate = `{
"tags": [
"Items Attachments"
],
"summary": "retrieves an attachment for an item",
"summary": "Get Item Attachment",
"parameters": [
{
"type": "string",
@ -745,7 +748,7 @@ const docTemplate = `{
"tags": [
"Items Attachments"
],
"summary": "retrieves an attachment for an item",
"summary": "Update Item Attachment",
"parameters": [
{
"type": "string",
@ -789,7 +792,7 @@ const docTemplate = `{
"tags": [
"Items Attachments"
],
"summary": "retrieves an attachment for an item",
"summary": "Delete Item Attachment",
"parameters": [
{
"type": "string",
@ -974,7 +977,7 @@ const docTemplate = `{
"tags": [
"Labels"
],
"summary": "Create a new label",
"summary": "Create Label",
"parameters": [
{
"description": "Label Data",
@ -1009,7 +1012,7 @@ const docTemplate = `{
"tags": [
"Labels"
],
"summary": "Gets a label and fields",
"summary": "Get Label",
"parameters": [
{
"type": "string",
@ -1040,7 +1043,7 @@ const docTemplate = `{
"tags": [
"Labels"
],
"summary": "updates a label",
"summary": "Update Label",
"parameters": [
{
"type": "string",
@ -1071,7 +1074,7 @@ const docTemplate = `{
"tags": [
"Labels"
],
"summary": "deletes a label",
"summary": "Delete Label",
"parameters": [
{
"type": "string",
@ -1146,7 +1149,7 @@ const docTemplate = `{
"tags": [
"Locations"
],
"summary": "Create a new location",
"summary": "Create Location",
"parameters": [
{
"description": "Location Data",
@ -1181,7 +1184,7 @@ const docTemplate = `{
"tags": [
"Locations"
],
"summary": "Get All Locations",
"summary": "Get Locations Tree",
"parameters": [
{
"type": "boolean",
@ -1228,7 +1231,7 @@ const docTemplate = `{
"tags": [
"Locations"
],
"summary": "Gets a location and fields",
"summary": "Get Location",
"parameters": [
{
"type": "string",
@ -1259,7 +1262,7 @@ const docTemplate = `{
"tags": [
"Locations"
],
"summary": "updates a location",
"summary": "Update Location",
"parameters": [
{
"type": "string",
@ -1299,7 +1302,7 @@ const docTemplate = `{
"tags": [
"Locations"
],
"summary": "deletes a location",
"summary": "Delete Location",
"parameters": [
{
"type": "string",
@ -1316,6 +1319,179 @@ const docTemplate = `{
}
}
},
"/v1/notifiers": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Notifiers"
],
"summary": "Get Notifiers",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.NotifierOut"
}
}
}
}
]
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Notifiers"
],
"summary": "Create Notifier",
"parameters": [
{
"description": "Notifier Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/repo.NotifierCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.NotifierOut"
}
}
}
}
},
"/v1/notifiers/test": {
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Notifiers"
],
"summary": "Test Notifier",
"parameters": [
{
"type": "string",
"description": "Notifier ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "URL",
"name": "url",
"in": "query",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
}
}
}
},
"/v1/notifiers/{id}": {
"put": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Notifiers"
],
"summary": "Update Notifier",
"parameters": [
{
"type": "string",
"description": "Notifier ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Notifier Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/repo.NotifierUpdate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.NotifierOut"
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Notifiers"
],
"summary": "Delete a Notifier",
"parameters": [
{
"type": "string",
"description": "Notifier ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
}
}
}
},
"/v1/qrcode": {
"get": {
"security": [
@ -1329,7 +1505,7 @@ const docTemplate = `{
"tags": [
"Items"
],
"summary": "Encode data into QRCode",
"summary": "Create QR Code",
"parameters": [
{
"type": "string",
@ -1361,7 +1537,7 @@ const docTemplate = `{
"tags": [
"Reporting"
],
"summary": "Generates a Bill of Materials CSV",
"summary": "Export Bill of Materials",
"responses": {
"200": {
"description": "text/csv",
@ -1380,7 +1556,7 @@ const docTemplate = `{
"tags": [
"Base"
],
"summary": "Retrieves the basic information about the API",
"summary": "Application Info",
"responses": {
"200": {
"description": "OK",
@ -1401,7 +1577,7 @@ const docTemplate = `{
"tags": [
"User"
],
"summary": "Updates the users password",
"summary": "Change Password",
"parameters": [
{
"description": "Password Payload",
@ -1504,7 +1680,7 @@ const docTemplate = `{
"tags": [
"User"
],
"summary": "Get the current user",
"summary": "Register New User",
"parameters": [
{
"description": "User Data",
@ -1536,7 +1712,7 @@ const docTemplate = `{
"tags": [
"User"
],
"summary": "Get the current user",
"summary": "Get User Self",
"responses": {
"200": {
"description": "OK",
@ -1570,7 +1746,7 @@ const docTemplate = `{
"tags": [
"User"
],
"summary": "Update the current user",
"summary": "Update Account",
"parameters": [
{
"description": "User Data",
@ -1615,7 +1791,7 @@ const docTemplate = `{
"tags": [
"User"
],
"summary": "Deletes the user account",
"summary": "Delete Account",
"responses": {
"204": {
"description": "No Content"
@ -2293,6 +2469,72 @@ const docTemplate = `{
}
}
},
"repo.NotifierCreate": {
"type": "object",
"required": [
"name",
"url"
],
"properties": {
"isActive": {
"type": "boolean"
},
"name": {
"type": "string",
"maxLength": 255,
"minLength": 1
},
"url": {
"type": "string"
}
}
},
"repo.NotifierOut": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"groupId": {
"type": "string"
},
"id": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"name": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"userId": {
"type": "string"
}
}
},
"repo.NotifierUpdate": {
"type": "object",
"required": [
"name"
],
"properties": {
"isActive": {
"type": "boolean"
},
"name": {
"type": "string",
"maxLength": 255,
"minLength": 1
},
"url": {
"type": "string",
"x-nullable": true
}
}
},
"repo.PaginationResult-repo_ItemSummary": {
"type": "object",
"properties": {
@ -2597,8 +2839,8 @@ var SwaggerInfo = &swag.Spec{
Host: "",
BasePath: "/api",
Schemes: []string{},
Title: "Go API Templates",
Description: "This is a simple Rest API Server Template that implements some basic User and Authentication patterns to help you get started and bootstrap your next project!.",
Title: "Homebox API",
Description: "Track, Manage, and Organize your Shit.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}

View file

@ -1,8 +1,8 @@
{
"swagger": "2.0",
"info": {
"description": "This is a simple Rest API Server Template that implements some basic User and Authentication patterns to help you get started and bootstrap your next project!.",
"title": "Go API Templates",
"description": "Track, Manage, and Organize your Shit.",
"title": "Homebox API",
"contact": {
"name": "Don't"
},
@ -20,13 +20,14 @@
"Bearer": []
}
],
"description": "Ensures all items in the database have an asset ID",
"produces": [
"application/json"
],
"tags": [
"Group"
"Actions"
],
"summary": "Ensures all items in the database have an asset id",
"summary": "Ensure Asset IDs",
"responses": {
"200": {
"description": "OK",
@ -44,13 +45,14 @@
"Bearer": []
}
],
"description": "Ensures all items in the database have an import ref",
"produces": [
"application/json"
],
"tags": [
"Group"
"Actions"
],
"summary": "Ensures all items in the database have an import ref",
"summary": "Ensures Import Refs",
"responses": {
"200": {
"description": "OK",
@ -68,13 +70,14 @@
"Bearer": []
}
],
"description": "Resets all item date fields to the beginning of the day",
"produces": [
"application/json"
],
"tags": [
"Group"
"Actions"
],
"summary": "Resets all item date fields to the beginning of the day",
"summary": "Zero Out Time Fields",
"responses": {
"200": {
"description": "OK",
@ -96,9 +99,9 @@
"application/json"
],
"tags": [
"Assets"
"Items"
],
"summary": "Gets an item by Asset ID",
"summary": "Get Item by Asset ID",
"parameters": [
{
"type": "string",
@ -131,7 +134,7 @@
"tags": [
"Group"
],
"summary": "Get the current user's group",
"summary": "Get Group",
"responses": {
"200": {
"description": "OK",
@ -153,7 +156,7 @@
"tags": [
"Group"
],
"summary": "Updates some fields of the current users group",
"summary": "Update Group",
"parameters": [
{
"description": "User Data",
@ -188,7 +191,7 @@
"tags": [
"Group"
],
"summary": "Get the current user",
"summary": "Create Group Invitation",
"parameters": [
{
"description": "User Data",
@ -223,7 +226,7 @@
"tags": [
"Statistics"
],
"summary": "Get the current user's group statistics",
"summary": "Get Group Statistics",
"responses": {
"200": {
"description": "OK",
@ -247,7 +250,7 @@
"tags": [
"Statistics"
],
"summary": "Get the current user's group statistics",
"summary": "Get Label Statistics",
"responses": {
"200": {
"description": "OK",
@ -274,7 +277,7 @@
"tags": [
"Statistics"
],
"summary": "Get the current user's group statistics",
"summary": "Get Location Statistics",
"responses": {
"200": {
"description": "OK",
@ -301,7 +304,7 @@
"tags": [
"Statistics"
],
"summary": "Queries the changes overtime of the purchase price over time",
"summary": "Get Purchase Price Statistics",
"parameters": [
{
"type": "string",
@ -339,7 +342,7 @@
"tags": [
"Items"
],
"summary": "Get All Items",
"summary": "Query All Items",
"parameters": [
{
"type": "string",
@ -401,7 +404,7 @@
"tags": [
"Items"
],
"summary": "Create a new item",
"summary": "Create Item",
"parameters": [
{
"description": "Item Data",
@ -433,7 +436,7 @@
"tags": [
"Items"
],
"summary": "exports items into the database",
"summary": "Export Items",
"responses": {
"200": {
"description": "text/csv",
@ -457,7 +460,7 @@
"tags": [
"Items"
],
"summary": "imports items into the database",
"summary": "Get All Custom Field Names",
"responses": {
"200": {
"description": "OK",
@ -484,7 +487,7 @@
"tags": [
"Items"
],
"summary": "imports items into the database",
"summary": "Get All Custom Field Values",
"responses": {
"200": {
"description": "OK",
@ -511,7 +514,7 @@
"tags": [
"Items"
],
"summary": "imports items into the database",
"summary": "Import Items",
"parameters": [
{
"type": "file",
@ -541,7 +544,7 @@
"tags": [
"Items"
],
"summary": "Gets a item and fields",
"summary": "Get Item",
"parameters": [
{
"type": "string",
@ -572,7 +575,7 @@
"tags": [
"Items"
],
"summary": "updates a item",
"summary": "Update Item",
"parameters": [
{
"type": "string",
@ -612,7 +615,7 @@
"tags": [
"Items"
],
"summary": "deletes a item",
"summary": "Delete Item",
"parameters": [
{
"type": "string",
@ -642,7 +645,7 @@
"tags": [
"Items Attachments"
],
"summary": "imports items into the database",
"summary": "Create Item Attachment",
"parameters": [
{
"type": "string",
@ -702,7 +705,7 @@
"tags": [
"Items Attachments"
],
"summary": "retrieves an attachment for an item",
"summary": "Get Item Attachment",
"parameters": [
{
"type": "string",
@ -737,7 +740,7 @@
"tags": [
"Items Attachments"
],
"summary": "retrieves an attachment for an item",
"summary": "Update Item Attachment",
"parameters": [
{
"type": "string",
@ -781,7 +784,7 @@
"tags": [
"Items Attachments"
],
"summary": "retrieves an attachment for an item",
"summary": "Delete Item Attachment",
"parameters": [
{
"type": "string",
@ -966,7 +969,7 @@
"tags": [
"Labels"
],
"summary": "Create a new label",
"summary": "Create Label",
"parameters": [
{
"description": "Label Data",
@ -1001,7 +1004,7 @@
"tags": [
"Labels"
],
"summary": "Gets a label and fields",
"summary": "Get Label",
"parameters": [
{
"type": "string",
@ -1032,7 +1035,7 @@
"tags": [
"Labels"
],
"summary": "updates a label",
"summary": "Update Label",
"parameters": [
{
"type": "string",
@ -1063,7 +1066,7 @@
"tags": [
"Labels"
],
"summary": "deletes a label",
"summary": "Delete Label",
"parameters": [
{
"type": "string",
@ -1138,7 +1141,7 @@
"tags": [
"Locations"
],
"summary": "Create a new location",
"summary": "Create Location",
"parameters": [
{
"description": "Location Data",
@ -1173,7 +1176,7 @@
"tags": [
"Locations"
],
"summary": "Get All Locations",
"summary": "Get Locations Tree",
"parameters": [
{
"type": "boolean",
@ -1220,7 +1223,7 @@
"tags": [
"Locations"
],
"summary": "Gets a location and fields",
"summary": "Get Location",
"parameters": [
{
"type": "string",
@ -1251,7 +1254,7 @@
"tags": [
"Locations"
],
"summary": "updates a location",
"summary": "Update Location",
"parameters": [
{
"type": "string",
@ -1291,7 +1294,7 @@
"tags": [
"Locations"
],
"summary": "deletes a location",
"summary": "Delete Location",
"parameters": [
{
"type": "string",
@ -1308,6 +1311,179 @@
}
}
},
"/v1/notifiers": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Notifiers"
],
"summary": "Get Notifiers",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/server.Results"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/repo.NotifierOut"
}
}
}
}
]
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Notifiers"
],
"summary": "Create Notifier",
"parameters": [
{
"description": "Notifier Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/repo.NotifierCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.NotifierOut"
}
}
}
}
},
"/v1/notifiers/test": {
"post": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Notifiers"
],
"summary": "Test Notifier",
"parameters": [
{
"type": "string",
"description": "Notifier ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "URL",
"name": "url",
"in": "query",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
}
}
}
},
"/v1/notifiers/{id}": {
"put": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Notifiers"
],
"summary": "Update Notifier",
"parameters": [
{
"type": "string",
"description": "Notifier ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Notifier Data",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/repo.NotifierUpdate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/repo.NotifierOut"
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Notifiers"
],
"summary": "Delete a Notifier",
"parameters": [
{
"type": "string",
"description": "Notifier ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
}
}
}
},
"/v1/qrcode": {
"get": {
"security": [
@ -1321,7 +1497,7 @@
"tags": [
"Items"
],
"summary": "Encode data into QRCode",
"summary": "Create QR Code",
"parameters": [
{
"type": "string",
@ -1353,7 +1529,7 @@
"tags": [
"Reporting"
],
"summary": "Generates a Bill of Materials CSV",
"summary": "Export Bill of Materials",
"responses": {
"200": {
"description": "text/csv",
@ -1372,7 +1548,7 @@
"tags": [
"Base"
],
"summary": "Retrieves the basic information about the API",
"summary": "Application Info",
"responses": {
"200": {
"description": "OK",
@ -1393,7 +1569,7 @@
"tags": [
"User"
],
"summary": "Updates the users password",
"summary": "Change Password",
"parameters": [
{
"description": "Password Payload",
@ -1496,7 +1672,7 @@
"tags": [
"User"
],
"summary": "Get the current user",
"summary": "Register New User",
"parameters": [
{
"description": "User Data",
@ -1528,7 +1704,7 @@
"tags": [
"User"
],
"summary": "Get the current user",
"summary": "Get User Self",
"responses": {
"200": {
"description": "OK",
@ -1562,7 +1738,7 @@
"tags": [
"User"
],
"summary": "Update the current user",
"summary": "Update Account",
"parameters": [
{
"description": "User Data",
@ -1607,7 +1783,7 @@
"tags": [
"User"
],
"summary": "Deletes the user account",
"summary": "Delete Account",
"responses": {
"204": {
"description": "No Content"
@ -2285,6 +2461,72 @@
}
}
},
"repo.NotifierCreate": {
"type": "object",
"required": [
"name",
"url"
],
"properties": {
"isActive": {
"type": "boolean"
},
"name": {
"type": "string",
"maxLength": 255,
"minLength": 1
},
"url": {
"type": "string"
}
}
},
"repo.NotifierOut": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"groupId": {
"type": "string"
},
"id": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"name": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"userId": {
"type": "string"
}
}
},
"repo.NotifierUpdate": {
"type": "object",
"required": [
"name"
],
"properties": {
"isActive": {
"type": "boolean"
},
"name": {
"type": "string",
"maxLength": 255,
"minLength": 1
},
"url": {
"type": "string",
"x-nullable": true
}
}
},
"repo.PaginationResult-repo_ItemSummary": {
"type": "object",
"properties": {

View file

@ -451,6 +451,51 @@ definitions:
itemId:
type: string
type: object
repo.NotifierCreate:
properties:
isActive:
type: boolean
name:
maxLength: 255
minLength: 1
type: string
url:
type: string
required:
- name
- url
type: object
repo.NotifierOut:
properties:
createdAt:
type: string
groupId:
type: string
id:
type: string
isActive:
type: boolean
name:
type: string
updatedAt:
type: string
userId:
type: string
type: object
repo.NotifierUpdate:
properties:
isActive:
type: boolean
name:
maxLength: 255
minLength: 1
type: string
url:
type: string
x-nullable: true
required:
- name
type: object
repo.PaginationResult-repo_ItemSummary:
properties:
items:
@ -640,16 +685,15 @@ definitions:
info:
contact:
name: Don't
description: This is a simple Rest API Server Template that implements some basic
User and Authentication patterns to help you get started and bootstrap your next
project!.
description: Track, Manage, and Organize your Shit.
license:
name: MIT
title: Go API Templates
title: Homebox API
version: "1.0"
paths:
/v1/actions/ensure-asset-ids:
post:
description: Ensures all items in the database have an asset ID
produces:
- application/json
responses:
@ -659,11 +703,12 @@ paths:
$ref: '#/definitions/v1.ActionAmountResult'
security:
- Bearer: []
summary: Ensures all items in the database have an asset id
summary: Ensure Asset IDs
tags:
- Group
- Actions
/v1/actions/ensure-import-refs:
post:
description: Ensures all items in the database have an import ref
produces:
- application/json
responses:
@ -673,11 +718,12 @@ paths:
$ref: '#/definitions/v1.ActionAmountResult'
security:
- Bearer: []
summary: Ensures all items in the database have an import ref
summary: Ensures Import Refs
tags:
- Group
- Actions
/v1/actions/zero-item-time-fields:
post:
description: Resets all item date fields to the beginning of the day
produces:
- application/json
responses:
@ -687,9 +733,9 @@ paths:
$ref: '#/definitions/v1.ActionAmountResult'
security:
- Bearer: []
summary: Resets all item date fields to the beginning of the day
summary: Zero Out Time Fields
tags:
- Group
- Actions
/v1/assets/{id}:
get:
parameters:
@ -707,9 +753,9 @@ paths:
$ref: '#/definitions/repo.PaginationResult-repo_ItemSummary'
security:
- Bearer: []
summary: Gets an item by Asset ID
summary: Get Item by Asset ID
tags:
- Assets
- Items
/v1/groups:
get:
produces:
@ -721,7 +767,7 @@ paths:
$ref: '#/definitions/repo.Group'
security:
- Bearer: []
summary: Get the current user's group
summary: Get Group
tags:
- Group
put:
@ -741,7 +787,7 @@ paths:
$ref: '#/definitions/repo.Group'
security:
- Bearer: []
summary: Updates some fields of the current users group
summary: Update Group
tags:
- Group
/v1/groups/invitations:
@ -762,7 +808,7 @@ paths:
$ref: '#/definitions/v1.GroupInvitation'
security:
- Bearer: []
summary: Get the current user
summary: Create Group Invitation
tags:
- Group
/v1/groups/statistics:
@ -776,7 +822,7 @@ paths:
$ref: '#/definitions/repo.GroupStatistics'
security:
- Bearer: []
summary: Get the current user's group statistics
summary: Get Group Statistics
tags:
- Statistics
/v1/groups/statistics/labels:
@ -792,7 +838,7 @@ paths:
type: array
security:
- Bearer: []
summary: Get the current user's group statistics
summary: Get Label Statistics
tags:
- Statistics
/v1/groups/statistics/locations:
@ -808,7 +854,7 @@ paths:
type: array
security:
- Bearer: []
summary: Get the current user's group statistics
summary: Get Location Statistics
tags:
- Statistics
/v1/groups/statistics/purchase-price:
@ -831,7 +877,7 @@ paths:
$ref: '#/definitions/repo.ValueOverTime'
security:
- Bearer: []
summary: Queries the changes overtime of the purchase price over time
summary: Get Purchase Price Statistics
tags:
- Statistics
/v1/items:
@ -872,7 +918,7 @@ paths:
$ref: '#/definitions/repo.PaginationResult-repo_ItemSummary'
security:
- Bearer: []
summary: Get All Items
summary: Query All Items
tags:
- Items
post:
@ -892,7 +938,7 @@ paths:
$ref: '#/definitions/repo.ItemSummary'
security:
- Bearer: []
summary: Create a new item
summary: Create Item
tags:
- Items
/v1/items/{id}:
@ -910,7 +956,7 @@ paths:
description: No Content
security:
- Bearer: []
summary: deletes a item
summary: Delete Item
tags:
- Items
get:
@ -929,7 +975,7 @@ paths:
$ref: '#/definitions/repo.ItemOut'
security:
- Bearer: []
summary: Gets a item and fields
summary: Get Item
tags:
- Items
put:
@ -954,7 +1000,7 @@ paths:
$ref: '#/definitions/repo.ItemOut'
security:
- Bearer: []
summary: updates a item
summary: Update Item
tags:
- Items
/v1/items/{id}/attachments:
@ -993,7 +1039,7 @@ paths:
$ref: '#/definitions/server.ErrorResponse'
security:
- Bearer: []
summary: imports items into the database
summary: Create Item Attachment
tags:
- Items Attachments
/v1/items/{id}/attachments/{attachment_id}:
@ -1014,7 +1060,7 @@ paths:
description: No Content
security:
- Bearer: []
summary: retrieves an attachment for an item
summary: Delete Item Attachment
tags:
- Items Attachments
get:
@ -1038,7 +1084,7 @@ paths:
$ref: '#/definitions/v1.ItemAttachmentToken'
security:
- Bearer: []
summary: retrieves an attachment for an item
summary: Get Item Attachment
tags:
- Items Attachments
put:
@ -1066,7 +1112,7 @@ paths:
$ref: '#/definitions/repo.ItemOut'
security:
- Bearer: []
summary: retrieves an attachment for an item
summary: Update Item Attachment
tags:
- Items Attachments
/v1/items/{id}/maintenance:
@ -1144,7 +1190,7 @@ paths:
type: string
security:
- Bearer: []
summary: exports items into the database
summary: Export Items
tags:
- Items
/v1/items/fields:
@ -1160,7 +1206,7 @@ paths:
type: array
security:
- Bearer: []
summary: imports items into the database
summary: Get All Custom Field Names
tags:
- Items
/v1/items/fields/values:
@ -1176,7 +1222,7 @@ paths:
type: array
security:
- Bearer: []
summary: imports items into the database
summary: Get All Custom Field Values
tags:
- Items
/v1/items/import:
@ -1194,7 +1240,7 @@ paths:
description: No Content
security:
- Bearer: []
summary: imports items into the database
summary: Import Items
tags:
- Items
/v1/labels:
@ -1235,7 +1281,7 @@ paths:
$ref: '#/definitions/repo.LabelSummary'
security:
- Bearer: []
summary: Create a new label
summary: Create Label
tags:
- Labels
/v1/labels/{id}:
@ -1253,7 +1299,7 @@ paths:
description: No Content
security:
- Bearer: []
summary: deletes a label
summary: Delete Label
tags:
- Labels
get:
@ -1272,7 +1318,7 @@ paths:
$ref: '#/definitions/repo.LabelOut'
security:
- Bearer: []
summary: Gets a label and fields
summary: Get Label
tags:
- Labels
put:
@ -1291,7 +1337,7 @@ paths:
$ref: '#/definitions/repo.LabelOut'
security:
- Bearer: []
summary: updates a label
summary: Update Label
tags:
- Labels
/v1/locations:
@ -1337,7 +1383,7 @@ paths:
$ref: '#/definitions/repo.LocationSummary'
security:
- Bearer: []
summary: Create a new location
summary: Create Location
tags:
- Locations
/v1/locations/{id}:
@ -1355,7 +1401,7 @@ paths:
description: No Content
security:
- Bearer: []
summary: deletes a location
summary: Delete Location
tags:
- Locations
get:
@ -1374,7 +1420,7 @@ paths:
$ref: '#/definitions/repo.LocationOut'
security:
- Bearer: []
summary: Gets a location and fields
summary: Get Location
tags:
- Locations
put:
@ -1399,7 +1445,7 @@ paths:
$ref: '#/definitions/repo.LocationOut'
security:
- Bearer: []
summary: updates a location
summary: Update Location
tags:
- Locations
/v1/locations/tree:
@ -1425,9 +1471,112 @@ paths:
type: object
security:
- Bearer: []
summary: Get All Locations
summary: Get Locations Tree
tags:
- Locations
/v1/notifiers:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/server.Results'
- properties:
items:
items:
$ref: '#/definitions/repo.NotifierOut'
type: array
type: object
security:
- Bearer: []
summary: Get Notifiers
tags:
- Notifiers
post:
parameters:
- description: Notifier Data
in: body
name: payload
required: true
schema:
$ref: '#/definitions/repo.NotifierCreate'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/repo.NotifierOut'
security:
- Bearer: []
summary: Create Notifier
tags:
- Notifiers
/v1/notifiers/{id}:
delete:
parameters:
- description: Notifier ID
in: path
name: id
required: true
type: string
responses:
"204":
description: No Content
security:
- Bearer: []
summary: Delete a Notifier
tags:
- Notifiers
put:
parameters:
- description: Notifier ID
in: path
name: id
required: true
type: string
- description: Notifier Data
in: body
name: payload
required: true
schema:
$ref: '#/definitions/repo.NotifierUpdate'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/repo.NotifierOut'
security:
- Bearer: []
summary: Update Notifier
tags:
- Notifiers
/v1/notifiers/test:
post:
parameters:
- description: Notifier ID
in: path
name: id
required: true
type: string
- description: URL
in: query
name: url
required: true
type: string
produces:
- application/json
responses:
"204":
description: No Content
security:
- Bearer: []
summary: Test Notifier
tags:
- Notifiers
/v1/qrcode:
get:
parameters:
@ -1444,7 +1593,7 @@ paths:
type: string
security:
- Bearer: []
summary: Encode data into QRCode
summary: Create QR Code
tags:
- Items
/v1/reporting/bill-of-materials:
@ -1458,7 +1607,7 @@ paths:
type: string
security:
- Bearer: []
summary: Generates a Bill of Materials CSV
summary: Export Bill of Materials
tags:
- Reporting
/v1/status:
@ -1470,7 +1619,7 @@ paths:
description: OK
schema:
$ref: '#/definitions/v1.ApiSummary'
summary: Retrieves the basic information about the API
summary: Application Info
tags:
- Base
/v1/users/change-password:
@ -1487,7 +1636,7 @@ paths:
description: No Content
security:
- Bearer: []
summary: Updates the users password
summary: Change Password
tags:
- User
/v1/users/login:
@ -1553,7 +1702,7 @@ paths:
responses:
"204":
description: No Content
summary: Get the current user
summary: Register New User
tags:
- User
/v1/users/self:
@ -1565,7 +1714,7 @@ paths:
description: No Content
security:
- Bearer: []
summary: Deletes the user account
summary: Delete Account
tags:
- User
get:
@ -1583,7 +1732,7 @@ paths:
type: object
security:
- Bearer: []
summary: Get the current user
summary: Get User Self
tags:
- User
put:
@ -1608,7 +1757,7 @@ paths:
type: object
security:
- Bearer: []
summary: Update the current user
summary: Update Account
tags:
- User
securityDefinitions: