Subversion Repositories SmartDukaan

Rev

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