LeoF99 / siena-backend-challenge

Siena's challenge for the Senior Backend Engineer position

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

siena-backend-challenge

Siena's challenge for the Senior Backend Engineer position

This project used Node.js + Express.js. It also used LocalStack to simulate AWS cloud locally and Postgress as database.

!!! The Prompt Engineering details are located on ./PROMPT_ENGINEERING.md.

Requirements

  1. You need to have Docker and Docker-compose installed.

  2. You need Node and Yarn installed.

Setup project

  1. Bring project dependencies up with docker-compose.
docker compose up -d

# the project uses Localstack to run AWS services locally
# It also uses a Postgrees image
  1. Install dependencies with Yarn and run database migrations and seeds.
yarn setup

# this will run yarn install and the migrations command.
  1. Copy .env.example file to .env.

Running Project

  1. To run the project build.
yarn start

# this script will create the build and run it
  1. To run the project with file watch (for development).
yarn dev

If everithing went well, the terminal should look like this: terminal

Usage

The repository alredy have everithing necessary to run some manual tests.

You can find a CSV sample file on ./assets/smallCsvSample.csv.

  1. To test the /upload endpoint you can use the following Curl command or use the Postman / Insomnia collection located at ./docs/siena-collection.json.
curl --request POST \
  --url http://localhost:5000/upload \
  --header 'Content-Type: multipart/form-data' \
  --header 'User-Agent: insomnia/8.6.1' \
  --form file={PATH}/siena-backend-challenge/assets/smallCsvSample.csv

# use the example csv provided
# you can check the uploaded file on Localstck's S3 using the awslocal cli
  1. To test the /conversation endpoint (after the upload of the sample csv file) you can run the following Curl command.
curl --request GET \
  --url 'http://localhost:5000/conversation?limit=1&skip=0' \

# change the pagination parameters as needed
  1. To test the /conversation/:id/message endpoint, you can run the following Curl command. Use the above endpoint to get a conversation ID.
curl --request GET \
  --url http://localhost:5000/conversation/{some-id}/message \

Data Structure

To model the databade tables I've used TypeOrm and Postgrees.

The tables details can be viewed bellow. tables

Running the unit tests

To run the unit tests, just run the following command:

yarn test

About

Siena's challenge for the Senior Backend Engineer position


Languages

Language:TypeScript 98.1%Language:JavaScript 1.9%