IamIGI / Computer-Shop-Server

Backend of project: "Computer-Shop". Project board: https://github.com/users/IamIGI/projects/1/views/1
https://hotshot.tk
2 stars 0 forks source link

#AdminSettings #Backend Make API for HotShootPromition. Make anothe API with DB for HotShootPromotion. Choose random product for promotion, and also block it for 2 days #12

Open IamIGI opened 2 years ago

IamIGI commented 2 years ago

Each product after HotShoot Promtion have to be banned for one week - when number of products in your list of products id greater than 7

IamIGI commented 2 years ago

Write check to db, if db key "Queue" = [], then take random product to hotShoot promotion if Queue !== [] then take first item from array as a hotShootPromotion and delete it. Collection schema: Queue: [ {productId: <id>, discount: <price>}, . . {productId: <id>, discount: <price>} ], Blocked: [{productId: <id>, date: <date>},....,{productId: <id>, date: <date>}] The discount is the value of the price, which is subtracted from the normal price, it gives the promotional price. Item when begin his promotion is getting added to Blocked document with date of begining. After 2 days it's deleted from the blocked list

IamIGI commented 2 years ago

getHotShoot controller will check is it 10 am or 10 pm. IF it is then product for hotShoot promotion will be changed and the previous product will be added to blocked list with date and hour of being added

IamIGI commented 2 years ago

promotion: {productData: <Object>, discount: <Number>, date: <String>}, this key will store actuall HotShoot promotion

IamIGI commented 2 years ago

For changing promotion will be checked time of the promotion set, if the 12 hours pass, then item will be changed. So it is important that first item in promotion functionality will be set by 10 am or 10 pm time

IamIGI commented 2 years ago

Blocked List work fine, but after 12 hours disable promotion from last hotShootPromotion product