20 lines
549 B
Go
20 lines
549 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Attachment struct {
|
|
ID uuid.UUID `gorm:"primaryKey" json:"id"`
|
|
MessageID uuid.UUID `gorm:"index;not null" json:"message_id"`
|
|
Filename string `gorm:"not null" json:"filename"`
|
|
FileSize int64 `gorm:"not null" json:"file_size"`
|
|
MimeType string `gorm:"not null" json:"mime_type"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
|
|
// Relation optionnelle vers le message
|
|
Message *Message `gorm:"foreignKey:MessageID" json:"message,omitempty"`
|
|
}
|