Skip to content

Commit

Permalink
🔨 fix rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
danyx23 committed Jan 27, 2024
1 parent 5eb73fd commit ce49d9f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions adminSiteServer/adminRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
} from "../baker/GrapherBaker.js"
import { Chart } from "../db/model/Chart.js"
import { getVariableMetadata } from "../db/model/Variable.js"
import { DatasetFilesRow, DatasetsRow } from "@ourworldindata/types"
import { DatasetFilesRow, DbPlainDataset } from "@ourworldindata/types"

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / testdbcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / svgTester

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / testcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / bundlewatch

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / testcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / bundlewatch

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / testdbcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / bundlewatch

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / testcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / testdbcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / svgTester

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

Check failure on line 46 in adminSiteServer/adminRouter.tsx

View workflow job for this annotation

GitHub Actions / svgTester

Module '"@ourworldindata/types"' has no exported member 'DatasetFilesRow'.

// Used for rate-limiting important endpoints (login, register) to prevent brute force attacks
const limiterMiddleware = (
Expand Down Expand Up @@ -139,7 +139,7 @@ adminRouter.get("/datasets/:datasetId.csv", async (req, res) => {
const datasetId = expectInt(req.params.datasetId)

const datasetName = (
await db.knexRawFirst<Pick<DatasetsRow, "name">>(
await db.knexRawFirst<Pick<DbPlainDataset, "name">>(
`SELECT name FROM datasets WHERE id=?`,
[datasetId]
)
Expand Down
6 changes: 3 additions & 3 deletions adminSiteServer/apiRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ import {
OwidGdoc,
} from "@ourworldindata/utils"
import {
DatasetTagsRow,
DatasetDbPlainTag,

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / svgTester

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / testcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / testcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / testcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / svgTester

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.

Check failure on line 54 in adminSiteServer/apiRouter.ts

View workflow job for this annotation

GitHub Actions / svgTester

Module '"@ourworldindata/types"' has no exported member 'DatasetDbPlainTag'.
GrapherInterface,
OwidGdocLinkType,
TagsRow,
DbPlainTag,
grapherKeysToSerialize,
} from "@ourworldindata/types"
import {
Expand Down Expand Up @@ -1778,7 +1778,7 @@ apiRouter.get("/datasets.json", async (req) => {
`)

const tags = await db.knexRaw<
Pick<TagsRow, "id" | "name"> & Pick<DatasetTagsRow, "datasetId">
Pick<DbPlainTag, "id" | "name"> & Pick<DatasetDbPlainTag, "datasetId">
>(`
SELECT dt.datasetId, t.id, t.name FROM dataset_tags dt
JOIN tags t ON dt.tagId = t.id
Expand Down
4 changes: 2 additions & 2 deletions adminSiteServer/exportGitData.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as db from "../db/db.js"
import { syncDatasetToGitRepo } from "./gitDataExport.js"
import { DatasetsRow, DatasetsRowTableName } from "@ourworldindata/types"
import { DbPlainDataset, DbPlainDatasetTableName } from "@ourworldindata/types"

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / svgTester

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / testcheck

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / testcheck

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / testcheck

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / svgTester

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

Check failure on line 3 in adminSiteServer/exportGitData.ts

View workflow job for this annotation

GitHub Actions / svgTester

'"@ourworldindata/types"' has no exported member named 'DbPlainDatasetTableName'. Did you mean 'DatasetsTableName'?

const main = async () => {
const knex = db.knexInstance()
const datasets = await knex<DatasetsRow>(DatasetsRowTableName).where({
const datasets = await knex<DbPlainDataset>(DbPlainDatasetTableName).where({
namespace: "owid",
})
for (const dataset of datasets) {
Expand Down
4 changes: 2 additions & 2 deletions adminSiteServer/gitDataExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import * as db from "../db/db.js"
import filenamify from "filenamify"
import { execFormatted } from "../db/execWrapper.js"
import { JsonError } from "@ourworldindata/utils"
import { DatasetsRow } from "@ourworldindata/types"
import { DbPlainDataset } from "@ourworldindata/types"
import { Knex } from "knex"
import { getSourcesForDataset } from "../db/model/Source.js"

const datasetToReadme = async (
knex: Knex<any, any[]>,
dataset: DatasetsRow
dataset: DbPlainDataset
): Promise<string> => {
// TODO: add origins here
const source = (await getSourcesForDataset(knex, dataset.id))[0]
Expand Down
16 changes: 8 additions & 8 deletions db/model/Dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import * as db from "../db.js"
import { VariableRow, variableTable, writeVariableCSV } from "./Variable.js"
import _ from "lodash"
import {
DatasetsRow,
DatasetsRowTableName,
TagsRow,
DbPlainDataset,
DatasetsTableName,
DbPlainTag,
} from "@ourworldindata/types"
import { Knex } from "knex"

Expand All @@ -45,8 +45,8 @@ export class Dataset extends BaseEntity {
export async function getDatasetById(
knex: Knex<any, any[]>,
datasetId: number
): Promise<DatasetsRow | undefined> {
const dataset = await knex<DatasetsRow>(DatasetsRowTableName)
): Promise<DbPlainDataset | undefined> {
const dataset = await knex<DbPlainDataset>(DatasetsTableName)
.where({ id: datasetId })
.first()
if (!dataset) return undefined
Expand Down Expand Up @@ -116,7 +116,7 @@ export async function datasetToDatapackage(
const variables = (await db
.knexTable(variableTable)
.where({ datasetId })) as VariableRow[]
const tags = await db.knexRaw<Pick<TagsRow, "id" | "name">>(
const tags = await db.knexRaw<Pick<DbPlainTag, "id" | "name">>(
`SELECT t.id, t.name FROM dataset_tags dt JOIN tags t ON t.id=dt.tagId WHERE dt.datasetId=?`,
[datasetId],
knex
Expand Down Expand Up @@ -159,7 +159,7 @@ export async function datasetToDatapackage(
}

export function isDatasetWithName(
dataset: DatasetsRow
): dataset is DatasetsRow & { name: NonNullable<DatasetsRow["name"]> } {
dataset: DbPlainDataset
): dataset is DbPlainDataset & { name: NonNullable<DbPlainDataset["name"]> } {
return dataset.name !== undefined && dataset.name !== null
}
16 changes: 8 additions & 8 deletions db/model/Source.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Entity, PrimaryGeneratedColumn, Column, BaseEntity } from "typeorm"
import { Knex } from "knex"
import {
SourcesRowEnriched,
SourcesRowRaw,
SourcesRowTableName,
DbEnrichedSource,
DbRawSource,
SourcesTableName,
parseSourcesRow,
} from "@ourworldindata/types"

Expand All @@ -18,8 +18,8 @@ export class Source extends BaseEntity {
export async function getSourceById(
knex: Knex<any, any[]>,
sourceId: number
): Promise<SourcesRowEnriched | undefined> {
const rawSource = await knex<SourcesRowRaw>(SourcesRowTableName)
): Promise<DbEnrichedSource | undefined> {
const rawSource = await knex<DbRawSource>(SourcesTableName)
.where({ id: sourceId })
.first()
if (!rawSource) return undefined
Expand All @@ -34,8 +34,8 @@ export async function getSourceById(
export async function getSourcesForDataset(
knex: Knex<any, any[]>,
datasetId: number
): Promise<SourcesRowEnriched[]> {
const rawSources = await knex<SourcesRowRaw>(SourcesRowTableName).where({
): Promise<DbEnrichedSource[]> {
const rawSources = await knex<DbRawSource>(SourcesTableName).where({
datasetId,
})
const sources = rawSources.map((rawSource) =>
Expand All @@ -49,7 +49,7 @@ export async function getSourcesForDataset(
}

export async function sourceToDatapackage(
source: SourcesRowEnriched
source: DbEnrichedSource
): Promise<any> {
return Object.assign({}, { name: source.name }, source.description)
}

0 comments on commit ce49d9f

Please sign in to comment.