Files
apskel-pos-backend/internal/models/category.go
T
2026-10-04 21:54:13 +07:00

67 lines
1.7 KiB
Go

package models
import (
"time"
"github.com/google/uuid"
)
type Category struct {
ID uuid.UUID
OrganizationID uuid.UUID
OutletID *uuid.UUID
Name string
Description *string
ImageURL *string
Order int
IsActive bool
CreatedAt time.Time
UpdatedAt time.Time
}
type CreateCategoryRequest struct {
OrganizationID uuid.UUID `validate:"required"`
OutletID *uuid.UUID
ParentID *uuid.UUID
Name string `validate:"required,min=1,max=255"`
Description *string `validate:"omitempty,max=1000"`
ImageURL *string `validate:"omitempty,url"`
Order int `validate:"min=0"`
OwnerFeePercent *float64 `validate:"omitempty,min=0,max=100"`
// IsTeam defaults to true when left out
IsTeam *bool
}
type UpdateCategoryRequest struct {
Name *string `validate:"omitempty,min=1,max=255"`
Description *string `validate:"omitempty,max=1000"`
ImageURL *string `validate:"omitempty,url"`
OutletID *uuid.UUID
ParentID *uuid.UUID
Order *int `validate:"omitempty,min=0"`
OwnerFeePercent *float64 `validate:"omitempty,min=0,max=100"`
IsTeam *bool
IsActive *bool
// Clear flags remove the value; a nil pointer above only means "leave unchanged"
ClearParentID bool
ClearOwnerFeePercent bool
}
type CategoryResponse struct {
ID uuid.UUID
OrganizationID uuid.UUID
OutletID *uuid.UUID
ParentID *uuid.UUID
ParentName *string
Name string
Description *string
ImageURL *string
Order int
OwnerFeePercent *float64
IsTeam bool
IsActive bool
CreatedAt time.Time
UpdatedAt time.Time
}