Subversion Repositories SmartDukaan

Rev

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