feat: update profit sharing

This commit is contained in:
efrilm
2026-10-04 21:54:13 +07:00
parent b59b7b4ddd
commit 117e3529aa
23 changed files with 521 additions and 95 deletions
+7 -3
View File
@@ -42,9 +42,13 @@ type Category struct {
BusinessType string `gorm:"size:50;default:'restaurant'" json:"business_type"`
Metadata Metadata `gorm:"type:jsonb;default:'{}'" json:"metadata"`
// OwnerFeePercent overrides the owner's share in the parent category budget report; nil uses the default
OwnerFeePercent *float64 `gorm:"type:numeric(5,2)" json:"owner_fee_percent"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
OwnerFeePercent *float64 `gorm:"type:numeric(5,2)" json:"owner_fee_percent"`
// IsTeam marks a parent category as a team in the revenue split. It has no gorm
// default on purpose: GORM would turn an explicit false into the default on insert,
// so callers creating a category set it themselves.
IsTeam bool `gorm:"not null" json:"is_team"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
Organization Organization `gorm:"foreignKey:OrganizationID" json:"organization,omitempty"`
Products []Product `gorm:"foreignKey:CategoryID" json:"products,omitempty"`