Attachments (#2716)

* create attachment site

* add deletion

* - fix person create attachment

* - add presentation type
- add some more file endings
- various fixes
This commit is contained in:
brendanlaschke
2023-11-29 16:58:58 +01:00
committed by GitHub
parent d50cf5291a
commit 7e454d2013
15 changed files with 654 additions and 14 deletions

View File

@ -0,0 +1,20 @@
import { Attachment } from '@/activities/files/types/Attachment';
import { useFindManyObjectRecords } from '@/object-record/hooks/useFindManyObjectRecords';
import { ActivityTargetableEntity } from '../../types/ActivityTargetableEntity';
export const useAttachments = (entity: ActivityTargetableEntity) => {
const { objects: attachments } = useFindManyObjectRecords({
objectNamePlural: 'attachments',
filter: {
[entity.type === 'Company' ? 'companyId' : 'personId']: { eq: entity.id },
},
orderBy: {
createdAt: 'DescNullsFirst',
},
});
return {
attachments: attachments as Attachment[],
};
};