Subversion Repositories SmartDukaan

Rev

Rev 3355 | Rev 3361 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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 
3009 chandransh 14
	PAUSED = 2,			//Item's sale has been paused manually.
123 ashish 15
	ACTIVE = 3,			//Item is available for sale as of now
2984 rajveer 16
	IN_PROCESS = 4,		//Item has been added, but content is not available for the same
17
	CONTENT_COMPLETE = 5,  //The content for this item has been completed. We can start selling the item now.
3009 chandransh 18
	PAUSED_BY_RISK = 6    //Item's sale has been automatically paused since it was marked as risky
103 ashish 19
}
20
 
646 chandransh 21
enum WarehouseLocation{
1330 chandransh 22
	Mumbai = 0,
23
	Delhi = 1,
646 chandransh 24
	Bangalore = 2,
25
	Kolkata = 3
26
}
27
 
1330 chandransh 28
struct Vendor{
29
	1:i64 id,
30
	2:string name
31
}
32
 
2841 chandransh 33
enum BillingType {
34
	OURS = 0,
35
	EXTERNAL = 1
36
}
37
 
483 rajveer 38
/* 
39
Warehouse fields details
40
location: it is full address
41
vendorString: some key for the warehouse
42
*/
85 ashish 43
struct Warehouse{
44
	1:i64 id,
752 chandransh 45
	2:string displayName,
46
	3:string location,
47
	4:status warehouseStatus,
48
	5:i64 addedOn,
49
	6:i64 lastCheckedOn,
50
	7:string tinNumber,
51
	8:string pincode,
52
	9:string vendorString,
2824 chandransh 53
	10:WarehouseLocation logisticsLocation,
54
	11:string vendor,
2841 chandransh 55
	12:i64 vendorId,
56
	13:BillingType billingType
85 ashish 57
}
115 ashish 58
/* */
85 ashish 59
struct ItemInventory{
60
	1:i64 id,
483 rajveer 61
	2:map<i64,i64> availability
85 ashish 62
}
63
 
483 rajveer 64
 
85 ashish 65
struct ItemInventoryHistory{
66
	1:i64 item_id,
67
	2:i64 warehouse_id,
68
	3:i64 timestamp,
69
	4:i64 availability
70
}
71
 
72
struct Item{
73
	1:i64 id,
956 chandransh 74
	2:string productGroup
75
	3:string brand,
76
	4:string modelNumber,
2128 ankur.sing 77
	5:string modelName,
78
	6:string color,
79
	7:i64 category,
80
	8:string comments,
81
	9:i64 catalogItemId,
82
	10:i64 featureId,
83
	11:string featureDescription,
84
	12:ItemInventory itemInventory,
2127 ankur.sing 85
	13:optional double mrp, //maxmimum retail price
2491 ankur.sing 86
	14:optional double mop, //market operative price
2127 ankur.sing 87
	15:optional double sellingPrice, //Selling price
2491 ankur.sing 88
	16:optional double transferPrice,
2127 ankur.sing 89
	17:optional double weight,
2128 ankur.sing 90
	18:i64 addedOn,
2491 ankur.sing 91
	19:optional i64 startDate,
92
	20:optional i64 retireDate,
720 chandransh 93
	21:status itemStatus,
2128 ankur.sing 94
	22:string status_description,
95
	23:map<string,string> otherInfo,
96
	24:string bestDealText,
2127 ankur.sing 97
	25:optional double bestDealValue,
2491 ankur.sing 98
	26:optional double dealerPrice,
2128 ankur.sing 99
	27:bool defaultForEntity,
100
	28:i64 updatedOn,
2127 ankur.sing 101
	29:optional i64 bestSellingRank, 
2249 ankur.sing 102
	30:string hotspotCategory,
3355 chandransh 103
	31:bool risky,
3359 chandransh 104
	32:optional i32 expectedDelay,
105
	33:optional i64 preferredWarehouse
85 ashish 106
}
107
 
1343 chandransh 108
struct VendorItemPricing{
1349 chandransh 109
	1:i64 vendorId,
110
	2:i64 itemId,
1343 chandransh 111
	3:double transferPrice,
112
	4:double mop,
113
	5:double dealerPrice
114
}
115
 
1967 rajveer 116
struct Category{
117
	1:i64 id,
118
	2:string label,
119
	3:string description,
120
	4:i64 parent_category_id,
121
	/**
122
	* This field should not be used.
123
	*/
124
	5:list<i64> children_category_ids
125
}
2113 ankur.sing 126
 
127
struct VendorItemMapping{
128
	1:i64 vendorId,
129
	2:string itemKey,
130
	3:i64 itemId,
131
	4:string vendorCategory
132
}
2983 chandransh 133
 
134
struct ItemShippingInfo{
135
	1:bool isActive,
136
	2:optional bool isRisky,
137
	3:optional i64 quantity
138
}
139
 
121 ashish 140
exception InventoryServiceException{
85 ashish 141
	1:i64 id,
142
	2:string message
143
}
144
 
121 ashish 145
service InventoryService{
763 rajveer 146
 
147
	/**
148
	* For closing the open session in sqlalchemy
149
	*/
150
	void closeSession(),
151
 
85 ashish 152
/**
153
	Availability and inventory attributes	
154
*/
155
	//all add and update methods - added by Ashish
123 ashish 156
	i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
157
	i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
121 ashish 158
	i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
2983 chandransh 159
 
160
	/**
161
	Checks if the item given to the corresponding itemId is active. If it's active,
162
	whether it's risky and if it's risky, its inventory position.
163
	*/
164
	ItemShippingInfo isActive(1:i64 itemId) throws (1:InventoryServiceException isex),
165
 
2033 rajveer 166
	string getItemStatusDescription(1:i64 itemId) throws (1:InventoryServiceException isex),
3323 chandransh 167
 
168
	/**
169
	Stores the incremental warehouse updates of items.
170
	*/
171
	void updateInventoryHistory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
172
 
173
	/**
174
	Stores the final inventory stocks of items.
175
	*/
483 rajveer 176
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
2983 chandransh 177
 
103 ashish 178
	//all delete methods
121 ashish 179
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
103 ashish 180
 
181
	//Item management apis
121 ashish 182
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
183
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
184
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
85 ashish 185
	//Other accessor methods - added by Ashish
121 ashish 186
	Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 187
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
121 ashish 188
	list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
189
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
190
	ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 191
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
192
	//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
121 ashish 193
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
2076 rajveer 194
	bool markItemAsContentComplete(1:i64 entityId, 2:i64 category, 3:string brand, 4:string modelName, 5:string modelNumber) throws (1:InventoryServiceException cex),
646 chandransh 195
 
3355 chandransh 196
	/**
197
	Determines the warehouse that should be used to fulfil an order for the given item.
198
	It first checks all the warehouses which are in the logistics location given by the
199
	warehouse_loc parameter. If none of the warehouses there have any inventory, then the
200
	preferred warehouse for the item is used. 
1157 rajveer 201
 
3355 chandransh 202
	Returns an ordered list of size 4 with following elements in the given order:
203
	1. Logistics location of the warehouse which was finally picked up to ship the order.  
204
	2. Id of the warehouse which was finally picked up.
205
	3. Inventory size in the selected warehouse.
206
	4. Expected delay added by the category manager.
646 chandransh 207
	 */
208
	list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
3355 chandransh 209
 
121 ashish 210
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
1343 chandransh 211
 
212
	/**
213
	 Returns the warehouse with the given id.
214
	*/
121 ashish 215
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
216
	list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
502 rajveer 217
	list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
218
 
862 chandransh 219
	/**
220
	 Increases the reservation count for an item in a warehouse. Should always succeed normally.
221
	*/
222
	bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
223
 
224
	/**
225
	 Decreases the reservation count for an item in a warehouse. Should always succeed normally.
226
	*/
227
	bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
228
 
502 rajveer 229
	// for home page .... best deals, best sellers and latest arrivals
588 chandransh 230
	list<Item> getBestSellers() throws (1:InventoryServiceException isex),
1924 rajveer 231
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 232
	i64 getBestSellersCount() throws (1:InventoryServiceException cex),
233
 
234
	list<Item> getBestDeals() throws (1:InventoryServiceException isex),
1924 rajveer 235
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 236
	i64 getBestDealsCount() throws (1:InventoryServiceException cex),
237
 
2975 chandransh 238
	/**
239
	Returns a list of items sorted in the descending order by start date.
240
	The list is limited to the 'latest_arrivals_count' configuraiton parameter.
241
	*/
588 chandransh 242
	list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
2975 chandransh 243
 
244
	/**
245
	Returns the list of catalog ids of latest arrivals in the given categories of the given brand.
246
	To ignore the categories, pass the list as empty. To ignore brand, pass it as null.   
247
	*/
248
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:list<i64> categories) throws (1:InventoryServiceException cex),
249
 
250
	/**
251
	Get the total number of latest arrivals we are willing to show.
252
	The count's upper bound is the 'latest_arrivals_count' configuraiton parameter.
253
	*/
632 rajveer 254
	i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
255
 
1157 rajveer 256
 
257
	i64 generateNewEntityID(),
258
 
259
	/**
1343 chandransh 260
	Returns the pricing information of an item associated with the vendor of the given warehouse.
261
	Raises an exception if either the item, vendor or the associated pricing information can't be found.
262
	*/
263
	VendorItemPricing getItemPricing(1:i64 itemId, 2:i64 warehouseId) throws (1:InventoryServiceException cex),
264
 
265
	/**
1157 rajveer 266
	* Store category object and retrieve it
267
	*/
1967 rajveer 268
	/**
632 rajveer 269
	bool putCategoryObject(1:binary object),
270
	binary getCategoryObject()
1967 rajveer 271
	*/
272
 
273
	/**
274
	* All category related functions
275
	*/
276
	bool addCategory(1:Category category),
277
	Category getCategory(1:i64 id),
1990 ankur.sing 278
	list<Category> getAllCategories(),
1967 rajveer 279
 
1990 ankur.sing 280
	/**
281
	Returns the list of vendor pricing information of an item.
282
	Raises an exception if item not found corresponding to itemId
283
	*/
284
	list<VendorItemPricing> getAllItemPricing(1:i64 itemId) throws (1:InventoryServiceException cex),
285
 
286
 
287
	/**
2113 ankur.sing 288
	Adds vendor prices corresponding to the item. If pricing already exists then updates the prices. 
1990 ankur.sing 289
	Raises an exception if either the item or vendor can't be found corresponding to their ids.
290
	*/
2113 ankur.sing 291
	void addVendorItemPricing(1:VendorItemPricing vendorItemPricing) throws (1:InventoryServiceException cex),
1990 ankur.sing 292
 
2063 ankur.sing 293
	/**
294
	Return list of all vendors
295
	*/
2113 ankur.sing 296
	list<Vendor> getAllVendors(), 
2063 ankur.sing 297
 
2113 ankur.sing 298
	/**
299
	Checks if the item exists in VendorItemMapping for the given hotspot parameters (ProductGroup,Brand,ModelNumber,Color),
300
	vendor and category.
301
	Returns true if it exists else false.
302
	*/
303
	bool itemExists(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color, 5:i64 vendor_id, 6:string category),
304
 
305
	/**
2356 ankur.sing 306
	Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.  
2113 ankur.sing 307
	*/
2356 ankur.sing 308
	void addVendorItemMapping(1:string key, 2:VendorItemMapping vendorItemMapping) throws (1:InventoryServiceException cex),
2113 ankur.sing 309
 
310
	/**
311
	Returns the list of vendor item mapping corresponding to itemId passed as parameter.
312
	Raises an exception if item not found corresponding to itemId
313
	*/
314
	list<VendorItemMapping> getVendorItemMappings(1:i64 itemId) throws (1:InventoryServiceException cex),
315
 
316
	/**
317
	Checks if similar item exists (with same ProductGroup, Brand, ModelNumber, Color)
318
	If yes, returns the itemId else returns 0
319
	*/
2284 ankur.sing 320
	i64 checkSimilarItem(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color),
321
 
322
	/**
323
	Marks/Unmarks an item as risky. This flag is used for automatic marking of an item as INACTIVE in case of zero inventory.
324
	*/
2356 ankur.sing 325
	void changeItemRiskyFlag(1:i64 itemId, 2:bool risky),
326
 
327
	/**
328
	Returns list of items marked as risky.
329
	*/
330
	list<Item> getItemsByRiskyFlag(),
331
 
332
	/**
333
	Returns list of items with any status except PHASED_OUT and filtered by vendor category.
334
	Raises exception if vendorCategory is null. 
335
	*/
2807 rajveer 336
	list<Item> getItemsByVendorCategory(1:string vendorCategory),
337
 
338
	/**
339
	Returns list of catalog ids of items with same similarity index as of the given itemId 
340
	*/
341
	list<i64> getSimilarItemsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 itemId),
3079 rajveer 342
 
343
	/**
344
	Add user requests for out of stock items. Once user will ask for notify me an entry will 
345
	*/
3086 rajveer 346
	bool addProductNotification(i64 itemId, string email),
3079 rajveer 347
 
3086 rajveer 348
	/**
349
		Send the product notifications to the users for items which has stock.
350
	*/
3348 varun.gupt 351
	bool sendProductNotifications(),
3079 rajveer 352
 
3348 varun.gupt 353
	/**
354
		Returns list of brand names for a given category Id
355
	*/
356
	list<string> getAllBrandsByCategory(1:i64 categoryId)
85 ashish 357
}
358