a8078f787c
Add Status field (gorm, indexed, default active) to both User and File models. Add User status constants: StatusActive, StatusAdminDeleted. Add File status constant: StatusUserDeleted. Add tests verifying Status field is excluded from JSON serialization. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
24 lines
755 B
Go
24 lines
755 B
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// User represents a registered account.
|
|
type User struct {
|
|
ID string `gorm:"primaryKey;type:varchar(36)" json:"id"`
|
|
Username string `gorm:"uniqueIndex;type:varchar(64);not null" json:"username"`
|
|
Email string `gorm:"uniqueIndex;type:varchar(255);not null" json:"email"`
|
|
PasswordHash string `gorm:"type:varchar(255);not null" json:"-"`
|
|
IsAdmin bool `gorm:"default:false" json:"is_admin"`
|
|
Status string `gorm:"type:varchar(32);not null;default:active;index" json:"-"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// User status constants.
|
|
const (
|
|
StatusActive = "active"
|
|
StatusAdminDeleted = "admin_deleted"
|
|
)
|