package entities import ( "time" "github.com/google/uuid" ) type LetterOutgoingActivityLog struct { ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"` LetterID uuid.UUID `gorm:"type:uuid;not null" json:"letter_id"` ActionType string `gorm:"not null" json:"action_type"` ActorUserID *uuid.UUID `json:"actor_user_id,omitempty"` ActorDepartmentID *uuid.UUID `json:"actor_department_id,omitempty"` TargetType *string `json:"target_type,omitempty"` TargetID *uuid.UUID `json:"target_id,omitempty"` FromStatus *string `json:"from_status,omitempty"` ToStatus *string `json:"to_status,omitempty"` Context JSONB `gorm:"type:jsonb" json:"context,omitempty"` OccurredAt time.Time `gorm:"autoCreateTime" json:"occurred_at"` // Relations Letter *LetterOutgoing `gorm:"foreignKey:LetterID" json:"letter,omitempty"` ActorUser *User `gorm:"foreignKey:ActorUserID" json:"actor_user,omitempty"` ActorDepartment *Department `gorm:"foreignKey:ActorDepartmentID" json:"actor_department,omitempty"` } func (LetterOutgoingActivityLog) TableName() string { return "letter_outgoing_activity_logs" } // Action types for letter outgoing activity logs const ( LetterOutgoingActionCreated = "created" LetterOutgoingActionUpdated = "updated" LetterOutgoingActionDeleted = "deleted" LetterOutgoingActionStatusChanged = "status_changed" LetterOutgoingActionSubmittedApproval = "submitted_for_approval" LetterOutgoingActionApproved = "approved" LetterOutgoingActionRejected = "rejected" LetterOutgoingActionRevised = "revised" LetterOutgoingActionSent = "sent" LetterOutgoingActionArchived = "archived" LetterOutgoingActionAttachmentAdded = "attachment_added" LetterOutgoingActionAttachmentRemoved = "attachment_removed" LetterOutgoingActionRecipientAdded = "recipient_added" LetterOutgoingActionRecipientRemoved = "recipient_removed" LetterOutgoingActionDiscussionAdded = "discussion_added" )