journaling
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
||||
import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common';
|
||||
import { CreateUserDto } from './dto/create-user.dto';
|
||||
import { UpdateUserDto } from './dto/update-user.dto';
|
||||
import { EntityNotFoundError, Repository } from 'typeorm';
|
||||
@@ -7,14 +7,16 @@ import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { randomStringGenerator } from '@nestjs/common/utils/random-string-generator.util';
|
||||
import { hashPassword } from '../helper/hash_password';
|
||||
import { CoaService } from 'src/transaction/coa.service';
|
||||
import { coaType } from 'src/helper/enum-list';
|
||||
import { balanceType, coaType } from 'src/helper/enum-list';
|
||||
import { RoleService } from 'src/configurable/roles.service';
|
||||
import { InputCoaDto } from 'src/transaction/dto/input-coa.dto';
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
constructor(
|
||||
@InjectRepository(User)
|
||||
private usersRepository: Repository<User>,
|
||||
@Inject(forwardRef(() => CoaService))
|
||||
private coaService: CoaService,
|
||||
private roleService: RoleService
|
||||
) {}
|
||||
@@ -32,6 +34,25 @@ export class UsersService {
|
||||
roles:roles
|
||||
});
|
||||
|
||||
let dataCoaWallet = new InputCoaDto();
|
||||
dataCoaWallet.userId = result.identifiers[0].id;
|
||||
dataCoaWallet.balanceType = balanceType.CREDIT;
|
||||
dataCoaWallet.type = coaType.WALLET;
|
||||
|
||||
let dataCoaAR = new InputCoaDto();
|
||||
dataCoaAR.userId = result.identifiers[0].id;
|
||||
dataCoaAR.balanceType = balanceType.CREDIT;
|
||||
dataCoaAR.type = coaType.ACCOUNT_RECEIVABLE;
|
||||
|
||||
let dataCoaPayable = new InputCoaDto();
|
||||
dataCoaPayable.userId = result.identifiers[0].id;
|
||||
dataCoaPayable.balanceType = balanceType.CREDIT;
|
||||
dataCoaPayable.type = coaType.ACCOUNT_PAYABLE;
|
||||
|
||||
await this.coaService.create(dataCoaWallet);
|
||||
await this.coaService.create(dataCoaAR);
|
||||
await this.coaService.create(dataCoaPayable);
|
||||
|
||||
return this.usersRepository.findOneOrFail(result.identifiers[0].id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user