miniITCS/backend/internal/models/user.go

27 lines
732 B
Go

package models
import (
"time"
)
type User struct {
ID int64 `json:"id" db:"id"`
Username string `json:"username" db:"username"`
Password string `json:"-" db:"password"` // Never expose password in JSON
Email string `json:"email" db:"email"`
Role string `json:"role" db:"role"` // "admin" or "user"
Active bool `json:"active" db:"active"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}
type LoginRequest struct {
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
}
type LoginResponse struct {
Token string `json:"token"`
User User `json:"user"`
}