Skip to content

Commit 61b2333

Browse files
authored
Merge pull request #542 from mfts/fix/download
fix: bulk download
2 parents 57aba32 + 093b154 commit 61b2333

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

Diff for: pages/api/links/download/bulk.ts

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import {
1313
getMimeTypeFromSupportedType,
1414
} from "@/lib/utils/get-content-type";
1515

16+
export const config = {
17+
maxDuration: 180,
18+
};
19+
1620
const s3Client = getS3Client();
1721
const s3Service = new S3DownloadService(s3Client);
1822

Diff for: pages/api/links/download/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default async function handle(
2929
},
3030
document: {
3131
select: {
32+
teamId: true,
3233
versions: {
3334
where: { isPrimary: true },
3435
select: {
@@ -82,6 +83,15 @@ export default async function handle(
8283
data: { downloadedAt: new Date() },
8384
});
8485

86+
// TODO: team hardcode for special download
87+
if (
88+
view.document!.teamId === "clwt1qwt00000qz39aqra71w6" &&
89+
view.document!.versions[0].type === "sheet"
90+
) {
91+
const downloadUrl = view.document!.versions[0].file;
92+
return res.status(200).json({ downloadUrl });
93+
}
94+
8595
const downloadUrl = await getFile({
8696
type: view.document!.versions[0].storageType,
8797
data: view.document!.versions[0].file,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- AlterTable
2+
ALTER TABLE "Link" ALTER COLUMN "enableFeedback" SET DEFAULT false;
3+

Diff for: prisma/schema.prisma

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ model Link {
223223
createdAt DateTime @default(now())
224224
updatedAt DateTime @updatedAt
225225
enableNotification Boolean? @default(true) // Optional give user a option to pause/resume the notifications
226-
enableFeedback Boolean? @default(true) // Optional give user a option to enable the reactions toolbar
226+
enableFeedback Boolean? @default(false) // Optional give user a option to enable the reactions toolbar
227227
enableQuestion Boolean? @default(false) // Optional give user a option to enable the question feedback
228228
enableScreenshotProtection Boolean? @default(false) // Optional give user a option to enable the screenshot protection
229229
feedback Feedback?

0 commit comments

Comments
 (0)