21 lines
655 B
Go
21 lines
655 B
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type User struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Username string `gorm:"uniqueIndex;not null;size:255" json:"username"`
|
|
Email string `gorm:"uniqueIndex;not null;size:255" json:"email"`
|
|
Password string `gorm:"not null" json:"password"` // Hash speichern, nicht das Klartext-Passwort!
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"`
|
|
|
|
// Relationships
|
|
Portfolios []Portfolio `gorm:"foreignKey:UserID" json:"portfolios,omitempty"`
|
|
}
|