mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
refactor(nestjs): Implement users module
This commit is contained in:
@@ -12,22 +12,21 @@ export class EditCurrencyService {
|
||||
|
||||
/**
|
||||
* Edit details of the given currency.
|
||||
* @param {number} tenantId
|
||||
* @param {number} currencyId
|
||||
* @param {ICurrencyDTO} currencyDTO
|
||||
* @param {number} currencyCode - Currency code.
|
||||
* @param {ICurrencyDTO} currencyDTO - Edit currency dto.
|
||||
*/
|
||||
public async editCurrency(
|
||||
currencyId: number,
|
||||
currencyCode: string,
|
||||
currencyDTO: EditCurrencyDto,
|
||||
): Promise<Currency> {
|
||||
const foundCurrency = await this.currencyModel()
|
||||
.query()
|
||||
.findOne('id', currencyId)
|
||||
.findOne('currencyCode', currencyCode)
|
||||
.throwIfNotFound();
|
||||
|
||||
const currency = await this.currencyModel()
|
||||
.query()
|
||||
.patchAndFetchById(currencyId, {
|
||||
.patchAndFetchById(foundCurrency.id, {
|
||||
...currencyDTO,
|
||||
});
|
||||
return currency;
|
||||
|
||||
Reference in New Issue
Block a user