Skip to content

Conversation

@mKleinCreative
Copy link
Contributor

No description provided.

@@ -0,0 +1,23 @@
const apiClient = require('../../gateway/codeship');

Copy link

@punitrathore punitrathore Oct 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is a file inside the routes folder it should return a router

const password = process.env.CODESHIP_PASSWORD;
let authorization;

async function postAuth() {
Copy link

@punitrathore punitrathore Oct 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename the function to authenticate

return authorization;
}

function listProjects(organizationId) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename function to getProjects

});
}

function listBuilds(organizationId, projectId) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename function to getBuilds, also check how you can only fetch the last build as opposed to all of them?

@@ -0,0 +1,61 @@
require('dotenv').load();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be moved to the config.js file, and should only happen when the NODE_ENV is development

const apiUrl = process.env.CODESHIP_API_URL;
const username = process.env.CODESHIP_USERNAME;
const password = process.env.CODESHIP_PASSWORD;
let authorization;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to authenticationResponse.

let projects = (await apiClient.listProjects(orgId)).projects;

// Embed the latest builds into each project
projects = await Promise.all(projects.map(async (project) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract this function, and name it addBuildsToProject

const router = require('express').Router();

router.get('/', async (req, res) => {
async function appendBuildsToProjects(project) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move this function out of the router function?

Copy link

@punitrathore punitrathore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please look at the final comment :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants