This Django API is designed to maintain and build products using the Cassandra NoSQL database.
required
python=>3
Cassandra
git clone https://github.com/AkshayDawkhar/inventory
cd inventory create virtual environment
virtualenv venvActivate
| linux | windows |
|---|---|
source venv/bin/activate |
venvironment\Scripts\activate |
requirements
pip install -r requirements.txtrunserver
python sync_cassandra.py
cd inventory
python manage.py runserverGET all products
GET /products| Parameter | Type | Description |
|---|---|---|
create new product
POST /products| Parameter | Type | Description |
|---|---|---|
| category | string |
Required |
| color | string |
default black |
| dname | string |
Required. name to display |
| required_items | list[uuid] |
pid of raw needed to build |
| required_items_no | list[INT] |
number of raw needed as per required_items |
{
"category": "PCB",
"dname": "RS 1G",
"required_items": [
"2b955212-9f1a-11ed-a285-f889d2e645af",
"59851e5a-9f1a-11ed-b500-f889d2e645af"
],
"required_items_no": [4,6]
}GET product
GET /products/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
move product to trash
DELETE /products/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
update product
PUT /products/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
| category | string |
Required |
| color | string |
default black |
| dname | string |
Required. name to display |
| required_items | list[uuid] |
pid of raw needed to build |
| required_items_no | list[INT] |
number of raw needed as per required_items |
{
"category": "PCB",
"dname": "RS 1G",
"color":"red",
"required_items": [
"2b955212-9f1a-11ed-a285-f889d2e645af",
"59851e5a-9f1a-11ed-b500-f889d2e645af"
],
"required_items_no": [4,6]
}GET all Trashed product
GET /trash/| Parameter | Type | Description |
|---|---|---|
GET Trashed product
GET /trash/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
restore trashed product
POST /trash/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
delete trashed product before 30 days
DELETE /trash/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
pid |
UUID |
Required. pid to |
GET all build product details
GET /build/| Parameter | Type | Description |
|---|---|---|
get max possible product can build in available raw
GET /build/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
build product
POST /build/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
build_no |
INT |
Required. number of product to build |
discard product
DELETE /build/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
discard_no |
INT |
Required. number of product to discard |
get build details
GET /build/edit/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
Edit product build info
PUT /build/edit/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
build_no |
INT |
Required. to set product to build number |
Required
GET /build/required/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
GET all workers account
GET /account/| Parameter | Type | Description |
|---|---|---|
create worker account
POST /account/| Parameter | Type | Description |
|---|---|---|
| f_name | Text |
required. first name of user |
| l_name | Text |
required. last name of user |
mail |
required. unregistered mail for user | |
| username | Text |
required. username for user |
| password | Text |
required. password for user |
GET workers account
GET /account/${string:username}| Parameter | Type | Description |
|---|---|---|
Edit workers account
PUT /account/${string:username}| Parameter | Type | Description |
|---|---|---|
| f_name | Text |
required. first name of user |
| l_name | Text |
required. last name of user |
Login workers account
POST /account/login/| Parameter | Type | Description |
|---|---|---|
| username | Text |
required. |
| password | Text |
required. |
GET all admin account
GET /account/admin| Parameter | Type | Description |
|---|---|---|
create admin account
POST /account/admin/| Parameter | Type | Description |
|---|---|---|
| f_name | Text |
required. first name of user |
| l_name | Text |
required. last name of user |
mail |
required. unregistered mail for user | |
| username | Text |
required. username for user |
| password | Text |
required. password for user |
GET admin account
GET /account/admin/${string:username}| Parameter | Type | Description |
|---|---|---|
Edit admin account
PUT /account/admin/${string:username}| Parameter | Type | Description |
|---|---|---|
| f_name | Text |
required. first name of user |
| l_name | Text |
required. last name of user |
Login admin account
POST /account/admin/login/| Parameter | Type | Description |
|---|---|---|
| username | Text |
required. |
| password | Text |
required. |
GET all workers order
GET /order/| Parameter | Type | Description |
|---|---|---|
create order
POST /order/edit/| Parameter | Type | Description |
|---|---|---|
| timestamp | timestamp |
required. on which date |
| numbers | INT |
required. how many |
Delete order
DELETE /order/edit/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
| timestamp | timestamp |
required. on which date |
| numbers | INT |
required. how many |
Edit order
PUT /order/edit/${string:username}| Parameter | Type | Description |
|---|---|---|
| timestamp | timestamp |
required. on which date |
| numbers | INT |
required. how many |
complete order
POST /order/${uuid:pid}| Parameter | Type | Description |
|---|---|---|
| timestamp | timestamp |
required. on which date |
| numbers | INT |
required. how many |