Chore(backend): Enable attaching attachments to companies and people (backend) (#1726)

Enable attaching attachments to companies and people (backend)

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
This commit is contained in:
gitstart-twenty
2023-09-26 10:39:13 +01:00
committed by GitHub
parent ba86be2c5b
commit f60c209e39
5 changed files with 91 additions and 11 deletions

View File

@ -33,9 +33,11 @@ export class AttachmentResolver {
async uploadAttachment(
@AuthUser() user: User,
@AuthWorkspace() workspace: Workspace,
@Args('activityId') activityId: string,
@Args({ name: 'file', type: () => GraphQLUpload })
{ createReadStream, filename, mimetype }: FileUpload,
@Args('activityId') activityId?: string,
@Args('companyId') companyId?: string,
@Args('personId') personId?: string,
): Promise<string> {
const stream = createReadStream();
const buffer = await streamToBuffer(stream);
@ -53,7 +55,9 @@ export class AttachmentResolver {
fullPath: path,
type: this.attachmentService.getFileTypeFromFileName(filename),
name: filename,
activityId: activityId,
activityId,
companyId,
personId,
authorId: user.id,
workspaceId: workspace.id,
},