name -> full_name + fixed error message for missing access token

This commit is contained in:
askeluv 2019-03-13 11:47:42 +08:00
parent b88e42a52d
commit 1693506f80
15 changed files with 21 additions and 21 deletions

View File

@ -4,7 +4,7 @@ const table = new Table({
name: 'raw.github_repo',
columns: [
{ name: 'observed_timestamp', type: 'numeric', isPrimary: true },
{ name: 'name', type: 'varchar', isPrimary: true },
{ name: 'full_name', type: 'varchar', isPrimary: true },
{ name: 'created_at', type: 'numeric', isNullable: false },
{ name: 'updated_at', type: 'numeric', isNullable: false },

View File

@ -4,7 +4,7 @@ const table = new Table({
name: 'raw.github_pull_request',
columns: [
{ name: 'observed_timestamp', type: 'numeric', isPrimary: true },
{ name: 'repo_name', type: 'varchar', isPrimary: true },
{ name: 'repo_full_name', type: 'varchar', isPrimary: true },
{ name: 'pull_request_number', type: 'numeric', isPrimary: true },
{ name: 'created_at', type: 'numeric', isNullable: false },

View File

@ -4,7 +4,7 @@ const table = new Table({
name: 'raw.github_fork',
columns: [
{ name: 'observed_timestamp', type: 'numeric', isPrimary: true },
{ name: 'name', type: 'varchar', isPrimary: true },
{ name: 'full_name', type: 'varchar', isPrimary: true },
{ name: 'owner_login', type: 'varchar', isPrimary: true },
{ name: 'created_at', type: 'numeric', isNullable: false },

View File

@ -1,7 +1,7 @@
import { fetchAsync } from '@0x/utils';
export interface GithubRepoResponse {
name: string;
full_name: string;
created_at: string;
updated_at: string;
pushed_at: string;
@ -27,7 +27,7 @@ export interface GithubPullRequestResponse {
};
base: {
repo: {
name: string;
full_name: string;
};
};
}

View File

@ -7,8 +7,8 @@ export class GithubFork {
@PrimaryColumn({ name: 'observed_timestamp', type: 'bigint', transformer: numberToBigIntTransformer })
public observedTimestamp!: number;
@PrimaryColumn({ name: 'name' })
public name!: string;
@PrimaryColumn({ name: 'full_name' })
public fullName!: string;
@PrimaryColumn({ name: 'owner_login' })
public ownerLogin!: string;

View File

@ -7,8 +7,8 @@ export class GithubPullRequest {
@PrimaryColumn({ name: 'observed_timestamp', type: 'bigint', transformer: numberToBigIntTransformer })
public observedTimestamp!: number;
@PrimaryColumn({ name: 'repo_name' })
public repoName!: string;
@PrimaryColumn({ name: 'repo_full_name' })
public repoFullName!: string;
@PrimaryColumn({ name: 'pull_request_number', transformer: numberToBigIntTransformer })
public pullRequestNumber!: number;

View File

@ -7,8 +7,8 @@ export class GithubRepo {
@PrimaryColumn({ name: 'observed_timestamp', type: 'bigint', transformer: numberToBigIntTransformer })
public observedTimestamp!: number;
@PrimaryColumn({ name: 'name' })
public name!: string;
@PrimaryColumn({ name: 'full_name' })
public fullName!: string;
@Column({ name: 'created_at', type: 'bigint', transformer: numberToBigIntTransformer })
public createdAt!: number;

View File

@ -9,7 +9,7 @@ export function parseGithubForks(response: GithubForkResponse[], observedTimesta
const result: GithubFork[] = response.map(fork => {
const parsedFork = new GithubFork();
parsedFork.observedTimestamp = observedTimestamp;
parsedFork.name = fork.name;
parsedFork.fullName = fork.full_name;
parsedFork.ownerLogin = fork.owner.login;
parsedFork.createdAt = Date.parse(fork.created_at);
parsedFork.updatedAt = Date.parse(fork.updated_at);

View File

@ -12,7 +12,7 @@ export function parseGithubPulls(
return response.map(pull => {
const parsedPullRequest = new GithubPullRequest();
parsedPullRequest.observedTimestamp = observedTimestamp;
parsedPullRequest.repoName = pull.base.repo.name;
parsedPullRequest.repoFullName = pull.base.repo.full_name;
parsedPullRequest.createdAt = Date.parse(pull.created_at);
parsedPullRequest.updatedAt = Date.parse(pull.updated_at);
parsedPullRequest.closedAt = pull.closed_at ? Date.parse(pull.closed_at) : null;

View File

@ -8,7 +8,7 @@ import { GithubRepo } from '../../entities';
export function parseGithubRepo(rawRepo: GithubRepoResponse, observedTimestamp: number): GithubRepo {
const parsedRepo = new GithubRepo();
parsedRepo.observedTimestamp = observedTimestamp;
parsedRepo.name = rawRepo.name;
parsedRepo.fullName = rawRepo.full_name;
parsedRepo.createdAt = Date.parse(rawRepo.created_at);
parsedRepo.updatedAt = Date.parse(rawRepo.updated_at);
parsedRepo.pushedAt = Date.parse(rawRepo.pushed_at);

View File

@ -24,7 +24,7 @@ let connection: Connection;
connection = await createConnection(ormConfig as ConnectionOptions);
const accessToken = process.env.GITHUB_ACCESS_TOKEN;
if (accessToken === undefined) {
throw new Error('Missing required env var: BLOXY_API_KEY');
throw new Error('Missing required env var: GITHUB_ACCESS_TOKEN');
}
const githubSource = new GithubSource(GITHUB_OWNER, GITHUB_REPO, GITHUB_BRANCH, accessToken);
const observedTimestamp = Date.now();

View File

@ -12,7 +12,7 @@ chaiSetup.configure();
// tslint:disable:custom-no-magic-numbers
const fork: GithubFork = {
observedTimestamp: Date.now(),
name: '0x-monorepo',
fullName: 'NoahZinsmeister/0x-monorepo',
ownerLogin: 'NoahZinsmeister',
createdAt: 1552181010000,
updatedAt: 1552191123000,
@ -33,7 +33,7 @@ const fork: GithubFork = {
const pullRequest: GithubPullRequest = {
observedTimestamp: Date.now(),
repoName: '0x-monorepo',
repoFullName: '0xProject/0x-monorepo',
pullRequestNumber: 1684,
state: 'open',
title: '[WIP] Pull Github data',
@ -46,7 +46,7 @@ const pullRequest: GithubPullRequest = {
const repo: GithubRepo = {
observedTimestamp: Date.now(),
name: '0x-monorepo',
fullName: '0xProject/0x-monorepo',
createdAt: 1495549053000,
updatedAt: 1551908929000,
pushedAt: 1551916745000,

View File

@ -13,7 +13,7 @@ import { GithubFork } from '../../../src/entities';
const ParsedGithubFork = new GithubFork();
ParsedGithubFork.observedTimestamp = Date.now();
ParsedGithubFork.name = '0x-monorepo';
ParsedGithubFork.fullName = 'NoahZinsmeister/0x-monorepo';
ParsedGithubFork.ownerLogin = 'NoahZinsmeister';
ParsedGithubFork.createdAt = 1552181010000; // tslint:disable-line:custom-no-magic-numbers
ParsedGithubFork.updatedAt = 1552191123000; // tslint:disable-line:custom-no-magic-numbers

View File

@ -6,7 +6,7 @@ import { GithubPullRequest } from '../../../src/entities';
const ParsedGithubPullRequest: GithubPullRequest = {
observedTimestamp: Date.now(),
repoName: '0x-monorepo',
repoFullName: '0xProject/0x-monorepo',
pullRequestNumber: 1684,
state: 'open',
title: '[WIP] Pull Github data',

View File

@ -6,7 +6,7 @@ import { GithubRepo } from '../../../src/entities';
const ParsedGithubRepo: GithubRepo = {
observedTimestamp: Date.now(),
name: '0x-monorepo',
fullName: '0xProject/0x-monorepo',
createdAt: 1495549053000,
updatedAt: 1551908929000,
pushedAt: 1551916745000,