jaecoo-be/app/database/entity/approval_histories.entity.go

20 lines
1011 B
Go
Raw Normal View History

package entity
import (
"time"
)
// ApprovalHistories is a generic table to store approval/rejection history for all modules
type ApprovalHistories struct {
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
ModuleType string `json:"module_type" gorm:"type:varchar"` // e.g., "banners", "galleries", "products", "sales_agents", "promotions"
ModuleId uint `json:"module_id" gorm:"type:int4"` // ID of the record in the respective module table
StatusId int `json:"status_id" gorm:"type:int4"` // 1: pending, 2: approved, 3: rejected
Action string `json:"action" gorm:"type:varchar"` // "approve" or "reject"
ApprovedBy *uint `json:"approved_by" gorm:"type:int4"` // User ID who performed the action
Message *string `json:"message" gorm:"type:text"` // Optional message/reason
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
}