Subversion Repositories SmartDukaan

Rev

Rev 2841 | Rev 2983 | 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
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
 
2841 chandransh 32
enum BillingType {
33
	OURS = 0,
34
	EXTERNAL = 1
35
}
36
 
483 rajveer 37
/* 
38
Warehouse fields details
39
location: it is full address
40
vendorString: some key for the warehouse
41
*/
85 ashish 42
struct Warehouse{
43
	1:i64 id,
752 chandransh 44
	2:string displayName,
45
	3:string location,
46
	4:status warehouseStatus,
47
	5:i64 addedOn,
48
	6:i64 lastCheckedOn,
49
	7:string tinNumber,
50
	8:string pincode,
51
	9:string vendorString,
2824 chandransh 52
	10:WarehouseLocation logisticsLocation,
53
	11:string vendor,
2841 chandransh 54
	12:i64 vendorId,
55
	13:BillingType billingType
85 ashish 56
}
115 ashish 57
/* */
85 ashish 58
struct ItemInventory{
59
	1:i64 id,
483 rajveer 60
	2:map<i64,i64> availability
85 ashish 61
}
62
 
483 rajveer 63
 
85 ashish 64
struct ItemInventoryHistory{
65
	1:i64 item_id,
66
	2:i64 warehouse_id,
67
	3:i64 timestamp,
68
	4:i64 availability
69
}
70
 
71
struct Item{
72
	1:i64 id,
956 chandransh 73
	2:string productGroup
74
	3:string brand,
75
	4:string modelNumber,
2128 ankur.sing 76
	5:string modelName,
77
	6:string color,
78
	7:i64 category,
79
	8:string comments,
80
	9:i64 catalogItemId,
81
	10:i64 featureId,
82
	11:string featureDescription,
83
	12:ItemInventory itemInventory,
2127 ankur.sing 84
	13:optional double mrp, //maxmimum retail price
2491 ankur.sing 85
	14:optional double mop, //market operative price
2127 ankur.sing 86
	15:optional double sellingPrice, //Selling price
2491 ankur.sing 87
	16:optional double transferPrice,
2127 ankur.sing 88
	17:optional double weight,
2128 ankur.sing 89
	18:i64 addedOn,
2491 ankur.sing 90
	19:optional i64 startDate,
91
	20:optional i64 retireDate,
720 chandransh 92
	21:status itemStatus,
2128 ankur.sing 93
	22:string status_description,
94
	23:map<string,string> otherInfo,
95
	24:string bestDealText,
2127 ankur.sing 96
	25:optional double bestDealValue,
2491 ankur.sing 97
	26:optional double dealerPrice,
2128 ankur.sing 98
	27:bool defaultForEntity,
99
	28:i64 updatedOn,
2127 ankur.sing 100
	29:optional i64 bestSellingRank, 
2249 ankur.sing 101
	30:string hotspotCategory,
2807 rajveer 102
	31:bool risky,
103
	32:i64 similarityIndex
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
}
1967 rajveer 131
 
121 ashish 132
exception InventoryServiceException{
85 ashish 133
	1:i64 id,
134
	2:string message
135
}
136
 
121 ashish 137
service InventoryService{
763 rajveer 138
 
139
	/**
140
	* For closing the open session in sqlalchemy
141
	*/
142
	void closeSession(),
143
 
85 ashish 144
/**
145
	Availability and inventory attributes	
146
*/
147
	//all add and update methods - added by Ashish
123 ashish 148
	i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
149
	i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
121 ashish 150
	i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
632 rajveer 151
	bool isActive(1:i64 itemId) throws (1:InventoryServiceException isex),
2033 rajveer 152
	string getItemStatusDescription(1:i64 itemId) throws (1:InventoryServiceException isex),
483 rajveer 153
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
154
	// commented right now. write on based of requirement
155
	// void updatePrice(1:i64 item_id, 2:i64 warehouse_id, 3:double price) throws (1:InventoryServiceException cex),
103 ashish 156
	//all delete methods
121 ashish 157
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
103 ashish 158
 
159
	//Item management apis
121 ashish 160
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
161
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
162
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
85 ashish 163
	//Other accessor methods - added by Ashish
121 ashish 164
	Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 165
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
121 ashish 166
	list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
167
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
168
	ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 169
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
170
	//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
121 ashish 171
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
2076 rajveer 172
	bool markItemAsContentComplete(1:i64 entityId, 2:i64 category, 3:string brand, 4:string modelName, 5:string modelNumber) throws (1:InventoryServiceException cex),
646 chandransh 173
 
1157 rajveer 174
 
646 chandransh 175
	/**
176
	  Returns the id of the warehouse with the largest inventory of the item and the inventory size in the given locations.
177
	  The size of list will always be 2.
178
	 */
179
	list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
121 ashish 180
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
1343 chandransh 181
 
182
	/**
183
	 Returns the warehouse with the given id.
184
	*/
121 ashish 185
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
186
	list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
502 rajveer 187
	list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
188
 
862 chandransh 189
	/**
190
	 Increases the reservation count for an item in a warehouse. Should always succeed normally.
191
	*/
192
	bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
193
 
194
	/**
195
	 Decreases the reservation count for an item in a warehouse. Should always succeed normally.
196
	*/
197
	bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
198
 
502 rajveer 199
	// for home page .... best deals, best sellers and latest arrivals
588 chandransh 200
	list<Item> getBestSellers() throws (1:InventoryServiceException isex),
1924 rajveer 201
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 202
	i64 getBestSellersCount() throws (1:InventoryServiceException cex),
203
 
204
	list<Item> getBestDeals() throws (1:InventoryServiceException isex),
1924 rajveer 205
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 206
	i64 getBestDealsCount() throws (1:InventoryServiceException cex),
207
 
2975 chandransh 208
	/**
209
	Returns a list of items sorted in the descending order by start date.
210
	The list is limited to the 'latest_arrivals_count' configuraiton parameter.
211
	*/
588 chandransh 212
	list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
2975 chandransh 213
 
214
	/**
215
	Returns the list of catalog ids of latest arrivals in the given categories of the given brand.
216
	To ignore the categories, pass the list as empty. To ignore brand, pass it as null.   
217
	*/
218
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:list<i64> categories) throws (1:InventoryServiceException cex),
219
 
220
	/**
221
	Get the total number of latest arrivals we are willing to show.
222
	The count's upper bound is the 'latest_arrivals_count' configuraiton parameter.
223
	*/
632 rajveer 224
	i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
225
 
1157 rajveer 226
 
227
	i64 generateNewEntityID(),
228
 
229
	/**
1343 chandransh 230
	Returns the pricing information of an item associated with the vendor of the given warehouse.
231
	Raises an exception if either the item, vendor or the associated pricing information can't be found.
232
	*/
233
	VendorItemPricing getItemPricing(1:i64 itemId, 2:i64 warehouseId) throws (1:InventoryServiceException cex),
234
 
235
	/**
1157 rajveer 236
	* Store category object and retrieve it
237
	*/
1967 rajveer 238
	/**
632 rajveer 239
	bool putCategoryObject(1:binary object),
240
	binary getCategoryObject()
1967 rajveer 241
	*/
242
 
243
	/**
244
	* All category related functions
245
	*/
246
	bool addCategory(1:Category category),
247
	Category getCategory(1:i64 id),
1990 ankur.sing 248
	list<Category> getAllCategories(),
1967 rajveer 249
 
1990 ankur.sing 250
	/**
251
	Returns the list of vendor pricing information of an item.
252
	Raises an exception if item not found corresponding to itemId
253
	*/
254
	list<VendorItemPricing> getAllItemPricing(1:i64 itemId) throws (1:InventoryServiceException cex),
255
 
256
 
257
	/**
2113 ankur.sing 258
	Adds vendor prices corresponding to the item. If pricing already exists then updates the prices. 
1990 ankur.sing 259
	Raises an exception if either the item or vendor can't be found corresponding to their ids.
260
	*/
2113 ankur.sing 261
	void addVendorItemPricing(1:VendorItemPricing vendorItemPricing) throws (1:InventoryServiceException cex),
1990 ankur.sing 262
 
2063 ankur.sing 263
	/**
264
	Return list of all vendors
265
	*/
2113 ankur.sing 266
	list<Vendor> getAllVendors(), 
2063 ankur.sing 267
 
2113 ankur.sing 268
	/**
269
	Checks if the item exists in VendorItemMapping for the given hotspot parameters (ProductGroup,Brand,ModelNumber,Color),
270
	vendor and category.
271
	Returns true if it exists else false.
272
	*/
273
	bool itemExists(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color, 5:i64 vendor_id, 6:string category),
274
 
275
	/**
2356 ankur.sing 276
	Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.  
2113 ankur.sing 277
	*/
2356 ankur.sing 278
	void addVendorItemMapping(1:string key, 2:VendorItemMapping vendorItemMapping) throws (1:InventoryServiceException cex),
2113 ankur.sing 279
 
280
	/**
281
	Returns the list of vendor item mapping corresponding to itemId passed as parameter.
282
	Raises an exception if item not found corresponding to itemId
283
	*/
284
	list<VendorItemMapping> getVendorItemMappings(1:i64 itemId) throws (1:InventoryServiceException cex),
285
 
286
	/**
287
	Checks if similar item exists (with same ProductGroup, Brand, ModelNumber, Color)
288
	If yes, returns the itemId else returns 0
289
	*/
2284 ankur.sing 290
	i64 checkSimilarItem(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color),
291
 
292
	/**
293
	Marks/Unmarks an item as risky. This flag is used for automatic marking of an item as INACTIVE in case of zero inventory.
294
	*/
2356 ankur.sing 295
	void changeItemRiskyFlag(1:i64 itemId, 2:bool risky),
296
 
297
	/**
298
	Returns list of items marked as risky.
299
	*/
300
	list<Item> getItemsByRiskyFlag(),
301
 
302
	/**
303
	Returns list of items with any status except PHASED_OUT and filtered by vendor category.
304
	Raises exception if vendorCategory is null. 
305
	*/
2807 rajveer 306
	list<Item> getItemsByVendorCategory(1:string vendorCategory),
307
 
308
	/**
309
	Returns list of catalog ids of items with same similarity index as of the given itemId 
310
	*/
311
	list<i64> getSimilarItemsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 itemId),
85 ashish 312
}
313