21 lines
655 B
Go
21 lines
655 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type ServerUser struct {
|
|
ID uuid.UUID `gorm:"primaryKey" json:"id"`
|
|
ServerID uuid.UUID `gorm:"index;not null" json:"server_id"`
|
|
UserID uuid.UUID `gorm:"index;not null" json:"user_id"`
|
|
Username *string `json:"username,omitempty"` // Option<String> = pointeur nullable
|
|
JoinedAt time.Time `gorm:"autoCreateTime" json:"joined_at"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
|
|
|
// Relations pour navigation (optionnelles)
|
|
Server *Server `gorm:"foreignKey:ServerID" json:"server,omitempty"`
|
|
User *User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
|
}
|