Skip to content

allmannyttan/matcha-kontraktet-backend

Repository files navigation

What is matcha-kontraktet-backend?

matcha-kontraktet-backend is an API that uses Slussen to get data about leases to detect if any lease is an illegal sublet by matching the contract data with Swedish folkbokföring through Syna or Creditsafe.

Development

Dependencies

Developing

  • Matcha kontraktet uses PostgresQL that we run in docker
  • Matcha kontraktet uses Slussen that we run in Docker.
  • You need some configuration files as described in the Config section
  • Create a personal token for GitHub Packages as described above and run docker login https://docker.pkg.github.com

Getting started

nvm use
npm i
docker-compose up -d
npm run migrate:up
npm run seed:dev
npm run dev

Go to http://localhost:9000/

Config

Local config.json is needed for Syna credentials. Credentials are found in LastPass.

{
  "syna": {
    "username": "",
    "customerNumber": ""
  }
}

The other service for population registration is Creditsafe. Config options will be updated soon.

Migrations and seeds

  • Create new migration: npx knex migrate:make <migration_name>
  • Create new seed for dev: npx knex seed:make $(date +%s)_<name> --env dev
  • Reset (recreate and seed) dev db: npm run reset:dev