mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-06-06 09:58:59 +00:00
feat(custom-fields): add custom fields support
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import { TenantModelProxy } from '@/modules/System/models/TenantBaseModel';
|
||||
import { CustomField } from '../models/CustomField';
|
||||
|
||||
@Injectable()
|
||||
export class GetCustomFieldsService {
|
||||
constructor(
|
||||
@Inject(CustomField.name)
|
||||
private readonly customFieldModel: TenantModelProxy<typeof CustomField>,
|
||||
) {}
|
||||
|
||||
async getCustomFields(resourceName?: string) {
|
||||
let query = this.customFieldModel()
|
||||
.query()
|
||||
.orderBy('order', 'ASC');
|
||||
|
||||
if (resourceName) {
|
||||
query = query.where('resource_name', resourceName);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user