-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathModelMeta.ts
More file actions
29 lines (24 loc) · 779 Bytes
/
ModelMeta.ts
File metadata and controls
29 lines (24 loc) · 779 Bytes
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
import { TypeDataMapping, Access } from '@tdev-api/document';
import { TypeMeta } from '@tdev-models/DocumentRoot';
import { fSeconds } from '../helpers/time';
export interface MetaInit {
readonly?: boolean;
minReadTime?: number;
}
export class ModelMeta extends TypeMeta<'page_read_check'> {
readonly type = 'page_read_check';
readonly minReadTime: number;
constructor(props: Partial<MetaInit>) {
super('page_read_check', props.readonly ? Access.RO_User : undefined);
this.minReadTime = props.minReadTime || 10;
}
get defaultData(): TypeDataMapping['page_read_check'] {
return {
readTime: 0,
read: false
};
}
get fMinReadTime() {
return fSeconds(this.minReadTime);
}
}