This commit is contained in:
2025-11-02 01:25:30 +01:00
commit ed18be9fbd
17 changed files with 598 additions and 0 deletions

20
models/server_user.go Normal file
View File

@@ -0,0 +1,20 @@
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"`
}