ValGeorgiev / hermes

Official Hermes Gift repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HermesGift

Official Hermes Gift repository

Table of Contents

  1. Application Configurations
  2. Technology stack
  3. Routing
  4. Data API
  5. Backend Endpoints
  6. Git Flow

Application Configurations

Technology stack

Main languages & libraries :

  • React
  • Redux
  • Webpack
  • Babel
  • react-router
  • lodash
  • Django
  • Postgre

Routing

Route Description Old page
/ Home page http://hermesgift.bg/
/products Products page with http://hermesgift.bg/index.php/categories/sklad
/products/:category Products from category http://hermesgift.bg/index.php/categories/sklad/mobile-accessories
/services Services page http://hermesgift.bg/index.php/nashatapechatnitsa
/service/:serviceid Service details page http://hermesgift.bg/index.php/nashatapechatnitsa/item/tamponen-pechat
/for-us For us & Contacts page http://hermesgift.bg/index.php/for-us
/search/products/:keyword Search page with specific keyword http://hermesgift.bg/index.php/component/virtuemart/search?keyword=180-01&limitstart=0&option=com_virtuemart&view=category
/catalogs Catalogs page http://hermesgift.bg/index.php/catalogs

DATA API

Product
  • name: Product name
  • description: Product description
  • product_id: Hermes product ID
  • client_id: Client product ID
  • category_id: Category ID (ForeignKey)
  • price: Price
  • currency: USD/lv
  • image_link: link to cloudinary
  • online: true/false
  • views: Number of views
Category

Category contain products example

  • name: Category name
  • value: Category value (for links)
  • products: Products in the category
  • parent_category: Parent category
  • image_link: Category front image
  • online: true/false
Catalog

PDF Catalogs, examples

  • name: Catalog name
  • image_link: Catalog front image (link to cloudinary)
  • link: Link to catalog pdf
  • online: true/false
Assets

Texts Example 1 , Example 2

  • title: Asset title
  • body: Asset body (HTML or simple text)
  • asset_id: Unique asset id
  • image_link: Asset front image
  • online: true/false
Site

Site configurations. Example: Which assets to be displayed on http://hermesgift.bg/index.php/nashatapechatnitsa And other configurations

  • services: Array with assets values

Backend Endpoints

Product:

Get product:

method: GET
endpoint: /api/product/{id}
response:

{
	name: String,
	description: String,
	price: String,			// 22,00 лв
	product_id: String,
	image_link: String,
	category_id: ForeignKey
}

error response:

{
    status_code: 404,
    "detail": "Not Found"
}

description:

  • If everything is OK with this product, the API returns status 200 and product data.
  • If product is not found, the API returns status 404 and NOT_FOUND status_code
  • If product is offline, the API returns status 404 and NOT_FOUND status_code

Get products from category:

method: GET
endpoint: /api/products/{category_name}
response:

{
	products: [
		{
			name: String,
			price: String,
			image_link: String,
			product_id: String
		},
		{
			name: String,
			price: String,
			image_link: String,
			product_id: String
		}
	],
	count: Number
}

error response:

{
    status_code: 404,
    "detail": "Not Found"
}

optional parameters:
count: how many products to return. Example: when we want to implement pagination (page size is this count)
start: from which product to start the search. Same Example ^

description:
If category is not found, the API returns status 404 and NOT_FOUND status_code
Return only online products



Category:

Get categories:

method: GET
endpoint: /api/categories
response:

{
	categories: [
		{
			name: String,
			value: String,
			category_img: String
		},
		{
			name: String,
			value: String,
			category_img: String
		}
	],
	count: Number
}

description:
Returns only online categories

Catalog:

Get catalogs:

method: GET
endpoint: /api/catalogs
response:

{
	catalogs: [
		{
			name: String,
			image_link: String,
			link: String
		},
		{
			name: String,
			image_link: String,
			link: String
		}
	],
	count: Number
}

description:
Returns only online catalogs

Asset:

method: GET
endpoint: /api/asset/{asset_id}
response:

{
	title: String,
	body: String,
	asset_id: String,
	image_link: String
}

error response:

{
    status_code: 404,
    "detail": "Not Found"
}

description:
Return only online asset
Body is a simple text or html with tags

Sites:

Get site configuration

method: GET
endpoint: /api/site/{config}
Example response:

{
	services: [
		Asset,
		Asset
	]
}

error response:

{
    status_code: 404,
    "detail": "Not Found"
}

description:
Return only online assets
Return only the configuration which you search ({config})

Git Flow

  • master - main branch, used only for production builds
  • dev - dev branch, used to contains all ready features
  • local-branch - dev branch, used to contains a separated feature
	Steps when you want to develop a feature.
	1. Pull dev branch
	2. Create a new branch. Example update-en-translations
	3. Switch to your new branch
	4. Commit
	5. When you are ready, push your changes
	6. Go to **hermes** github repository and click "Create a pull request" button
	7. Add title and description
	8. Wait for review approval and merge

About

Official Hermes Gift repository

License:MIT License


Languages

Language:JavaScript 50.8%Language:Python 34.6%Language:CSS 13.5%Language:HTML 1.1%