Add files deletion when destroying attachment, workspace or workspaceMember (#10222)
Solution - update attachment soft delete logic by destroy (seen with Weiko & Felix) - add two jobs for file and workspace folder deletion - add listener to attachment and workspaceMember destroy event -> add file deletion job - update logic in deleteWorkspace method -> add wokspace folder deletion job closes https://github.com/twentyhq/core-team-issues/issues/147 To go further - delete old avatar when workspaceMember replaces its avatar - same with workspace picture --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
@ -5,7 +5,7 @@ import { PREVIEWABLE_EXTENSIONS } from '@/activities/files/components/DocumentVi
|
||||
import { Attachment } from '@/activities/files/types/Attachment';
|
||||
import { downloadFile } from '@/activities/files/utils/downloadFile';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
|
||||
import { useDestroyOneRecord } from '@/object-record/hooks/useDestroyOneRecord';
|
||||
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
||||
import {
|
||||
FieldContext,
|
||||
@ -95,12 +95,12 @@ export const AttachmentRow = ({
|
||||
[attachment?.id],
|
||||
);
|
||||
|
||||
const { deleteOneRecord: deleteOneAttachment } = useDeleteOneRecord({
|
||||
const { destroyOneRecord: destroyOneAttachment } = useDestroyOneRecord({
|
||||
objectNameSingular: CoreObjectNameSingular.Attachment,
|
||||
});
|
||||
|
||||
const handleDelete = () => {
|
||||
deleteOneAttachment(attachment.id);
|
||||
destroyOneAttachment(attachment.id);
|
||||
};
|
||||
|
||||
const { updateOneRecord: updateOneAttachment } = useUpdateOneRecord({
|
||||
|
||||
Reference in New Issue
Block a user