Subversion Repositories SmartDukaan

Rev

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