Subversion Repositories SmartDukaan

Rev

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