forked from wangziqi/gongxue-base
refactor(deposits): remove inline installment creation
This commit is contained in:
@@ -5,7 +5,7 @@ import { Deposit } from '../entities/deposit.entity';
|
||||
import { Student } from '../entities/student.entity';
|
||||
import { DepositInstallment } from '../entities/deposit-installment.entity';
|
||||
|
||||
import { CreateDepositDto, RefundDepositDto, CreateDepositWithInstallmentsDto } from './dto/deposit.dto';
|
||||
import { CreateDepositDto, RefundDepositDto } from './dto/deposit.dto';
|
||||
|
||||
@Injectable()
|
||||
export class DepositsService {
|
||||
@@ -55,17 +55,6 @@ export class DepositsService {
|
||||
recordedBy: userId,
|
||||
});
|
||||
|
||||
if (dto instanceof CreateDepositWithInstallmentsDto && dto.installments?.length) {
|
||||
deposit.installments = dto.installments.map((i) => {
|
||||
const inst = this.installmentRepo.create({
|
||||
amount: i.amount,
|
||||
dueDate: i.dueDate,
|
||||
status: 'pending',
|
||||
});
|
||||
return inst;
|
||||
});
|
||||
}
|
||||
|
||||
return this.repo.save(deposit);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user