Skip to content

The wardrobe service for the clothing and outfit purposes

Notifications You must be signed in to change notification settings

aneksamun/wardrobe-api

Repository files navigation

Wardrobe API

Build status

The purpose of the system is to allow the user to store and retrieve clothing, clothing categories, and outfits of clothing. As such, it is letting user to:

  • Search for clothes by name
  • Return a list of clothes, their categories & which outfits they're in Upload a CSV file containing clothes and clothing categories in the following format:
name, category
iSwim Summer Bikini, Bikinis
iWalk Blue Jeans, Trousers
iWalk Dress Trousers, Trousers
  • Tag clothes as part of an outfit

Configuration

The service can customised by changing following settings

Setting Description Default value
SERVER_HTTP_PORT Server port 8080
DB_NAME Database name wardrobe
DB_HOST Database server host localhost
DB_PORT Database server port 5432
DB_USER Database user user
DB_PASSWORD Database user password 1234
DB_CREATE_SCHEMA Whether to create a database schema on the system run? true

How to?

Use given sbt commands to compile and test project.

  • sbt compile - compiles project
  • sbt test - runs unit tests
  • sbt docker - builds a Docker image
  • sbt it:test - runs Integration Tests
  • sbt run - runs project

Execute docker-compose up -d to start service dependencies as Postgres database.

Endpoints

Upon service run following set of the actions are available:

Path Method Response Description
/api/clothes POST 200 Use endpoint to upload CSV file containing clothes and categories
/api/clothes/:name GET 200 Use endpoint to search clothes by name
/api/clothes?offset=0&limit=10 GET 200/404 Use endpoint to browse clothes. Apply an offset and limit to page results
/api/clothes/:name/outfit PUT 200/500 Use endpoint to tag clothes. The outfit must be provided in the body as { "name": "outfit" }

Technology stack

  • scala 2.13.6 as the main application programming language
  • http4s typeful, functional, streaming HTTP for Scala
  • doobie a pure functional JDBC layer for Scala
  • cats to write more functional and less boilerplate code
  • cats-effect The Haskell IO monad for Scala
  • pureconfig for loading configuration files
  • refined for type constraints avoiding unnecessary testing and biolerplate
  • circe a JSON library for Scala
  • scalatest and ScalaCheck for unit and property based testing
  • testcontainers to run system dependant services for Integration Testing purposes
  • sttp the Scala http client

About

The wardrobe service for the clothing and outfit purposes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages