New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: gmail attachments #5081
feat: gmail attachments #5081
Conversation
...-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/modules/attachment/repositories/attachment.repository.ts
Show resolved
Hide resolved
packages/twenty-server/src/modules/attachment/standard-objects/attachment.object-metadata.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much @rostaklein for your contribution. Sorry, we forgot to notify you about some changes relative to this issue, I detailed them in the comments below. Do not hesitate to ask me or @charlesBochet if you have any questions.
...-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids.ts
Outdated
Show resolved
Hide resolved
@@ -55,6 +57,36 @@ export class AttachmentObjectMetadata extends BaseObjectMetadata { | |||
}) | |||
type: string; | |||
|
|||
@FieldMetadata({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the change, but after discussion with the team, we now want to create a new composite FieldMetadataType File
(you can take example on FieldMetadataType.Link
in packages/twenty-server/src/engine/metadata-modules/field-metadata/composite-types/link.composite-type.ts
) instead of creating a new storage driver type, since gmail
is not really a storage driver type.
This composite field should have the following properties:
- fileName: string
- fileExtension: string
- uploadedAt: DateTime
- storageType: 'server' | 'gmail'
- We also want to add a virtual property
fullPath
which will be computed insidequery-result-getters.factory
.
The table Attachment
will only have one column of type File
(in addition to the id, createdAt, updatedAt ... and the relations).
In packages/twenty-server/src/engine/core-modules/file/controllers/file.controller.ts
we want to create a new endpoint @Get(gmail/:filename)
which will call users.messages.attachments.get to get the fileStream.
@charlesBochet can help you if you have any questions regarding this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense 馃憤 Ive actually already added one composite field :D #4492 This time it should be hopefully a bit easier though as I wont aim to add it as a field assignable to an object + read/write table, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! It will actually be very similar, with an additional tweak on the getters logic! I can assist you if you have any question :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to ping on Discord direclty if you need real time inputs!
packages/twenty-server/src/modules/attachment/repositories/attachment.repository.ts
Show resolved
Hide resolved
packages/twenty-server/src/modules/attachment/standard-objects/attachment.object-metadata.ts
Outdated
Show resolved
Hide resolved
Closing this one (we still have the code in the closed PR) as we decide to move on with smaller PRs |
closes #4108
Wow, this one took some time to set up. I gave up multiple times when I was exhausted after work (there have been a lot of changes around the email sync lately, including folder structure and lot of stuff necessary for the actual setup etc.). After exchanging few messages with @bosiraphael I finally got it running! 馃槃
.env
correctly (AUTH_GOOGLE_APIS_CALLBACK_URL, CACHE_STORAGE_TYPE...
)yarn nx command twenty-server cron:messaging:gmail-fetch-messages-from-cache
via debugger to see whats going onthis is just a draft to ask first few questions, ill continue developing in this branch :)