Skip to content

Commit 042e64e

Browse files
Merge pull request #592 from dzcode-io/feat/digest-cron
feat: Cron job to gather Github info and digest them to a SQLite database
2 parents 2aba3ee + ff443bd commit 042e64e

File tree

165 files changed

+2978
-2754
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+2978
-2754
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ coverage
1818
# api
1919
api/oracle-cloud/build
2020
api/fetch_cache
21+
api/sqlite_db
2122
api/nodemon.json
2223

2324
# web
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
CREATE TABLE `contributions` (
2+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
3+
`record_imported_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
4+
`title` text NOT NULL,
5+
`updated_at` text NOT NULL,
6+
`url` text NOT NULL,
7+
`type` text NOT NULL,
8+
`run_id` text NOT NULL,
9+
`activity_count` integer NOT NULL,
10+
`repository_id` integer NOT NULL,
11+
`contributor_id` integer NOT NULL,
12+
FOREIGN KEY (`repository_id`) REFERENCES `repositories`(`id`) ON UPDATE no action ON DELETE no action,
13+
FOREIGN KEY (`contributor_id`) REFERENCES `contributors`(`id`) ON UPDATE no action ON DELETE no action
14+
);
15+
--> statement-breakpoint
16+
CREATE TABLE `contributors` (
17+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
18+
`record_imported_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
19+
`run_id` text DEFAULT 'initial-run-id' NOT NULL,
20+
`name` text NOT NULL,
21+
`username` text NOT NULL,
22+
`url` text NOT NULL,
23+
`avatar_url` text NOT NULL
24+
);
25+
--> statement-breakpoint
26+
CREATE TABLE `projects` (
27+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
28+
`record_imported_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
29+
`name` text NOT NULL,
30+
`slug` text NOT NULL,
31+
`run_id` text DEFAULT 'initial-run-id' NOT NULL
32+
);
33+
--> statement-breakpoint
34+
CREATE TABLE `repositories` (
35+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
36+
`record_imported_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
37+
`provider` text NOT NULL,
38+
`owner` text NOT NULL,
39+
`name` text NOT NULL,
40+
`run_id` text DEFAULT 'initial-run-id' NOT NULL,
41+
`project_id` integer NOT NULL,
42+
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE no action
43+
);
44+
--> statement-breakpoint
45+
CREATE UNIQUE INDEX `contributions_url_unique` ON `contributions` (`url`);--> statement-breakpoint
46+
CREATE UNIQUE INDEX `contributors_url_unique` ON `contributors` (`url`);--> statement-breakpoint
47+
CREATE UNIQUE INDEX `projects_slug_unique` ON `projects` (`slug`);--> statement-breakpoint
48+
CREATE UNIQUE INDEX `repositories_provider_owner_name_unique` ON `repositories` (`provider`,`owner`,`name`);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CREATE TABLE `contributor_repository_relation` (
2+
`contributor_id` integer NOT NULL,
3+
`repository_id` integer NOT NULL,
4+
`record_imported_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
5+
`run_id` text DEFAULT 'initial-run-id' NOT NULL,
6+
`score` integer NOT NULL,
7+
PRIMARY KEY(`contributor_id`, `repository_id`),
8+
FOREIGN KEY (`contributor_id`) REFERENCES `contributors`(`id`) ON UPDATE no action ON DELETE no action,
9+
FOREIGN KEY (`repository_id`) REFERENCES `repositories`(`id`) ON UPDATE no action ON DELETE no action
10+
);
Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
{
2+
"version": "6",
3+
"dialect": "sqlite",
4+
"id": "ba41012f-4495-42ff-ace1-61bd7eaef476",
5+
"prevId": "00000000-0000-0000-0000-000000000000",
6+
"tables": {
7+
"contributions": {
8+
"name": "contributions",
9+
"columns": {
10+
"id": {
11+
"name": "id",
12+
"type": "integer",
13+
"primaryKey": true,
14+
"notNull": true,
15+
"autoincrement": true
16+
},
17+
"record_imported_at": {
18+
"name": "record_imported_at",
19+
"type": "text",
20+
"primaryKey": false,
21+
"notNull": true,
22+
"autoincrement": false,
23+
"default": "CURRENT_TIMESTAMP"
24+
},
25+
"title": {
26+
"name": "title",
27+
"type": "text",
28+
"primaryKey": false,
29+
"notNull": true,
30+
"autoincrement": false
31+
},
32+
"updated_at": {
33+
"name": "updated_at",
34+
"type": "text",
35+
"primaryKey": false,
36+
"notNull": true,
37+
"autoincrement": false
38+
},
39+
"url": {
40+
"name": "url",
41+
"type": "text",
42+
"primaryKey": false,
43+
"notNull": true,
44+
"autoincrement": false
45+
},
46+
"type": {
47+
"name": "type",
48+
"type": "text",
49+
"primaryKey": false,
50+
"notNull": true,
51+
"autoincrement": false
52+
},
53+
"run_id": {
54+
"name": "run_id",
55+
"type": "text",
56+
"primaryKey": false,
57+
"notNull": true,
58+
"autoincrement": false
59+
},
60+
"activity_count": {
61+
"name": "activity_count",
62+
"type": "integer",
63+
"primaryKey": false,
64+
"notNull": true,
65+
"autoincrement": false
66+
},
67+
"repository_id": {
68+
"name": "repository_id",
69+
"type": "integer",
70+
"primaryKey": false,
71+
"notNull": true,
72+
"autoincrement": false
73+
},
74+
"contributor_id": {
75+
"name": "contributor_id",
76+
"type": "integer",
77+
"primaryKey": false,
78+
"notNull": true,
79+
"autoincrement": false
80+
}
81+
},
82+
"indexes": {
83+
"contributions_url_unique": {
84+
"name": "contributions_url_unique",
85+
"columns": ["url"],
86+
"isUnique": true
87+
}
88+
},
89+
"foreignKeys": {
90+
"contributions_repository_id_repositories_id_fk": {
91+
"name": "contributions_repository_id_repositories_id_fk",
92+
"tableFrom": "contributions",
93+
"tableTo": "repositories",
94+
"columnsFrom": ["repository_id"],
95+
"columnsTo": ["id"],
96+
"onDelete": "no action",
97+
"onUpdate": "no action"
98+
},
99+
"contributions_contributor_id_contributors_id_fk": {
100+
"name": "contributions_contributor_id_contributors_id_fk",
101+
"tableFrom": "contributions",
102+
"tableTo": "contributors",
103+
"columnsFrom": ["contributor_id"],
104+
"columnsTo": ["id"],
105+
"onDelete": "no action",
106+
"onUpdate": "no action"
107+
}
108+
},
109+
"compositePrimaryKeys": {},
110+
"uniqueConstraints": {}
111+
},
112+
"contributors": {
113+
"name": "contributors",
114+
"columns": {
115+
"id": {
116+
"name": "id",
117+
"type": "integer",
118+
"primaryKey": true,
119+
"notNull": true,
120+
"autoincrement": true
121+
},
122+
"record_imported_at": {
123+
"name": "record_imported_at",
124+
"type": "text",
125+
"primaryKey": false,
126+
"notNull": true,
127+
"autoincrement": false,
128+
"default": "CURRENT_TIMESTAMP"
129+
},
130+
"run_id": {
131+
"name": "run_id",
132+
"type": "text",
133+
"primaryKey": false,
134+
"notNull": true,
135+
"autoincrement": false,
136+
"default": "'initial-run-id'"
137+
},
138+
"name": {
139+
"name": "name",
140+
"type": "text",
141+
"primaryKey": false,
142+
"notNull": true,
143+
"autoincrement": false
144+
},
145+
"username": {
146+
"name": "username",
147+
"type": "text",
148+
"primaryKey": false,
149+
"notNull": true,
150+
"autoincrement": false
151+
},
152+
"url": {
153+
"name": "url",
154+
"type": "text",
155+
"primaryKey": false,
156+
"notNull": true,
157+
"autoincrement": false
158+
},
159+
"avatar_url": {
160+
"name": "avatar_url",
161+
"type": "text",
162+
"primaryKey": false,
163+
"notNull": true,
164+
"autoincrement": false
165+
}
166+
},
167+
"indexes": {
168+
"contributors_url_unique": {
169+
"name": "contributors_url_unique",
170+
"columns": ["url"],
171+
"isUnique": true
172+
}
173+
},
174+
"foreignKeys": {},
175+
"compositePrimaryKeys": {},
176+
"uniqueConstraints": {}
177+
},
178+
"projects": {
179+
"name": "projects",
180+
"columns": {
181+
"id": {
182+
"name": "id",
183+
"type": "integer",
184+
"primaryKey": true,
185+
"notNull": true,
186+
"autoincrement": true
187+
},
188+
"record_imported_at": {
189+
"name": "record_imported_at",
190+
"type": "text",
191+
"primaryKey": false,
192+
"notNull": true,
193+
"autoincrement": false,
194+
"default": "CURRENT_TIMESTAMP"
195+
},
196+
"name": {
197+
"name": "name",
198+
"type": "text",
199+
"primaryKey": false,
200+
"notNull": true,
201+
"autoincrement": false
202+
},
203+
"slug": {
204+
"name": "slug",
205+
"type": "text",
206+
"primaryKey": false,
207+
"notNull": true,
208+
"autoincrement": false
209+
},
210+
"run_id": {
211+
"name": "run_id",
212+
"type": "text",
213+
"primaryKey": false,
214+
"notNull": true,
215+
"autoincrement": false,
216+
"default": "'initial-run-id'"
217+
}
218+
},
219+
"indexes": {
220+
"projects_slug_unique": {
221+
"name": "projects_slug_unique",
222+
"columns": ["slug"],
223+
"isUnique": true
224+
}
225+
},
226+
"foreignKeys": {},
227+
"compositePrimaryKeys": {},
228+
"uniqueConstraints": {}
229+
},
230+
"repositories": {
231+
"name": "repositories",
232+
"columns": {
233+
"id": {
234+
"name": "id",
235+
"type": "integer",
236+
"primaryKey": true,
237+
"notNull": true,
238+
"autoincrement": true
239+
},
240+
"record_imported_at": {
241+
"name": "record_imported_at",
242+
"type": "text",
243+
"primaryKey": false,
244+
"notNull": true,
245+
"autoincrement": false,
246+
"default": "CURRENT_TIMESTAMP"
247+
},
248+
"provider": {
249+
"name": "provider",
250+
"type": "text",
251+
"primaryKey": false,
252+
"notNull": true,
253+
"autoincrement": false
254+
},
255+
"owner": {
256+
"name": "owner",
257+
"type": "text",
258+
"primaryKey": false,
259+
"notNull": true,
260+
"autoincrement": false
261+
},
262+
"name": {
263+
"name": "name",
264+
"type": "text",
265+
"primaryKey": false,
266+
"notNull": true,
267+
"autoincrement": false
268+
},
269+
"run_id": {
270+
"name": "run_id",
271+
"type": "text",
272+
"primaryKey": false,
273+
"notNull": true,
274+
"autoincrement": false,
275+
"default": "'initial-run-id'"
276+
},
277+
"project_id": {
278+
"name": "project_id",
279+
"type": "integer",
280+
"primaryKey": false,
281+
"notNull": true,
282+
"autoincrement": false
283+
}
284+
},
285+
"indexes": {
286+
"repositories_provider_owner_name_unique": {
287+
"name": "repositories_provider_owner_name_unique",
288+
"columns": ["provider", "owner", "name"],
289+
"isUnique": true
290+
}
291+
},
292+
"foreignKeys": {
293+
"repositories_project_id_projects_id_fk": {
294+
"name": "repositories_project_id_projects_id_fk",
295+
"tableFrom": "repositories",
296+
"tableTo": "projects",
297+
"columnsFrom": ["project_id"],
298+
"columnsTo": ["id"],
299+
"onDelete": "no action",
300+
"onUpdate": "no action"
301+
}
302+
},
303+
"compositePrimaryKeys": {},
304+
"uniqueConstraints": {}
305+
}
306+
},
307+
"enums": {},
308+
"_meta": {
309+
"schemas": {},
310+
"tables": {},
311+
"columns": {}
312+
},
313+
"internal": {
314+
"indexes": {}
315+
}
316+
}

0 commit comments

Comments
 (0)