mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-02 07:40:28 +00:00
linter autofix
This commit is contained in:
parent
4297111ab4
commit
a60047e390
13 changed files with 18 additions and 24 deletions
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
type (
|
type (
|
||||||
GroupInvitationCreate struct {
|
GroupInvitationCreate struct {
|
||||||
Uses int `json:"uses" validate:"required,min=1,max=100"`
|
Uses int `json:"uses" validate:"required,min=1,max=100"`
|
||||||
ExpiresAt time.Time `json:"expiresAt"`
|
ExpiresAt time.Time `json:"expiresAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,6 @@ func (ctrl *V1Controller) HandleGetAllCustomFieldValues() errchain.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
return adapters.Query(fn, http.StatusOK)
|
return adapters.Query(fn, http.StatusOK)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleItemsImport godocs
|
// HandleItemsImport godocs
|
||||||
|
|
|
@ -39,7 +39,6 @@ func (ctrl *V1Controller) HandleItemAttachmentCreate() errchain.HandlerFunc {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Err(err).Msg("failed to parse multipart form")
|
log.Err(err).Msg("failed to parse multipart form")
|
||||||
return validate.NewRequestError(errors.New("failed to parse multipart form"), http.StatusBadRequest)
|
return validate.NewRequestError(errors.New("failed to parse multipart form"), http.StatusBadRequest)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
errs := validate.NewFieldErrors()
|
errs := validate.NewFieldErrors()
|
||||||
|
|
|
@ -55,8 +55,8 @@ type (
|
||||||
|
|
||||||
ItemCreate struct {
|
ItemCreate struct {
|
||||||
ImportRef string `json:"-"`
|
ImportRef string `json:"-"`
|
||||||
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable"`
|
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable"`
|
||||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||||
Description string `json:"description" validate:"max=1000"`
|
Description string `json:"description" validate:"max=1000"`
|
||||||
AssetID AssetID `json:"-"`
|
AssetID AssetID `json:"-"`
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ type (
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemUpdate struct {
|
ItemUpdate struct {
|
||||||
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable,x-omitempty"`
|
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable,x-omitempty"`
|
||||||
ID uuid.UUID `json:"id"`
|
ID uuid.UUID `json:"id"`
|
||||||
AssetID AssetID `json:"assetId"`
|
AssetID AssetID `json:"assetId"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
@ -108,7 +108,7 @@ type (
|
||||||
ItemPatch struct {
|
ItemPatch struct {
|
||||||
ID uuid.UUID `json:"id"`
|
ID uuid.UUID `json:"id"`
|
||||||
Quantity *int `json:"quantity,omitempty" extensions:"x-nullable,x-omitempty"`
|
Quantity *int `json:"quantity,omitempty" extensions:"x-nullable,x-omitempty"`
|
||||||
ImportRef *string `json:"-,omitempty" extensions:"x-nullable,x-omitempty"`
|
ImportRef *string `json:"-,omitempty" extensions:"x-nullable,x-omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemSummary struct {
|
ItemSummary struct {
|
||||||
|
|
|
@ -77,7 +77,6 @@ func TestItemsRepository_RecursiveRelationships(t *testing.T) {
|
||||||
updated, err = tRepos.Items.GetOne(context.Background(), child.ID)
|
updated, err = tRepos.Items.GetOne(context.Background(), child.ID)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Nil(t, updated.Parent)
|
assert.Nil(t, updated.Parent)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,14 @@ type LabelRepository struct {
|
||||||
|
|
||||||
type (
|
type (
|
||||||
LabelCreate struct {
|
LabelCreate struct {
|
||||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||||
Description string `json:"description" validate:"max=255"`
|
Description string `json:"description" validate:"max=255"`
|
||||||
Color string `json:"color"`
|
Color string `json:"color"`
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelUpdate struct {
|
LabelUpdate struct {
|
||||||
ID uuid.UUID `json:"id"`
|
ID uuid.UUID `json:"id"`
|
||||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||||
Description string `json:"description" validate:"max=255"`
|
Description string `json:"description" validate:"max=255"`
|
||||||
Color string `json:"color"`
|
Color string `json:"color"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,12 @@ type LocationRepository struct {
|
||||||
type (
|
type (
|
||||||
LocationCreate struct {
|
LocationCreate struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable"`
|
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
LocationUpdate struct {
|
LocationUpdate struct {
|
||||||
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable"`
|
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable"`
|
||||||
ID uuid.UUID `json:"id"`
|
ID uuid.UUID `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
|
|
|
@ -23,7 +23,7 @@ type MaintenanceEntryRepository struct {
|
||||||
type MaintenanceEntryCreate struct {
|
type MaintenanceEntryCreate struct {
|
||||||
CompletedDate types.Date `json:"completedDate"`
|
CompletedDate types.Date `json:"completedDate"`
|
||||||
ScheduledDate types.Date `json:"scheduledDate"`
|
ScheduledDate types.Date `json:"scheduledDate"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Cost float64 `json:"cost,string"`
|
Cost float64 `json:"cost,string"`
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,6 @@ func (r *MaintenanceEntryRepository) GetLog(ctx context.Context, groupID, itemID
|
||||||
maintenanceentry.DateNotNil(),
|
maintenanceentry.DateNotNil(),
|
||||||
maintenanceentry.DateNEQ(time.Time{}),
|
maintenanceentry.DateNEQ(time.Time{}),
|
||||||
))
|
))
|
||||||
|
|
||||||
} else if query.Scheduled {
|
} else if query.Scheduled {
|
||||||
q = q.Where(maintenanceentry.And(
|
q = q.Where(maintenanceentry.And(
|
||||||
maintenanceentry.Or(
|
maintenanceentry.Or(
|
||||||
|
|
|
@ -35,15 +35,15 @@ func NewNotifierRepository(db *ent.Client) *NotifierRepository {
|
||||||
|
|
||||||
type (
|
type (
|
||||||
NotifierCreate struct {
|
NotifierCreate struct {
|
||||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||||
IsActive bool `json:"isActive"`
|
IsActive bool `json:"isActive"`
|
||||||
URL string `json:"url" validate:"required,shoutrrr"`
|
URL string `json:"url" validate:"required,shoutrrr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifierUpdate struct {
|
NotifierUpdate struct {
|
||||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||||
IsActive bool `json:"isActive"`
|
IsActive bool `json:"isActive"`
|
||||||
URL *string `json:"url" validate:"omitempty,shoutrrr" extensions:"x-nullable" `
|
URL *string `json:"url" validate:"omitempty,shoutrrr" extensions:"x-nullable"`
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifierOut struct {
|
NotifierOut struct {
|
||||||
|
|
|
@ -116,7 +116,6 @@ func TestAuthTokenRepo_PurgeExpiredTokens(t *testing.T) {
|
||||||
assert.NotNil(createdToken)
|
assert.NotNil(createdToken)
|
||||||
|
|
||||||
createdTokens = append(createdTokens, createdToken)
|
createdTokens = append(createdTokens, createdToken)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Purge expired tokens
|
// Purge expired tokens
|
||||||
|
|
|
@ -16,7 +16,7 @@ const (
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
conf.Version
|
conf.Version
|
||||||
Mode string `yaml:"mode" conf:"default:development"` // development or production
|
Mode string `yaml:"mode" conf:"default:development"` // development or production
|
||||||
Web WebConfig `yaml:"web"`
|
Web WebConfig `yaml:"web"`
|
||||||
Storage Storage `yaml:"storage"`
|
Storage Storage `yaml:"storage"`
|
||||||
Log LoggerConf `yaml:"logger"`
|
Log LoggerConf `yaml:"logger"`
|
||||||
|
@ -27,13 +27,13 @@ type Config struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
AllowRegistration bool `yaml:"disable_registration" conf:"default:true"`
|
AllowRegistration bool `yaml:"disable_registration" conf:"default:true"`
|
||||||
AutoIncrementAssetID bool `yaml:"auto_increment_asset_id" conf:"default:true"`
|
AutoIncrementAssetID bool `yaml:"auto_increment_asset_id" conf:"default:true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DebugConf struct {
|
type DebugConf struct {
|
||||||
Enabled bool `yaml:"enabled" conf:"default:false"`
|
Enabled bool `yaml:"enabled" conf:"default:false"`
|
||||||
Port string `yaml:"port" conf:"default:4000"`
|
Port string `yaml:"port" conf:"default:4000"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebConfig struct {
|
type WebConfig struct {
|
||||||
|
|
|
@ -6,6 +6,6 @@ const (
|
||||||
|
|
||||||
type Storage struct {
|
type Storage struct {
|
||||||
// Data is the path to the root directory
|
// Data is the path to the root directory
|
||||||
Data string `yaml:"data" conf:"default:./.data"`
|
Data string `yaml:"data" conf:"default:./.data"`
|
||||||
SqliteUrl string `yaml:"sqlite-url" conf:"default:./.data/homebox.db?_pragma=busy_timeout=1000&_pragma=journal_mode=WAL&_fk=1"`
|
SqliteUrl string `yaml:"sqlite-url" conf:"default:./.data/homebox.db?_pragma=busy_timeout=1000&_pragma=journal_mode=WAL&_fk=1"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@ func init() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks a struct for validation errors and returns any errors the occur. This
|
// Checks a struct for validation errors and returns any errors the occur. This
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue