Subversion Repositories SmartDukaan

Rev

Rev 6962 | Rev 7256 | 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
 
6805 anupam.sin 29
enum PremiumType {
30
    PERCENT = 1,
31
    ABSOLUTE = 2
32
}
33
 
85 ashish 34
struct Item{
35
	1:i64 id,
956 chandransh 36
	2:string productGroup
37
	3:string brand,
38
	4:string modelNumber,
2128 ankur.sing 39
	5:string modelName,
40
	6:string color,
41
	7:i64 category,
42
	8:string comments,
43
	9:i64 catalogItemId,
44
	10:i64 featureId,
45
	11:string featureDescription,
2127 ankur.sing 46
	13:optional double mrp, //maxmimum retail price
4762 phani.kuma 47
	14:optional double sellingPrice, //Selling price
48
	15:optional double weight,
49
	16:i64 addedOn,
50
	17:optional i64 startDate,
51
	18:optional i64 retireDate,
52
	19:status itemStatus,
53
	20:string status_description,
5324 rajveer 54
	21:map<string,string> otherInfo,
4762 phani.kuma 55
	22:string bestDealText,
56
	23:optional double bestDealValue,
57
	24:bool defaultForEntity,
58
	25:i64 updatedOn,
59
	26:optional i64 bestSellingRank,
60
	27:bool risky,
61
	28:optional i32 expectedDelay,
5440 phani.kuma 62
	29:optional bool isWarehousePreferenceSticky,
63
	30:i32 warrantyPeriod,
64
	31:optional i64 preferredVendor,
65
	32:ItemType type,
66
	33:optional i64 comingSoonStartDate,
67
	34:optional i64 expectedArrivalDate,
5460 phani.kuma 68
	35:bool hasItemNo,
6039 amit.gupta 69
	36:bool clearance,
6241 amit.gupta 70
	37:double vatPercentage,
6805 anupam.sin 71
	38:bool showSellingPrice,
6777 vikram.rag 72
	39:string bestDealsDetailsText,
73
	40:string bestDealsDetailsLink,
6805 anupam.sin 74
	41:i64 preferredInsurer
85 ashish 75
}
76
 
6805 anupam.sin 77
struct Insurer{
78
	1:i64 id,
79
	2:string name,
6903 anupam.sin 80
	3:string address,
81
	4:i64 declaredAmount,
82
	5:i64 creditedAmount
6805 anupam.sin 83
}
84
 
85
struct ItemInsurerMapping{
86
	1:i64 itemId,
87
	2:i64 insurer,
88
	3:PremiumType premiumType,
89
	4:double premiumValue
90
}
91
 
1967 rajveer 92
struct Category{
93
	1:i64 id,
94
	2:string label,
95
	3:string description,
96
	4:i64 parent_category_id,
97
	/**
98
	* This field should not be used.
99
	*/
100
	5:list<i64> children_category_ids
4762 phani.kuma 101
	6:string display_name
1967 rajveer 102
}
2113 ankur.sing 103
 
2983 chandransh 104
struct ItemShippingInfo{
105
	1:bool isActive,
106
	2:optional bool isRisky,
107
	3:optional i64 quantity
108
}
109
 
3556 rajveer 110
struct Source{
111
	1:i64 id,
112
	2:string name,
113
	3:string identifier
114
}
115
 
116
struct SourceItemPricing{
117
	1:i64 sourceId,
118
	2:i64 itemId,
119
	3:double mrp,
120
	4:double sellingPrice
121
}
122
 
4295 varun.gupt 123
struct ProductNotificationRequest	{
124
	1:Item item,
125
	2:string email,
126
	3:i64 addedOn
127
}
128
 
129
struct ProductNotificationRequestCount	{
130
	1:Item item,
131
	2:i64 count
132
}
133
 
5504 phani.kuma 134
struct VoucherItemMapping{
5512 rajveer 135
	1:i64 voucherType,
5504 phani.kuma 136
	2:i64 itemId,
137
	3:i64 amount
138
}
139
 
5945 mandeep.dh 140
exception CatalogServiceException{
85 ashish 141
	1:i64 id,
142
	2:string message
143
}
144
 
6511 kshitij.so 145
struct EntityTag {
146
    1:i64 entityId,
147
    2:string tag
148
}
149
 
6848 kshitij.so 150
struct Banner {
151
    1:string bannerName,
152
    2:string imageName,
153
    3:string link,
154
    4:i64 priority,
155
    5:bool isActive,
156
    6:bool hasMap
157
}
158
 
159
struct BannerMap {
160
    1:string bannerName,
161
    2:string mapLink,
162
    3:string coordinates
163
}
164
 
7190 amar.kumar 165
struct FreebieItem {
166
	1:i64 itemId,
167
	2:i64 freebieItemId
168
}
169
 
5945 mandeep.dh 170
service CatalogService extends GenericService.GenericService{
763 rajveer 171
 
85 ashish 172
/**
173
	Availability and inventory attributes	
174
*/
175
	//all add and update methods - added by Ashish
5945 mandeep.dh 176
	i64 addItem(1:Item item) throws (1:CatalogServiceException cex),
177
	i64 updateItem(1:Item item) throws (1:CatalogServiceException cex),
2983 chandransh 178
 
179
	/**
180
	Checks if the item given to the corresponding itemId is active. If it's active,
181
	whether it's risky and if it's risky, its inventory position.
182
	*/
5945 mandeep.dh 183
	ItemShippingInfo isActive(1:i64 itemId) throws (1:CatalogServiceException isex),
2983 chandransh 184
 
5945 mandeep.dh 185
	string getItemStatusDescription(1:i64 itemId) throws (1:CatalogServiceException isex),
3323 chandransh 186
 
103 ashish 187
	//Item management apis
5945 mandeep.dh 188
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:CatalogServiceException cex),
189
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:CatalogServiceException cex),
190
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:CatalogServiceException cex),
85 ashish 191
	//Other accessor methods - added by Ashish
5945 mandeep.dh 192
	Item getItem(1:i64 item_id) throws (1:CatalogServiceException cex),
193
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:CatalogServiceException cex),
194
	list<Item> getValidItemsByCatalogId(1:i64 catalog_item_id) throws  (1:CatalogServiceException cex),
195
	list<Item> getAllItems(1:bool isActive) throws (1:CatalogServiceException cex),
196
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:CatalogServiceException cex),
197
	bool markItemAsContentComplete(1:i64 entityId, 2:i64 category, 3:string brand, 4:string modelName, 5:string modelNumber) throws (1:CatalogServiceException cex),
646 chandransh 198
 
3355 chandransh 199
	/**
3848 chandransh 200
	Gets at most 'limit' items starting at the given offset. Returns an empty list if there are no more items at the given offset.
201
	*/
5945 mandeep.dh 202
	list<Item> getAllItemsInRange(1:i64 offset, 2:i64 limit) throws (1:CatalogServiceException cex),
3848 chandransh 203
 
204
	/**
205
	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.
206
	*/
5945 mandeep.dh 207
	list<Item> getAllItemsByStatusInRange(1:status itemStatus, 2:i64 offset, 3:i64 limit) throws (1:CatalogServiceException cex),
3848 chandransh 208
 
209
	/**
210
	Gets a count of all items by status
211
	*/
212
	i32 getItemCountByStatus(1:bool useStatus, 2:status itemStatus),
1157 rajveer 213
 
502 rajveer 214
	// for home page .... best deals, best sellers and latest arrivals
5945 mandeep.dh 215
	list<Item> getBestSellers() throws (1:CatalogServiceException isex),
216
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:CatalogServiceException cex),
217
	i64 getBestSellersCount() throws (1:CatalogServiceException cex),
588 chandransh 218
 
5945 mandeep.dh 219
	list<Item> getBestDeals() throws (1:CatalogServiceException isex),
220
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:CatalogServiceException cex),
221
	i64 getBestDealsCount() throws (1:CatalogServiceException cex),
5217 amit.gupta 222
 
5945 mandeep.dh 223
	list<Item> getComingSoon() throws (1:CatalogServiceException isex),
224
	list<i64> getComingSoonCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:CatalogServiceException cex),
225
	i64 getComingSoonCount() throws (1:CatalogServiceException cex),
588 chandransh 226
 
2975 chandransh 227
	/**
228
	Returns a list of items sorted in the descending order by start date.
229
	The list is limited to the 'latest_arrivals_count' configuraiton parameter.
230
	*/
5945 mandeep.dh 231
	list<Item> getLatestArrivals() throws (1:CatalogServiceException isex),
2975 chandransh 232
 
233
	/**
234
	Returns the list of catalog ids of latest arrivals in the given categories of the given brand.
235
	To ignore the categories, pass the list as empty. To ignore brand, pass it as null.   
236
	*/
5945 mandeep.dh 237
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:list<i64> categories) throws (1:CatalogServiceException cex),
2975 chandransh 238
 
239
	/**
240
	Get the total number of latest arrivals we are willing to show.
241
	The count's upper bound is the 'latest_arrivals_count' configuraiton parameter.
242
	*/
5945 mandeep.dh 243
	i64 getLatestArrivalsCount() throws (1:CatalogServiceException cex),
632 rajveer 244
 
1157 rajveer 245
 
246
	i64 generateNewEntityID(),
247
 
248
	/**
1967 rajveer 249
	* All category related functions
250
	*/
251
	bool addCategory(1:Category category),
252
	Category getCategory(1:i64 id),
1990 ankur.sing 253
	list<Category> getAllCategories(),
1967 rajveer 254
 
1990 ankur.sing 255
	/**
4423 phani.kuma 256
	Returns the list of similar items.
257
	*/
258
	list<Item> getAllSimilarItems(1:i64 itemId),
259
 
260
	/**
261
	Adds similar item.
262
	*/
5945 mandeep.dh 263
	Item addSimilarItem(1:i64 itemId, 2:i64 catalogItemId) throws (1:CatalogServiceException cex),
4423 phani.kuma 264
 
265
	/**
6511 kshitij.so 266
	Tag Related
267
	*/
268
 
269
	bool addTag(1:string displayName, 2:i64 itemId),
270
	bool deleteEntityTag(1:string displayName, 2:i64 itemId),
271
	bool deleteTag(1:string displayName),
272
	list<string> getAllTags(),
273
	list<i64> getAllEntitiesByTagName(1:string displayName)
6842 amit.gupta 274
	map<i64, list<string>> getAllEntityTags()
6511 kshitij.so 275
 
6850 kshitij.so 276
	bool addBanner(1:string bannerName 2:string imageName, 3:string link, 4:i64 priority, 5:bool isActive , 6:bool hasMap),
277
	list <string> getAllBanners(),
278
	bool deleteBanner(1:string bannerName),
279
	Banner getBannerDetails(1:string bannerName),
280
	list <Banner> getActiveBanners(),
6848 kshitij.so 281
	bool addBannerMap(1:string bannerName, 2:string mapLink, 3:string coordinates),
282
	bool deleteBannerMap(1:string bannerName),
283
	list <BannerMap> getBannerMapDetails(1:string bannerName),
6511 kshitij.so 284
	/**
4423 phani.kuma 285
	Delete similar item.
286
	*/
5945 mandeep.dh 287
	bool deleteSimilarItem(1:i64 itemId, 2:i64 catalogItemId) throws (1:CatalogServiceException cex),
4423 phani.kuma 288
 
289
	/**
4725 phani.kuma 290
	Checks if similar item exists (with same Brand, ModelNumber, ModelName, Color)
2113 ankur.sing 291
	If yes, returns the itemId else returns 0
292
	*/
4725 phani.kuma 293
	i64 checkSimilarItem(1:string brand, 2:string modelNumber, 3:string modelName, 4:string color),
2284 ankur.sing 294
 
295
	/**
5945 mandeep.dh 296
	Check wether item is risky and change status if inventory is not available for risky items
2284 ankur.sing 297
	*/
5945 mandeep.dh 298
	void validateRiskyStatus(1:i64 itemId),
2356 ankur.sing 299
 
300
	/**
5945 mandeep.dh 301
    Marks/Unmarks an item as risky. This flag is used for automatic marking of an item as INACTIVE in case of zero inventory.
302
    */
303
    void changeItemRiskyFlag(1:i64 itemId, 2:bool risky),
304
 
305
 
306
	/**
2356 ankur.sing 307
	Returns list of items marked as risky.
308
	*/
309
	list<Item> getItemsByRiskyFlag(),
310
 
311
	/**
4957 phani.kuma 312
	Returns list of items with any status except PHASED_OUT and filtered by category, brand.
2356 ankur.sing 313
	*/
4957 phani.kuma 314
	list<Item> getItemsForMasterSheet(1:string category, 2:string brand),
2807 rajveer 315
 
316
	/**
317
	Returns list of catalog ids of items with same similarity index as of the given itemId 
318
	*/
319
	list<i64> getSimilarItemsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 itemId),
3079 rajveer 320
 
321
	/**
322
	Add user requests for out of stock items. Once user will ask for notify me an entry will 
323
	*/
3086 rajveer 324
	bool addProductNotification(i64 itemId, string email),
3079 rajveer 325
 
3086 rajveer 326
	/**
327
		Send the product notifications to the users for items which has stock.
328
	*/
3348 varun.gupt 329
	bool sendProductNotifications(),
3079 rajveer 330
 
3348 varun.gupt 331
	/**
332
		Returns list of brand names for a given category Id
333
	*/
3556 rajveer 334
	list<string> getAllBrandsByCategory(1:i64 categoryId),
4957 phani.kuma 335
 
336
    /**
337
		Returns list of brand names
338
	*/
339
	list<string> getAllBrands(),
340
 
3556 rajveer 341
	/**
342
	Return list of all sources
343
	*/
344
	list<Source> getAllSources(), 
345
 
346
	/**
347
	Returns the pricing information of an item. If no information is found, exception will be thrown.
348
	*/
5945 mandeep.dh 349
	SourceItemPricing getItemPricingBySource(1:i64 itemId, 2:i64 sourceId) throws (1:CatalogServiceException cex),
3556 rajveer 350
 
351
	/**
352
	Adds prices to be displayed corresponding to the item if user comes from a source.
353
	If item is not found or source is not found, it will throw exception.
354
	*/
5945 mandeep.dh 355
	void addSourceItemPricing(1:SourceItemPricing sourceItemPricing) throws (1:CatalogServiceException cex),
3556 rajveer 356
 
357
	/**
358
	Returns the list of source pricing information of an item.
359
	Raises an exception if item not found corresponding to itemId
360
	*/
5945 mandeep.dh 361
	list<SourceItemPricing> getAllSourcePricing(1:i64 itemId) throws (1:CatalogServiceException cex),
3556 rajveer 362
 
363
	/**
364
	Get the item for a given itemId and sourceId. MRP and sellingPrice will be updated for source if we have different prices for source.
365
	*/
5945 mandeep.dh 366
	Item getItemForSource(1:i64 item_id, 2:optional i64  sourceId) throws (1:CatalogServiceException cex),
3872 chandransh 367
 
368
	/**
369
	Searches items matching the the given terms in the catalog and returns results within the specified range.
370
	*/
371
	list<Item> searchItemsInRange(1:list<string> searchTerms, 2:i64 offset, 3:i64 limit),
372
 
373
	/**
374
	Gets the count of search results for the given search terms so that the user can go through all the pages.
375
	*/
4024 chandransh 376
	i32 getSearchResultCount(1:list<string> searchTerms),
377
 
378
	/**
4295 varun.gupt 379
	Returns a list of product notifications added after a supplied datetime
380
	*/
381
	list<ProductNotificationRequest> getProductNotifications(1:i64 startDateTime),
382
 
383
	/**
384
	Returns a list of count of requests for product notification against each item
385
	*/
386
	list<ProductNotificationRequestCount> getProductNotificationRequestCount(1:i64 startDateTime)
4370 anupam.sin 387
 
388
	/**
4649 phani.kuma 389
	This method adds a log to authorize table with Item Id, username who authorized the change, reason.
390
	*/
5945 mandeep.dh 391
	bool addAuthorizationLog(1:i64 itemId, 2:string username, 3:string reason) throws (1:CatalogServiceException cex),
5336 rajveer 392
 
5945 mandeep.dh 393
    list<i64> getClearanceSaleCatalogIds() throws (1:CatalogServiceException cex),
5504 phani.kuma 394
 
5945 mandeep.dh 395
	bool addupdateVoucherForItem(1:i64 catalog_item_id, 2:i64 voucherType, 3:i64 voucherAmount) throws (1:CatalogServiceException cex),
5504 phani.kuma 396
 
5945 mandeep.dh 397
	bool deleteVoucherForItem(1:i64 catalog_item_id, 2:i64 voucherType) throws (1:CatalogServiceException cex),
5504 phani.kuma 398
 
5512 rajveer 399
	i64 getVoucherAmount(1:i64 itemId, 2:i64 voucherType),
5504 phani.kuma 400
 
401
	list<VoucherItemMapping> getAllItemVouchers(1:i64 itemId),
5586 phani.kuma 402
 
6039 amit.gupta 403
	bool isValidCatalogItemId(1:i64 catalog_item_id),
404
 
405
	double getVatPercentageForItem(1:i64 itemId, 2:double price),
6531 vikram.rag 406
 
407
	double getVatAmountForItem(1:i64 itemId, 2:double price),
408
 
6821 amar.kumar 409
	list<Item> getAllIgnoredInventoryUpdateItemsList(1:i32 offset,2:i32 limit),
410
 
411
	list<Item> getAllAliveItems();	
6805 anupam.sin 412
 
413
	/**
414
	This method returns the insurance amount needed to insure the given item for a given quantity.
415
	*/
6921 anupam.sin 416
	i64 getInsuranceAmount(1:i64 itemId, 2:double price, 3:i64 insurerId, 4:i64 quantity),
6805 anupam.sin 417
 
6921 anupam.sin 418
	Insurer getInsurer(1:i64 insurerId),
6838 vikram.rag 419
 
6962 rajveer 420
	list<Insurer> getAllInsurers(),
421
 
7190 amar.kumar 422
	void updateInsuranceDeclaredAmount(1:i64 insurerId, 2:double amount),
423
 
424
	i64 getFreebieForItem(1:i64 itemId),
425
 
426
	void addOrUpdateFreebieForItem(1:FreebieItem freebieItem)
5110 mandeep.dh 427
}