Subversion Repositories SmartDukaan

Rev

Rev 1349 | Rev 1924 | 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
 
4
/**
5
	Objects
6
*/
7
 
123 ashish 8
/**
1330 chandransh 9
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 10
**/
103 ashish 11
enum status{
123 ashish 12
	PHASED_OUT = 0,		//Item is no longer selling
13
	DELETED = 1,		//Item has been deliberately deleted 
14
	PAUSED = 2,			//Item's sale is currently paused
15
	ACTIVE = 3,			//Item is available for sale as of now
16
	IN_PROCESS = 4		//Item has been added, but content is not available for the same
720 chandransh 17
	CONTENT_COMPLETE = 5  //The content for this item has been completed. We can start selling the item now.
103 ashish 18
}
19
 
646 chandransh 20
enum WarehouseLocation{
1330 chandransh 21
	Mumbai = 0,
22
	Delhi = 1,
646 chandransh 23
	Bangalore = 2,
24
	Kolkata = 3
25
}
26
 
1330 chandransh 27
struct Vendor{
28
	1:i64 id,
29
	2:string name
30
}
31
 
483 rajveer 32
/* 
33
Warehouse fields details
34
location: it is full address
35
vendorString: some key for the warehouse
36
*/
85 ashish 37
struct Warehouse{
38
	1:i64 id,
752 chandransh 39
	2:string displayName,
40
	3:string location,
41
	4:status warehouseStatus,
42
	5:i64 addedOn,
43
	6:i64 lastCheckedOn,
44
	7:string tinNumber,
45
	8:string pincode,
46
	9:string vendorString,
47
	10:WarehouseLocation logisticsLocation
1330 chandransh 48
	11:string vendor
85 ashish 49
}
115 ashish 50
/* */
85 ashish 51
struct ItemInventory{
52
	1:i64 id,
483 rajveer 53
	2:map<i64,i64> availability
85 ashish 54
}
55
 
483 rajveer 56
 
85 ashish 57
struct ItemInventoryHistory{
58
	1:i64 item_id,
59
	2:i64 warehouse_id,
60
	3:i64 timestamp,
61
	4:i64 availability
62
}
63
 
64
struct Item{
65
	1:i64 id,
956 chandransh 66
	2:string productGroup
67
	3:string brand,
68
	4:string modelNumber,
69
	5:string modelName,
1330 chandransh 70
	6:string color,
71
	7:i64 category,
72
	8:string comments,
73
	9:i64 catalogItemId,
121 ashish 74
	10:i64 featureId,
75
	11:string featureDescription,
483 rajveer 76
	12:ItemInventory itemInventory,
77
	13:double mrp, //maxmimum retail price
78
	14:double mop, //market operative price
79
	15:double sellingPrice, //Selling price
1343 chandransh 80
	16:double transferPrice,
720 chandransh 81
	17:double weight,
82
	18:i64 addedOn,
83
	19:i64 startDate,
84
	20:i64 retireDate,
85
	21:status itemStatus,
86
	22:map<string,string> otherInfo,
87
	23:string bestDealText,
88
	24:double bestDealValue,
89
	25:double dealerPrice,
1910 varun.gupt 90
	26:bool defaultForEntity,
91
	27:i64 updatedOn
85 ashish 92
}
93
 
1343 chandransh 94
struct VendorItemPricing{
1349 chandransh 95
	1:i64 vendorId,
96
	2:i64 itemId,
1343 chandransh 97
	3:double transferPrice,
98
	4:double mop,
99
	5:double dealerPrice
100
}
101
 
121 ashish 102
exception InventoryServiceException{
85 ashish 103
	1:i64 id,
104
	2:string message
105
}
106
 
121 ashish 107
service InventoryService{
763 rajveer 108
 
109
	/**
110
	* For closing the open session in sqlalchemy
111
	*/
112
	void closeSession(),
113
 
85 ashish 114
/**
115
	Availability and inventory attributes	
116
*/
117
	//all add and update methods - added by Ashish
123 ashish 118
	i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
119
	i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
121 ashish 120
	i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
632 rajveer 121
	bool isActive(1:i64 itemId) throws (1:InventoryServiceException isex),
483 rajveer 122
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
123
	// commented right now. write on based of requirement
124
	// void updatePrice(1:i64 item_id, 2:i64 warehouse_id, 3:double price) throws (1:InventoryServiceException cex),
103 ashish 125
	//all delete methods
121 ashish 126
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
103 ashish 127
 
128
	//Item management apis
121 ashish 129
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
130
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
131
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
85 ashish 132
	//Other accessor methods - added by Ashish
121 ashish 133
	Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 134
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
121 ashish 135
	list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
136
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
137
	ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 138
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
139
	//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
121 ashish 140
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
720 chandransh 141
	bool markItemAsContentComplete(1:i64 entityId) throws (1:InventoryServiceException cex),
646 chandransh 142
 
1157 rajveer 143
 
646 chandransh 144
	/**
145
	  Returns the id of the warehouse with the largest inventory of the item and the inventory size in the given locations.
146
	  The size of list will always be 2.
147
	 */
148
	list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
121 ashish 149
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
1343 chandransh 150
 
151
	/**
152
	 Returns the warehouse with the given id.
153
	*/
121 ashish 154
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
155
	list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
502 rajveer 156
	list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
157
 
862 chandransh 158
	/**
159
	 Increases the reservation count for an item in a warehouse. Should always succeed normally.
160
	*/
161
	bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
162
 
163
	/**
164
	 Decreases the reservation count for an item in a warehouse. Should always succeed normally.
165
	*/
166
	bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
167
 
502 rajveer 168
	// for home page .... best deals, best sellers and latest arrivals
588 chandransh 169
	list<Item> getBestSellers() throws (1:InventoryServiceException isex),
623 chandransh 170
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 171
	i64 getBestSellersCount() throws (1:InventoryServiceException cex),
172
 
173
	list<Item> getBestDeals() throws (1:InventoryServiceException isex),
623 chandransh 174
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 175
	i64 getBestDealsCount() throws (1:InventoryServiceException cex),
176
 
177
	list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
623 chandransh 178
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 category) throws (1:InventoryServiceException cex),
632 rajveer 179
	i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
180
 
1157 rajveer 181
 
182
	i64 generateNewEntityID(),
183
 
184
	/**
1343 chandransh 185
	Returns the pricing information of an item associated with the vendor of the given warehouse.
186
	Raises an exception if either the item, vendor or the associated pricing information can't be found.
187
	*/
188
	VendorItemPricing getItemPricing(1:i64 itemId, 2:i64 warehouseId) throws (1:InventoryServiceException cex),
189
 
190
	/**
1157 rajveer 191
	* Store category object and retrieve it
192
	*/
632 rajveer 193
	bool putCategoryObject(1:binary object),
194
	binary getCategoryObject()
85 ashish 195
}
196