diff --git a/api/package.json b/api/package.json index 0ce9de92..4fc17d8d 100644 --- a/api/package.json +++ b/api/package.json @@ -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", @@ -39,4 +39,4 @@ "nconf": "^0.11.0", "pg": "^8.5.1" } -} +} \ No newline at end of file diff --git a/api/src/db-connection.ts b/api/src/db-connection.ts index bb5f7d8c..8019c19f 100644 --- a/api/src/db-connection.ts +++ b/api/src/db-connection.ts @@ -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. diff --git a/api/src/types/db.ts b/api/src/types/db.ts index aab3ded6..93d9a060 100644 --- a/api/src/types/db.ts +++ b/api/src/types/db.ts @@ -3,18 +3,18 @@ * 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; @@ -22,9 +22,9 @@ interface EntityRow { source: string; } -type EntityRowUpdates = Omit; +export type EntityRowUpdates = Omit; -interface BoundingBoxRow { +export interface BoundingBoxRow { id: number; entity_id: number; source: string; @@ -35,7 +35,7 @@ interface BoundingBoxRow { height: number; } -interface EntityDataRow { +export interface EntityDataRow { id: number; entity_id: number; source: string; @@ -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;