Subversion Repositories SmartDukaan

Rev

Rev 3086 | Rev 3323 | 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),
483 rajveer 165
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
2983 chandransh 166
 
103 ashish 167
	//all delete methods
121 ashish 168
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
103 ashish 169
 
170
	//Item management apis
121 ashish 171
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
172
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
173
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
85 ashish 174
	//Other accessor methods - added by Ashish
121 ashish 175
	Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 176
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
121 ashish 177
	list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
178
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
179
	ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 180
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
181
	//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
121 ashish 182
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
2076 rajveer 183
	bool markItemAsContentComplete(1:i64 entityId, 2:i64 category, 3:string brand, 4:string modelName, 5:string modelNumber) throws (1:InventoryServiceException cex),
646 chandransh 184
 
1157 rajveer 185
 
646 chandransh 186
	/**
187
	  Returns the id of the warehouse with the largest inventory of the item and the inventory size in the given locations.
188
	  The size of list will always be 2.
189
	 */
190
	list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
121 ashish 191
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
1343 chandransh 192
 
193
	/**
194
	 Returns the warehouse with the given id.
195
	*/
121 ashish 196
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
197
	list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
502 rajveer 198
	list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
199
 
862 chandransh 200
	/**
201
	 Increases the reservation count for an item in a warehouse. Should always succeed normally.
202
	*/
203
	bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
204
 
205
	/**
206
	 Decreases the reservation count for an item in a warehouse. Should always succeed normally.
207
	*/
208
	bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
209
 
502 rajveer 210
	// for home page .... best deals, best sellers and latest arrivals
588 chandransh 211
	list<Item> getBestSellers() throws (1:InventoryServiceException isex),
1924 rajveer 212
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 213
	i64 getBestSellersCount() throws (1:InventoryServiceException cex),
214
 
215
	list<Item> getBestDeals() throws (1:InventoryServiceException isex),
1924 rajveer 216
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 217
	i64 getBestDealsCount() throws (1:InventoryServiceException cex),
218
 
2975 chandransh 219
	/**
220
	Returns a list of items sorted in the descending order by start date.
221
	The list is limited to the 'latest_arrivals_count' configuraiton parameter.
222
	*/
588 chandransh 223
	list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
2975 chandransh 224
 
225
	/**
226
	Returns the list of catalog ids of latest arrivals in the given categories of the given brand.
227
	To ignore the categories, pass the list as empty. To ignore brand, pass it as null.   
228
	*/
229
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:list<i64> categories) throws (1:InventoryServiceException cex),
230
 
231
	/**
232
	Get the total number of latest arrivals we are willing to show.
233
	The count's upper bound is the 'latest_arrivals_count' configuraiton parameter.
234
	*/
632 rajveer 235
	i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
236
 
1157 rajveer 237
 
238
	i64 generateNewEntityID(),
239
 
240
	/**
1343 chandransh 241
	Returns the pricing information of an item associated with the vendor of the given warehouse.
242
	Raises an exception if either the item, vendor or the associated pricing information can't be found.
243
	*/
244
	VendorItemPricing getItemPricing(1:i64 itemId, 2:i64 warehouseId) throws (1:InventoryServiceException cex),
245
 
246
	/**
1157 rajveer 247
	* Store category object and retrieve it
248
	*/
1967 rajveer 249
	/**
632 rajveer 250
	bool putCategoryObject(1:binary object),
251
	binary getCategoryObject()
1967 rajveer 252
	*/
253
 
254
	/**
255
	* All category related functions
256
	*/
257
	bool addCategory(1:Category category),
258
	Category getCategory(1:i64 id),
1990 ankur.sing 259
	list<Category> getAllCategories(),
1967 rajveer 260
 
1990 ankur.sing 261
	/**
262
	Returns the list of vendor pricing information of an item.
263
	Raises an exception if item not found corresponding to itemId
264
	*/
265
	list<VendorItemPricing> getAllItemPricing(1:i64 itemId) throws (1:InventoryServiceException cex),
266
 
267
 
268
	/**
2113 ankur.sing 269
	Adds vendor prices corresponding to the item. If pricing already exists then updates the prices. 
1990 ankur.sing 270
	Raises an exception if either the item or vendor can't be found corresponding to their ids.
271
	*/
2113 ankur.sing 272
	void addVendorItemPricing(1:VendorItemPricing vendorItemPricing) throws (1:InventoryServiceException cex),
1990 ankur.sing 273
 
2063 ankur.sing 274
	/**
275
	Return list of all vendors
276
	*/
2113 ankur.sing 277
	list<Vendor> getAllVendors(), 
2063 ankur.sing 278
 
2113 ankur.sing 279
	/**
280
	Checks if the item exists in VendorItemMapping for the given hotspot parameters (ProductGroup,Brand,ModelNumber,Color),
281
	vendor and category.
282
	Returns true if it exists else false.
283
	*/
284
	bool itemExists(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color, 5:i64 vendor_id, 6:string category),
285
 
286
	/**
2356 ankur.sing 287
	Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.  
2113 ankur.sing 288
	*/
2356 ankur.sing 289
	void addVendorItemMapping(1:string key, 2:VendorItemMapping vendorItemMapping) throws (1:InventoryServiceException cex),
2113 ankur.sing 290
 
291
	/**
292
	Returns the list of vendor item mapping corresponding to itemId passed as parameter.
293
	Raises an exception if item not found corresponding to itemId
294
	*/
295
	list<VendorItemMapping> getVendorItemMappings(1:i64 itemId) throws (1:InventoryServiceException cex),
296
 
297
	/**
298
	Checks if similar item exists (with same ProductGroup, Brand, ModelNumber, Color)
299
	If yes, returns the itemId else returns 0
300
	*/
2284 ankur.sing 301
	i64 checkSimilarItem(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color),
302
 
303
	/**
304
	Marks/Unmarks an item as risky. This flag is used for automatic marking of an item as INACTIVE in case of zero inventory.
305
	*/
2356 ankur.sing 306
	void changeItemRiskyFlag(1:i64 itemId, 2:bool risky),
307
 
308
	/**
309
	Returns list of items marked as risky.
310
	*/
311
	list<Item> getItemsByRiskyFlag(),
312
 
313
	/**
314
	Returns list of items with any status except PHASED_OUT and filtered by vendor category.
315
	Raises exception if vendorCategory is null. 
316
	*/
2807 rajveer 317
	list<Item> getItemsByVendorCategory(1:string vendorCategory),
318
 
319
	/**
320
	Returns list of catalog ids of items with same similarity index as of the given itemId 
321
	*/
322
	list<i64> getSimilarItemsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 itemId),
3079 rajveer 323
 
324
	/**
325
	Add user requests for out of stock items. Once user will ask for notify me an entry will 
326
	*/
3086 rajveer 327
	bool addProductNotification(i64 itemId, string email),
3079 rajveer 328
 
3086 rajveer 329
	/**
330
		Send the product notifications to the users for items which has stock.
331
	*/
332
	bool sendProductNotifications()
3079 rajveer 333
 
85 ashish 334
}
335