-
-
Notifications
You must be signed in to change notification settings - Fork 336
/
Share.ts
48 lines (42 loc) · 1.47 KB
/
Share.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
import {ShareOptions} from 'app/common/ShareOptions';
import {Document} from 'app/gen-server/entity/Document';
import {nativeValues} from 'app/gen-server/lib/values';
import {BaseEntity, Column, Entity, JoinColumn, ManyToOne,
PrimaryColumn} from 'typeorm';
@Entity({name: 'shares'})
export class Share extends BaseEntity {
/**
* A simple integer auto-incrementing identifier for a share.
* Suitable for use in within-database references.
*/
@PrimaryColumn({name: 'id', type: Number})
public id: number;
/**
* A long string secret to identify the share. Suitable for URLs.
* Unique across the database / installation.
*/
@Column({name: 'key', type: String})
public key: string;
/**
* A string to identify the share. This identifier is common to the home
* database and the document specified by docId. It need only be unique
* within that document, and is not a secret. These two properties are
* important when you imagine handling documents that are transferred
* between installations, or copied, etc.
*/
@Column({name: 'link_id', type: String})
public linkId: string;
/**
* The document to which the share belongs.
*/
@Column({name: 'doc_id', type: String})
public docId: string;
/**
* Any overall qualifiers on the share.
*/
@Column({name: 'options', type: nativeValues.jsonEntityType})
public options: ShareOptions;
@ManyToOne(type => Document)
@JoinColumn({name: 'doc_id'})
public doc: Document;
}