29 lines
1.6 KiB
Go
29 lines
1.6 KiB
Go
package entity
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
"time"
|
|
)
|
|
|
|
type ArticleApprovalFlows struct {
|
|
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
|
ArticleId uint `json:"article_id" gorm:"type:int4;not null"`
|
|
WorkflowId uint `json:"workflow_id" gorm:"type:int4;not null"`
|
|
CurrentStep int `json:"current_step" gorm:"type:int4;default:1"`
|
|
StatusId int `json:"status_id" gorm:"type:int4;default:1"` // 1=pending, 2=approved, 3=rejected, 4=revision_requested
|
|
SubmittedById uint `json:"submitted_by_id" gorm:"type:int4;not null"`
|
|
SubmittedAt time.Time `json:"submitted_at" gorm:"default:now()"`
|
|
CompletedAt *time.Time `json:"completed_at" gorm:"type:timestamp"`
|
|
RejectionReason *string `json:"rejection_reason" gorm:"type:text"`
|
|
RevisionRequested *bool `json:"revision_requested" gorm:"type:bool;default:false"`
|
|
RevisionMessage *string `json:"revision_message" gorm:"type:text"`
|
|
ClientId *uuid.UUID `json:"client_id" gorm:"type:UUID"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
|
|
|
|
// Relations
|
|
Article Articles `json:"article" gorm:"foreignKey:ArticleId;constraint:OnDelete:CASCADE"`
|
|
Workflow ApprovalWorkflows `json:"workflow" gorm:"foreignKey:WorkflowId"`
|
|
SubmittedBy *Users `json:"submitted_by" gorm:"foreignKey:SubmittedById"`
|
|
StepLogs []ArticleApprovalStepLogs `json:"step_logs" gorm:"foreignKey:ApprovalFlowId;constraint:OnDelete:CASCADE"`
|
|
} |