add revision number

This commit is contained in:
Aditya Siregar
2025-10-13 08:46:26 +07:00
parent 4e58ce95fb
commit e58472c963
13 changed files with 364 additions and 48 deletions
+12 -11
View File
@@ -49,17 +49,18 @@ const (
)
type LetterOutgoingApproval 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"`
StepID uuid.UUID `gorm:"type:uuid;not null" json:"step_id"`
StepOrder int `gorm:"not null" json:"step_order"`
ParallelGroup int `gorm:"default:1" json:"parallel_group"`
IsRequired bool `gorm:"default:true" json:"is_required"`
ApproverID *uuid.UUID `json:"approver_id,omitempty"`
Status ApprovalStatus `gorm:"not null;default:'pending'" json:"status"`
Remarks *string `json:"remarks,omitempty"`
ActedAt *time.Time `json:"acted_at,omitempty"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
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"`
StepID uuid.UUID `gorm:"type:uuid;not null" json:"step_id"`
RevisionNumber int `gorm:"not null;default:0" json:"revision_number"`
StepOrder int `gorm:"not null" json:"step_order"`
ParallelGroup int `gorm:"default:1" json:"parallel_group"`
IsRequired bool `gorm:"default:true" json:"is_required"`
ApproverID *uuid.UUID `json:"approver_id,omitempty"`
Status ApprovalStatus `gorm:"not null;default:'pending'" json:"status"`
Remarks *string `json:"remarks,omitempty"`
ActedAt *time.Time `json:"acted_at,omitempty"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
// Relations
Letter *LetterOutgoing `gorm:"foreignKey:LetterID" json:"letter,omitempty"`
+9 -7
View File
@@ -28,6 +28,7 @@ type LetterOutgoing struct {
IssueDate time.Time `json:"issue_date"`
Status LetterOutgoingStatus `gorm:"not null;default:'draft'" json:"status"`
ApprovalFlowID *uuid.UUID `json:"approval_flow_id,omitempty"`
RevisionNumber int `gorm:"not null;default:0" json:"revision_number"`
CreatedBy uuid.UUID `gorm:"not null" json:"created_by"`
IsArchived bool `gorm:"not null;default:false" json:"is_archived"`
ArchivedAt *time.Time `json:"archived_at,omitempty"`
@@ -67,13 +68,14 @@ type LetterOutgoingRecipient struct {
func (LetterOutgoingRecipient) TableName() string { return "letter_outgoing_recipients" }
type LetterOutgoingAttachment 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"`
FileURL string `gorm:"not null" json:"file_url"`
FileName string `gorm:"not null" json:"file_name"`
FileType string `gorm:"not null" json:"file_type"`
UploadedBy *uuid.UUID `json:"uploaded_by,omitempty"`
UploadedAt time.Time `gorm:"autoCreateTime" json:"uploaded_at"`
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"`
RevisionNumber int `gorm:"not null;default:0" json:"revision_number"`
FileURL string `gorm:"not null" json:"file_url"`
FileName string `gorm:"not null" json:"file_name"`
FileType string `gorm:"not null" json:"file_type"`
UploadedBy *uuid.UUID `json:"uploaded_by,omitempty"`
UploadedAt time.Time `gorm:"autoCreateTime" json:"uploaded_at"`
}
func (LetterOutgoingAttachment) TableName() string { return "letter_outgoing_attachments" }
@@ -36,6 +36,7 @@ const (
LetterOutgoingActionSubmittedApproval = "submitted_for_approval"
LetterOutgoingActionApproved = "approved"
LetterOutgoingActionRejected = "rejected"
LetterOutgoingActionRevised = "revised"
LetterOutgoingActionSent = "sent"
LetterOutgoingActionArchived = "archived"
LetterOutgoingActionAttachmentAdded = "attachment_added"