Skip to content

tmcallister92/retool-demo

Repository files navigation

Corso Ritual 🔮

Hello, fellow wizard or witch of bits and bytes. Coding is our ritual, is it yours?

With this, we'll dive into an exploration of your critical thinking process. Hopefully learning more on how you collaborate, and work through adding into an existing codebase. So, it'll be a peer development session with one of our engineers, and your more than welcome to search the internet.

In preparation, you may want to review this document entirely, especially the core tools and technologies of our stack. Reference links exist at the end of this document.

Prompt

You're creating your own successful local shop conjuring and crafting spells, potions, and other things from your grimoire. After a bit of time, you're specialized products have started to grow a cult-like following with growing requests for a newsletter of your new creations. So, with that in mind, you've decided to create an API to manage your followers, and maybe someday send them the newsletter they desire.

A Koa server has been bootstrapped for you, with a sample GET request, and associated tests. Given that sample, create all of the other CRUDL routes with associated tests and appropriate HTTP status codes.

  • Start with a POST request, and make sure to validate the ctx.request.body.
  • Add tests for the happy-path, OK: 200, requests.
  • Add tests for any BAD_REQUEST: 400 requests.
  • Add tests for any INTERNAL_SERVER_ERROR: 500 requests.

Only after completing the POST request, move onto the other remaining CRUDL requests.

Time permitting, an additional bonus step would be to add another entity with a relationship to the original, and generate the associated migration. This additional entity is the wizard's choice, but could be something like: newsletters, addresses, etc.

Getting Started

To succeed with this challenge you'll need the latest major LTS version of Node.js, currently Node 18. Everything else should be available after you install the dependencies using yarn.

yarn should come with the most of the recent versions of Node.js through Corepack.

A tip on getting started, make sure you've run yarn install and yarn reset to apply the DB schema to your local sqlite.

Getting to Done

At the end, you should be able to run the lint and coverage scripts without them erroring. Meaning that you have no lint warnings, and test coverage up to at least 80% for statements, branches, functions, and lines. An no you can't just add eslint-disable comments, or modify the coverage thresholds.

Available Scripts

  • dev: Run the API for development.
  • build: Create distributable artifacts.
  • start: Run the built API.
  • test: Run all tests, or run individual tests with test <glob>
  • coverage: Run tests and evaluate the test coverage.
  • lint: Run linting for opinionated code styling.
  • reset: Reset your database to clean slate without any data.
  • migrate: Create a migration based on changes to schema.prisma.
  • studio: Run a local webpage to inspect data, or use your favorite SQLite-compatible client.

Core Tools and Technologies

As reference, this core of this project uses a variety of tools and technologies:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/tryretool/retool-onpremise/ssop/deploy-retool)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published