Fix settings data
This commit is contained in:
parent
93721ef2d8
commit
2326a95d2a
5 changed files with 18 additions and 11 deletions
|
@ -2,11 +2,7 @@
|
|||
"type": "object",
|
||||
"description": "SettingObject",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"value"
|
||||
],
|
||||
"required": ["id", "name", "value"],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
|
@ -25,6 +21,11 @@
|
|||
"minLength": 2,
|
||||
"maxLength": 100
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"minLength": 0,
|
||||
"maxLength": 100
|
||||
},
|
||||
"value": {
|
||||
"oneOf": [
|
||||
{
|
||||
|
@ -38,8 +39,11 @@
|
|||
},
|
||||
{
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS `setting`
|
|||
created_on INTEGER NOT NULL DEFAULT 0,
|
||||
modified_on INTEGER NOT NULL DEFAULT 0,
|
||||
name TEXT NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
description TEXT NOT NULL DEFAULT "",
|
||||
value TEXT NOT NULL,
|
||||
UNIQUE (name)
|
||||
);
|
||||
|
|
|
@ -11,8 +11,8 @@ INSERT INTO `setting` (
|
|||
strftime('%s', 'now'),
|
||||
strftime('%s', 'now'),
|
||||
"error-reporting",
|
||||
"If enabled, any application errors are reported to Sentry. Sensitive information is not sent. All information sent is also private.",
|
||||
"true"
|
||||
"If enabled, any application errors are reported to Sentry. Sensitive information is not sent.",
|
||||
"true" -- remember this is json
|
||||
);
|
||||
|
||||
-- Default site
|
||||
|
@ -27,7 +27,7 @@ INSERT INTO `setting` (
|
|||
strftime('%s', 'now'),
|
||||
"default-site",
|
||||
"What to show users who hit your Nginx server by default",
|
||||
"welcome"
|
||||
'"welcome"' -- remember this is json
|
||||
);
|
||||
|
||||
-- Default Certificate Authorities
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"npm/internal/database"
|
||||
"npm/internal/entity"
|
||||
"npm/internal/errors"
|
||||
"npm/internal/logger"
|
||||
"npm/internal/model"
|
||||
)
|
||||
|
||||
|
@ -100,6 +101,7 @@ func List(pageInfo model.PageInfo, filters []model.Filter) (ListResponse, error)
|
|||
var totalRows int
|
||||
queryErr := countRow.Scan(&totalRows)
|
||||
if queryErr != nil && queryErr != sql.ErrNoRows {
|
||||
logger.Debug("%+v", queryErr)
|
||||
return result, queryErr
|
||||
}
|
||||
|
||||
|
@ -108,6 +110,7 @@ func List(pageInfo model.PageInfo, filters []model.Filter) (ListResponse, error)
|
|||
query, params = entity.ListQueryBuilder(exampleModel, tableName, &pageInfo, defaultSort, filters, getFilterMapFunctions(), false)
|
||||
err := db.Select(&items, query, params...)
|
||||
if err != nil {
|
||||
logger.Debug("%+v", err)
|
||||
return result, err
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"npm/internal/model"
|
||||
)
|
||||
|
||||
// ListResponse is the JSON response for users list
|
||||
// ListResponse is the JSON response for settings list
|
||||
type ListResponse struct {
|
||||
Total int `json:"total"`
|
||||
Offset int `json:"offset"`
|
||||
|
|
Loading…
Reference in a new issue