Subversion Repositories SmartDukaan

Rev

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