-
Notifications
You must be signed in to change notification settings - Fork 558
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow per-user settings and store them in database (#639)
* create needed field in sqlite database * update account model * update Account struct for save Account options * update sqlite database return account settings * save configure in sqlite as text and return that * read configure from user account and defualt configure for shiori * add api/ui for update settings in database user can save settings in database (in sqlite database) * check configures be in json format before save in database * support MariaDB * fix wrong comment * support PostgreSQL * revert unneeded change in new logic * change configures to config * change SaveAccount to SaveAccountSettings * add migrate database scripts * change default in migration scrtipts * update model * read config field as json from database * fix parse value config value & update config update * update default value for new user * update settings variable name to reflect database value in UI * fix typo * not panic if user not exist and update worng comment * visitor user can update there settings now * remove unneeded loading dialog * fix typo * update function for pg and mysql * remove IsJson * move scan method to model * simplify jsonify * simplify assignees value to account.Config * missing part of function * fix some typo and unneeded field in struct * add down migrate script for all database * change createEbook to CreateEbook * use json instead of text in mysql and postgres * implement * remove unneeded part * remove unneeded jsonify in code * return SelectContext and GetContext * remove defualt config in reques for new user it will be set in backend * New API * remove legacy API * remove validateSessionWithoutOwnerStatus * remove Jsonify function don't need that anymore * add unit test for database * update migrate script name * change put to patch * return PUT * fix Patch problem and now use PATCH instead of PUT * remove unneeded retuen * more cleaner code for request new settings * fix bug to handle string in Scan method thanks to fmartingr * fix Authorization & use GetAccount & remove username from request * shiori-settings remove and it read from shiori-account * add swagger documentation * API unit test * fix typo * remove unneeded coment Co-authored-by: Felipe Martin <[email protected]> * better Documentation Co-authored-by: Felipe Martin <[email protected]> * shiori-toke remove on logout * fix typo * add unit test check update config in database * update swag documentation * fix swag formaing error --------- Co-authored-by: Felipe Martin <[email protected]>
- Loading branch information
1 parent
46c1a6a
commit c05d617
Showing
29 changed files
with
906 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
CREATE TABLE IF NOT EXISTS account( | ||
id INT(11) NOT NULL AUTO_INCREMENT, | ||
username VARCHAR(250) NOT NULL, | ||
password BINARY(80) NOT NULL, | ||
owner TINYINT(1) NOT NULL DEFAULT '0', | ||
id INT(11) NOT NULL AUTO_INCREMENT, | ||
username VARCHAR(250) NOT NULL, | ||
password BINARY(80) NOT NULL, | ||
owner TINYINT(1) NOT NULL DEFAULT '0', | ||
PRIMARY KEY (id), | ||
UNIQUE KEY account_username_UNIQUE (username)) | ||
CHARACTER SET utf8mb4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE account DROP COLUMN config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE account | ||
ADD COLUMN config JSON NOT NULL DEFAULT '{}'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE account DROP COLUMN config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE account | ||
ADD COLUMN config JSONB NOT NULL DEFAULT '{}'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE account DROP COLUMN config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ALTER TABLE account | ||
ADD config JSON NOT NULL DEFAULT '{}'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.