mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
refactor(nestjs): Implement users module
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { events } from '@/common/events/events';
|
||||
import { MutateBaseCurrencyAccounts } from '../MutateBaseCurrencyAccounts';
|
||||
|
||||
@Injectable()
|
||||
export class MutateBaseCurrencyAccountsSubscriber {
|
||||
constructor(
|
||||
public readonly mutateBaseCurrencyAccounts: MutateBaseCurrencyAccounts,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Updates the all accounts currency once the base currency
|
||||
* of the organization is mutated.
|
||||
*/
|
||||
@OnEvent(events.organization.baseCurrencyUpdated)
|
||||
async updateAccountsCurrencyOnBaseCurrencyMutated({
|
||||
organizationDTO,
|
||||
}) {
|
||||
await this.mutateBaseCurrencyAccounts.mutateAllAccountsCurrency(
|
||||
organizationDTO.baseCurrency
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user