mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
add server to monorepo.
This commit is contained in:
30
packages/server/src/models/Option.ts
Normal file
30
packages/server/src/models/Option.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import TenantModel from 'models/TenantModel';
|
||||
import definedOptions from '@/data/options';
|
||||
|
||||
|
||||
export default class Option extends TenantModel {
|
||||
/**
|
||||
* Table name.
|
||||
*/
|
||||
static get tableName() {
|
||||
return 'options';
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the given options is defined or either not.
|
||||
* @param {Array} options
|
||||
* @return {Boolean}
|
||||
*/
|
||||
static validateDefined(options) {
|
||||
const notDefined = [];
|
||||
|
||||
options.forEach((option) => {
|
||||
if (!definedOptions[option.group]) {
|
||||
notDefined.push(option);
|
||||
} else if (!definedOptions[option.group].some((o) => o.key === option.key)) {
|
||||
notDefined.push(option);
|
||||
}
|
||||
});
|
||||
return notDefined;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user