Skip to content

Filipstrozik/knsolvro

Repository files navigation

KN Solvro Backend Recruitment Task

Description

This repository is a response to the recruitment task of the Solvro science club. link As you can see I chose Nest JS Framework and TypeScript. Initially I used the free SQL database, but after the trial period ended, I came to the local Oracle database. Main Controller is /cart there are all required functionalities for this task and examples you can see on postman collection down here.

Postman requests collection

Run in Postman

Endpoints Quick Description

If You are from KN Solvro here are short descriptions of endpoints where key functionalities are implemented: (Item is a record of product and quantity)

  1. Adding a product to the cart:
#POST
'/cart/items/:id'
#id - product id
Body: 
{
    "quantity": 1
}
  1. Removing an product from the cart
#DELETE
'/cart/items/:id'
# item id
  1. Change the quantity of an item
#PATCH
'/cart/items/:id'
#id - item id
Body: 
{
    "quantity": 2
}
  1. Adding a discount(promo) code (percentage and fixed amount)
#PATCH
'/cart/promo/:name'
#name - discount code (string)
  1. Change of delivery type (different prices for delivery)
#PATCH
'/cart/delivery/:id'
#id - delivery id
  1. Displaying information about the basket.
#GET
'/cart'
  1. Sharing the basket (the possibility of sending it to another user, after opening the link, the products should be placed in the new basket of the new user).
#generate link:
#GET
'/cart/share'

#send link to someone...

#copy cart (as a new user)
#GET
'/cart/copy/:ssesionId'
# just click the link basicly it looks like this:
# cart/copy/8gfXbj-9dKmKcn1OAKBUTMXsuxZUrPW8
  1. Remember that the cart should be placed in the context of a single user session, it cannot be global. RE: one cart belongs to one user's session in this api.

Additional enpoints

  1. Adding new product
#POST
'/cart/prod'
Body: 
{
    "title": "banan",
    "desc": "zielony",
    "price": 44
}
  1. Adding new delivery
#POST
'/cart/delivery'
Body: 
{
    "type": "Kurier",
    "price": 40
}
  1. Adding new promotion(discount) (percentage and fixed amount)
#POST
'/cart/promo'
Body: 
{
    "name": "minusK10",
    "discount": 10
}
OR
Body: 
{
    "name": "minus20",
    "discount": 0.8
}

There will be also additional endpoints to make these entities full CRUD functionalities...

Installation

No node modules are in this repository so You have to download them.

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
# (in progress)
$ npm run test

Stay in touch

License

Nest is MIT licensed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published