dansdata-se / api

Open API for retrieving information about social dances in Sweden.

Home Page:https://api.dansdata.se

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dansdata API

Open API for retrieving information about social dances in Sweden.

Getting Started

The project makes use of VSCode's devcontainer feature to create a basic, common development environment. The following instructions assume you are using this environment. If you do not want to use a devcontainer, necessary steps to configure your local environment can be deduced from files in the .devcontainer directory.

To initialize/update your development database to match your current state:

$ npm run dev:db:push

To run the API locally

$ npm run dev

To create a new database migration:

$ npm run dev:db:migrate -- dev -- --name my_migration_name

To use prisma studio

$ npm run dev:db:studio

Environment Variables

This project uses environment variables for database connections and more.

Certain variables, such as cloudflare credentials, need to be configured manually for some features to work.

Please see src/env/index.ts for more details.

Testing

Unit tests can be run using

$ npm run test:unit

Integration tests can be run using

$ npm run test:integration

To run all tests, simply use

$ npm run test:all

The group a test is in is determined by an initial documentation comment, e.g.:

/**
 * @group unit
 */

See also jest-runner-groups.

Resetting the development database

Ususally npm run dev:db:push should be enough to apply your prisma changes to the database. However, sometimes it is necessary to perform a deeper clean.

To do this, connect to the database (the devcontainer comes with the SQLTools extension preconfigured for such a connection - use the database icon in the left bar of vscode) and run

DROP SCHEMA auth CASCADE;
DROP SCHEMA events CASCADE;
DROP SCHEMA portal CASCADE;
DROP SCHEMA profiles CASCADE;
DROP SCHEMA public CASCADE;
DROP SCHEMA storage CASCADE;
DROP SCHEMA logs CASCADE;

Then use npm run dev:db:push to re-initialize your development database.

Contributing

Dansdata is a project by dancers, for dancers. Contributions are welcome!

Please see CONTRIBUTING.md for guidelines.

About Dansdata.se

Dansdata (lit. "dance data") is an open API for information relating to social dancing in Sweden.

Felix Zedén Yverås is the project's current maintainer.

License

MIT

About

Open API for retrieving information about social dances in Sweden.

https://api.dansdata.se

License:MIT License


Languages

Language:TypeScript 96.4%Language:JavaScript 1.5%Language:PLpgSQL 1.1%Language:CSS 0.7%Language:Dockerfile 0.3%Language:Shell 0.1%