From 91a8f950ecc3dfdc27019db9e2c86c8aee87df18 Mon Sep 17 00:00:00 2001 From: FoskyM Date: Sun, 1 Oct 2023 19:23:03 +0800 Subject: [PATCH] feat: add model of scope --- js/src/common/extend.js | 4 +++- js/src/common/models/Scope.js | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 js/src/common/models/Scope.js diff --git a/js/src/common/extend.js b/js/src/common/extend.js index 54f41cd..8e49d35 100644 --- a/js/src/common/extend.js +++ b/js/src/common/extend.js @@ -1,7 +1,9 @@ import Extend from 'flarum/common/extenders'; import Client from "./models/Client"; +import Scope from "./models/Scope"; export default [ new Extend.Store() - .add('oauth-clients', Client), + .add('oauth-clients', Client) + .add('oauth-scopes', Scope), ]; diff --git a/js/src/common/models/Scope.js b/js/src/common/models/Scope.js new file mode 100644 index 0000000..2bf3eea --- /dev/null +++ b/js/src/common/models/Scope.js @@ -0,0 +1,9 @@ +import Model from 'flarum/common/Model'; + +export default class Client extends Model { + scope = Model.attribute('scope'); + is_default = Model.attribute('is_default', value => value === 1); + scope_name = Model.attribute('scope_name'); + scope_icon = Model.attribute('scope_icon'); + scope_desc = Model.attribute('scope_desc'); +}