mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-06 01:20:31 +00:00
start requiring validation tags
This commit is contained in:
parent
73be2333f6
commit
844dc5e856
3 changed files with 9 additions and 9 deletions
|
@ -51,8 +51,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"`
|
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description" validate:"required,min=1,max=1000"`
|
||||||
AssetID AssetID `json:"-"`
|
AssetID AssetID `json:"-"`
|
||||||
|
|
||||||
// Edges
|
// Edges
|
||||||
|
|
|
@ -17,15 +17,15 @@ type LabelRepository struct {
|
||||||
}
|
}
|
||||||
type (
|
type (
|
||||||
LabelCreate struct {
|
LabelCreate struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||||
Description string `json:"description"`
|
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"`
|
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description" validate:"max=255"`
|
||||||
Color string `json:"color"`
|
Color string `json:"color"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ func mapLocationOut(location *ent.Location) LocationOut {
|
||||||
}
|
}
|
||||||
|
|
||||||
type LocationQuery struct {
|
type LocationQuery struct {
|
||||||
FilterChildren bool `json:"filterChildren"`
|
FilterChildren bool `json:"filterChildren" schema:"filterChildren"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetALlWithCount returns all locations with item count field populated
|
// GetALlWithCount returns all locations with item count field populated
|
||||||
|
@ -217,7 +217,7 @@ func (r *LocationRepository) Update(ctx context.Context, data LocationUpdate) (L
|
||||||
return r.update(ctx, data, location.ID(data.ID))
|
return r.update(ctx, data, location.ID(data.ID))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *LocationRepository) UpdateOneByGroup(ctx context.Context, GID, ID uuid.UUID, data LocationUpdate) (LocationOut, error) {
|
func (r *LocationRepository) UpdateByGroup(ctx context.Context, GID, ID uuid.UUID, data LocationUpdate) (LocationOut, error) {
|
||||||
return r.update(ctx, data, location.ID(ID), location.HasGroupWith(group.ID(GID)))
|
return r.update(ctx, data, location.ID(ID), location.HasGroupWith(group.ID(GID)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ type FlatTreeItem struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type TreeQuery struct {
|
type TreeQuery struct {
|
||||||
WithItems bool `json:"withItems"`
|
WithItems bool `json:"withItems" schema:"withItems"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (lr *LocationRepository) Tree(ctx context.Context, GID uuid.UUID, tq TreeQuery) ([]TreeItem, error) {
|
func (lr *LocationRepository) Tree(ctx context.Context, GID uuid.UUID, tq TreeQuery) ([]TreeItem, error) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue