Skip to content

Commit c4db14c

Browse files
getheobaldchpy04
authored andcommitted
#3943 update formatting
1 parent 0489507 commit c4db14c

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/backend/src/utils/slack.utils.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { userTransformer } from '../transformers/user.transformer.js';
3232
import { SlackRichTextBlock } from '../services/slack.services.js';
3333
import UsersService from '../services/users.services.js';
3434
import { getReimbursementRequestQueryArgs } from '../prisma-query-args/reimbursement-requests.query-args.js';
35+
import { create } from 'domain';
3536

3637
interface SlackMessageThread {
3738
messageInfoId: string;
@@ -148,9 +149,8 @@ export const sendReimbursementRequestCreatedNotificationAndCreateMessageInfo = a
148149

149150
const { identifier, totalCost, description, vendor } = reimbursementRequest;
150151
const formattedCost = `$${(totalCost / 100).toFixed(2)}`; // convert from cents to dollars and cents
151-
const formattedDesc = description !== '' ? `for ${description} ` : '';
152152

153-
const msg = `${await getUserSlackMentionOrName(submitterId)} created a reimbursement request for ${formattedCost} ${formattedDesc}from ${vendor.name} (ID#: ${identifier}) 💲`;
153+
const msg = `${await getUserSlackMentionOrName(submitterId)} created a reimbursement request for ${formattedCost} at ${vendor.name} (ID#: ${identifier}) 💲`;
154154
const link = `https://finishlinebyner.com/finance/reimbursement-requests/${requestId}`;
155155
const linkButtonText = 'View Reimbursement Request';
156156

@@ -163,13 +163,23 @@ export const sendReimbursementRequestCreatedNotificationAndCreateMessageInfo = a
163163
const messageInfo = await sendMessage(financeTeam.slackId, msg, link, linkButtonText);
164164
if (!messageInfo) return;
165165

166-
await prisma.message_Info.create({
166+
const createdMessageInfo = await prisma.message_Info.create({
167167
data: {
168168
reimbursementRequestId: requestId,
169169
channelId: messageInfo.channelId,
170170
timestamp: messageInfo.ts
171171
}
172172
});
173+
174+
const { messageInfoId, channelId, timestamp } = createdMessageInfo;
175+
176+
// send reimbursement request description in slack thread
177+
if (description !== '') {
178+
await sendThreadResponse(
179+
[{ messageInfoId, channelId, timestamp, changeRequestId: null }],
180+
`Description: ${description}`
181+
);
182+
}
173183
};
174184

175185
/**

0 commit comments

Comments
 (0)