2025-08-09 18:58:22 +07:00
|
|
|
package entities
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/google/uuid"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type LetterDiscussion 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"`
|
|
|
|
|
ParentID *uuid.UUID `json:"parent_id,omitempty"`
|
|
|
|
|
UserID uuid.UUID `gorm:"type:uuid;not null" json:"user_id"`
|
|
|
|
|
Message string `gorm:"not null" json:"message"`
|
|
|
|
|
Mentions JSONB `gorm:"type:jsonb" json:"mentions,omitempty"`
|
|
|
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
|
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
|
|
|
|
EditedAt *time.Time `json:"edited_at,omitempty"`
|
2025-08-15 21:17:19 +07:00
|
|
|
|
|
|
|
|
// Relationships
|
|
|
|
|
User *User `gorm:"foreignKey:UserID;references:ID" json:"user,omitempty"`
|
2025-08-09 18:58:22 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (LetterDiscussion) TableName() string { return "letter_incoming_discussions" }
|