Conversation
src/server/routes/auth.js
Outdated
| @@ -0,0 +1,23 @@ | |||
| const apiClient = require('../../gateway/codeship'); | |||
|
|
|||
There was a problem hiding this comment.
since this is a file inside the routes folder it should return a router
src/gateway/codeship.js
Outdated
| const password = process.env.CODESHIP_PASSWORD; | ||
| let authorization; | ||
|
|
||
| async function postAuth() { |
There was a problem hiding this comment.
rename the function to authenticate
src/gateway/codeship.js
Outdated
| return authorization; | ||
| } | ||
|
|
||
| function listProjects(organizationId) { |
src/gateway/codeship.js
Outdated
| }); | ||
| } | ||
|
|
||
| function listBuilds(organizationId, projectId) { |
There was a problem hiding this comment.
rename function to getBuilds, also check how you can only fetch the last build as opposed to all of them?
src/gateway/codeship.js
Outdated
| @@ -0,0 +1,61 @@ | |||
| require('dotenv').load(); | |||
There was a problem hiding this comment.
this should be moved to the config.js file, and should only happen when the NODE_ENV is development
src/gateway/codeship.js
Outdated
| const apiUrl = process.env.CODESHIP_API_URL; | ||
| const username = process.env.CODESHIP_USERNAME; | ||
| const password = process.env.CODESHIP_PASSWORD; | ||
| let authorization; |
There was a problem hiding this comment.
rename to authenticationResponse.
src/server/routes/auth.js
Outdated
| let projects = (await apiClient.listProjects(orgId)).projects; | ||
|
|
||
| // Embed the latest builds into each project | ||
| projects = await Promise.all(projects.map(async (project) => { |
There was a problem hiding this comment.
extract this function, and name it addBuildsToProject
| const router = require('express').Router(); | ||
|
|
||
| router.get('/', async (req, res) => { | ||
| async function appendBuildsToProjects(project) { |
There was a problem hiding this comment.
can you move this function out of the router function?
punitrathore
left a comment
There was a problem hiding this comment.
please look at the final comment :)
No description provided.