Mytheresa - Backend Challenge

Build Status

MYTHERESA

Mytheresa - Backend Challenge

Dear candidate,

Thank you again for your application for the position as Backend Engineer (m/f/d).

Today, we want to get a deeper understanding of your knowledge and problem-solving skills.

We want you to implement a REST API endpoint that given a list of products, applies some discounts to them and can be filtered.

You are free to choose whatever language and tools you are most comfortable with. Please add instructions on how to run it and publish it in Github.

What we expect

  • Code structure/architecture must fit this use case, as simple or as complex needed to complete what is asked for.
  • Tests are a must. Code must be testable without requiring networking or the filesystem. Tests should be runnable with 1 command.
  • The project must be runnable with 1 simple command from any machine.
  • Explanations on decisions taken

Given this list of products:

{
    "products": [
        {
            "sku": "000001",
            "name": "BV Lean leather ankle boots",
            "category": "boots",
            "price": 89000
        },
        {
            "sku": "000002",
            "name": "BV Lean leather ankle boots",
            "category": "boots",
            "price": 99000
        },
        {
            "sku": "000003",
            "name": "Ashlington leather ankle boots",
            "category": "boots",
            "price": 71000
        },
        {
            "sku": "000004",
            "name": "Naima embellished suede sandals",
            "category": "sandals",
            "price": 79500
        },
        {
            "sku": "000005",
            "name": "Nathane leather sneakers",
            "category": "sneakers",
            "price": 59000
        }
    ]
}

You must take into account that this list could grow to have 20.000 products.

The prices are integers for example, 100.00€ would be 10000.

You can store the products as you see fit (json file, in memory, rdbms of choice)

Given that:

  • Products in the boots category have a 30% discount.
  • The product with sku = 000003 has a 15% discount.
  • When multiple discounts collide, the biggest discount must be applied.

Provide a single endpoint

GET /products

  • Can be filtered by category as a query string parameter
  • (optional) Can be filtered by priceLessThan as a query string parameter, this filter applies before discounts are applied and will show products with prices lesser than or equal the value provided.
  • Returns a list of Product with the given discounts applied when necessary
  • Must return at most 5 elements. (The order does not matter)

Product model

  • price.currency is always EUR
  • When a product does not have a discount, price final and price original should be the same number and discount_percentage should be null.
  • When a product has a discount price original is the original price, price final is the amount with the discount applied and discount_percentage represents the applied discount with the % sign.

Example product with a discount of 30% applied:

{
    "sku": "000001",
    "name": "BV Lean leather ankle boots",
    "category": "boots",
    "price": {
        "original": 89000,
        "final": 62300,
        "discount_percentage": "30%",
        "currency": "EUR"
    }
}

Example product without a discount

{
    "sku": "000001",
    "name": "BV Lean leather ankle boots",
    "category": "boots",
    "price": {
        "original": 89000,
        "final": 89000,
        "discount_percentage": null,
        "currency": "EUR"
    }
}

If you have any further question, please don’t hesitate and contact us.

Best of luck for this challenge!

How to run the APP

You must install Docker in order to run the server.

Once is installed execute in project folder:

docker-compose up --build app

Otherwise, with GoLang compiler installed you're able to:

  • Build and execute
go build -o . ./main
./main
  • Test and coverage report:
go test ./... --coverprofile outfile
go tool cover -html=outfile -o cover.html
  • Curl request example:
curl http://localhost:8080/products?category=boots&priceLessThan=90000

Response:

{
    "products": [
        {
            "sku": "000001",
            "name": "BV Lean leather ankle boots",
            "category": "boots",
            "price": {
                "original": 89000,
                "final": 62300,
                "discount_percentage": "30%",
                "currency": "EUR"
            }
        },
        {
            "sku": "000003",
            "name": "Ashlington leather ankle boots",
            "category": "boots",
            "price": {
                "original": 71000,
                "final": 49700,
                "discount_percentage": "30%",
                "currency": "EUR"
            }
        }
    ]
}

And that's all. :-)

Similar Resources

Spothero-challenge - Spot Hero Backend Challenge

##Spot Hero Backend Challenge As per the requirements mentioned in the challenge

Feb 17, 2022

Servian-tech-challenge - Submission to Servian Tech Challenge

Servian-tech-challenge - Submission to Servian Tech Challenge

Submission to Servian Tech Challenge LinkedIn Application live version TABLE OF

Jan 7, 2022

Cross commerce challenge - Cross Commerce Store Challenge With Golang

Cross commerce challenge - Cross Commerce Store Challenge With Golang

Cross Commerce Store Desafio Simples Aplicação ETL Todo o código fonte está cont

Feb 13, 2022

Benzinga Backend Challenge, A HTTP receiver and webhook forwarder

benzinga-backend-challenge Benzinga Backend Challenge, a simple webhook receiver and forwarder. The application should be a basic webhook receiver tha

Jan 3, 2022

Buff Up Backend Challenge For Go

Buff Up Backend Challenge As part of the recruitment process we would like to complete the following backend challenge. We use this backend challenge

Nov 21, 2021

A challenge in Go. A simple backend responding to API calls reading/writing data from to PostgreSQL db.

Go Challenge The challenge has been executed in two different steps. Steps 1 Hour tag: 1 hour: As the challenge required, the tag is a snapshot of wha

Dec 4, 2021

Coding challenge for fullstack and backend developer candidates

todotxt Yet another a Go library for Gina Trapani's todo.txt files. ✅ Features Based on go-todotxt from Fabio Berchtold with: Go mod support Segments

Dec 10, 2022

Coding challenge for fullstack and backend developer candidates

Backend/API Developer Code Challenge Overview In this task, you will develop a commandline interface for working with a standard todo.txt file. (todo.

Sep 19, 2022

Spotify Backend Developer Intern Challenge 2022 (Go, Gin, SQLite3)

Shopify Backend Developer Intern Challenge - Summer 2022 This is an API for managing inventory items. The API is written in Go and uses Gin and sqlite

Jan 19, 2022

A simple CRUD app built with Go for Shopify Backend Developer Intern Challenge - Summer 2022

Shopify Backend Developer Intern Challenge - Summer 2022 A simple CRUD app built with Go and Gin. This let you update track your inventory, add new it

Jan 18, 2022

Alura Challenge Backend 3 - Desenvolva uma aplicação web para analisar e investigar transações financeiras

alura-challenge-backend Descrição Aplicação para upload e análise de transações financeiras. Suporte arquivos .csv com os campos abaixo (não utilizar

Aug 17, 2022

Taina backend Backend service With Golang

taina-backend Backend service Getting Started Essential steps to get your backend service deployed A helloworld example has been shipped with the temp

Nov 17, 2021

Acropolis Backend is the Go backend for Acropolis - the central management system for Full Stack at Brown

Acropolis Backend is the Go backend for Acropolis - the central management system for Full Stack at Brown

Acropolis Backend Acropolis Backend is the Go backend for Acropolis — the centra

Dec 25, 2021

Go-backend-test - Creating backend stuff & openid connect authentication stuff in golang

Go Backend Coding Practice This is my practice repo to learn about creating back

Feb 5, 2022

Beatstore-backend-go - Backend implementation for a social media app / e-commerce store for instrumental music,built with Golang

BeatStore-Backend-Go Backend implementation for a social media app / e-commerce

Oct 7, 2022

Golang Code Challenge for PARSPOOYESH

golang-code-challenge Dependencies You must have go and Docker installed on your machine also you need to go get this Dependencies: name repo gorilla/

Mar 18, 2022

A Golang and Python solution for Queue-it's Proof-of-Work challenge.

Queue-it Proof-of-Work A Golang and Python solution for Queue-it's Proof-of-Work challenge (https://queue-it.com/blog/proof-of-work-block-bad-bots/).

Oct 16, 2022

800k lines switch case cpp challenge

800k lines switch case cpp challenge

800k lines cpp compile challenge 80万行cpp编译挑战 800k lines cpp 编译 challenge generate 生成Cpp代码 go run generator.go compile 编译Cpp代码 g++ -m64 main.cpp binary

Oct 27, 2021

cert-manager webhook & CoreDNS plugin for solving DNS01 challenge on self-hosted authoritative DNS server.

cert-manager webhook & CoreDNS plugin for solving DNS01 challenge on self-hosted authoritative DNS server.

cert-manager webhook & CoreDNS plugin This repo exists for a niche case scenario in which we are running cert-manager on one or multiple Kubernetes cl

Feb 4, 2022
Servian-tech-challenge - Submission to Servian Tech Challenge
Servian-tech-challenge - Submission to Servian Tech Challenge

Submission to Servian Tech Challenge LinkedIn Application live version TABLE OF

Jan 7, 2022
Cross commerce challenge - Cross Commerce Store Challenge With Golang
Cross commerce challenge - Cross Commerce Store Challenge With Golang

Cross Commerce Store Desafio Simples Aplicação ETL Todo o código fonte está cont

Feb 13, 2022
Coding challenge - Word Counts

Word Count Challenge Run the program Build the application with go build. The application accepts input from filename parameters, or from STDIN. For e

Dec 14, 2021
Solutions to the 11th tuenti challenge
Solutions to the 11th tuenti challenge

Tuenti challenge 11 Intro These are the solutions to the Tuenti Challenge. The c

Dec 22, 2021
Klever.io Challenge
Klever.io Challenge

Klever Technical Challenge About the challenge The Technical Challenge consists of creating an API with Golang using gRPC with stream pipes that expos

Jan 10, 2022
Owldetect - Take home challenge for Haraj Solutions Engineer candidates

OwlDetect Welcome to Haraj take home challenge! In this challenge you will be as

Feb 17, 2022
Web Service challenge: Matriz Transformation

Web Service challenge: Matriz Transformation Recebendo como input uma matriz atr

Feb 16, 2022
A simple, secure self-destructing message service, using HashiCorp Vault product as a backend
A simple, secure self-destructing message service, using HashiCorp Vault product as a backend

sup3rS3cretMes5age! A simple, secure self-destructing message service, using Has

Mar 5, 2022
Das-register - Backend of DAS registration service

Prerequisites Install & Run Usage Register Set Reverse Record Others Documents d

Dec 7, 2022
Scp-wallet-api - Backend for SCP Wallet app

SCP Wallet API Backend for SCP Wallet app. It exposes a simplified REST API whic

Jan 31, 2022