Skip to content

Commit e9a0819

Browse files
committed
Merge branch 'develop' of https://github.com/Real-Dev-Squad/website-backend into bugfix/issue957
2 parents 2dc68a5 + af8c843 commit e9a0819

Some content is hidden

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

60 files changed

+3655
-228
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
extends: ["standard", "plugin:mocha/recommended", "plugin:security/recommended", "plugin:prettier/recommended"],
1212
plugins: ["mocha", "security", "prettier"],
1313
parserOptions: {
14-
ecmaVersion: 12,
14+
ecmaVersion: 13,
1515
},
1616
globals: {
1717
config: "readonly",

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Real Dev Squad API
66

77
<!-- TABLE OF CONTENTS -->
8+
89
## Table of Contents
910

1011
- [About the Project](#about-the-project)
@@ -14,16 +15,19 @@
1415
- [CONTRIBUTING](CONTRIBUTING.md)
1516

1617
## About the Project
18+
1719
This Project serves the backend APIs required for [Real Dev Squad](https://realdevsquad.com/) web projects. This project is built in [Express.js](https://expressjs.com/).
1820

1921
## Prerequisites
22+
2023
- The application uses [node-config](https://github.com/lorenwest/node-config)([documentation](https://github.com/lorenwest/node-config/wiki/Configuration-Files)) for managing config.
2124
- Create a new file: `config/local.js`. Override the required config values from `config/development.js` and `config/default.js` into `config/local.js`.
2225
- Register the application for [GitHub OAuth](https://docs.github.com/en/developers/apps/creating-an-oauth-app) to get the `clientId` and `clientSecret`. Add the callback URL as `http://<HOSTNAME>:<PORT>/auth/github/callback`
23-
- Create an application on [FireStore](https://firebase.google.com/docs/firestore) and [generate a service file](https://cloud.google.com/iam/docs/creating-managing-service-account-keys). Add the service file credentials in the local config (or your env variables) as a string (don't forget to escape the newline in private_key)
26+
- Create an application on [FireStore](https://firebase.google.com/docs/firestore) and [generate a service file](https://cloud.google.com/iam/docs/creating-managing-service-account-keys). Add the service file credentials in the local config (or your env variables) as a string. Make sure you convert all the escape sequence (newline) - `\n` with `\\n` in private_key field.
2427
- For running the project locally, [Firebase Local Emulator Suite](https://firebase.google.com/docs/emulator-suite) can also be used instead of using the remote DB. Steps for setting it up: [CONTRIBUTING.md - Using Firebase Emulator Locally](https://github.com/Real-Dev-Squad/website-backend/blob/develop/CONTRIBUTING.md#using-firebase-emulator-locally)
2528

2629
## Starting Local Development
30+
2731
Please install `yarn` and `volta`
2832

2933
[Why Volta?](https://docs.volta.sh/guide/#why-volta)
@@ -33,13 +37,15 @@ To install Volta, please follow the [process](https://docs.volta.sh/guide/gettin
3337
### Local Development Setup
3438

3539
Install all the packages using the following command:
40+
3641
```shell
3742
yarn
3843
```
3944

4045
#### Confirm correct configuration setup
4146

4247
This command should be successful, before moving to development.
48+
4349
```shell
4450
yarn validate-setup
4551
```
@@ -55,29 +61,40 @@ Run TDD in watch mode. Exiting this command will print the coverage report. Try
5561
```shell
5662
yarn tdd:watch
5763
```
64+
5865
#### Running a server in Dev mode
66+
5967
```shell
6068
yarn dev
6169
```
70+
6271
## What happens in production:
72+
6373
- Install packages
74+
6475
```
65-
yarn
76+
yarn
6677
```
78+
6779
- Run tests
80+
6881
```
6982
yarn run test
7083
```
84+
7185
- Prune dev dependencies
86+
7287
```
7388
npm prune --production
7489
```
90+
7591
- Run start command (with port information)
92+
7693
```
7794
yarn start
7895
```
79-
Note: These are handled automatically behind the scene when pushing to [Heroku](https://devcenter.heroku.com/)
8096

97+
Note: These are handled automatically behind the scene when pushing to [Heroku](https://devcenter.heroku.com/)
8198

8299
Check out our video on how to setup the backend here: [Wiki link](https://github.com/Real-Dev-Squad/website-backend/wiki/Backend-setup-and-understanding-the-flow)
83100

config/custom-environment-variables.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,9 @@ module.exports = {
8787
routesCacheTTL: {
8888
"/members": "ROUTESCACHETTL_MEMBERS",
8989
},
90+
91+
Event100ms: {
92+
APP_ACCESS_KEY: "EVENT_100MS_APP_ACCESS_KEY",
93+
APP_SECRET: "EVENT_100MS_APP_SECREt",
94+
},
9095
};

config/default.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,9 @@ module.exports = {
9696
routesCacheTTL: {
9797
"/members": 900,
9898
},
99+
100+
Event100ms: {
101+
APP_ACCESS_KEY: "EVENT_100MS_APP_ACCESS_KEY",
102+
APP_SECRET: "EVENT_100MS_APP_SECREt",
103+
},
99104
};

config/production.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Defaults set from default.js
44
*/
55
module.exports = {
6+
discordUnverifiedRoleId: "1103047289330745386",
7+
discordDeveloperRoleId: "915490782939582485",
68
userToken: {
79
cookieName: "rds-session",
810
},

config/staging.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Defaults set from default.js
44
*/
55
module.exports = {
6+
discordUnverifiedRoleId: "1120875993771544687",
7+
discordDeveloperRoleId: "1121445071213056071",
68
enableFileLogs: false,
79
enableConsoleLogs: true,
810

config/test.js

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module.exports = {
99
enableFileLogs: false,
1010
// Console logs are set to avoid the winston error of no defined transports
1111
enableConsoleLogs: true,
12-
12+
discordUnverifiedRoleId: "1234567890",
13+
discordDeveloperRoleId: "9876543210",
1314
githubOauth: {
1415
clientId: "clientId",
1516
clientSecret: "clientSecret",
@@ -107,8 +108,49 @@ module.exports = {
107108
},
108109

109110
rdsServerlessBot: {
110-
rdsServerLessPublicKey: "RSA PUBLIC KEY",
111-
rdsServerLessPrivateKey: "RSA PRIVATE KEY",
111+
rdsServerLessPublicKey:
112+
"-----BEGIN PUBLIC KEY-----\n" +
113+
"MIIBITANBgkqhkiG9w0BAQEFAAOCAQ4AMIIBCQKCAQBK3CkprcpAYxme7vtdjpWO\n" +
114+
"gFFjoYsqU3OmhMEty/s1gnW5tgbK4ief4xk+cU+mu3YvjzWudT/SV17tAWxL4Y+G\n" +
115+
"incJwL5gpQwlnw9qOAdRGkpBriQLec7kNVIydZXbUitziy+iSimxNzdDmjvlK9ZG\n" +
116+
"miVLZm+MePbUtgaIpfgd+4bRWzudlITiNmWY7HppLzyBw+037iEICM4kwPPFI+SO\n" +
117+
"GJhpAAmD6vk0MeZk1NeQmyQp/uOPpWmVRzgyK+XVc6AwZHV+/n6xAIT91/DjJlD1\n" +
118+
"N+nS7Sqo3RJ04+KlNRUclzINOC7JBYkKtG7YQ0U9nNLkRrRlON+O6tY4OT86T1O1\n" +
119+
"AgMBAAE=\n" +
120+
"-----END PUBLIC KEY-----",
121+
rdsServerLessPrivateKey:
122+
"-----BEGIN RSA PRIVATE KEY-----\n" +
123+
"MIIEoQIBAAKCAQBK3CkprcpAYxme7vtdjpWOgFFjoYsqU3OmhMEty/s1gnW5tgbK\n" +
124+
"4ief4xk+cU+mu3YvjzWudT/SV17tAWxL4Y+GincJwL5gpQwlnw9qOAdRGkpBriQL\n" +
125+
"ec7kNVIydZXbUitziy+iSimxNzdDmjvlK9ZGmiVLZm+MePbUtgaIpfgd+4bRWzud\n" +
126+
"lITiNmWY7HppLzyBw+037iEICM4kwPPFI+SOGJhpAAmD6vk0MeZk1NeQmyQp/uOP\n" +
127+
"pWmVRzgyK+XVc6AwZHV+/n6xAIT91/DjJlD1N+nS7Sqo3RJ04+KlNRUclzINOC7J\n" +
128+
"BYkKtG7YQ0U9nNLkRrRlON+O6tY4OT86T1O1AgMBAAECggEAAhInHV0ObEuRiOEJ\n" +
129+
"mSP5pTCNj9kHNYuLdn7TrUWoVGmgghu0AmbRO84Xg6+0yWMEOPqYPJRHyLTcDmhs\n" +
130+
"q4i45Lrt4hov6hKGzH+i+IhGQ4sbpMeBfcPH4m5LMNQp6iBSzWZ7Ud0FXD6vy7H3\n" +
131+
"mDZnPhrDj1ttGJC8G1RRx/P3cjTcc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
146+
"lgOC/dJBTZLcBtixdERqcJ+o4P7oFRS6hz/9n4s+kkzxXVqEmtJmBQvHUo3I/Qgc\n" +
147+
"Ba+XMCP64pXPC3r1llhKRwIl+6UFn+QlpbxtgQjhbULnSbc7fw==\n" +
148+
"-----END RSA PRIVATE KEY-----",
112149
ttl: 60,
113150
},
151+
152+
Event100ms: {
153+
APP_ACCESS_KEY: "EVENT_100MS_APP_ACCESS_KEY",
154+
APP_SECRET: "EVENT_100MS_APP_SECREt",
155+
},
114156
};

constants/events.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const API_100MS_BASE_URL = "https://api.100ms.live/v2";
2+
const GET_ALL_EVENTS_LIMIT_MIN = 10;
3+
const UNWANTED_PROPERTIES_FROM_100MS = [
4+
"customer_id",
5+
"app_id",
6+
"recording_info",
7+
"template_id",
8+
"template",
9+
"customer",
10+
];
11+
12+
module.exports = { API_100MS_BASE_URL, GET_ALL_EVENTS_LIMIT_MIN, UNWANTED_PROPERTIES_FROM_100MS };
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const IMAGE_VERIFICATION_TYPES = ["profile", "discord"];
2+
3+
module.exports = { IMAGE_VERIFICATION_TYPES };

constants/taskRequests.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const TASK_REQUEST_STATUS = {
2+
WAITING: "WAITING",
3+
APPROVED: "APPROVED",
4+
};
5+
6+
module.exports = { TASK_REQUEST_STATUS };

0 commit comments

Comments
 (0)