Subversion Repositories SmartDukaan

Rev

Rev 5712 | Rev 6039 | 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
 
3374 rajveer 4
include "GenericService.thrift"
5
 
85 ashish 6
/**
7
	Objects
8
*/
9
 
123 ashish 10
/**
1330 chandransh 11
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 12
**/
5110 mandeep.dh 13
enum status {
123 ashish 14
	PHASED_OUT = 0,		//Item is no longer selling
15
	DELETED = 1,		//Item has been deliberately deleted 
3009 chandransh 16
	PAUSED = 2,			//Item's sale has been paused manually.
123 ashish 17
	ACTIVE = 3,			//Item is available for sale as of now
2984 rajveer 18
	IN_PROCESS = 4,		//Item has been added, but content is not available for the same
19
	CONTENT_COMPLETE = 5,  //The content for this item has been completed. We can start selling the item now.
5217 amit.gupta 20
	PAUSED_BY_RISK = 6,    //Item's sale has been automatically paused since it was marked as risky
21
	COMING_SOON= 7		//Item is now in Coming Soon Page and will move to ACTIVE gradually as it achieves the Start date.
103 ashish 22
}
23
 
5110 mandeep.dh 24
enum ItemType {
25
    SERIALIZED = 1,
26
    NON_SERIALIZED = 2
27
}
28
 
85 ashish 29
struct Item{
30
	1:i64 id,
956 chandransh 31
	2:string productGroup
32
	3:string brand,
33
	4:string modelNumber,
2128 ankur.sing 34
	5:string modelName,
35
	6:string color,
36
	7:i64 category,
37
	8:string comments,
38
	9:i64 catalogItemId,
39
	10:i64 featureId,
40
	11:string featureDescription,
2127 ankur.sing 41
	13:optional double mrp, //maxmimum retail price
4762 phani.kuma 42
	14:optional double sellingPrice, //Selling price
43
	15:optional double weight,
44
	16:i64 addedOn,
45
	17:optional i64 startDate,
46
	18:optional i64 retireDate,
47
	19:status itemStatus,
48
	20:string status_description,
5324 rajveer 49
	21:map<string,string> otherInfo,
4762 phani.kuma 50
	22:string bestDealText,
51
	23:optional double bestDealValue,
52
	24:bool defaultForEntity,
53
	25:i64 updatedOn,
54
	26:optional i64 bestSellingRank,
55
	27:bool risky,
56
	28:optional i32 expectedDelay,
5440 phani.kuma 57
	29:optional bool isWarehousePreferenceSticky,
58
	30:i32 warrantyPeriod,
59
	31:optional i64 preferredVendor,
60
	32:ItemType type,
61
	33:optional i64 comingSoonStartDate,
62
	34:optional i64 expectedArrivalDate,
5460 phani.kuma 63
	35:bool hasItemNo,
64
	36:bool clearance
85 ashish 65
}
66
 
1967 rajveer 67
struct Category{
68
	1:i64 id,
69
	2:string label,
70
	3:string description,
71
	4:i64 parent_category_id,
72
	/**
73
	* This field should not be used.
74
	*/
75
	5:list<i64> children_category_ids
4762 phani.kuma 76
	6:string display_name
1967 rajveer 77
}
2113 ankur.sing 78
 
2983 chandransh 79
struct ItemShippingInfo{
80
	1:bool isActive,
81
	2:optional bool isRisky,
82
	3:optional i64 quantity
83
}
84
 
3556 rajveer 85
struct Source{
86
	1:i64 id,
87
	2:string name,
88
	3:string identifier
89
}
90
 
91
struct SourceItemPricing{
92
	1:i64 sourceId,
93
	2:i64 itemId,
94
	3:double mrp,
95
	4:double sellingPrice
96
}
97
 
4295 varun.gupt 98
struct ProductNotificationRequest	{
99
	1:Item item,
100
	2:string email,
101
	3:i64 addedOn
102
}
103
 
104
struct ProductNotificationRequestCount	{
105
	1:Item item,
106
	2:i64 count
107
}
108
 
5504 phani.kuma 109
struct VoucherItemMapping{
5512 rajveer 110
	1:i64 voucherType,
5504 phani.kuma 111
	2:i64 itemId,
112
	3:i64 amount
113
}
114
 
5945 mandeep.dh 115
exception CatalogServiceException{
85 ashish 116
	1:i64 id,
117
	2:string message
118
}
119
 
5945 mandeep.dh 120
service CatalogService extends GenericService.GenericService{
763 rajveer 121
 
85 ashish 122
/**
123
	Availability and inventory attributes	
124
*/
125
	//all add and update methods - added by Ashish
5945 mandeep.dh 126
	i64 addItem(1:Item item) throws (1:CatalogServiceException cex),
127
	i64 updateItem(1:Item item) throws (1:CatalogServiceException cex),
2983 chandransh 128
 
129
	/**
130
	Checks if the item given to the corresponding itemId is active. If it's active,
131
	whether it's risky and if it's risky, its inventory position.
132
	*/
5945 mandeep.dh 133
	ItemShippingInfo isActive(1:i64 itemId) throws (1:CatalogServiceException isex),
2983 chandransh 134
 
5945 mandeep.dh 135
	string getItemStatusDescription(1:i64 itemId) throws (1:CatalogServiceException isex),
3323 chandransh 136
 
103 ashish 137
	//Item management apis
5945 mandeep.dh 138
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:CatalogServiceException cex),
139
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:CatalogServiceException cex),
140
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:CatalogServiceException cex),
85 ashish 141
	//Other accessor methods - added by Ashish
5945 mandeep.dh 142
	Item getItem(1:i64 item_id) throws (1:CatalogServiceException cex),
143
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:CatalogServiceException cex),
144
	list<Item> getValidItemsByCatalogId(1:i64 catalog_item_id) throws  (1:CatalogServiceException cex),
145
	list<Item> getAllItems(1:bool isActive) throws (1:CatalogServiceException cex),
146
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:CatalogServiceException cex),
147
	bool markItemAsContentComplete(1:i64 entityId, 2:i64 category, 3:string brand, 4:string modelName, 5:string modelNumber) throws (1:CatalogServiceException cex),
646 chandransh 148
 
3355 chandransh 149
	/**
3848 chandransh 150
	Gets at most 'limit' items starting at the given offset. Returns an empty list if there are no more items at the given offset.
151
	*/
5945 mandeep.dh 152
	list<Item> getAllItemsInRange(1:i64 offset, 2:i64 limit) throws (1:CatalogServiceException cex),
3848 chandransh 153
 
154
	/**
155
	Gets at most 'limit' items starting at the given offset in the given status. Returns an empty list if there are no more items at the given offset.
156
	*/
5945 mandeep.dh 157
	list<Item> getAllItemsByStatusInRange(1:status itemStatus, 2:i64 offset, 3:i64 limit) throws (1:CatalogServiceException cex),
3848 chandransh 158
 
159
	/**
160
	Gets a count of all items by status
161
	*/
162
	i32 getItemCountByStatus(1:bool useStatus, 2:status itemStatus),
1157 rajveer 163
 
502 rajveer 164
	// for home page .... best deals, best sellers and latest arrivals
5945 mandeep.dh 165
	list<Item> getBestSellers() throws (1:CatalogServiceException isex),
166
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:CatalogServiceException cex),
167
	i64 getBestSellersCount() throws (1:CatalogServiceException cex),
588 chandransh 168
 
5945 mandeep.dh 169
	list<Item> getBestDeals() throws (1:CatalogServiceException isex),
170
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:CatalogServiceException cex),
171
	i64 getBestDealsCount() throws (1:CatalogServiceException cex),
5217 amit.gupta 172
 
5945 mandeep.dh 173
	list<Item> getComingSoon() throws (1:CatalogServiceException isex),
174
	list<i64> getComingSoonCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:CatalogServiceException cex),
175
	i64 getComingSoonCount() throws (1:CatalogServiceException cex),
588 chandransh 176
 
2975 chandransh 177
	/**
178
	Returns a list of items sorted in the descending order by start date.
179
	The list is limited to the 'latest_arrivals_count' configuraiton parameter.
180
	*/
5945 mandeep.dh 181
	list<Item> getLatestArrivals() throws (1:CatalogServiceException isex),
2975 chandransh 182
 
183
	/**
184
	Returns the list of catalog ids of latest arrivals in the given categories of the given brand.
185
	To ignore the categories, pass the list as empty. To ignore brand, pass it as null.   
186
	*/
5945 mandeep.dh 187
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:list<i64> categories) throws (1:CatalogServiceException cex),
2975 chandransh 188
 
189
	/**
190
	Get the total number of latest arrivals we are willing to show.
191
	The count's upper bound is the 'latest_arrivals_count' configuraiton parameter.
192
	*/
5945 mandeep.dh 193
	i64 getLatestArrivalsCount() throws (1:CatalogServiceException cex),
632 rajveer 194
 
1157 rajveer 195
 
196
	i64 generateNewEntityID(),
197
 
198
	/**
1967 rajveer 199
	* All category related functions
200
	*/
201
	bool addCategory(1:Category category),
202
	Category getCategory(1:i64 id),
1990 ankur.sing 203
	list<Category> getAllCategories(),
1967 rajveer 204
 
1990 ankur.sing 205
	/**
4423 phani.kuma 206
	Returns the list of similar items.
207
	*/
208
	list<Item> getAllSimilarItems(1:i64 itemId),
209
 
210
	/**
211
	Adds similar item.
212
	*/
5945 mandeep.dh 213
	Item addSimilarItem(1:i64 itemId, 2:i64 catalogItemId) throws (1:CatalogServiceException cex),
4423 phani.kuma 214
 
215
	/**
216
	Delete similar item.
217
	*/
5945 mandeep.dh 218
	bool deleteSimilarItem(1:i64 itemId, 2:i64 catalogItemId) throws (1:CatalogServiceException cex),
4423 phani.kuma 219
 
220
	/**
4725 phani.kuma 221
	Checks if similar item exists (with same Brand, ModelNumber, ModelName, Color)
2113 ankur.sing 222
	If yes, returns the itemId else returns 0
223
	*/
4725 phani.kuma 224
	i64 checkSimilarItem(1:string brand, 2:string modelNumber, 3:string modelName, 4:string color),
2284 ankur.sing 225
 
226
	/**
5945 mandeep.dh 227
	Check wether item is risky and change status if inventory is not available for risky items
2284 ankur.sing 228
	*/
5945 mandeep.dh 229
	void validateRiskyStatus(1:i64 itemId),
2356 ankur.sing 230
 
231
	/**
5945 mandeep.dh 232
    Marks/Unmarks an item as risky. This flag is used for automatic marking of an item as INACTIVE in case of zero inventory.
233
    */
234
    void changeItemRiskyFlag(1:i64 itemId, 2:bool risky),
235
 
236
 
237
	/**
2356 ankur.sing 238
	Returns list of items marked as risky.
239
	*/
240
	list<Item> getItemsByRiskyFlag(),
241
 
242
	/**
4957 phani.kuma 243
	Returns list of items with any status except PHASED_OUT and filtered by category, brand.
2356 ankur.sing 244
	*/
4957 phani.kuma 245
	list<Item> getItemsForMasterSheet(1:string category, 2:string brand),
2807 rajveer 246
 
247
	/**
248
	Returns list of catalog ids of items with same similarity index as of the given itemId 
249
	*/
250
	list<i64> getSimilarItemsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 itemId),
3079 rajveer 251
 
252
	/**
253
	Add user requests for out of stock items. Once user will ask for notify me an entry will 
254
	*/
3086 rajveer 255
	bool addProductNotification(i64 itemId, string email),
3079 rajveer 256
 
3086 rajveer 257
	/**
258
		Send the product notifications to the users for items which has stock.
259
	*/
3348 varun.gupt 260
	bool sendProductNotifications(),
3079 rajveer 261
 
3348 varun.gupt 262
	/**
263
		Returns list of brand names for a given category Id
264
	*/
3556 rajveer 265
	list<string> getAllBrandsByCategory(1:i64 categoryId),
4957 phani.kuma 266
 
267
    /**
268
		Returns list of brand names
269
	*/
270
	list<string> getAllBrands(),
271
 
3556 rajveer 272
	/**
273
	Return list of all sources
274
	*/
275
	list<Source> getAllSources(), 
276
 
277
	/**
278
	Returns the pricing information of an item. If no information is found, exception will be thrown.
279
	*/
5945 mandeep.dh 280
	SourceItemPricing getItemPricingBySource(1:i64 itemId, 2:i64 sourceId) throws (1:CatalogServiceException cex),
3556 rajveer 281
 
282
	/**
283
	Adds prices to be displayed corresponding to the item if user comes from a source.
284
	If item is not found or source is not found, it will throw exception.
285
	*/
5945 mandeep.dh 286
	void addSourceItemPricing(1:SourceItemPricing sourceItemPricing) throws (1:CatalogServiceException cex),
3556 rajveer 287
 
288
	/**
289
	Returns the list of source pricing information of an item.
290
	Raises an exception if item not found corresponding to itemId
291
	*/
5945 mandeep.dh 292
	list<SourceItemPricing> getAllSourcePricing(1:i64 itemId) throws (1:CatalogServiceException cex),
3556 rajveer 293
 
294
	/**
295
	Get the item for a given itemId and sourceId. MRP and sellingPrice will be updated for source if we have different prices for source.
296
	*/
5945 mandeep.dh 297
	Item getItemForSource(1:i64 item_id, 2:optional i64  sourceId) throws (1:CatalogServiceException cex),
3872 chandransh 298
 
299
	/**
300
	Searches items matching the the given terms in the catalog and returns results within the specified range.
301
	*/
302
	list<Item> searchItemsInRange(1:list<string> searchTerms, 2:i64 offset, 3:i64 limit),
303
 
304
	/**
305
	Gets the count of search results for the given search terms so that the user can go through all the pages.
306
	*/
4024 chandransh 307
	i32 getSearchResultCount(1:list<string> searchTerms),
308
 
309
	/**
4295 varun.gupt 310
	Returns a list of product notifications added after a supplied datetime
311
	*/
312
	list<ProductNotificationRequest> getProductNotifications(1:i64 startDateTime),
313
 
314
	/**
315
	Returns a list of count of requests for product notification against each item
316
	*/
317
	list<ProductNotificationRequestCount> getProductNotificationRequestCount(1:i64 startDateTime)
4370 anupam.sin 318
 
319
	/**
4649 phani.kuma 320
	This method adds a log to authorize table with Item Id, username who authorized the change, reason.
321
	*/
5945 mandeep.dh 322
	bool addAuthorizationLog(1:i64 itemId, 2:string username, 3:string reason) throws (1:CatalogServiceException cex),
5336 rajveer 323
 
5945 mandeep.dh 324
    list<i64> getClearanceSaleCatalogIds() throws (1:CatalogServiceException cex),
5504 phani.kuma 325
 
5945 mandeep.dh 326
	bool addupdateVoucherForItem(1:i64 catalog_item_id, 2:i64 voucherType, 3:i64 voucherAmount) throws (1:CatalogServiceException cex),
5504 phani.kuma 327
 
5945 mandeep.dh 328
	bool deleteVoucherForItem(1:i64 catalog_item_id, 2:i64 voucherType) throws (1:CatalogServiceException cex),
5504 phani.kuma 329
 
5512 rajveer 330
	i64 getVoucherAmount(1:i64 itemId, 2:i64 voucherType),
5504 phani.kuma 331
 
332
	list<VoucherItemMapping> getAllItemVouchers(1:i64 itemId),
5586 phani.kuma 333
 
5945 mandeep.dh 334
	bool isValidCatalogItemId(1:i64 catalog_item_id)
5110 mandeep.dh 335
}