feat: add email and phone number to credit expense log (#22846)
* feat: add email and phone number to credit expense log * feat: fix test cases * Update downloadExpenseLog.handler.ts --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
This commit is contained in:
1 parent
be7d127c9e
commit
ef114d7727
6 files changed
+26
-1
No files matched your search
@@ -59,6 +59,8 @@ export class CreditService {
|
||||
bookingUid,
|
||||
smsSid,
|
||||
smsSegments,
|
||||
phoneNumber,
|
||||
email,
|
||||
callDuration,
|
||||
creditFor,
|
||||
externalRef,
|
||||
@@ -69,6 +71,8 @@ export class CreditService {
|
||||
bookingUid?: string;
|
||||
smsSid?: string;
|
||||
smsSegments?: number;
|
||||
phoneNumber?: string;
|
||||
email?: string;
|
||||
callDuration?: number;
|
||||
creditFor?: CreditUsageType;
|
||||
externalRef?: string;
|
||||
@@ -117,6 +121,8 @@ export class CreditService {
|
||||
credits,
|
||||
creditType,
|
||||
smsSegments,
|
||||
phoneNumber,
|
||||
email,
|
||||
callDuration,
|
||||
creditFor,
|
||||
tx,
|
||||
@@ -323,12 +329,14 @@ export class CreditService {
|
||||
credits: number | null;
|
||||
creditType: CreditType;
|
||||
smsSegments?: number;
|
||||
phoneNumber?: string;
|
||||
email?: string;
|
||||
callDuration?: number;
|
||||
creditFor?: CreditUsageType;
|
||||
tx: PrismaTransaction;
|
||||
externalRef?: string;
|
||||
}) {
|
||||
const { credits, creditType, bookingUid, smsSid, teamId, userId, smsSegments, callDuration, creditFor, tx } = props;
|
||||
const { credits, creditType, bookingUid, smsSid, teamId, userId, smsSegments, callDuration, creditFor, phoneNumber, email, tx } = props;
|
||||
let creditBalance: { id: string; additionalCredits: number } | null | undefined =
|
||||
await CreditsRepository.findCreditBalance({ teamId, userId }, tx);
|
||||
|
||||
@@ -370,6 +378,8 @@ export class CreditService {
|
||||
bookingUid,
|
||||
smsSid,
|
||||
smsSegments,
|
||||
phoneNumber,
|
||||
email,
|
||||
callDuration,
|
||||
externalRef: props.externalRef,
|
||||
},
|
||||
|
||||
@@ -132,6 +132,8 @@ describe("CreditsRepository", () => {
|
||||
bookingUid: true,
|
||||
smsSid: true,
|
||||
smsSegments: true,
|
||||
email: true,
|
||||
phoneNumber: true,
|
||||
callDuration: true,
|
||||
externalRef: true,
|
||||
},
|
||||
@@ -169,6 +171,8 @@ describe("CreditsRepository", () => {
|
||||
bookingUid: true,
|
||||
smsSid: true,
|
||||
smsSegments: true,
|
||||
email: true,
|
||||
phoneNumber: true,
|
||||
callDuration: true,
|
||||
externalRef: true,
|
||||
},
|
||||
|
||||
@@ -148,6 +148,8 @@ export class CreditsRepository {
|
||||
bookingUid: true,
|
||||
smsSid: true,
|
||||
smsSegments: true,
|
||||
phoneNumber: true,
|
||||
email: true,
|
||||
callDuration: true,
|
||||
externalRef: true,
|
||||
},
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "CreditExpenseLog" ADD COLUMN "email" TEXT,
|
||||
ADD COLUMN "phoneNumber" TEXT;
|
||||
@@ -616,6 +616,8 @@ model CreditExpenseLog {
|
||||
date DateTime
|
||||
smsSid String?
|
||||
smsSegments Int?
|
||||
phoneNumber String?
|
||||
email String?
|
||||
callDuration Int?
|
||||
creditFor CreditUsageType?
|
||||
externalRef String? @unique
|
||||
|
||||
@@ -20,6 +20,8 @@ const headers = [
|
||||
"Number of Segments",
|
||||
"Call Duration",
|
||||
"External Ref",
|
||||
"Phone Number",
|
||||
"Email",
|
||||
];
|
||||
|
||||
export const downloadExpenseLogHandler = async ({ ctx, input }: DownloadExpenseLogOptions) => {
|
||||
@@ -52,6 +54,8 @@ export const downloadExpenseLogHandler = async ({ ctx, input }: DownloadExpenseL
|
||||
log.creditType,
|
||||
log.bookingUid ?? "",
|
||||
log.smsSegments?.toString() ?? "-",
|
||||
log.phoneNumber ?? "",
|
||||
log.email ?? "",
|
||||
log.callDuration?.toString() ?? "-",
|
||||
log.externalRef ?? "-",
|
||||
]);
|
||||
|
||||
Reference in new issue
Block a user