Subversion Repositories SmartDukaan

Rev

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