- Add avatar upload functionality with public URL access. - Implement user login with email and password authentication. - Create endpoints for fetching and updating the authenticated user's profile. - Set up database migrations for user profiles, including email and role management. - Introduce personal data management linked to user profiles. - Add email verification process with welcome email templates.
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package profiles
|
|
|
|
type Status int
|
|
|
|
const (
|
|
StatusActive Status = iota
|
|
StatusInactive
|
|
StatusSuspended
|
|
StatusDeleted
|
|
StatusPending
|
|
StatusWaitingDeletion
|
|
StatusBanned
|
|
)
|
|
|
|
// StatusOption describes a valid profile status for display in admin UIs.
|
|
type StatusOption struct {
|
|
Name string `json:"name"`
|
|
Value Status `json:"value"`
|
|
Updatable bool `json:"updatable"`
|
|
}
|
|
|
|
// Statuses returns every valid profile status with a display name and its underlying value.
|
|
func Statuses() []StatusOption {
|
|
return []StatusOption{
|
|
{Name: "Active", Value: StatusActive, Updatable: true},
|
|
{Name: "Inactive", Value: StatusInactive, Updatable: true},
|
|
{Name: "Suspended", Value: StatusSuspended, Updatable: true},
|
|
{Name: "Deleted", Value: StatusDeleted, Updatable: false},
|
|
{Name: "Pending", Value: StatusPending, Updatable: true},
|
|
{Name: "Waiting deletion", Value: StatusWaitingDeletion, Updatable: false},
|
|
{Name: "Banned", Value: StatusBanned, Updatable: true},
|
|
}
|
|
}
|
|
|
|
// IsValid reports whether s is one of the defined Status values.
|
|
func (s Status) IsValid() bool {
|
|
return s >= StatusActive && s <= StatusBanned
|
|
}
|