feat: Bulk HTML export (#4620)

* wip

* Working bulk html export

* Refactor

* test

* test
This commit is contained in:
Tom Moor
2022-12-30 17:42:20 +00:00
committed by GitHub
parent 1b8dd9399c
commit f3469d25fe
32 changed files with 485 additions and 258 deletions

View File

@@ -1,7 +1,7 @@
import { Transaction } from "sequelize";
import { v4 as uuidv4 } from "uuid";
import { Attachment, Event, User } from "@server/models";
import { uploadToS3FromBuffer } from "@server/utils/s3";
import { uploadToS3 } from "@server/utils/s3";
export default async function attachmentCreator({
id,
@@ -24,7 +24,13 @@ export default async function attachmentCreator({
}) {
const key = `uploads/${user.id}/${uuidv4()}/${name}`;
const acl = process.env.AWS_S3_ACL || "private";
const url = await uploadToS3FromBuffer(buffer, type, key, acl);
const url = await uploadToS3({
body: buffer,
contentType: type,
contentLength: buffer.length,
key,
acl,
});
const attachment = await Attachment.create(
{
id,