narasiahli-be/app/database/entity/conversations.entity.go

18 lines
755 B
Go

package entity
import (
"narasi-ahli-be/app/database/entity/users"
"time"
)
type Conversations struct {
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
Participant1ID uint `json:"participant1_id" gorm:"type:int4;not null;index"`
Participant2ID uint `json:"participant2_id" gorm:"type:int4;not null;index"`
LastMessageAt *time.Time `json:"last_message_at"`
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
Participant1 *users.Users `json:"participant1" gorm:"foreignKey:Participant1ID;references:ID"`
Participant2 *users.Users `json:"participant2" gorm:"foreignKey:Participant2ID;references:ID"`
}