cofacts / rumors-db

Scripts for managing rumors db
https://g0v.hackmd.io/@mrorz/S1caurZq8
MIT License
6 stars 11 forks source link

Use Typescript to define DB schema #68

Closed MrOrz closed 4 months ago

MrOrz commented 6 months ago

This helps with the type safety of rumors-api.

Schema in 2 formats

We decided to write the same schema in 2 format, one in Elasticsearch mappings, another in zod. We want type safety and correct indexing settings in the same time, however:

This is why we write the schema in two different formats, and use examples to ensure that the two schemas are in sync by type checking and try inserting them in DB during CI.

Changes