diff --git a/backend/internal/data/repo/repo_items.go b/backend/internal/data/repo/repo_items.go index 69434b8..04c203b 100644 --- a/backend/internal/data/repo/repo_items.go +++ b/backend/internal/data/repo/repo_items.go @@ -51,8 +51,8 @@ type ( ItemCreate struct { ImportRef string `json:"-"` ParentID uuid.UUID `json:"parentId" extensions:"x-nullable"` - Name string `json:"name"` - Description string `json:"description"` + Name string `json:"name" validate:"required,min=1,max=255"` + Description string `json:"description" validate:"required,min=1,max=1000"` AssetID AssetID `json:"-"` // Edges diff --git a/backend/internal/data/repo/repo_labels.go b/backend/internal/data/repo/repo_labels.go index a761ef8..ee62fd8 100644 --- a/backend/internal/data/repo/repo_labels.go +++ b/backend/internal/data/repo/repo_labels.go @@ -17,15 +17,15 @@ type LabelRepository struct { } type ( LabelCreate struct { - Name string `json:"name"` - Description string `json:"description"` + Name string `json:"name" validate:"required,min=1,max=255"` + Description string `json:"description" validate:"max=255"` Color string `json:"color"` } LabelUpdate struct { ID uuid.UUID `json:"id"` - Name string `json:"name"` - Description string `json:"description"` + Name string `json:"name" validate:"required,min=1,max=255"` + Description string `json:"description" validate:"max=255"` Color string `json:"color"` } diff --git a/backend/internal/data/repo/repo_locations.go b/backend/internal/data/repo/repo_locations.go index 542095e..e65a983 100644 --- a/backend/internal/data/repo/repo_locations.go +++ b/backend/internal/data/repo/repo_locations.go @@ -91,7 +91,7 @@ func mapLocationOut(location *ent.Location) LocationOut { } type LocationQuery struct { - FilterChildren bool `json:"filterChildren"` + FilterChildren bool `json:"filterChildren" schema:"filterChildren"` } // 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)) } -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))) } @@ -246,7 +246,7 @@ type FlatTreeItem 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) {