Skip to content

Commit

Permalink
Fix types version conflict and DB types issue
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkreidler committed Jan 12, 2021
1 parent 0ea9b57 commit 86d26d0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"devDependencies": {
"@types/hapi__hapi": "^18.2.5",
"@types/hapi__joi": "^16.0.2",
"@types/hapi__joi": "^17.1.6",
"@types/jest": "^26.0.3",
"@types/nconf": "^0.10.0",
"@types/pg": "^7.14.7",
Expand All @@ -39,4 +39,4 @@
"nconf": "^0.11.0",
"pg": "^8.5.1"
}
}
}
8 changes: 8 additions & 0 deletions api/src/db-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ import {
} from "./types/api";
import * as validation from "./types/validation";
import { DBConfig } from "./conf";
import {
LogEntryRow,
BoundingBoxRow,
EntityDataRow,
EntityRow,
EntityDataRowType,
EntityRowUpdates,
} from "./types/db";

/**
* Create a Knex query builder that can be used to submit queries to the database.
Expand Down
16 changes: 8 additions & 8 deletions api/src/types/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
* in the database. Correspond to schemas in 'data-processing/common/models.py'
*/

interface PaperRow {
export interface PaperRow {
s2_id: string;
arxiv_id: string;
}

interface VersionRow {
export interface VersionRow {
id: number;
paper_id: string;
index: number;
}

interface EntityRow {
export interface EntityRow {
paper_id: string;
id: number;
version: number;
type: string;
source: string;
}

type EntityRowUpdates = Omit<EntityRow, "id" | "type" | "paper_id">;
export type EntityRowUpdates = Omit<EntityRow, "id" | "type" | "paper_id">;

interface BoundingBoxRow {
export interface BoundingBoxRow {
id: number;
entity_id: number;
source: string;
Expand All @@ -35,7 +35,7 @@ interface BoundingBoxRow {
height: number;
}

interface EntityDataRow {
export interface EntityDataRow {
id: number;
entity_id: number;
source: string;
Expand All @@ -46,14 +46,14 @@ interface EntityDataRow {
relation_type: string | null;
}

type EntityDataRowType =
export type EntityDataRowType =
| "boolean"
| "integer"
| "float"
| "string"
| "relation-id";

interface LogEntryRow {
export interface LogEntryRow {
ip_address: string;
username: string | null;
level: string;
Expand Down

0 comments on commit 86d26d0

Please sign in to comment.