mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
add server to monorepo.
This commit is contained in:
22
packages/server/src/services/Branches/GetBranches.ts
Normal file
22
packages/server/src/services/Branches/GetBranches.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||
import { Service, Inject } from 'typedi';
|
||||
|
||||
@Service()
|
||||
export class GetBranches {
|
||||
@Inject()
|
||||
tenancy: HasTenancyService;
|
||||
|
||||
/**
|
||||
* Retrieves branches list.
|
||||
* @param {number} tenantId
|
||||
* @param {number} branchId
|
||||
* @returns
|
||||
*/
|
||||
public getBranches = async (tenantId: number) => {
|
||||
const { Branch } = this.tenancy.models(tenantId);
|
||||
|
||||
const branches = await Branch.query().orderBy('name', 'DESC');
|
||||
|
||||
return branches;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user