25 lines
983 B
Go
25 lines
983 B
Go
|
|
package entity
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/google/uuid"
|
||
|
|
"time"
|
||
|
|
)
|
||
|
|
|
||
|
|
// MenuModules menghubungkan menu dengan modul-modul yang dimilikinya
|
||
|
|
// Contoh: Menu "Article" bisa punya modul: "table_article", "create_article", "edit_article", "delete_article"
|
||
|
|
type MenuModules struct {
|
||
|
|
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
||
|
|
MenuId uint `json:"menu_id" gorm:"type:int4;not null"`
|
||
|
|
ModuleId uint `json:"module_id" gorm:"type:int4;not null"`
|
||
|
|
Position *int `json:"position" gorm:"type:int4"` // Urutan modul dalam menu
|
||
|
|
ClientId *uuid.UUID `json:"client_id" gorm:"type:UUID"`
|
||
|
|
IsActive *bool `json:"is_active" gorm:"type:bool;default:true"`
|
||
|
|
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
|
||
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
|
||
|
|
|
||
|
|
// Relations
|
||
|
|
Menu *MasterMenus `json:"menu,omitempty" gorm:"foreignKey:MenuId"`
|
||
|
|
Module *MasterModules `json:"module,omitempty" gorm:"foreignKey:ModuleId"`
|
||
|
|
}
|
||
|
|
|