kontenhumas-be/app/database/entity/article_comments.entity.go

28 lines
1022 B
Go
Raw Normal View History

2025-09-28 01:53:09 +00:00
package entity
import (
"time"
"github.com/google/uuid"
)
type ArticleComments struct {
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
Message string `json:"message" gorm:"type:varchar"`
ArticleId uint `json:"article_id" gorm:"type:int4"`
CommentFrom *uint `json:"comment_from" gorm:"type:int4"`
ParentId *int `json:"parent_id" gorm:"type:int4"`
IsPublic bool `json:"is_public" gorm:"type:bool;default:false"`
StatusId int `json:"status_id" gorm:"type:int4;default:0"`
ApprovedAt *time.Time `json:"approved_at" gorm:"type:timestamp"`
ClientId *uuid.UUID `json:"client_id" gorm:"type:UUID"`
IsActive bool `json:"is_active" gorm:"type:bool"`
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"`
}
// statusId => 0: waiting, 1: accepted, 2: replied, 3: rejected