mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
add server to monorepo.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import events from '@/subscribers/events';
|
||||
import { IOrganizationBuildEventPayload } from '@/interfaces';
|
||||
import { InitialCurrenciesSeed } from '../InitialCurrenciesSeed';
|
||||
|
||||
@Service()
|
||||
export class SeedInitialCurrenciesOnSetupSubsriber {
|
||||
@Inject()
|
||||
seedInitialCurrencies: InitialCurrenciesSeed;
|
||||
|
||||
/**
|
||||
* Attaches events.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(events.organization.build, this.seedInitialCurrenciesOnBuild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed initial currencies once organization build.
|
||||
* @param {IOrganizationBuildEventPayload}
|
||||
*/
|
||||
private seedInitialCurrenciesOnBuild = async ({
|
||||
systemUser,
|
||||
buildDTO,
|
||||
tenantId,
|
||||
}: IOrganizationBuildEventPayload) => {
|
||||
await this.seedInitialCurrencies.seedInitialCurrencies(
|
||||
tenantId,
|
||||
buildDTO.baseCurrency
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user