-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtypes.ts
More file actions
79 lines (69 loc) · 2.05 KB
/
types.ts
File metadata and controls
79 lines (69 loc) · 2.05 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* eslint-disable @typescript-eslint/no-explicit-any */
import { FacebookJob } from '../shared_types'
// Models
export interface FacebookJobRow {
id: number;
jobType: string;
status: string;
scheduledAt: string;
startedAt: string | null;
finishedAt: string | null;
progressJSON: string | null;
error: string | null;
}
// Converters
export function convertFacebookJobRowToFacebookJob(row: FacebookJobRow): FacebookJob {
return {
id: row.id,
jobType: row.jobType,
status: row.status,
scheduledAt: new Date(row.scheduledAt),
startedAt: row.startedAt ? new Date(row.startedAt) : null,
finishedAt: row.finishedAt ? new Date(row.finishedAt) : null,
progressJSON: row.progressJSON ? JSON.parse(row.progressJSON) : null,
error: row.error,
};
}
// TODO: I think we can also get the post_type ("shared a group", "updated status", etc),
// link_url, and group_name from the content.
export interface FacebookArchivePost {
id_str: string;
created_at: string;
full_text: string;
title: string;
isReposted: boolean;
media?: FacebookArchiveMedia[]; // Media attachments
// lang: string;
}
export interface FacebookArchiveMedia {
uri: string;
type: 'photo' | 'video';
description?: string; // Some media items have descriptions
creationTimestamp?: number; // From media.creation_timestamp
}
export interface FacebookPostRow {
id: number;
username: string;
postID: string;
createdAt: string;
title: string;
text: string;
path: string;
addedToDatabaseAt: string;
archivedAt: string | null;
deletedPostAt: string | null;
hasMedia: boolean;
isReposted: boolean;
}
export interface FacebookPostMediaRow {
mediaId: string;
postId: string; // Foreign key to post.postID
type: string;
uri: string;
description: string | null;
createdAt: string | null;
addedToDatabaseAt: string;
}
export interface FacebookPostWithMedia extends FacebookPostRow {
media?: FacebookPostMediaRow[];
}