| 85 |
ashish |
1 |
namespace java in.shop2020.model.v1.catalog
|
| 95 |
ashish |
2 |
namespace py shop2020.thriftpy.model.v1.catalog
|
| 85 |
ashish |
3 |
|
|
|
4 |
/**
|
|
|
5 |
Objects
|
|
|
6 |
*/
|
|
|
7 |
|
| 123 |
ashish |
8 |
/**
|
|
|
9 |
Caution :- Never ever change the numbers in it. Please confirm from @ashish before any changes in enuma dn other entries in file.
|
|
|
10 |
**/
|
|
|
11 |
|
| 103 |
ashish |
12 |
enum status{
|
| 123 |
ashish |
13 |
PHASED_OUT = 0, //Item is no longer selling
|
|
|
14 |
DELETED = 1, //Item has been deliberately deleted
|
|
|
15 |
PAUSED = 2, //Item's sale is currently paused
|
|
|
16 |
ACTIVE = 3, //Item is available for sale as of now
|
|
|
17 |
IN_PROCESS = 4 //Item has been added, but content is not available for the same
|
| 103 |
ashish |
18 |
}
|
|
|
19 |
|
| 85 |
ashish |
20 |
struct Warehouse{
|
|
|
21 |
1:i64 id,
|
|
|
22 |
2:string location,
|
| 103 |
ashish |
23 |
4:status warehouseStatus
|
|
|
24 |
5:i64 addedOn
|
| 85 |
ashish |
25 |
}
|
| 115 |
ashish |
26 |
/* */
|
| 85 |
ashish |
27 |
struct ItemInventory{
|
|
|
28 |
1:i64 id,
|
|
|
29 |
2:map<i64,i64> availability,
|
| 103 |
ashish |
30 |
3:i64 lastCheckedOn
|
| 85 |
ashish |
31 |
}
|
|
|
32 |
|
|
|
33 |
struct ItemInventoryHistory{
|
|
|
34 |
1:i64 item_id,
|
|
|
35 |
2:i64 warehouse_id,
|
|
|
36 |
3:i64 timestamp,
|
|
|
37 |
4:i64 availability
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
struct Item{
|
|
|
41 |
1:i64 id,
|
| 123 |
ashish |
42 |
2:i64 catalogItemId,
|
| 103 |
ashish |
43 |
3:ItemInventory itemInventory,
|
|
|
44 |
4:i64 addedOn,
|
|
|
45 |
5:i64 startDate,
|
|
|
46 |
6:status itemStatus,
|
|
|
47 |
7:map<string,string> otherInfo,
|
| 123 |
ashish |
48 |
8:map<i64, double> price, //price on each warehouse
|
| 121 |
ashish |
49 |
9:double weight,
|
|
|
50 |
10:i64 featureId,
|
|
|
51 |
11:string featureDescription,
|
|
|
52 |
12:i64 vendorItemId
|
| 85 |
ashish |
53 |
}
|
|
|
54 |
|
| 121 |
ashish |
55 |
exception InventoryServiceException{
|
| 85 |
ashish |
56 |
1:i64 id,
|
|
|
57 |
2:string message
|
|
|
58 |
}
|
|
|
59 |
|
| 121 |
ashish |
60 |
service InventoryService{
|
| 85 |
ashish |
61 |
|
|
|
62 |
/**
|
|
|
63 |
Content methods
|
|
|
64 |
*/
|
|
|
65 |
|
|
|
66 |
/**
|
|
|
67 |
Availability and inventory attributes
|
|
|
68 |
*/
|
|
|
69 |
//all add and update methods - added by Ashish
|
| 123 |
ashish |
70 |
i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
|
|
|
71 |
i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
|
| 121 |
ashish |
72 |
i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
|
|
|
73 |
void updateInventory(1:i64 item_id, 2:i64 warehouse_id, 3: i64 quantity, 4:i64 timestamp) throws (1:InventoryServiceException cex),
|
| 123 |
ashish |
74 |
void updatePrice(1:i64 item_id, 2:i64 warehouse_id, 3:double price) throws (1:InventoryServiceException cex),
|
| 103 |
ashish |
75 |
//all delete methods
|
| 121 |
ashish |
76 |
void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
|
| 103 |
ashish |
77 |
|
|
|
78 |
//Item management apis
|
| 121 |
ashish |
79 |
void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
|
|
|
80 |
void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
|
|
|
81 |
void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
|
| 85 |
ashish |
82 |
//Other accessor methods - added by Ashish
|
| 121 |
ashish |
83 |
Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
|
|
|
84 |
list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
|
|
|
85 |
list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
|
|
|
86 |
ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
|
|
|
87 |
i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
|
|
|
88 |
list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
|
|
|
89 |
Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
|
|
|
90 |
list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
|
| 123 |
ashish |
91 |
list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
|
| 85 |
ashish |
92 |
}
|
|
|
93 |
|