22 lines
1.0 KiB
Go
22 lines
1.0 KiB
Go
package entity
|
|
|
|
import (
|
|
"narasi-ahli-be/app/database/entity/users"
|
|
"time"
|
|
)
|
|
|
|
type ChatMessages struct {
|
|
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
|
ConversationID uint `json:"conversation_id" gorm:"type:int4;not null;index"`
|
|
SenderID uint `json:"sender_id" gorm:"type:int4;not null;index"`
|
|
MessageText *string `json:"message_text" gorm:"type:text"`
|
|
MessageType string `json:"message_type" gorm:"type:varchar;not null;default:'text'"`
|
|
FileURL *string `json:"file_url" gorm:"type:varchar"`
|
|
FileName *string `json:"file_name" gorm:"type:varchar"`
|
|
FileSize *int64 `json:"file_size" gorm:"type:bigint"`
|
|
IsRead bool `json:"is_read" gorm:"default:false"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
|
|
Conversation *Conversations `json:"conversation" gorm:"foreignKey:ConversationID;references:ID"`
|
|
Sender *users.Users `json:"sender" gorm:"foreignKey:SenderID;references:ID"`
|
|
}
|