Falabella Hackathon - Team Browse
Demo URLS
- Product Page = https://hackathon.rlab.app/12/929 (/author-id/product-id)
- Authors Page = https://hackathon.rlab.app/22 (/author-id)
- Admin Page = https://hackathon.rlab.app/admin
- Product Analytics Page = https://hackathon.rlab.app/analytics/1072?entityType=sku (/product-d)
- Author Analytics Page = https://hackathon.rlab.app/analytics/22?entityType=author (/author-id)
Development Setup
Requirements
Node v12
yarn
(to install runnpm i -g yarn
)
Install dependencies
# Install global dependencies
yarn install -W
# Install plugin dependencies
yarn workspace plugin install
# Install server dependencies
yarn workspace server install
# Install website dependencies
yarn workspace website install
Build Plugin
yarn workspace plugin build
Run application
yarn workspace website watch
yarn workspace server watch
Website is accessible at localhost:1234
Server is accessible at localhost:3000
Install packages
# Install global packages
yarn add <list-of-package> -W
# Install server packages
yarn workspace server add <list-of-package>
# Install website packages
yarn workspace website add <list-of-package>
Project Structure
Server
src/plugin/config
- Config to read env variables
src/routes
- Routes Declaration
src/utils
- Utilities
Website
components
- UI components Declaration
context
- React context Declaration
http
- REST API Declarations
pages
- Root pages
Load Review & Ratings Plugins
- Insert Script in HTML
<script src="<path-to-script>/rnr-script.js"></script>
- Load ratings module
<script>
const element = document.getElementById('reviews');
RNR.setHost('api-server-host');
RNR.load(element, {
userId: 'user-id',
productId: 'product-id',
});
</script>
- Load user module
<script>
const element = document.getElementById('reviews');
RNR.setHost('api-server-host');
RNR.loadUserPanel(element, {
userId: 'user-id',
});
</script>
Devops
- Docker
- Docker-compose
- CICD : https://drone.io/
- helm deployment
- Server : https://contabo.com/
CICD Pipelines
Review n Ratings APIS
-
Create new review
(post) : 'api/v1/ratingsAndReviews' (reqBody) : { entityId, rating , title, description, author}
-
Edit review
(post) : 'api/v1/ratingsAndReviews/edit' (reqBody) : { id, rating , title, description}
-
Mark review as Helpfull
(post) : 'api/v1/ratingsAndReviews/flag' (reqBody) : { id, helpful_count}
-
Remove/Delete review
(delete) : 'api/v1/ratingsAndReviews/{reviewId}'
-
Get Review with Id
(get) : 'api/v1/ratingsAndReviews/{reviewId}'
-
Get averageRatings
(get) : 'api/v1/averageRatings/{entityid}'