feat: create customer management menu

This commit is contained in:
2026-04-17 09:17:26 +02:00
parent 7bce04e05a
commit 612e97e76e
11 changed files with 190 additions and 9 deletions

View File

@@ -2,7 +2,7 @@ package model
import "encoding/json"
type B2BTopMenu struct {
type B2BMenu struct {
MenuID int `gorm:"column:menu_id;primaryKey;autoIncrement" json:"menu_id"`
Label json.RawMessage `gorm:"column:label;type:longtext;not null;default:'{}'" json:"label"`
ParentID *int `gorm:"column:parent_id;index:FK_b2b_top_menu_parent_id" json:"parent_id,omitempty"`
@@ -10,10 +10,22 @@ type B2BTopMenu struct {
Active int8 `gorm:"column:active;type:tinyint;not null;default:1" json:"active"`
Position int `gorm:"column:position;not null;default:1" json:"position"`
Parent *B2BTopMenu `gorm:"foreignKey:ParentID;references:MenuID;constraint:OnDelete:RESTRICT,OnUpdate:RESTRICT" json:"parent,omitempty"`
Children []*B2BTopMenu `gorm:"foreignKey:ParentID" json:"children,omitempty"`
Parent *B2BMenu `gorm:"foreignKey:ParentID;references:MenuID;constraint:OnDelete:RESTRICT,OnUpdate:RESTRICT" json:"parent,omitempty"`
Children []*B2BMenu `gorm:"foreignKey:ParentID" json:"children,omitempty"`
}
type B2BTopMenu struct {
B2BMenu
}
func (B2BTopMenu) TableName() string {
return "b2b_top_menu"
}
type B2BCustomerManagementMenu struct {
B2BMenu
}
func (B2BCustomerManagementMenu) TableName() string {
return "b2b_customer_management_menu"
}