Subversion Repositories SmartDukaan

Rev

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