Files
template-vitrine/backend/internal/modules/users/model.go
T
Xor290 919c807004
ci-api / test (push) Failing after 8m7s
ci-web / test (push) Failing after 5m5s
chore: build
2026-09-20 12:18:33 +02:00

28 lines
698 B
Go

// Package users owns the user account entity and its CRUD operations.
// The auth module depends on this package to look up credentials, but
// never owns or duplicates the User model itself.
package users
import (
"time"
"github.com/google/uuid"
)
const (
RoleAdmin = "admin"
RoleCustomer = "customer"
)
type User struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey"`
Username string `gorm:"uniqueIndex;not null"`
PasswordHash string `gorm:"not null"`
Role string `gorm:"not null;default:admin"`
IsActive bool `gorm:"not null;default:true"`
CreatedAt time.Time
UpdatedAt time.Time
}
func (User) TableName() string { return "users" }