Subversion Repositories SmartDukaan

Rev

Rev 3323 | Rev 3355 | 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,
3089 rajveer 103
	31:bool risky
85 ashish 104
}
105
 
1343 chandransh 106
struct VendorItemPricing{
1349 chandransh 107
	1:i64 vendorId,
108
	2:i64 itemId,
1343 chandransh 109
	3:double transferPrice,
110
	4:double mop,
111
	5:double dealerPrice
112
}
113
 
1967 rajveer 114
struct Category{
115
	1:i64 id,
116
	2:string label,
117
	3:string description,
118
	4:i64 parent_category_id,
119
	/**
120
	* This field should not be used.
121
	*/
122
	5:list<i64> children_category_ids
123
}
2113 ankur.sing 124
 
125
struct VendorItemMapping{
126
	1:i64 vendorId,
127
	2:string itemKey,
128
	3:i64 itemId,
129
	4:string vendorCategory
130
}
2983 chandransh 131
 
132
struct ItemShippingInfo{
133
	1:bool isActive,
134
	2:optional bool isRisky,
135
	3:optional i64 quantity
136
}
137
 
121 ashish 138
exception InventoryServiceException{
85 ashish 139
	1:i64 id,
140
	2:string message
141
}
142
 
121 ashish 143
service InventoryService{
763 rajveer 144
 
145
	/**
146
	* For closing the open session in sqlalchemy
147
	*/
148
	void closeSession(),
149
 
85 ashish 150
/**
151
	Availability and inventory attributes	
152
*/
153
	//all add and update methods - added by Ashish
123 ashish 154
	i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
155
	i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
121 ashish 156
	i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
2983 chandransh 157
 
158
	/**
159
	Checks if the item given to the corresponding itemId is active. If it's active,
160
	whether it's risky and if it's risky, its inventory position.
161
	*/
162
	ItemShippingInfo isActive(1:i64 itemId) throws (1:InventoryServiceException isex),
163
 
2033 rajveer 164
	string getItemStatusDescription(1:i64 itemId) throws (1:InventoryServiceException isex),
3323 chandransh 165
 
166
	/**
167
	Stores the incremental warehouse updates of items.
168
	*/
169
	void updateInventoryHistory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
170
 
171
	/**
172
	Stores the final inventory stocks of items.
173
	*/
483 rajveer 174
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
2983 chandransh 175
 
103 ashish 176
	//all delete methods
121 ashish 177
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
103 ashish 178
 
179
	//Item management apis
121 ashish 180
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
181
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
182
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
85 ashish 183
	//Other accessor methods - added by Ashish
121 ashish 184
	Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 185
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
121 ashish 186
	list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
187
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
188
	ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 189
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
190
	//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
121 ashish 191
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
2076 rajveer 192
	bool markItemAsContentComplete(1:i64 entityId, 2:i64 category, 3:string brand, 4:string modelName, 5:string modelNumber) throws (1:InventoryServiceException cex),
646 chandransh 193
 
1157 rajveer 194
 
646 chandransh 195
	/**
196
	  Returns the id of the warehouse with the largest inventory of the item and the inventory size in the given locations.
197
	  The size of list will always be 2.
198
	 */
199
	list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
121 ashish 200
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
1343 chandransh 201
 
202
	/**
203
	 Returns the warehouse with the given id.
204
	*/
121 ashish 205
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
206
	list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
502 rajveer 207
	list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
208
 
862 chandransh 209
	/**
210
	 Increases the reservation count for an item in a warehouse. Should always succeed normally.
211
	*/
212
	bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
213
 
214
	/**
215
	 Decreases the reservation count for an item in a warehouse. Should always succeed normally.
216
	*/
217
	bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
218
 
502 rajveer 219
	// for home page .... best deals, best sellers and latest arrivals
588 chandransh 220
	list<Item> getBestSellers() throws (1:InventoryServiceException isex),
1924 rajveer 221
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 222
	i64 getBestSellersCount() throws (1:InventoryServiceException cex),
223
 
224
	list<Item> getBestDeals() throws (1:InventoryServiceException isex),
1924 rajveer 225
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 226
	i64 getBestDealsCount() throws (1:InventoryServiceException cex),
227
 
2975 chandransh 228
	/**
229
	Returns a list of items sorted in the descending order by start date.
230
	The list is limited to the 'latest_arrivals_count' configuraiton parameter.
231
	*/
588 chandransh 232
	list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
2975 chandransh 233
 
234
	/**
235
	Returns the list of catalog ids of latest arrivals in the given categories of the given brand.
236
	To ignore the categories, pass the list as empty. To ignore brand, pass it as null.   
237
	*/
238
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:list<i64> categories) throws (1:InventoryServiceException cex),
239
 
240
	/**
241
	Get the total number of latest arrivals we are willing to show.
242
	The count's upper bound is the 'latest_arrivals_count' configuraiton parameter.
243
	*/
632 rajveer 244
	i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
245
 
1157 rajveer 246
 
247
	i64 generateNewEntityID(),
248
 
249
	/**
1343 chandransh 250
	Returns the pricing information of an item associated with the vendor of the given warehouse.
251
	Raises an exception if either the item, vendor or the associated pricing information can't be found.
252
	*/
253
	VendorItemPricing getItemPricing(1:i64 itemId, 2:i64 warehouseId) throws (1:InventoryServiceException cex),
254
 
255
	/**
1157 rajveer 256
	* Store category object and retrieve it
257
	*/
1967 rajveer 258
	/**
632 rajveer 259
	bool putCategoryObject(1:binary object),
260
	binary getCategoryObject()
1967 rajveer 261
	*/
262
 
263
	/**
264
	* All category related functions
265
	*/
266
	bool addCategory(1:Category category),
267
	Category getCategory(1:i64 id),
1990 ankur.sing 268
	list<Category> getAllCategories(),
1967 rajveer 269
 
1990 ankur.sing 270
	/**
271
	Returns the list of vendor pricing information of an item.
272
	Raises an exception if item not found corresponding to itemId
273
	*/
274
	list<VendorItemPricing> getAllItemPricing(1:i64 itemId) throws (1:InventoryServiceException cex),
275
 
276
 
277
	/**
2113 ankur.sing 278
	Adds vendor prices corresponding to the item. If pricing already exists then updates the prices. 
1990 ankur.sing 279
	Raises an exception if either the item or vendor can't be found corresponding to their ids.
280
	*/
2113 ankur.sing 281
	void addVendorItemPricing(1:VendorItemPricing vendorItemPricing) throws (1:InventoryServiceException cex),
1990 ankur.sing 282
 
2063 ankur.sing 283
	/**
284
	Return list of all vendors
285
	*/
2113 ankur.sing 286
	list<Vendor> getAllVendors(), 
2063 ankur.sing 287
 
2113 ankur.sing 288
	/**
289
	Checks if the item exists in VendorItemMapping for the given hotspot parameters (ProductGroup,Brand,ModelNumber,Color),
290
	vendor and category.
291
	Returns true if it exists else false.
292
	*/
293
	bool itemExists(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color, 5:i64 vendor_id, 6:string category),
294
 
295
	/**
2356 ankur.sing 296
	Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.  
2113 ankur.sing 297
	*/
2356 ankur.sing 298
	void addVendorItemMapping(1:string key, 2:VendorItemMapping vendorItemMapping) throws (1:InventoryServiceException cex),
2113 ankur.sing 299
 
300
	/**
301
	Returns the list of vendor item mapping corresponding to itemId passed as parameter.
302
	Raises an exception if item not found corresponding to itemId
303
	*/
304
	list<VendorItemMapping> getVendorItemMappings(1:i64 itemId) throws (1:InventoryServiceException cex),
305
 
306
	/**
307
	Checks if similar item exists (with same ProductGroup, Brand, ModelNumber, Color)
308
	If yes, returns the itemId else returns 0
309
	*/
2284 ankur.sing 310
	i64 checkSimilarItem(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color),
311
 
312
	/**
313
	Marks/Unmarks an item as risky. This flag is used for automatic marking of an item as INACTIVE in case of zero inventory.
314
	*/
2356 ankur.sing 315
	void changeItemRiskyFlag(1:i64 itemId, 2:bool risky),
316
 
317
	/**
318
	Returns list of items marked as risky.
319
	*/
320
	list<Item> getItemsByRiskyFlag(),
321
 
322
	/**
323
	Returns list of items with any status except PHASED_OUT and filtered by vendor category.
324
	Raises exception if vendorCategory is null. 
325
	*/
2807 rajveer 326
	list<Item> getItemsByVendorCategory(1:string vendorCategory),
327
 
328
	/**
329
	Returns list of catalog ids of items with same similarity index as of the given itemId 
330
	*/
331
	list<i64> getSimilarItemsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 itemId),
3079 rajveer 332
 
333
	/**
334
	Add user requests for out of stock items. Once user will ask for notify me an entry will 
335
	*/
3086 rajveer 336
	bool addProductNotification(i64 itemId, string email),
3079 rajveer 337
 
3086 rajveer 338
	/**
339
		Send the product notifications to the users for items which has stock.
340
	*/
3348 varun.gupt 341
	bool sendProductNotifications(),
3079 rajveer 342
 
3348 varun.gupt 343
	/**
344
		Returns list of brand names for a given category Id
345
	*/
346
	list<string> getAllBrandsByCategory(1:i64 categoryId)
85 ashish 347
}
348