Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

Update to latest main

Matthew Kilgoref835a341b395
diff --git a/backend/app/api/static/docs/docs.go b/backend/app/api/static/docs/docs.go
index d08de9b6..6c0a560e 100644
--- a/backend/app/api/static/docs/docs.go
+++ b/backend/app/api/static/docs/docs.go
@@ -2484,6 +2484,87 @@ const docTemplate = `{
}
}
}
+ },
+ "/v1/users/self/settings": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Get user settings",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Update user settings",
+ "parameters": [
+ {
+ "description": "Settings Data",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
}
},
"definitions": {
@@ -3569,6 +3650,14 @@ const docTemplate = `{
}
]
},
+ "settings": {
+ "description": "Settings holds the value of the \"settings\" field.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ ]
+ },
"superuser": {
"description": "Superuser holds the value of the \"superuser\" field.",
"type": "boolean"
@@ -4983,6 +5072,64 @@ const docTemplate = `{
}
}
},
+ "schema.DuplicateSettings": {
+ "type": "object",
+ "properties": {
+ "copyAttachments": {
+ "type": "boolean"
+ },
+ "copyCustomFields": {
+ "type": "boolean"
+ },
+ "copyMaintenance": {
+ "type": "boolean"
+ },
+ "copyPrefixOverride": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.UserSettings": {
+ "type": "object",
+ "properties": {
+ "displayLegacyHeader": {
+ "type": "boolean"
+ },
+ "duplicateSettings": {
+ "$ref": "#/definitions/schema.DuplicateSettings"
+ },
+ "editorAdvancedView": {
+ "type": "boolean"
+ },
+ "itemDisplayView": {
+ "type": "string"
+ },
+ "itemsPerPage": {
+ "type": "integer"
+ },
+ "itemsPerTablePage": {
+ "type": "integer"
+ },
+ "language": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "overrideFormatLocale": {
+ "type": "string"
+ },
+ "showDetails": {
+ "type": "boolean"
+ },
+ "showEmpty": {
+ "type": "boolean"
+ },
+ "theme": {
+ "type": "string"
+ }
+ }
+ },
"services.Latest": {
"type": "object",
"properties": {
diff --git a/backend/app/api/static/docs/openapi-3.json b/backend/app/api/static/docs/openapi-3.json
index f4ce81bf..07f57dd1 100644
--- a/backend/app/api/static/docs/openapi-3.json
+++ b/backend/app/api/static/docs/openapi-3.json
@@ -2665,6 +2665,89 @@
}
}
}
+ },
+ "/v1/users/self/settings": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Get user settings",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/components/schemas/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Update user settings",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/schema.UserSettings"
+ }
+ }
+ },
+ "description": "Settings Data",
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/components/schemas/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
}
},
"servers": [
@@ -3767,6 +3850,14 @@
}
]
},
+ "settings": {
+ "description": "Settings holds the value of the \"settings\" field.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/schema.UserSettings"
+ }
+ ]
+ },
"superuser": {
"description": "Superuser holds the value of the \"superuser\" field.",
"type": "boolean"
@@ -5181,6 +5272,64 @@
}
}
},
+ "schema.DuplicateSettings": {
+ "type": "object",
+ "properties": {
+ "copyAttachments": {
+ "type": "boolean"
+ },
+ "copyCustomFields": {
+ "type": "boolean"
+ },
+ "copyMaintenance": {
+ "type": "boolean"
+ },
+ "copyPrefixOverride": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.UserSettings": {
+ "type": "object",
+ "properties": {
+ "displayLegacyHeader": {
+ "type": "boolean"
+ },
+ "duplicateSettings": {
+ "$ref": "#/components/schemas/schema.DuplicateSettings"
+ },
+ "editorAdvancedView": {
+ "type": "boolean"
+ },
+ "itemDisplayView": {
+ "type": "string"
+ },
+ "itemsPerPage": {
+ "type": "integer"
+ },
+ "itemsPerTablePage": {
+ "type": "integer"
+ },
+ "language": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "overrideFormatLocale": {
+ "type": "string"
+ },
+ "showDetails": {
+ "type": "boolean"
+ },
+ "showEmpty": {
+ "type": "boolean"
+ },
+ "theme": {
+ "type": "string"
+ }
+ }
+ },
"services.Latest": {
"type": "object",
"properties": {
diff --git a/backend/app/api/static/docs/openapi-3.yaml b/backend/app/api/static/docs/openapi-3.yaml
index eda39cf7..40658d6c 100644
--- a/backend/app/api/static/docs/openapi-3.yaml
+++ b/backend/app/api/static/docs/openapi-3.yaml
@@ -1579,6 +1579,50 @@ paths:
responses:
"204":
description: No Content
+ /v1/users/self/settings:
+ get:
+ security:
+ - Bearer: []
+ tags:
+ - User
+ summary: Get user settings
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: "#/components/schemas/v1.Wrapped"
+ - type: object
+ properties:
+ item:
+ $ref: "#/components/schemas/schema.UserSettings"
+ put:
+ security:
+ - Bearer: []
+ tags:
+ - User
+ summary: Update user settings
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/schema.UserSettings"
+ description: Settings Data
+ required: true
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: "#/components/schemas/v1.Wrapped"
+ - type: object
+ properties:
+ item:
+ $ref: "#/components/schemas/schema.UserSettings"
servers:
- url: https://demo.homebox.software/api
- url: http://demo.homebox.software/api
@@ -2351,6 +2395,10 @@ components:
description: Role holds the value of the "role" field.
allOf:
- $ref: "#/components/schemas/user.Role"
+ settings:
+ description: Settings holds the value of the "settings" field.
+ allOf:
+ - $ref: "#/components/schemas/schema.UserSettings"
superuser:
description: Superuser holds the value of the "superuser" field.
type: boolean
@@ -3313,6 +3361,44 @@ components:
type: string
value:
type: number
+ schema.DuplicateSettings:
+ type: object
+ properties:
+ copyAttachments:
+ type: boolean
+ copyCustomFields:
+ type: boolean
+ copyMaintenance:
+ type: boolean
+ copyPrefixOverride:
+ type: string
+ schema.UserSettings:
+ type: object
+ properties:
+ displayLegacyHeader:
+ type: boolean
+ duplicateSettings:
+ $ref: "#/components/schemas/schema.DuplicateSettings"
+ editorAdvancedView:
+ type: boolean
+ itemDisplayView:
+ type: string
+ itemsPerPage:
+ type: integer
+ itemsPerTablePage:
+ type: integer
+ language:
+ type: string
+ locale:
+ type: string
+ overrideFormatLocale:
+ type: string
+ showDetails:
+ type: boolean
+ showEmpty:
+ type: boolean
+ theme:
+ type: string
services.Latest:
type: object
properties:
diff --git a/backend/app/api/static/docs/swagger.json b/backend/app/api/static/docs/swagger.json
index cb5a49f4..5705a7a5 100644
--- a/backend/app/api/static/docs/swagger.json
+++ b/backend/app/api/static/docs/swagger.json
@@ -2482,6 +2482,87 @@
}
}
}
+ },
+ "/v1/users/self/settings": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Get user settings",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Update user settings",
+ "parameters": [
+ {
+ "description": "Settings Data",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
}
},
"definitions": {
@@ -3567,6 +3648,14 @@
}
]
},
+ "settings": {
+ "description": "Settings holds the value of the \"settings\" field.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ ]
+ },
"superuser": {
"description": "Superuser holds the value of the \"superuser\" field.",
"type": "boolean"
@@ -4981,6 +5070,64 @@
}
}
},
+ "schema.DuplicateSettings": {
+ "type": "object",
+ "properties": {
+ "copyAttachments": {
+ "type": "boolean"
+ },
+ "copyCustomFields": {
+ "type": "boolean"
+ },
+ "copyMaintenance": {
+ "type": "boolean"
+ },
+ "copyPrefixOverride": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.UserSettings": {
+ "type": "object",
+ "properties": {
+ "displayLegacyHeader": {
+ "type": "boolean"
+ },
+ "duplicateSettings": {
+ "$ref": "#/definitions/schema.DuplicateSettings"
+ },
+ "editorAdvancedView": {
+ "type": "boolean"
+ },
+ "itemDisplayView": {
+ "type": "string"
+ },
+ "itemsPerPage": {
+ "type": "integer"
+ },
+ "itemsPerTablePage": {
+ "type": "integer"
+ },
+ "language": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "overrideFormatLocale": {
+ "type": "string"
+ },
+ "showDetails": {
+ "type": "boolean"
+ },
+ "showEmpty": {
+ "type": "boolean"
+ },
+ "theme": {
+ "type": "string"
+ }
+ }
+ },
"services.Latest": {
"type": "object",
"properties": {
diff --git a/backend/app/api/static/docs/swagger.yaml b/backend/app/api/static/docs/swagger.yaml
index 2a190f54..b9b956fa 100644
--- a/backend/app/api/static/docs/swagger.yaml
+++ b/backend/app/api/static/docs/swagger.yaml
@@ -3457,8 +3457,7 @@ paths:
- $ref: '#/definitions/v1.Wrapped'
- properties:
item:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/schema.UserSettings'
type: object
security:
- Bearer: []
@@ -3472,8 +3471,7 @@ paths:
name: payload
required: true
schema:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/schema.UserSettings'
produces:
- application/json
responses:
@@ -3484,12 +3482,11 @@ paths:
- $ref: '#/definitions/v1.Wrapped'
- properties:
item:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/schema.UserSettings'
type: object
security:
- Bearer: []
- summary: Get user settings
+ summary: Update user settings
tags:
- User
schemes:
diff --git a/backend/go.sum b/backend/go.sum
index 6f11d8f1..0d766402 100644
--- a/backend/go.sum
+++ b/backend/go.sum
@@ -325,6 +325,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
+github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
@@ -347,6 +349,8 @@ github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOF
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/olahol/melody v1.4.0 h1:Pa5SdeZL/zXPi1tJuMAPDbl4n3gQOThSL6G1p4qZ4SI=
github.com/olahol/melody v1.4.0/go.mod h1:GgkTl6Y7yWj/HtfD48Q5vLKPVoZOH+Qqgfa7CvJgJM4=
+github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
+github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU=
github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
@@ -389,6 +393,10 @@ github.com/shirou/gopsutil/v4 v4.25.11 h1:X53gB7muL9Gnwwo2evPSE+SfOrltMoR6V3xJAX
github.com/shirou/gopsutil/v4 v4.25.11/go.mod h1:EivAfP5x2EhLp2ovdpKSozecVXn1TmuG7SMzs/Wh4PU=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
+github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
+github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
+github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo=
github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
diff --git a/backend/internal/data/ent/migrate/schema.go b/backend/internal/data/ent/migrate/schema.go
index ef6161d8..36ece9c7 100644
--- a/backend/internal/data/ent/migrate/schema.go
+++ b/backend/internal/data/ent/migrate/schema.go
@@ -468,6 +468,7 @@ var (
{Name: "activated_on", Type: field.TypeTime, Nullable: true},
{Name: "oidc_issuer", Type: field.TypeString, Nullable: true},
{Name: "oidc_subject", Type: field.TypeString, Nullable: true},
+ {Name: "settings", Type: field.TypeJSON, Nullable: true},
{Name: "group_users", Type: field.TypeUUID},
}
// UsersTable holds the schema information for the "users" table.
@@ -478,7 +479,7 @@ var (
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "users_groups_users",
- Columns: []*schema.Column{UsersColumns[12]},
+ Columns: []*schema.Column{UsersColumns[13]},
RefColumns: []*schema.Column{GroupsColumns[0]},
OnDelete: schema.Cascade,
},
diff --git a/backend/internal/data/ent/mutation.go b/backend/internal/data/ent/mutation.go
index f5a1b13d..95c842e6 100644
--- a/backend/internal/data/ent/mutation.go
+++ b/backend/internal/data/ent/mutation.go
@@ -25,6 +25,7 @@ import (
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/maintenanceentry"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/notifier"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/predicate"
+ "github.com/sysadminsmedia/homebox/backend/internal/data/ent/schema"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/templatefield"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/user"
)
@@ -12583,6 +12584,7 @@ type UserMutation struct {
activated_on *time.Time
oidc_issuer *string
oidc_subject *string
+ settings *schema.UserSettings
clearedFields map[string]struct{}
group *uuid.UUID
clearedgroup bool
@@ -13149,6 +13151,55 @@ func (m *UserMutation) ResetOidcSubject() {
delete(m.clearedFields, user.FieldOidcSubject)
}
+// SetSettings sets the "settings" field.
+func (m *UserMutation) SetSettings(ss schema.UserSettings) {
+ m.settings = &ss
+}
+
+// Settings returns the value of the "settings" field in the mutation.
+func (m *UserMutation) Settings() (r schema.UserSettings, exists bool) {
+ v := m.settings
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldSettings returns the old "settings" field's value of the User entity.
+// If the User object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UserMutation) OldSettings(ctx context.Context) (v schema.UserSettings, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldSettings is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldSettings requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldSettings: %w", err)
+ }
+ return oldValue.Settings, nil
+}
+
+// ClearSettings clears the value of the "settings" field.
+func (m *UserMutation) ClearSettings() {
+ m.settings = nil
+ m.clearedFields[user.FieldSettings] = struct{}{}
+}
+
+// SettingsCleared returns if the "settings" field was cleared in this mutation.
+func (m *UserMutation) SettingsCleared() bool {
+ _, ok := m.clearedFields[user.FieldSettings]
+ return ok
+}
+
+// ResetSettings resets all changes to the "settings" field.
+func (m *UserMutation) ResetSettings() {
+ m.settings = nil
+ delete(m.clearedFields, user.FieldSettings)
+}
+
// SetGroupID sets the "group" edge to the Group entity by id.
func (m *UserMutation) SetGroupID(id uuid.UUID) {
m.group = &id
@@ -13330,7 +13381,7 @@ func (m *UserMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *UserMutation) Fields() []string {
- fields := make([]string, 0, 11)
+ fields := make([]string, 0, 12)
if m.created_at != nil {
fields = append(fields, user.FieldCreatedAt)
}
@@ -13364,6 +13415,9 @@ func (m *UserMutation) Fields() []string {
if m.oidc_subject != nil {
fields = append(fields, user.FieldOidcSubject)
}
+ if m.settings != nil {
+ fields = append(fields, user.FieldSettings)
+ }
return fields
}
@@ -13394,6 +13448,8 @@ func (m *UserMutation) Field(name string) (ent.Value, bool) {
return m.OidcIssuer()
case user.FieldOidcSubject:
return m.OidcSubject()
+ case user.FieldSettings:
+ return m.Settings()
}
return nil, false
}
@@ -13425,6 +13481,8 @@ func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, er
return m.OldOidcIssuer(ctx)
case user.FieldOidcSubject:
return m.OldOidcSubject(ctx)
+ case user.FieldSettings:
+ return m.OldSettings(ctx)
}
return nil, fmt.Errorf("unknown User field %s", name)
}
@@ -13511,6 +13569,13 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
}
m.SetOidcSubject(v)
return nil
+ case user.FieldSettings:
+ v, ok := value.(schema.UserSettings)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetSettings(v)
+ return nil
}
return fmt.Errorf("unknown User field %s", name)
}
@@ -13553,6 +13618,9 @@ func (m *UserMutation) ClearedFields() []string {
if m.FieldCleared(user.FieldOidcSubject) {
fields = append(fields, user.FieldOidcSubject)
}
+ if m.FieldCleared(user.FieldSettings) {
+ fields = append(fields, user.FieldSettings)
+ }
return fields
}
@@ -13579,6 +13647,9 @@ func (m *UserMutation) ClearField(name string) error {
case user.FieldOidcSubject:
m.ClearOidcSubject()
return nil
+ case user.FieldSettings:
+ m.ClearSettings()
+ return nil
}
return fmt.Errorf("unknown User nullable field %s", name)
}
@@ -13620,6 +13691,9 @@ func (m *UserMutation) ResetField(name string) error {
case user.FieldOidcSubject:
m.ResetOidcSubject()
return nil
+ case user.FieldSettings:
+ m.ResetSettings()
+ return nil
}
return fmt.Errorf("unknown User field %s", name)
}
diff --git a/backend/internal/data/ent/user.go b/backend/internal/data/ent/user.go
index 9d7d4866..e1578f74 100644
--- a/backend/internal/data/ent/user.go
+++ b/backend/internal/data/ent/user.go
@@ -3,6 +3,7 @@
package ent
import (
+ "encoding/json"
"fmt"
"strings"
"time"
@@ -11,6 +12,7 @@ import (
"entgo.io/ent/dialect/sql"
"github.com/google/uuid"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/group"
+ "github.com/sysadminsmedia/homebox/backend/internal/data/ent/schema"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/user"
)
@@ -41,6 +43,8 @@ type User struct {
OidcIssuer *string `json:"oidc_issuer,omitempty"`
// OidcSubject holds the value of the "oidc_subject" field.
OidcSubject *string `json:"oidc_subject,omitempty"`
+ // Settings holds the value of the "settings" field.
+ Settings schema.UserSettings `json:"settings,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the UserQuery when eager-loading is set.
Edges UserEdges `json:"edges"`
@@ -95,6 +99,8 @@ func (*User) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
+ case user.FieldSettings:
+ values[i] = new([]byte)
case user.FieldIsSuperuser, user.FieldSuperuser:
values[i] = new(sql.NullBool)
case user.FieldName, user.FieldEmail, user.FieldPassword, user.FieldRole, user.FieldOidcIssuer, user.FieldOidcSubject:
@@ -195,6 +201,14 @@ func (_m *User) assignValues(columns []string, values []any) error {
_m.OidcSubject = new(string)
*_m.OidcSubject = value.String
}
+ case user.FieldSettings:
+ if value, ok := values[i].(*[]byte); !ok {
+ return fmt.Errorf("unexpected type %T for field settings", values[i])
+ } else if value != nil && len(*value) > 0 {
+ if err := json.Unmarshal(*value, &_m.Settings); err != nil {
+ return fmt.Errorf("unmarshal field settings: %w", err)
+ }
+ }
case user.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullScanner); !ok {
return fmt.Errorf("unexpected type %T for field group_users", values[i])
@@ -288,6 +302,9 @@ func (_m *User) String() string {
builder.WriteString("oidc_subject=")
builder.WriteString(*v)
}
+ builder.WriteString(", ")
+ builder.WriteString("settings=")
+ builder.WriteString(fmt.Sprintf("%v", _m.Settings))
builder.WriteByte(')')
return builder.String()
}
diff --git a/backend/internal/data/ent/user/user.go b/backend/internal/data/ent/user/user.go
index 473d1d7f..d7877a0e 100644
--- a/backend/internal/data/ent/user/user.go
+++ b/backend/internal/data/ent/user/user.go
@@ -38,6 +38,8 @@ const (
FieldOidcIssuer = "oidc_issuer"
// FieldOidcSubject holds the string denoting the oidc_subject field in the database.
FieldOidcSubject = "oidc_subject"
+ // FieldSettings holds the string denoting the settings field in the database.
+ FieldSettings = "settings"
// EdgeGroup holds the string denoting the group edge name in mutations.
EdgeGroup = "group"
// EdgeAuthTokens holds the string denoting the auth_tokens edge name in mutations.
@@ -83,6 +85,7 @@ var Columns = []string{
FieldActivatedOn,
FieldOidcIssuer,
FieldOidcSubject,
+ FieldSettings,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "users"
diff --git a/backend/internal/data/ent/user/where.go b/backend/internal/data/ent/user/where.go
index 0d4ed5cd..131394c6 100644
--- a/backend/internal/data/ent/user/where.go
+++ b/backend/internal/data/ent/user/where.go
@@ -631,6 +631,16 @@ func OidcSubjectContainsFold(v string) predicate.User {
return predicate.User(sql.FieldContainsFold(FieldOidcSubject, v))
}
+// SettingsIsNil applies the IsNil predicate on the "settings" field.
+func SettingsIsNil() predicate.User {
+ return predicate.User(sql.FieldIsNull(FieldSettings))
+}
+
+// SettingsNotNil applies the NotNil predicate on the "settings" field.
+func SettingsNotNil() predicate.User {
+ return predicate.User(sql.FieldNotNull(FieldSettings))
+}
+
// HasGroup applies the HasEdge predicate on the "group" edge.
func HasGroup() predicate.User {
return predicate.User(func(s *sql.Selector) {
diff --git a/backend/internal/data/ent/user_create.go b/backend/internal/data/ent/user_create.go
index 3269f609..eae9cc3f 100644
--- a/backend/internal/data/ent/user_create.go
+++ b/backend/internal/data/ent/user_create.go
@@ -14,6 +14,7 @@ import (
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/authtokens"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/group"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/notifier"
+ "github.com/sysadminsmedia/homebox/backend/internal/data/ent/schema"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/user"
)
@@ -162,6 +163,20 @@ func (_c *UserCreate) SetNillableOidcSubject(v *string) *UserCreate {
return _c
}
+// SetSettings sets the "settings" field.
+func (_c *UserCreate) SetSettings(v schema.UserSettings) *UserCreate {
+ _c.mutation.SetSettings(v)
+ return _c
+}
+
+// SetNillableSettings sets the "settings" field if the given value is not nil.
+func (_c *UserCreate) SetNillableSettings(v *schema.UserSettings) *UserCreate {
+ if v != nil {
+ _c.SetSettings(*v)
+ }
+ return _c
+}
+
// SetID sets the "id" field.
func (_c *UserCreate) SetID(v uuid.UUID) *UserCreate {
_c.mutation.SetID(v)
@@ -403,6 +418,10 @@ func (_c *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
_spec.SetField(user.FieldOidcSubject, field.TypeString, value)
_node.OidcSubject = &value
}
+ if value, ok := _c.mutation.Settings(); ok {
+ _spec.SetField(user.FieldSettings, field.TypeJSON, value)
+ _node.Settings = value
+ }
if nodes := _c.mutation.GroupIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
diff --git a/backend/internal/data/ent/user_update.go b/backend/internal/data/ent/user_update.go
index c13f4057..a27d49c4 100644
--- a/backend/internal/data/ent/user_update.go
+++ b/backend/internal/data/ent/user_update.go
@@ -16,6 +16,7 @@ import (
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/group"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/notifier"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/predicate"
+ "github.com/sysadminsmedia/homebox/backend/internal/data/ent/schema"
"github.com/sysadminsmedia/homebox/backend/internal/data/ent/user"
)
@@ -188,6 +189,26 @@ func (_u *UserUpdate) ClearOidcSubject() *UserUpdate {
return _u
}
+// SetSettings sets the "settings" field.
+func (_u *UserUpdate) SetSettings(v schema.UserSettings) *UserUpdate {
+ _u.mutation.SetSettings(v)
+ return _u
+}
+
+// SetNillableSettings sets the "settings" field if the given value is not nil.
+func (_u *UserUpdate) SetNillableSettings(v *schema.UserSettings) *UserUpdate {
+ if v != nil {
+ _u.SetSettings(*v)
+ }
+ return _u
+}
+
+// ClearSettings clears the value of the "settings" field.
+func (_u *UserUpdate) ClearSettings() *UserUpdate {
+ _u.mutation.ClearSettings()
+ return _u
+}
+
// SetGroupID sets the "group" edge to the Group entity by ID.
func (_u *UserUpdate) SetGroupID(id uuid.UUID) *UserUpdate {
_u.mutation.SetGroupID(id)
@@ -400,6 +421,12 @@ func (_u *UserUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if _u.mutation.OidcSubjectCleared() {
_spec.ClearField(user.FieldOidcSubject, field.TypeString)
}
+ if value, ok := _u.mutation.Settings(); ok {
+ _spec.SetField(user.FieldSettings, field.TypeJSON, value)
+ }
+ if _u.mutation.SettingsCleared() {
+ _spec.ClearField(user.FieldSettings, field.TypeJSON)
+ }
if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
@@ -695,6 +722,26 @@ func (_u *UserUpdateOne) ClearOidcSubject() *UserUpdateOne {
return _u
}
+// SetSettings sets the "settings" field.
+func (_u *UserUpdateOne) SetSettings(v schema.UserSettings) *UserUpdateOne {
+ _u.mutation.SetSettings(v)
+ return _u
+}
+
+// SetNillableSettings sets the "settings" field if the given value is not nil.
+func (_u *UserUpdateOne) SetNillableSettings(v *schema.UserSettings) *UserUpdateOne {
+ if v != nil {
+ _u.SetSettings(*v)
+ }
+ return _u
+}
+
+// ClearSettings clears the value of the "settings" field.
+func (_u *UserUpdateOne) ClearSettings() *UserUpdateOne {
+ _u.mutation.ClearSettings()
+ return _u
+}
+
// SetGroupID sets the "group" edge to the Group entity by ID.
func (_u *UserUpdateOne) SetGroupID(id uuid.UUID) *UserUpdateOne {
_u.mutation.SetGroupID(id)
@@ -937,6 +984,12 @@ func (_u *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) {
if _u.mutation.OidcSubjectCleared() {
_spec.ClearField(user.FieldOidcSubject, field.TypeString)
}
+ if value, ok := _u.mutation.Settings(); ok {
+ _spec.SetField(user.FieldSettings, field.TypeJSON, value)
+ }
+ if _u.mutation.SettingsCleared() {
+ _spec.ClearField(user.FieldSettings, field.TypeJSON)
+ }
if _u.mutation.GroupCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
diff --git a/docs/en/api/openapi-2.0.json b/docs/en/api/openapi-2.0.json
index cb5a49f4..5705a7a5 100644
--- a/docs/en/api/openapi-2.0.json
+++ b/docs/en/api/openapi-2.0.json
@@ -2482,6 +2482,87 @@
}
}
}
+ },
+ "/v1/users/self/settings": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Get user settings",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Update user settings",
+ "parameters": [
+ {
+ "description": "Settings Data",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
}
},
"definitions": {
@@ -3567,6 +3648,14 @@
}
]
},
+ "settings": {
+ "description": "Settings holds the value of the \"settings\" field.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ ]
+ },
"superuser": {
"description": "Superuser holds the value of the \"superuser\" field.",
"type": "boolean"
@@ -4981,6 +5070,64 @@
}
}
},
+ "schema.DuplicateSettings": {
+ "type": "object",
+ "properties": {
+ "copyAttachments": {
+ "type": "boolean"
+ },
+ "copyCustomFields": {
+ "type": "boolean"
+ },
+ "copyMaintenance": {
+ "type": "boolean"
+ },
+ "copyPrefixOverride": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.UserSettings": {
+ "type": "object",
+ "properties": {
+ "displayLegacyHeader": {
+ "type": "boolean"
+ },
+ "duplicateSettings": {
+ "$ref": "#/definitions/schema.DuplicateSettings"
+ },
+ "editorAdvancedView": {
+ "type": "boolean"
+ },
+ "itemDisplayView": {
+ "type": "string"
+ },
+ "itemsPerPage": {
+ "type": "integer"
+ },
+ "itemsPerTablePage": {
+ "type": "integer"
+ },
+ "language": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "overrideFormatLocale": {
+ "type": "string"
+ },
+ "showDetails": {
+ "type": "boolean"
+ },
+ "showEmpty": {
+ "type": "boolean"
+ },
+ "theme": {
+ "type": "string"
+ }
+ }
+ },
"services.Latest": {
"type": "object",
"properties": {
diff --git a/docs/en/api/openapi-2.0.yaml b/docs/en/api/openapi-2.0.yaml
index 2a190f54..b9b956fa 100644
--- a/docs/en/api/openapi-2.0.yaml
+++ b/docs/en/api/openapi-2.0.yaml
@@ -3457,8 +3457,7 @@ paths:
- $ref: '#/definitions/v1.Wrapped'
- properties:
item:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/schema.UserSettings'
type: object
security:
- Bearer: []
@@ -3472,8 +3471,7 @@ paths:
name: payload
required: true
schema:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/schema.UserSettings'
produces:
- application/json
responses:
@@ -3484,12 +3482,11 @@ paths:
- $ref: '#/definitions/v1.Wrapped'
- properties:
item:
- additionalProperties: true
- type: object
+ $ref: '#/definitions/schema.UserSettings'
type: object
security:
- Bearer: []
- summary: Get user settings
+ summary: Update user settings
tags:
- User
schemes:
diff --git a/docs/en/api/openapi-3.0.json b/docs/en/api/openapi-3.0.json
index f4ce81bf..07f57dd1 100644
--- a/docs/en/api/openapi-3.0.json
+++ b/docs/en/api/openapi-3.0.json
@@ -2665,6 +2665,89 @@
}
}
}
+ },
+ "/v1/users/self/settings": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Get user settings",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/components/schemas/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Update user settings",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/schema.UserSettings"
+ }
+ }
+ },
+ "description": "Settings Data",
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/components/schemas/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
}
},
"servers": [
@@ -3767,6 +3850,14 @@
}
]
},
+ "settings": {
+ "description": "Settings holds the value of the \"settings\" field.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/schema.UserSettings"
+ }
+ ]
+ },
"superuser": {
"description": "Superuser holds the value of the \"superuser\" field.",
"type": "boolean"
@@ -5181,6 +5272,64 @@
}
}
},
+ "schema.DuplicateSettings": {
+ "type": "object",
+ "properties": {
+ "copyAttachments": {
+ "type": "boolean"
+ },
+ "copyCustomFields": {
+ "type": "boolean"
+ },
+ "copyMaintenance": {
+ "type": "boolean"
+ },
+ "copyPrefixOverride": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.UserSettings": {
+ "type": "object",
+ "properties": {
+ "displayLegacyHeader": {
+ "type": "boolean"
+ },
+ "duplicateSettings": {
+ "$ref": "#/components/schemas/schema.DuplicateSettings"
+ },
+ "editorAdvancedView": {
+ "type": "boolean"
+ },
+ "itemDisplayView": {
+ "type": "string"
+ },
+ "itemsPerPage": {
+ "type": "integer"
+ },
+ "itemsPerTablePage": {
+ "type": "integer"
+ },
+ "language": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "overrideFormatLocale": {
+ "type": "string"
+ },
+ "showDetails": {
+ "type": "boolean"
+ },
+ "showEmpty": {
+ "type": "boolean"
+ },
+ "theme": {
+ "type": "string"
+ }
+ }
+ },
"services.Latest": {
"type": "object",
"properties": {
diff --git a/docs/en/api/openapi-3.0.yaml b/docs/en/api/openapi-3.0.yaml
index eda39cf7..40658d6c 100644
--- a/docs/en/api/openapi-3.0.yaml
+++ b/docs/en/api/openapi-3.0.yaml
@@ -1579,6 +1579,50 @@ paths:
responses:
"204":
description: No Content
+ /v1/users/self/settings:
+ get:
+ security:
+ - Bearer: []
+ tags:
+ - User
+ summary: Get user settings
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: "#/components/schemas/v1.Wrapped"
+ - type: object
+ properties:
+ item:
+ $ref: "#/components/schemas/schema.UserSettings"
+ put:
+ security:
+ - Bearer: []
+ tags:
+ - User
+ summary: Update user settings
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/schema.UserSettings"
+ description: Settings Data
+ required: true
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: "#/components/schemas/v1.Wrapped"
+ - type: object
+ properties:
+ item:
+ $ref: "#/components/schemas/schema.UserSettings"
servers:
- url: https://demo.homebox.software/api
- url: http://demo.homebox.software/api
@@ -2351,6 +2395,10 @@ components:
description: Role holds the value of the "role" field.
allOf:
- $ref: "#/components/schemas/user.Role"
+ settings:
+ description: Settings holds the value of the "settings" field.
+ allOf:
+ - $ref: "#/components/schemas/schema.UserSettings"
superuser:
description: Superuser holds the value of the "superuser" field.
type: boolean
@@ -3313,6 +3361,44 @@ components:
type: string
value:
type: number
+ schema.DuplicateSettings:
+ type: object
+ properties:
+ copyAttachments:
+ type: boolean
+ copyCustomFields:
+ type: boolean
+ copyMaintenance:
+ type: boolean
+ copyPrefixOverride:
+ type: string
+ schema.UserSettings:
+ type: object
+ properties:
+ displayLegacyHeader:
+ type: boolean
+ duplicateSettings:
+ $ref: "#/components/schemas/schema.DuplicateSettings"
+ editorAdvancedView:
+ type: boolean
+ itemDisplayView:
+ type: string
+ itemsPerPage:
+ type: integer
+ itemsPerTablePage:
+ type: integer
+ language:
+ type: string
+ locale:
+ type: string
+ overrideFormatLocale:
+ type: string
+ showDetails:
+ type: boolean
+ showEmpty:
+ type: boolean
+ theme:
+ type: string
services.Latest:
type: object
properties:
diff --git a/docs/en/api/swagger-2.0.json b/docs/en/api/swagger-2.0.json
index cb5a49f4..5705a7a5 100644
--- a/docs/en/api/swagger-2.0.json
+++ b/docs/en/api/swagger-2.0.json
@@ -2482,6 +2482,87 @@
}
}
}
+ },
+ "/v1/users/self/settings": {
+ "get": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Get user settings",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "Bearer": []
+ }
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "User"
+ ],
+ "summary": "Update user settings",
+ "parameters": [
+ {
+ "description": "Settings Data",
+ "name": "payload",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/v1.Wrapped"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "item": {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
}
},
"definitions": {
@@ -3567,6 +3648,14 @@
}
]
},
+ "settings": {
+ "description": "Settings holds the value of the \"settings\" field.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/schema.UserSettings"
+ }
+ ]
+ },
"superuser": {
"description": "Superuser holds the value of the \"superuser\" field.",
"type": "boolean"
@@ -4981,6 +5070,64 @@
}
}
},
+ "schema.DuplicateSettings": {
+ "type": "object",
+ "properties": {
+ "copyAttachments": {
+ "type": "boolean"
+ },
+ "copyCustomFields": {
+ "type": "boolean"
+ },
+ "copyMaintenance": {
+ "type": "boolean"
+ },
+ "copyPrefixOverride": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.UserSettings": {
+ "type": "object",
+ "properties": {
+ "displayLegacyHeader": {
+ "type": "boolean"
+ },
+ "duplicateSettings": {
+ "$ref": "#/definitions/schema.DuplicateSettings"
+ },
+ "editorAdvancedView": {
+ "type": "boolean"
+ },
+ "itemDisplayView": {
+ "type": "string"
+ },
+ "itemsPerPage": {
+ "type": "integer"
+ },
+ "itemsPerTablePage": {
+ "type": "integer"
+ },
+ "language": {
+ "type": "string"
+ },
+ "locale": {
+ "type": "string"
+ },
+ "overrideFormatLocale": {
+ "type": "string"
+ },
+ "showDetails": {
+ "type": "boolean"
+ },
+ "showEmpty": {
+ "type": "boolean"
+ },
+ "theme": {
+ "type": "string"
+ }
+ }
+ },
"services.Latest": {
"type": "object",
"properties": {
diff --git a/docs/en/api/swagger-2.0.yaml b/docs/en/api/swagger-2.0.yaml
index 0d234331..b9b956fa 100644
--- a/docs/en/api/swagger-2.0.yaml
+++ b/docs/en/api/swagger-2.0.yaml
@@ -747,6 +747,10 @@ definitions:
allOf:
- $ref: '#/definitions/user.Role'
description: Role holds the value of the "role" field.
+ settings:
+ allOf:
+ - $ref: '#/definitions/schema.UserSettings'
+ description: Settings holds the value of the "settings" field.
superuser:
description: Superuser holds the value of the "superuser" field.
type: boolean
@@ -1710,6 +1714,44 @@ definitions:
value:
type: number
type: object
+ schema.DuplicateSettings:
+ properties:
+ copyAttachments:
+ type: boolean
+ copyCustomFields:
+ type: boolean
+ copyMaintenance:
+ type: boolean
+ copyPrefixOverride:
+ type: string
+ type: object
+ schema.UserSettings:
+ properties:
+ displayLegacyHeader:
+ type: boolean
+ duplicateSettings:
+ $ref: '#/definitions/schema.DuplicateSettings'
+ editorAdvancedView:
+ type: boolean
+ itemDisplayView:
+ type: string
+ itemsPerPage:
+ type: integer
+ itemsPerTablePage:
+ type: integer
+ language:
+ type: string
+ locale:
+ type: string
+ overrideFormatLocale:
+ type: string
+ showDetails:
+ type: boolean
+ showEmpty:
+ type: boolean
+ theme:
+ type: string
+ type: object
services.Latest:
properties:
date:
@@ -3403,6 +3445,50 @@ paths:
summary: Update Account
tags:
- User
+ /v1/users/self/settings:
+ get:
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/v1.Wrapped'
+ - properties:
+ item:
+ $ref: '#/definitions/schema.UserSettings'
+ type: object
+ security:
+ - Bearer: []
+ summary: Get user settings
+ tags:
+ - User
+ put:
+ parameters:
+ - description: Settings Data
+ in: body
+ name: payload
+ required: true
+ schema:
+ $ref: '#/definitions/schema.UserSettings'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/v1.Wrapped'
+ - properties:
+ item:
+ $ref: '#/definitions/schema.UserSettings'
+ type: object
+ security:
+ - Bearer: []
+ summary: Update user settings
+ tags:
+ - User
schemes:
- https
- http