Skip to content

Commit

Permalink
feat(tokens): make statuses work with new implemented access tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuri committed Aug 20, 2017
1 parent fead919 commit a68f774
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/api/db/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export function getBuilds(limit: number, offset: number): Promise<any> {

export function getBuild(id: number): Promise<any> {
return new Promise((resolve, reject) => {
new Build({ id: id }).fetch({ withRelated: ['repository', 'jobs.runs', 'runs.job_runs'] })
new Build({ id: id })
.fetch({ withRelated: ['repository.access_token', 'jobs.runs', 'runs.job_runs'] })
.then(build => {
if (!build) {
reject();
Expand Down Expand Up @@ -63,6 +64,7 @@ export function getBuild(id: number): Promise<any> {
return run;
});

build.repository.access_token = build.repository.access_token.token || null;
return build;
})
.then(build => {
Expand Down
5 changes: 4 additions & 1 deletion src/api/db/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export function getRepositoryOnly(id: number): Promise<any> {
if (!repo) {
reject(repo);
} else {
resolve(repo.toJSON());
repo = repo.toJSON();
repo.access_token = repo.access_token.token || null;

resolve(repo);
}
}).catch(err => reject(err));
});
Expand Down

0 comments on commit a68f774

Please sign in to comment.