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:
20
front/src/modules/activities/files/hooks/useAttachments.tsx
Normal file
20
front/src/modules/activities/files/hooks/useAttachments.tsx
Normal 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[],
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user