-
Notifications
You must be signed in to change notification settings - Fork 1
/
share-vo.ts
59 lines (49 loc) · 1.39 KB
/
share-vo.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { orderBy } from 'lodash';
import { BaseVO, DynamicListChild } from '@models/base-vo';
import { ArchiveVO } from './archive-vo';
import { FolderVO } from './folder-vo';
import { RecordVO } from './record-vo';
import { AccessRoleType, getAccessAsEnum } from './access-role';
export function sortShareVOs(shares: ShareVO[]) {
return orderBy(
shares,
[
share => share.status?.includes('pending') ? true : false,
share => getAccessAsEnum(share.accessRole),
share => (share.ArchiveVO.fullName as string).toLowerCase()
],
[
'desc',
'desc',
'asc'
]
);
}
export class ShareVO extends BaseVO implements DynamicListChild {
public shareId;
public folder_linkId;
public archiveId;
public accessRole: AccessRoleType;
public type;
public status: 'status.generic.ok' | 'status.generic.deleted' | 'status.generic.pending';
public requestToken: string;
public isPendingAction = false;
public isNewlyCreated = false;
public FolderVO: FolderVO;
public RecordVO: RecordVO;
public ItemVO;
public FolderLinkVO;
public ArchiveVO: ArchiveVO;
constructor(voData: any) {
super(voData);
if (this.ArchiveVO) {
this.ArchiveVO = new ArchiveVO(this.ArchiveVO);
}
if (this.FolderVO) {
this.FolderVO = new FolderVO(this.FolderVO);
}
if (this.RecordVO) {
this.RecordVO = new RecordVO(this.RecordVO);
}
}
}