fix: return arraybuffer artifacts for report exports
This commit is contained in:
parent
8ecead47f2
commit
00c75d14ee
2 changed files with 12 additions and 7 deletions
|
|
@ -48,7 +48,7 @@ export async function createConvexContext(identity: ViewerIdentity): Promise<Con
|
|||
export type ReportArtifact = {
|
||||
fileName: string
|
||||
mimeType: string
|
||||
buffer: Buffer
|
||||
buffer: ArrayBuffer
|
||||
}
|
||||
|
||||
type BaseOptions = {
|
||||
|
|
@ -123,10 +123,11 @@ export async function buildHoursWorkbook(
|
|||
options.companyId ? `-${options.companyId}` : ""
|
||||
}${options.search ? `-${encodeURIComponent(options.search)}` : ""}.xlsx`
|
||||
|
||||
const arrayBuffer = workbook.buffer.slice(workbook.byteOffset, workbook.byteOffset + workbook.byteLength)
|
||||
return {
|
||||
fileName,
|
||||
mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
buffer: workbook,
|
||||
buffer: arrayBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -185,10 +186,11 @@ export async function buildBacklogWorkbook(
|
|||
options.companyId ? `-${options.companyId}` : ""
|
||||
}.xlsx`
|
||||
|
||||
const arrayBuffer = workbook.buffer.slice(workbook.byteOffset, workbook.byteOffset + workbook.byteLength)
|
||||
return {
|
||||
fileName,
|
||||
mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
buffer: workbook,
|
||||
buffer: arrayBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -232,10 +234,11 @@ export async function buildSlaWorkbook(
|
|||
options.companyId ? `-${options.companyId}` : ""
|
||||
}.xlsx`
|
||||
|
||||
const arrayBuffer = workbook.buffer.slice(workbook.byteOffset, workbook.byteOffset + workbook.byteLength)
|
||||
return {
|
||||
fileName,
|
||||
mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
buffer: workbook,
|
||||
buffer: arrayBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -283,10 +286,11 @@ export async function buildCsatWorkbook(
|
|||
options.companyId ? `-${options.companyId}` : ""
|
||||
}.xlsx`
|
||||
|
||||
const arrayBuffer = workbook.buffer.slice(workbook.byteOffset, workbook.byteOffset + workbook.byteLength)
|
||||
return {
|
||||
fileName,
|
||||
mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
buffer: workbook,
|
||||
buffer: arrayBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -338,9 +342,10 @@ export async function buildTicketsByChannelWorkbook(
|
|||
options.companyId ? `-${options.companyId}` : ""
|
||||
}.xlsx`
|
||||
|
||||
const arrayBuffer = workbook.buffer.slice(workbook.byteOffset, workbook.byteOffset + workbook.byteLength)
|
||||
return {
|
||||
fileName,
|
||||
mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
buffer: workbook,
|
||||
buffer: arrayBuffer,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ export async function runReportSchedules(
|
|||
key,
|
||||
fileName: artifact.fileName,
|
||||
mimeType: artifact.mimeType,
|
||||
data: Buffer.from(artifact.buffer).toString("base64"),
|
||||
data: Buffer.from(new Uint8Array(artifact.buffer)).toString("base64"),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue