Skip to content

Commit

Permalink
added types for settings schema
Browse files Browse the repository at this point in the history
  • Loading branch information
kpal81xd committed Aug 13, 2024
1 parent d263d06 commit 51eda0a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/schema/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ class SettingsSchema {
this._schema = this._schemaApi._schema.settings;
}

/**
* @private
* @param {*} obj - The object to get the default data from
* @param {string} scope - The field scope
* @returns {*} - The default data
*/
_getDefaultData(obj, scope) {
const result = {};
for (const key in obj) {
Expand All @@ -38,14 +44,29 @@ class SettingsSchema {
return result;
}

/**
* Get the default settings for the project
*
* @returns {*} The default settings for the project
*/
getDefaultProjectSettings() {
return this._getDefaultData(this._schema, 'project');
}

/**
* Get the default settings for the user
*
* @returns {*} The default settings for the user
*/
getDefaultUserSettings() {
return this._getDefaultData(this._schema, 'user');
}

/**
* Get the default settings for the project user
*
* @returns {*} The default settings for the user in the project
*/
getDefaultProjectUserSettings() {
return this._getDefaultData(this._schema, 'projectUser');
}
Expand Down

0 comments on commit 51eda0a

Please sign in to comment.