Subversion Repositories SmartDukaan

Rev

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