Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
feat: add loan approval dates
Browse files Browse the repository at this point in the history
  • Loading branch information
kndonetm committed Nov 21, 2023
1 parent b386642 commit f737f37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/models/loan.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ const LoanSchema = new Schema({
immutable: true
},
approvalDate: {
type: Date,
immutable: true
type: Date
},
coborrower: {
name: NameSchema,
Expand Down
6 changes: 5 additions & 1 deletion src/routes/loans.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ router.put('/new/:username', async (req, res, next) => {
term: req.body.term,
paymentFrequency: req.body.paymentFrequency,
submissionDate: Date.now(),
approvalDate: null,
coborrower: req.body.coborrower,
originalLoanAmount: req.body.amount,
ledger: [],
Expand Down Expand Up @@ -204,7 +205,10 @@ router.post('/review-application/:loanID', async (req, res, next) => {
await Loan.updateOne(
{ loanID: req.params.loanID },
{
status: req.body.approved ? 'approved' : 'rejected'
$set: {
status: req.body.approved ? 'approved' : 'rejected',
approvalDate: Date.now()
}
},
{
runValidators: true
Expand Down

0 comments on commit f737f37

Please sign in to comment.