| 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 |
|
| 103 |
ashish |
8 |
enum status{
|
|
|
9 |
PHASED_OUT,
|
|
|
10 |
DELETED,
|
|
|
11 |
PAUSED,
|
|
|
12 |
ACTIVE,
|
|
|
13 |
}
|
|
|
14 |
|
| 95 |
ashish |
15 |
struct Category{
|
|
|
16 |
1:i64 id,
|
|
|
17 |
2:string name,
|
|
|
18 |
3:list<i64> childCategories,
|
|
|
19 |
4:i64 parent_id,
|
|
|
20 |
5:bool isTopLevel,
|
| 103 |
ashish |
21 |
6:i64 addedOn,
|
|
|
22 |
7:status categoryStatus
|
| 95 |
ashish |
23 |
}
|
|
|
24 |
|
|
|
25 |
|
| 85 |
ashish |
26 |
struct Vendor{
|
|
|
27 |
1:i64 id,
|
|
|
28 |
2:string name
|
| 103 |
ashish |
29 |
3:status vendorStatus
|
|
|
30 |
4:i64 addedOn
|
| 85 |
ashish |
31 |
}
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
struct Warehouse{
|
|
|
35 |
1:i64 id,
|
|
|
36 |
2:string location,
|
| 95 |
ashish |
37 |
3:i64 vendor_id
|
| 103 |
ashish |
38 |
4:status warehouseStatus
|
|
|
39 |
5:i64 addedOn
|
| 85 |
ashish |
40 |
}
|
|
|
41 |
|
|
|
42 |
struct ItemInventory{
|
|
|
43 |
1:i64 id,
|
|
|
44 |
2:map<i64,i64> availability,
|
| 103 |
ashish |
45 |
3:i64 lastCheckedOn
|
| 85 |
ashish |
46 |
}
|
|
|
47 |
|
|
|
48 |
struct ItemInventoryHistory{
|
|
|
49 |
1:i64 item_id,
|
|
|
50 |
2:i64 warehouse_id,
|
|
|
51 |
3:i64 timestamp,
|
|
|
52 |
4:i64 availability
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
struct Item{
|
|
|
56 |
1:i64 id,
|
| 103 |
ashish |
57 |
2:list<i64> categories,
|
|
|
58 |
3:ItemInventory itemInventory,
|
|
|
59 |
4:i64 addedOn,
|
|
|
60 |
5:i64 startDate,
|
|
|
61 |
6:status itemStatus,
|
|
|
62 |
7:map<string,string> otherInfo,
|
|
|
63 |
8:double price
|
| 85 |
ashish |
64 |
}
|
|
|
65 |
|
|
|
66 |
exception CatalogServiceException{
|
|
|
67 |
1:i64 id,
|
|
|
68 |
2:string message
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
service CatalogService{
|
|
|
75 |
|
|
|
76 |
/**
|
|
|
77 |
Content methods
|
|
|
78 |
*/
|
|
|
79 |
|
|
|
80 |
/**
|
|
|
81 |
Availability and inventory attributes
|
|
|
82 |
*/
|
|
|
83 |
//all add and update methods - added by Ashish
|
| 103 |
ashish |
84 |
i64 addCategory(1:Category category) throws (1:CatalogServiceException cex),
|
|
|
85 |
i64 addItem(1:Item item) throws (1:CatalogServiceException cex),
|
|
|
86 |
i64 addItemToCategory(1:i64 item_id, 2:i64 category_id) throws (1:CatalogServiceException cex),
|
|
|
87 |
i64 addWarehouse(1:Warehouse warehouse) throws (1:CatalogServiceException cex),
|
|
|
88 |
i64 addVendor(1:Vendor vendor) throws (1:CatalogServiceException cex),
|
| 85 |
ashish |
89 |
void updateInventory(1:i64 item_id, 2:i64 warehouse_id, 3: i64 quantity, 4:i64 timestamp) throws (1:CatalogServiceException cex),
|
|
|
90 |
|
| 103 |
ashish |
91 |
//all delete methods
|
|
|
92 |
void retireCategory(1:i64 category_id) throws (1:CatalogServiceException cex),
|
|
|
93 |
void retireVendor(1:i64 vendor_id) throws (1:CatalogServiceException cex),
|
|
|
94 |
void retireWarehouse(1:i64 warehouse_id) throws (1:CatalogServiceException cex),
|
|
|
95 |
|
|
|
96 |
//Item management apis
|
|
|
97 |
void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:CatalogServiceException cex),
|
|
|
98 |
void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:CatalogServiceException cex),
|
|
|
99 |
void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:CatalogServiceException cex),
|
| 85 |
ashish |
100 |
//Other accessor methods - added by Ashish
|
| 95 |
ashish |
101 |
Category getCategory(1:i64 id) throws (1:CatalogServiceException cex),
|
| 103 |
ashish |
102 |
list<Category> getAllCategories(1:bool isActive) throws (1:CatalogServiceException cex),
|
| 85 |
ashish |
103 |
Item getItem(1:i64 item_id) throws (1:CatalogServiceException cex),
|
| 103 |
ashish |
104 |
list<Item> getAllItemsForCategory(1:i64 category_id,2:bool isActive) throws (1:CatalogServiceException cex),
|
|
|
105 |
list<Item> getAllItems(1:bool isActive) throws (1:CatalogServiceException cex),
|
|
|
106 |
list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:CatalogServiceException cex),
|
| 85 |
ashish |
107 |
ItemInventory getItemInventory(1:i64 item_id) throws (1:CatalogServiceException cex),
|
| 103 |
ashish |
108 |
i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:CatalogServiceException cex),
|
| 95 |
ashish |
109 |
ItemInventoryHistory getItemInventoryHistory(1:i64 id, 2:i64 item_id, 3:i64 warehouse_id, 4: i64 from_date, 5:i64 to_date ) throws (1:CatalogServiceException cex),
|
| 103 |
ashish |
110 |
list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:CatalogServiceException cex),
|
| 85 |
ashish |
111 |
Warehouse getWarehouse(1:i64 warehouse_id) throws (1:CatalogServiceException cex),
|
| 103 |
ashish |
112 |
list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:CatalogServiceException cex),
|
|
|
113 |
list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:CatalogServiceException cex),
|
|
|
114 |
Vendor getVendor(1:i64 vendor_id) throws (1:CatalogServiceException cex),
|
|
|
115 |
list<Vendor> getAllVendors(1:bool isActive) throws (1:CatalogServiceException cex),
|
|
|
116 |
//i64 getExpectedDeliveryTime(1:i64 item_id) throws (1:CatalogServiceException cex)
|
| 85 |
ashish |
117 |
}
|
|
|
118 |
|