Skip to content

[epic] Read Service with CKAN v2 compatibility #1

@anuveyatsu

Description

@anuveyatsu

We are using Hasura as the base wrapper around Postgres.

We need a backwards compatible API

# dapi-endpoint includes version e.g. data-api.ckan.com/v1/ ...
{dapi-endpoint}/{dapi-id}/graphql  # raw Hasura
{dapi-endpoint}/{dapi-id}/datastore_search  # CKAN DataStore /api/3/datastore_search

# let's see about this one (if hard we may skip for now)
{dapi-endpoint}/{dapi-id}/datastore_search_sql/  # CKAN DS SQL /api/3/datastore_search_sql

Terminology

  • dapi-id = table name in postgres (?) tbc
    • NB: hasura does not allow - in table names ...

Acceptance

  • We have a new graphql endpoint
    • You can get CSV and xlsx data from it (?)
  • We have backwards compatible datastore_search
  • We have backwards compatible datastore_search_sql
  • We support CORS
  • We have a hook for metrics (to google analytics)

BONUS

  • We implement existing permissions (what are they?)

Tasks

  • Setup - create / define repo
    • Bootstrap an Express app (?use a boilerplate instead of doing it from scratch https://expressjs.com/en/starter/generator.html)
    • Setup tests - what should we use here? Supertest remains the default for node http server tests ...
    • Setup mocks / fixtures ie. the fixture postgres database
      • For mocks we can either use nock or mitm.js (interesting to give a try)
    • Setup CI to run the tests
  • Deploy to Hasura-dev on our cluster
  • Create the graphql endpoint
    • should serve as a proxy from/to hasura graphql server
    • receives a reqeust => preps a graphql query => hits hasura => pipes back the response
  • Create datastore_search endpoint
  • Create datastore_search_sql endpoint

Analysis

graph TD

subgraph Read API service
  hasura[Hasura]
  apiwrapper[NodeJS wrapper app]
end

postgres[Postgres]

apiwrapper --> hasura
hasura --> postgres
Loading

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions