28 lines
1022 B
Go
28 lines
1022 B
Go
|
|
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
|