mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
27 lines
685 B
TypeScript
27 lines
685 B
TypeScript
import { Inject } from '@nestjs/common';
|
|
import { Injectable } from '@nestjs/common';
|
|
import { Branch } from '../models/Branch.model';
|
|
import { TenantModelProxy } from '@/modules/System/models/TenantBaseModel';
|
|
|
|
@Injectable()
|
|
export class GetBranchService {
|
|
constructor(
|
|
@Inject(Branch.name)
|
|
private readonly branch: TenantModelProxy<typeof Branch>,
|
|
) {}
|
|
|
|
/**
|
|
* Retrieves the given branch details.
|
|
* @param {number} branchId
|
|
* @returns {Promise<IBranch>}
|
|
*/
|
|
public getBranch = async (branchId: number): Promise<Branch> => {
|
|
const branch = await this.branch()
|
|
.query()
|
|
.findById(branchId)
|
|
.throwIfNotFound();
|
|
|
|
return branch;
|
|
};
|
|
}
|