Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit bf6323d

Browse files
Merge pull request #863 from deckgo/jobs
feat: publish with cloud functions
2 parents a039ce9 + 1f803c1 commit bf6323d

File tree

79 files changed

+2762
-2022
lines changed

Some content is hidden

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

79 files changed

+2762
-2022
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[
2+
{
3+
"origin": [
4+
"http://localhost:3333",
5+
"http://localhost:3334",
6+
"https://deckdeckgo.app",
7+
"https://deckdeckgo-studio-staging.web.app",
8+
"https://deckdeckgo-studio-staging.firebaseapp.com",
9+
"https://deckdeckgo-app-staging.web.app",
10+
"https://deckdeckgo-app-staging.firebaseapp.com"
11+
],
12+
"responseHeader": ["Content-Type"],
13+
"method": ["GET"],
14+
"maxAgeSeconds": 3600
15+
}
16+
]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
firebase functions:config:set mailchimp.skip="true" info.mail.skip="true" github.skip="true" deckdeckgo.presentation.url="https://beta.deckdeckgo.io" deckdeckgo.api.skip="true"
3+
4+
firebase functions:config:get

cloud/config/set-cors-gcp.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
# https://cloud.google.com/storage/docs/configuring-cors?hl=fr
4+
5+
gsutil cors set cors-studio-beta.json gs://deckdeckgo-studio-beta.appspot.com

cloud/functions/package-lock.json

Lines changed: 919 additions & 747 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloud/functions/package.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,34 @@
1212
},
1313
"main": "lib/index.js",
1414
"dependencies": {
15-
"firebase-admin": "^8.12.1",
16-
"firebase-functions": "^3.7.0",
15+
"cors": "^2.8.5",
16+
"firebase-admin": "^9.1.1",
17+
"firebase-functions": "^3.11.0",
1718
"install": "^0.13.0",
1819
"js-beautify": "^1.13.0",
20+
"jsdom": "^16.4.0",
1921
"mailchimp-api-v3": "^1.14.0",
2022
"node-fetch": "^2.6.0",
21-
"nodemailer": "^6.4.8",
23+
"nodemailer": "^6.4.11",
2224
"npm": "^6.14.8",
2325
"puppeteer": "^2.1.1",
2426
"rimraf": "^3.0.2",
25-
"simple-git": "^2.19.0"
27+
"simple-git": "^2.20.1"
2628
},
2729
"devDependencies": {
30+
"@types/cors": "^2.8.7",
2831
"@types/js-beautify": "^1.11.0",
32+
"@types/jsdom": "^16.2.4",
2933
"@types/node": "^10.17.28",
3034
"@types/node-fetch": "^2.5.7",
3135
"@types/nodemailer": "^6.4.0",
3236
"@types/puppeteer": "^2.0.1",
3337
"@types/rimraf": "^3.0.0",
3438
"husky": "^4.2.5",
35-
"prettier": "^2.1.0",
36-
"pretty-quick": "^2.0.1",
37-
"tslint": "^6.1.2",
38-
"typescript": "^3.9.5"
39+
"prettier": "^2.1.1",
40+
"pretty-quick": "^3.0.0",
41+
"tslint": "^6.1.3",
42+
"typescript": "^4.0.2"
3943
},
4044
"private": true,
4145
"engines": {

cloud/functions/src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ app.firestore().settings({timestampsInSnapshots: true});
88

99
import {applyWatchDeckCreate, applyWatchDeckDelete, applyWatchDeckUpdate} from './watch/watch-deck';
1010
import {applyWatchUserCreate, applyWatchUserDelete, applyWatchUserUpdate} from './watch/watch-user';
11+
import {applyWatchTaskCreate} from './watch/watch-task';
12+
13+
import {publishTask} from './request/publish';
1114

1215
const runtimeOpts = {
1316
timeoutSeconds: 120,
@@ -22,6 +25,10 @@ export const watchDeckCreate = functions.firestore.document('decks/{deckId}').on
2225

2326
export const watchUserUpdate = functions.firestore.document('users/{userId}').onUpdate(applyWatchUserUpdate);
2427

28+
export const watchTaskCreate = functions.firestore.document('tasks/{taskId}').onCreate(applyWatchTaskCreate);
29+
2530
export const watchUserDelete = functions.auth.user().onDelete(applyWatchUserDelete);
2631

2732
export const watchUserCreate = functions.auth.user().onCreate(applyWatchUserCreate);
33+
34+
export const publish = functions.https.onRequest(publishTask);
File renamed without changes.

cloud/functions/src/model/deck.ts renamed to cloud/functions/src/model/data/deck.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
import {firestore} from 'firebase-admin';
2+
23
import {UserSocial} from './user';
34

5+
export interface DeckDeployData {
6+
status: 'scheduled' | 'failure' | 'successful';
7+
updated_at: firestore.Timestamp;
8+
}
9+
10+
export interface DeckDeploy {
11+
github?: DeckDeployData;
12+
api?: DeckDeployData;
13+
}
14+
15+
export interface DeckGitHubRepo {
16+
id: string;
17+
url: string;
18+
name: string;
19+
nameWithOwner: string;
20+
}
21+
22+
export interface DeckGitHub {
23+
repo?: DeckGitHubRepo;
24+
publish: boolean;
25+
}
26+
427
export interface DeckMetaAuthor {
528
name: string;
629
photo_url?: string | firestore.FieldValue;
@@ -20,13 +43,14 @@ export interface DeckMeta {
2043
published: boolean;
2144
published_at: firestore.Timestamp;
2245

23-
updated_at: firestore.Timestamp;
46+
feed: boolean;
2447

25-
github?: boolean;
48+
updated_at: firestore.Timestamp;
2649
}
2750

2851
export interface DeckAttributes {
2952
style?: string;
53+
transition?: 'slide' | 'fade' | 'none';
3054
}
3155

3256
export interface DeckClone {
@@ -39,6 +63,8 @@ export interface DeckData {
3963

4064
attributes?: DeckAttributes;
4165
background?: string;
66+
header?: string;
67+
footer?: string;
4268

4369
owner_id: string;
4470

@@ -48,6 +74,10 @@ export interface DeckData {
4874

4975
meta?: DeckMeta;
5076

77+
deploy?: DeckDeploy;
78+
79+
github?: DeckGitHub;
80+
5181
clone?: DeckClone;
5282

5383
created_at?: firestore.Timestamp;

0 commit comments

Comments
 (0)