mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: redesign accounts types.
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
import TenantRepository from 'repositories/TenantRepository';
|
||||
import { IAccountType } from 'interfaces';
|
||||
import { AccountType } from 'models';
|
||||
|
||||
export default class AccountTypeRepository extends TenantRepository {
|
||||
/**
|
||||
* Gets the repository's model.
|
||||
*/
|
||||
get model() {
|
||||
return AccountType.bindKnex(this.knex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve accounts types of the given keys.
|
||||
* @param {string[]} keys
|
||||
* @return {Promise<IAccountType[]>}
|
||||
*/
|
||||
getByKeys(keys: string[]): Promise<IAccountType[]> {
|
||||
return super.findWhereIn('key', keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve account tpy eof the given key.
|
||||
* @param {string} key
|
||||
* @return {Promise<IAccountType>}
|
||||
*/
|
||||
getByKey(key: string): Promise<IAccountType> {
|
||||
return super.findOne({ key });
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve accounts types of the given root type.
|
||||
* @param {string} rootType
|
||||
* @return {Promise<IAccountType[]>}
|
||||
*/
|
||||
getByRootType(rootType: string): Promise<IAccountType[]> {
|
||||
return super.find({ root_type: rootType });
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve accounts types of the given child type.
|
||||
* @param {string} childType
|
||||
* @return {Promise<IAccountType[]>}
|
||||
*/
|
||||
getByChildType(childType: string): Promise<IAccountType[]> {
|
||||
return super.find({ child_type: childType });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user