Skip to content

Commit

Permalink
fix borrower applications
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo Vieira committed Nov 13, 2023
1 parent d644d8b commit ba89be8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/core/src/services/microcredit/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export default class MicroCreditList {
};
}
const applications = await models.microCreditApplications.findAndCountAll({
attributes: ['id', 'amount', 'period', 'status', 'decisionOn', 'signedOn', 'claimedOn', 'createdAt'],
attributes: ['id', 'status', 'decisionOn', 'signedOn', 'claimedOn', ['createdAt', 'appliedOn']],
where,
include: [
{
Expand All @@ -361,11 +361,11 @@ export default class MicroCreditList {
return {
count: applications.count,
rows: applications.rows.map(a => {
const v = { application: { ...a.toJSON(), appliedOn: a.createdAt } };
delete v.application['user'];
const application: MicroCreditApplication & { appliedOn: Date } = a.toJSON();
delete application['user'];

return {
...v,
application,
...a.user!.toJSON()
};
})
Expand Down Expand Up @@ -489,7 +489,7 @@ export default class MicroCreditList {
: Promise.resolve([]),
include.includes('forms')
? models.microCreditApplications.findAll({
attributes: ['id', 'status', 'decisionOn', 'createdAt'],
attributes: ['id', 'status', 'decisionOn', 'signedOn', 'claimedOn', ['createdAt', 'appliedOn']],
where: {
userId: user.id
},
Expand Down

0 comments on commit ba89be8

Please sign in to comment.