summaryrefslogtreecommitdiff
path: root/internal/api/model
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api/model')
-rw-r--r--internal/api/model/account.go21
-rw-r--r--internal/api/model/admin.go2
2 files changed, 14 insertions, 9 deletions
diff --git a/internal/api/model/account.go b/internal/api/model/account.go
index ddfe6cc3a..238def59d 100644
--- a/internal/api/model/account.go
+++ b/internal/api/model/account.go
@@ -96,8 +96,7 @@ type Account struct {
EnableRSS bool `json:"enable_rss,omitempty"`
// Role of the account on this instance.
// Omitted for remote accounts.
- // example: user
- Role AccountRole `json:"role,omitempty"`
+ Role *AccountRole `json:"role,omitempty"`
}
// AccountCreateRequest models account creation parameters.
@@ -215,13 +214,19 @@ type AccountDeleteRequest struct {
// AccountRole models the role of an account.
//
-// swagger:enum accountRole
+// swagger:model accountRole
+type AccountRole struct {
+ Name AccountRoleName `json:"name"`
+}
+
+// AccountRoleName represent the name of the role of an account.
+//
// swagger:type string
-type AccountRole string
+type AccountRoleName string
const (
- AccountRoleUser AccountRole = "user" // Standard user
- AccountRoleModerator AccountRole = "moderator" // Moderator privileges
- AccountRoleAdmin AccountRole = "admin" // Instance admin
- AccountRoleUnknown AccountRole = "" // We don't know / remote account
+ AccountRoleUser AccountRoleName = "user" // Standard user
+ AccountRoleModerator AccountRoleName = "moderator" // Moderator privileges
+ AccountRoleAdmin AccountRoleName = "admin" // Instance admin
+ AccountRoleUnknown AccountRoleName = "" // We don't know / remote account
)
diff --git a/internal/api/model/admin.go b/internal/api/model/admin.go
index df688694d..cc5503770 100644
--- a/internal/api/model/admin.go
+++ b/internal/api/model/admin.go
@@ -56,7 +56,7 @@ type AdminAccountInfo struct {
// example: Pleaaaaaaaaaaaaaaase!!
InviteRequest *string `json:"invite_request"`
// The current role of the account.
- Role string `json:"role"`
+ Role AccountRole `json:"role"`
// Whether the account has confirmed their email address.
Confirmed bool `json:"confirmed"`
// Whether the account is currently approved.