Skip to content

Commit 60c58d9

Browse files
committed
Merge branch 'develop' of https://github.com/Real-Dev-Squad/website-backend into refactor-challenges-routes
2 parents 9f81e93 + 389b567 commit 60c58d9

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ The following project structure should be followed:
8383
```
8484

8585
## Generating Authentication Token
86+
- Run the project locally, make sure the server is listening to requests
8687
- Navigate to `https://github.com/login/oauth/authorize?client_id=<GITHUB_CLIENT_ID>`
87-
- Authorize the application.
88-
- Copy the response cookie named `rds-session` from the redirected request from the API.
88+
- Authorize the application
89+
- Copy the response cookie named rds-session from the redirected request <HOST>/auth/github/callback?code=<SOME_AUTOGENERATED_CODE>
8990
- Use the cookie for authenticated routes in the API.
9091
- For non-production environments, authentication is also supported with the `Authorization` header.
9192
- Authorization header: `Authorization: Bearer <token>`
@@ -96,4 +97,3 @@ The following project structure should be followed:
9697
- Every pull request should have associated issue(s) on our [issue tracker](https://github.com/Real-Dev-Squad/website-backend/issues).
9798
- For any non-trivial fixes and features, unit and integration tests must be added. The PR reviewer should not approve/merge PR(s) that lack these.
9899
- The PR(s) should be merged only after the CI passes.
99-

controllers/pullRequestsController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const getStalePRs = async (req, res) => {
106106
*/
107107
const getOpenPRs = async (req, res) => {
108108
try {
109-
const { data } = await githubService.fetchOpenPRs()
109+
const { data } = await githubService.fetchOpenPRs((req.query.page) || 1)
110110

111111
if (data.total_count) {
112112
const allPRs = []

local-test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const fs = require('fs')
22
const Firestore = require('./utils/firestore.js')
33
const config = require('config')
4-
const logger = require('./utils/logger')
54

65
// check whether github credentials are not falsy
76
if (
@@ -35,5 +34,7 @@ if (!firestoreData) {
3534
throw new Error('Problem with permission of read and write.\nCheck your firestore permissions')
3635
}
3736
await docRef.delete()
38-
logger.info('Success! The backend was successfully set up.')
37+
38+
// eslint-disable-next-line no-console
39+
console.log('Success! The backend was successfully set up.')
3940
})()

services/githubService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ const fetchStalePRs = async () => {
100100
* Fetches the latest 10 open PRs
101101
* @todo fetch N from query params
102102
*/
103-
const fetchOpenPRs = async () => {
103+
const fetchOpenPRs = async (pageNumber) => {
104104
try {
105105
const url = getGithubURL({
106106
is: 'open'
107107
}, {
108108
sort: 'created',
109109
order: 'desc',
110110
per_page: 10,
111-
page: 1
111+
page: pageNumber
112112
})
113113
return getFetch(url)
114114
} catch (err) {

utils/swaggerDefinition.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const swaggerJsDoc = require('swagger-jsdoc')
2+
const config = require('config')
23

34
/**
45
* Read more on: https://swagger.io/docs/specification/about

0 commit comments

Comments
 (0)