boolean-uk / software-developer

0 stars 0 forks source link

Documenting with OpenAPI v2, testing locally, and testing with CI - API that use prisma and postgres. #115

Closed dearshrewdwit closed 2 years ago

dearshrewdwit commented 2 years ago

Repository: https://github.com/boolean-uk/test-prisma-ci

Intention

Feedback requested - please add comments below.

Feel free to branch and open PRs with ideas/changes - and link PRs in comments below.

vherus commented 2 years ago

The initial work on this gave a great foundation to go on and has been introduced to a ci branch on the cinema API exercise: https://github.com/boolean-uk/database-cinema-booking-api/tree/ci

Some changes

The reason for splitting the core & extension test suites is so students can focus on the core criteria first and get the exercise into a complete state.

The reason for splitting the main branch & core criteria tests is so we can have passing CI on main while including a complete failing test suite for the core criteria.

Todo

vherus commented 2 years ago

All prisma repos need something like the below to add a query level log for students to get visibility on their queries:

const { PrismaClient } = require("@prisma/client")

let logLevel = {
    log: ['query'],
}

if (process.env.NODE_ENV === 'test') {
    logLevel = {}
}

const prisma = new PrismaClient(logLevel)

module.exports = prisma
vherus commented 2 years ago

All API exercises need a setup like the above cinema API exercise: https://www.notion.so/boolean/Building-APIs-eb8dfb6016344271927ac65fdfd7afa8