kontenhumas-be/app/database/entity/menu_actions.entity.go

28 lines
1.3 KiB
Go

package entity
import (
"github.com/google/uuid"
"time"
)
// MenuActions menyimpan actions yang tersedia di setiap menu
// Contoh: Menu "Content Management" punya actions: view, create, edit, delete, approve, export
type MenuActions struct {
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
MenuId uint `json:"menu_id" gorm:"type:int4;not null"`
ActionCode string `json:"action_code" gorm:"type:varchar(50);not null"` // 'view', 'create', 'edit', 'delete', 'approve', 'export'
ActionName string `json:"action_name" gorm:"type:varchar(255);not null"` // 'View Content', 'Create Content', etc.
Description *string `json:"description" gorm:"type:text"`
PathUrl *string `json:"path_url" gorm:"type:varchar(255)"` // Optional: untuk routing frontend
HttpMethod *string `json:"http_method" gorm:"type:varchar(10)"` // Optional: 'GET', 'POST', 'PUT', 'DELETE'
Position *int `json:"position" gorm:"type:int4"`
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"`
}