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

Commit

Permalink
Merge pull request #387 from kmcwebdev/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
csulit authored Oct 16, 2023
2 parents e15cd34 + d4df000 commit 06881db
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 23 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"dependencies": {
"@nestjs/axios": "^3.0.0",
"@nestjs/cache-manager": "^2.1.0",
"@nestjs/common": "^10.2.7",
"@nestjs/config": "^3.1.1",
"@nestjs/core": "^10.2.7",
Expand All @@ -35,6 +36,7 @@
"@nestjs/schedule": "^3.0.4",
"@propelauth/node": "^2.1.3",
"axios": "^1.5.0",
"cache-manager": "^5.2.4",
"compression": "^1.7.4",
"filestack-js": "^3.27.0",
"helmet": "^7.0.0",
Expand Down
24 changes: 6 additions & 18 deletions src/finance/services/reimbursement.approve.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,25 +184,13 @@ export class ReimbursementApproveService {
'=',
reimbursementRequestApprovalApprover.reimbursement_request_id,
)
.returning([
'frr.reimbursement_request_id',
'frr.reference_no',
'frr.requestor_id',
'frr.expense_type_id',
'frr.amount',
'frr.attachment',
'frr.created_at',
])
.returning('frr.expense_type_id')
.executeTakeFirstOrThrow();

const requestor = await trx
.selectFrom('users')
.select(['users.email', 'users.employee_id', 'users.full_name'])
.where(
'users.user_id',
'=',
updateReimbursementRequest.requestor_id,
)
.where('users.user_id', '=', reimbursement.requestor_id)
.executeTakeFirstOrThrow();

const expenseType = await trx
Expand All @@ -218,12 +206,12 @@ export class ReimbursementApproveService {
const approveRequestEmailData: ApproveRequestEmailType = {
to: [requestor.email],
fullName: requestor.full_name,
referenceNo: updateReimbursementRequest.reference_no,
referenceNo: reimbursement.reference_no,
employeeId: requestor.employee_id,
expenseType: expenseType.expense_type,
expenseDate: updateReimbursementRequest.created_at.toString(),
amount: updateReimbursementRequest.amount,
receiptsAttached: updateReimbursementRequest.attachment,
expenseDate: reimbursement.created_at.toString(),
amount: reimbursement.amount,
receiptsAttached: reimbursement.attachment,
};

this.eventEmitter.emit(
Expand Down
10 changes: 10 additions & 0 deletions src/finance/services/reimbursement.reject.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ export class ReimbursementRejectService {
remarks: data.rejection_reason,
};

await trx
.insertInto('finance_reimbursement_approval_audit_logs')
.values({
reimbursement_request_id:
reimbursementRequest.reimbursement_request_id,
user_id: user.original_user_id,
description: `${user.email} rejected this reimbursement request`,
})
.execute();

this.eventEmitter.emit(
'reimbursement-request-send-email-rejection',
emailRejectionData,
Expand Down
23 changes: 18 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,11 @@
resolved "https://registry.yarnpkg.com/@nestjs/axios/-/axios-3.0.0.tgz#a2e70b118e3058f3d4b9c3deacd496ec4e3ee69e"
integrity sha512-ULdH03jDWkS5dy9X69XbUVbhC+0pVnrRcj7bIK/ytTZ76w7CgvTZDJqsIyisg3kNOiljRW/4NIjSf3j6YGvl+g==

"@nestjs/cache-manager@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@nestjs/cache-manager/-/cache-manager-2.1.0.tgz#e4dadc4ba9c02c059db4dac5e0b5513466e2895a"
integrity sha512-9kep3a8Mq5cMuXN/anGhSYc0P48CRBXk5wyJJRBFxhNkCH8AIzZF4CASGVDIEMmm3OjVcEUHojjyJwCODS17Qw==

"@nestjs/cli@^10.1.18":
version "10.1.18"
resolved "https://registry.yarnpkg.com/@nestjs/cli/-/cli-10.1.18.tgz#7aa0099eea5fe60787eb822f9a8a6d47e22d0123"
Expand Down Expand Up @@ -2175,6 +2180,14 @@ bytes@3.1.2:
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5"
integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==

cache-manager@^5.2.4:
version "5.2.4"
resolved "https://registry.yarnpkg.com/cache-manager/-/cache-manager-5.2.4.tgz#01bebe2cc6bef993e3e959d59d3a25a3f2658df1"
integrity sha512-gkuCjug16NdGvKm/sydxGVx17uffrSWcEe2xraBtwRCgdYcFxwJAla4OYpASAZT2yhSoxgDiWL9XH6IAChcZJA==
dependencies:
lodash.clonedeep "^4.5.0"
lru-cache "^10.0.1"

call-bind@^1.0.0, call-bind@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"
Expand Down Expand Up @@ -4674,6 +4687,11 @@ long@^5.0.0:
resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1"
integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==

lru-cache@^10.0.1, "lru-cache@^9.1.1 || ^10.0.0":
version "10.0.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.1.tgz#0a3be479df549cca0e5d693ac402ff19537a6b7a"
integrity sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==

lru-cache@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
Expand All @@ -4688,11 +4706,6 @@ lru-cache@^6.0.0:
dependencies:
yallist "^4.0.0"

"lru-cache@^9.1.1 || ^10.0.0":
version "10.0.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.1.tgz#0a3be479df549cca0e5d693ac402ff19537a6b7a"
integrity sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==

luxon@~3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.3.0.tgz#d73ab5b5d2b49a461c47cedbc7e73309b4805b48"
Expand Down

0 comments on commit 06881db

Please sign in to comment.