| 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 |
/**
|
| 1330 |
chandransh |
9 |
Caution :- Never ever change the numbers in it. Please confirm from @Chandranshu or @Rajveer before any changes in enum and other entries in file.
|
| 123 |
ashish |
10 |
**/
|
| 103 |
ashish |
11 |
enum status{
|
| 123 |
ashish |
12 |
PHASED_OUT = 0, //Item is no longer selling
|
|
|
13 |
DELETED = 1, //Item has been deliberately deleted
|
|
|
14 |
PAUSED = 2, //Item's sale is currently paused
|
|
|
15 |
ACTIVE = 3, //Item is available for sale as of now
|
|
|
16 |
IN_PROCESS = 4 //Item has been added, but content is not available for the same
|
| 720 |
chandransh |
17 |
CONTENT_COMPLETE = 5 //The content for this item has been completed. We can start selling the item now.
|
| 103 |
ashish |
18 |
}
|
|
|
19 |
|
| 646 |
chandransh |
20 |
enum WarehouseLocation{
|
| 1330 |
chandransh |
21 |
Mumbai = 0,
|
|
|
22 |
Delhi = 1,
|
| 646 |
chandransh |
23 |
Bangalore = 2,
|
|
|
24 |
Kolkata = 3
|
|
|
25 |
}
|
|
|
26 |
|
| 1330 |
chandransh |
27 |
struct Vendor{
|
|
|
28 |
1:i64 id,
|
|
|
29 |
2:string name
|
|
|
30 |
}
|
|
|
31 |
|
| 483 |
rajveer |
32 |
/*
|
|
|
33 |
Warehouse fields details
|
|
|
34 |
location: it is full address
|
|
|
35 |
vendorString: some key for the warehouse
|
|
|
36 |
*/
|
| 85 |
ashish |
37 |
struct Warehouse{
|
|
|
38 |
1:i64 id,
|
| 752 |
chandransh |
39 |
2:string displayName,
|
|
|
40 |
3:string location,
|
|
|
41 |
4:status warehouseStatus,
|
|
|
42 |
5:i64 addedOn,
|
|
|
43 |
6:i64 lastCheckedOn,
|
|
|
44 |
7:string tinNumber,
|
|
|
45 |
8:string pincode,
|
|
|
46 |
9:string vendorString,
|
|
|
47 |
10:WarehouseLocation logisticsLocation
|
| 1330 |
chandransh |
48 |
11:string vendor
|
| 85 |
ashish |
49 |
}
|
| 115 |
ashish |
50 |
/* */
|
| 85 |
ashish |
51 |
struct ItemInventory{
|
|
|
52 |
1:i64 id,
|
| 483 |
rajveer |
53 |
2:map<i64,i64> availability
|
| 85 |
ashish |
54 |
}
|
|
|
55 |
|
| 483 |
rajveer |
56 |
|
| 85 |
ashish |
57 |
struct ItemInventoryHistory{
|
|
|
58 |
1:i64 item_id,
|
|
|
59 |
2:i64 warehouse_id,
|
|
|
60 |
3:i64 timestamp,
|
|
|
61 |
4:i64 availability
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
struct Item{
|
|
|
65 |
1:i64 id,
|
| 956 |
chandransh |
66 |
2:string productGroup
|
|
|
67 |
3:string brand,
|
|
|
68 |
4:string modelNumber,
|
| 2128 |
ankur.sing |
69 |
5:string modelName,
|
|
|
70 |
6:string color,
|
|
|
71 |
7:i64 category,
|
|
|
72 |
8:string comments,
|
|
|
73 |
9:i64 catalogItemId,
|
|
|
74 |
10:i64 featureId,
|
|
|
75 |
11:string featureDescription,
|
|
|
76 |
12:ItemInventory itemInventory,
|
| 2127 |
ankur.sing |
77 |
13:optional double mrp, //maxmimum retail price
|
| 2128 |
ankur.sing |
78 |
14:double mop, //market operative price
|
| 2127 |
ankur.sing |
79 |
15:optional double sellingPrice, //Selling price
|
| 2128 |
ankur.sing |
80 |
16:double transferPrice,
|
| 2127 |
ankur.sing |
81 |
17:optional double weight,
|
| 2128 |
ankur.sing |
82 |
18:i64 addedOn,
|
|
|
83 |
19:i64 startDate,
|
|
|
84 |
20:i64 retireDate,
|
| 720 |
chandransh |
85 |
21:status itemStatus,
|
| 2128 |
ankur.sing |
86 |
22:string status_description,
|
|
|
87 |
23:map<string,string> otherInfo,
|
|
|
88 |
24:string bestDealText,
|
| 2127 |
ankur.sing |
89 |
25:optional double bestDealValue,
|
| 2128 |
ankur.sing |
90 |
26:double dealerPrice,
|
|
|
91 |
27:bool defaultForEntity,
|
|
|
92 |
28:i64 updatedOn,
|
| 2127 |
ankur.sing |
93 |
29:optional i64 bestSellingRank,
|
| 2249 |
ankur.sing |
94 |
30:string hotspotCategory,
|
|
|
95 |
31:bool risky
|
| 85 |
ashish |
96 |
}
|
|
|
97 |
|
| 1343 |
chandransh |
98 |
struct VendorItemPricing{
|
| 1349 |
chandransh |
99 |
1:i64 vendorId,
|
|
|
100 |
2:i64 itemId,
|
| 1343 |
chandransh |
101 |
3:double transferPrice,
|
|
|
102 |
4:double mop,
|
|
|
103 |
5:double dealerPrice
|
|
|
104 |
}
|
|
|
105 |
|
| 1967 |
rajveer |
106 |
struct Category{
|
|
|
107 |
1:i64 id,
|
|
|
108 |
2:string label,
|
|
|
109 |
3:string description,
|
|
|
110 |
4:i64 parent_category_id,
|
|
|
111 |
/**
|
|
|
112 |
* This field should not be used.
|
|
|
113 |
*/
|
|
|
114 |
5:list<i64> children_category_ids
|
|
|
115 |
}
|
| 2113 |
ankur.sing |
116 |
|
|
|
117 |
struct VendorItemMapping{
|
|
|
118 |
1:i64 vendorId,
|
|
|
119 |
2:string itemKey,
|
|
|
120 |
3:i64 itemId,
|
|
|
121 |
4:string vendorCategory
|
|
|
122 |
}
|
| 1967 |
rajveer |
123 |
|
| 121 |
ashish |
124 |
exception InventoryServiceException{
|
| 85 |
ashish |
125 |
1:i64 id,
|
|
|
126 |
2:string message
|
|
|
127 |
}
|
|
|
128 |
|
| 121 |
ashish |
129 |
service InventoryService{
|
| 763 |
rajveer |
130 |
|
|
|
131 |
/**
|
|
|
132 |
* For closing the open session in sqlalchemy
|
|
|
133 |
*/
|
|
|
134 |
void closeSession(),
|
|
|
135 |
|
| 85 |
ashish |
136 |
/**
|
|
|
137 |
Availability and inventory attributes
|
|
|
138 |
*/
|
|
|
139 |
//all add and update methods - added by Ashish
|
| 123 |
ashish |
140 |
i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
|
|
|
141 |
i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
|
| 121 |
ashish |
142 |
i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
|
| 632 |
rajveer |
143 |
bool isActive(1:i64 itemId) throws (1:InventoryServiceException isex),
|
| 2033 |
rajveer |
144 |
string getItemStatusDescription(1:i64 itemId) throws (1:InventoryServiceException isex),
|
| 483 |
rajveer |
145 |
void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
|
|
|
146 |
// commented right now. write on based of requirement
|
|
|
147 |
// void updatePrice(1:i64 item_id, 2:i64 warehouse_id, 3:double price) throws (1:InventoryServiceException cex),
|
| 103 |
ashish |
148 |
//all delete methods
|
| 121 |
ashish |
149 |
void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
|
| 103 |
ashish |
150 |
|
|
|
151 |
//Item management apis
|
| 121 |
ashish |
152 |
void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
|
|
|
153 |
void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
|
|
|
154 |
void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
|
| 85 |
ashish |
155 |
//Other accessor methods - added by Ashish
|
| 121 |
ashish |
156 |
Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
|
| 632 |
rajveer |
157 |
list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws (1:InventoryServiceException cex),
|
| 121 |
ashish |
158 |
list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
|
|
|
159 |
list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
|
|
|
160 |
ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
|
| 632 |
rajveer |
161 |
ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
|
|
|
162 |
//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
|
| 121 |
ashish |
163 |
i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
|
| 2076 |
rajveer |
164 |
bool markItemAsContentComplete(1:i64 entityId, 2:i64 category, 3:string brand, 4:string modelName, 5:string modelNumber) throws (1:InventoryServiceException cex),
|
| 646 |
chandransh |
165 |
|
| 1157 |
rajveer |
166 |
|
| 646 |
chandransh |
167 |
/**
|
|
|
168 |
Returns the id of the warehouse with the largest inventory of the item and the inventory size in the given locations.
|
|
|
169 |
The size of list will always be 2.
|
|
|
170 |
*/
|
|
|
171 |
list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
|
| 121 |
ashish |
172 |
list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
|
| 1343 |
chandransh |
173 |
|
|
|
174 |
/**
|
|
|
175 |
Returns the warehouse with the given id.
|
|
|
176 |
*/
|
| 121 |
ashish |
177 |
Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
|
|
|
178 |
list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
|
| 502 |
rajveer |
179 |
list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
|
|
|
180 |
|
| 862 |
chandransh |
181 |
/**
|
|
|
182 |
Increases the reservation count for an item in a warehouse. Should always succeed normally.
|
|
|
183 |
*/
|
|
|
184 |
bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
|
|
|
185 |
|
|
|
186 |
/**
|
|
|
187 |
Decreases the reservation count for an item in a warehouse. Should always succeed normally.
|
|
|
188 |
*/
|
|
|
189 |
bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
|
|
|
190 |
|
| 502 |
rajveer |
191 |
// for home page .... best deals, best sellers and latest arrivals
|
| 588 |
chandransh |
192 |
list<Item> getBestSellers() throws (1:InventoryServiceException isex),
|
| 1924 |
rajveer |
193 |
list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
|
| 588 |
chandransh |
194 |
i64 getBestSellersCount() throws (1:InventoryServiceException cex),
|
|
|
195 |
|
|
|
196 |
list<Item> getBestDeals() throws (1:InventoryServiceException isex),
|
| 1924 |
rajveer |
197 |
list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
|
| 588 |
chandransh |
198 |
i64 getBestDealsCount() throws (1:InventoryServiceException cex),
|
|
|
199 |
|
|
|
200 |
list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
|
| 1924 |
rajveer |
201 |
list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
|
| 632 |
rajveer |
202 |
i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
|
|
|
203 |
|
| 1157 |
rajveer |
204 |
|
|
|
205 |
i64 generateNewEntityID(),
|
|
|
206 |
|
|
|
207 |
/**
|
| 1343 |
chandransh |
208 |
Returns the pricing information of an item associated with the vendor of the given warehouse.
|
|
|
209 |
Raises an exception if either the item, vendor or the associated pricing information can't be found.
|
|
|
210 |
*/
|
|
|
211 |
VendorItemPricing getItemPricing(1:i64 itemId, 2:i64 warehouseId) throws (1:InventoryServiceException cex),
|
|
|
212 |
|
|
|
213 |
/**
|
| 1157 |
rajveer |
214 |
* Store category object and retrieve it
|
|
|
215 |
*/
|
| 1967 |
rajveer |
216 |
/**
|
| 632 |
rajveer |
217 |
bool putCategoryObject(1:binary object),
|
|
|
218 |
binary getCategoryObject()
|
| 1967 |
rajveer |
219 |
*/
|
|
|
220 |
|
|
|
221 |
/**
|
|
|
222 |
* All category related functions
|
|
|
223 |
*/
|
|
|
224 |
bool addCategory(1:Category category),
|
|
|
225 |
Category getCategory(1:i64 id),
|
| 1990 |
ankur.sing |
226 |
list<Category> getAllCategories(),
|
| 1967 |
rajveer |
227 |
|
| 1990 |
ankur.sing |
228 |
/**
|
|
|
229 |
Returns the list of vendor pricing information of an item.
|
|
|
230 |
Raises an exception if item not found corresponding to itemId
|
|
|
231 |
*/
|
|
|
232 |
list<VendorItemPricing> getAllItemPricing(1:i64 itemId) throws (1:InventoryServiceException cex),
|
|
|
233 |
|
|
|
234 |
|
|
|
235 |
/**
|
| 2113 |
ankur.sing |
236 |
Adds vendor prices corresponding to the item. If pricing already exists then updates the prices.
|
| 1990 |
ankur.sing |
237 |
Raises an exception if either the item or vendor can't be found corresponding to their ids.
|
|
|
238 |
*/
|
| 2113 |
ankur.sing |
239 |
void addVendorItemPricing(1:VendorItemPricing vendorItemPricing) throws (1:InventoryServiceException cex),
|
| 1990 |
ankur.sing |
240 |
|
| 2063 |
ankur.sing |
241 |
/**
|
|
|
242 |
Return list of all vendors
|
|
|
243 |
*/
|
| 2113 |
ankur.sing |
244 |
list<Vendor> getAllVendors(),
|
| 2063 |
ankur.sing |
245 |
|
| 2113 |
ankur.sing |
246 |
/**
|
|
|
247 |
Checks if the item exists in VendorItemMapping for the given hotspot parameters (ProductGroup,Brand,ModelNumber,Color),
|
|
|
248 |
vendor and category.
|
|
|
249 |
Returns true if it exists else false.
|
|
|
250 |
*/
|
|
|
251 |
bool itemExists(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color, 5:i64 vendor_id, 6:string category),
|
|
|
252 |
|
|
|
253 |
/**
|
|
|
254 |
Adds vendor item mapping. Updates the key it the mapping already exists.
|
|
|
255 |
*/
|
|
|
256 |
void addVendorItemMapping(1:VendorItemMapping vendorItemMapping) throws (1:InventoryServiceException cex),
|
|
|
257 |
|
|
|
258 |
/**
|
|
|
259 |
Returns the list of vendor item mapping corresponding to itemId passed as parameter.
|
|
|
260 |
Raises an exception if item not found corresponding to itemId
|
|
|
261 |
*/
|
|
|
262 |
list<VendorItemMapping> getVendorItemMappings(1:i64 itemId) throws (1:InventoryServiceException cex),
|
|
|
263 |
|
|
|
264 |
/**
|
|
|
265 |
Checks if similar item exists (with same ProductGroup, Brand, ModelNumber, Color)
|
|
|
266 |
If yes, returns the itemId else returns 0
|
|
|
267 |
*/
|
| 2284 |
ankur.sing |
268 |
i64 checkSimilarItem(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color),
|
|
|
269 |
|
|
|
270 |
/**
|
|
|
271 |
Marks/Unmarks an item as risky. This flag is used for automatic marking of an item as INACTIVE in case of zero inventory.
|
|
|
272 |
*/
|
|
|
273 |
void changeItemRiskyFlag(1:i64 itemId, 2:bool risky)
|
| 85 |
ashish |
274 |
}
|
|
|
275 |
|