apply scholarship old functions
apply scholarship old functionsYash
javascript
8 months ago
1.6 kB
7
Indexable
async applyScholarship(data: ScholarshipAppliedDto): Promise<any> {
try {
const { id, ...scholarship } = data
scholarship.amount = await this.getScholrshipAmount({
id,
scholarshipId: scholarship.scholarshipId
})
const pushData: any = {}
pushData['$push'] = { scholarshipsApplied: scholarship }
const fee = await this.feestructureModel.findByIdAndUpdate(
id,
pushData,
{ new: true },
);
if (!fee) {
throw new NotFoundException('No fee found!');
}
else {
return await this.installmentUpdateAfterScholarship(fee)
}
} catch (e) {
throw new BadRequestException(e)
}
}
async applyCustomScholarship(data: CustomScholarshipApplied): Promise<any> {
try {
const { id, ...scholarship } = data
const pushData: any = {}
pushData['$push'] = { customScholarshipsApplied: scholarship }
const fee = await this.feestructureModel.findByIdAndUpdate(
id,
pushData,
{ new: true },
);
if (!fee) {
throw new NotFoundException('No fee found!');
}
else {
return await this.installmentUpdateAfterScholarship(fee)
}
} catch (e) {
throw new BadRequestException(e)
}
}Editor is loading...
Leave a Comment