Subversion Repositories SmartDukaan

Rev

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