mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
WIP Custom fields feature.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Model } from 'objection';
|
||||
|
||||
export default class ModelBase extends Model {
|
||||
|
||||
static get collection() {
|
||||
return Array;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,19 @@ export default class Option extends mixin(BaseModel, [mixin]) {
|
||||
return 'options';
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the model query.
|
||||
* @param {...any} args -
|
||||
*/
|
||||
static query(...args) {
|
||||
return super.query(...args).runAfter((result) => {
|
||||
if (result instanceof MetableCollection) {
|
||||
result.setModel(Option);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
static get collection() {
|
||||
return MetableCollection;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Model } from 'objection';
|
||||
import path from 'path';
|
||||
import BaseModel from '@/models/Model';
|
||||
import MetableCollection from '@/lib/Metable/MetableCollection';
|
||||
import ResourceFieldMetadataCollection from '@/collection/ResourceFieldMetadataCollection';
|
||||
|
||||
export default class ResourceFieldMetadata extends BaseModel {
|
||||
/**
|
||||
@@ -15,7 +15,7 @@ export default class ResourceFieldMetadata extends BaseModel {
|
||||
* Override the resource field metadata collection.
|
||||
*/
|
||||
static get collection() {
|
||||
return MetableCollection;
|
||||
return ResourceFieldMetadataCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user