Removed hardcoded string

- Roles are not hardcoded anymore (closes #4)
This commit is contained in:
2026-03-03 15:55:39 +01:00
parent 0afd5bfc3a
commit e7da8c9443
2 changed files with 19 additions and 1 deletions

View File

@@ -24,3 +24,21 @@ type ExpenseShare struct {
UserID string `json:"user_id"`
ShareCents int64 `json:"share_cents"`
}
type Role int
const (
RoleUser = iota
RoleAdmin
)
func (r Role) String() string {
switch r {
case RoleUser:
return "user"
case RoleAdmin:
return "admin"
default:
return "unknown"
}
}