start requiring validation tags

This commit is contained in:
Hayden 2023-03-08 09:44:19 -09:00
parent 73be2333f6
commit 844dc5e856
No known key found for this signature in database
GPG key ID: 17CF79474E257545
3 changed files with 9 additions and 9 deletions

View file

@ -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

View file

@ -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"`
}

View file

@ -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) {