Subversion Repositories SmartDukaan

Rev

Rev 763 | Rev 956 | 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,
510 rajveer 61
	2:string manufacturerName,
483 rajveer 62
	3:string modelNumber,
63
	4:string modelName,
623 chandransh 64
	5:i64 category,
483 rajveer 65
	6:string comments,
66
	7:i64 catalogItemId,
67
	8:string vendorItemId
121 ashish 68
	10:i64 featureId,
69
	11:string featureDescription,
483 rajveer 70
	12:ItemInventory itemInventory,
71
	13:double mrp, //maxmimum retail price
72
	14:double mop, //market operative price
73
	15:double sellingPrice, //Selling price
720 chandransh 74
	16:double transferPrice
75
	17:double weight,
76
	18:i64 addedOn,
77
	19:i64 startDate,
78
	20:i64 retireDate,
79
	21:status itemStatus,
80
	22:map<string,string> otherInfo,
81
	23:string bestDealText,
82
	24:double bestDealValue,
83
	25:double dealerPrice,
84
	26:i64 updatedOn,
85
	27:string color
85 ashish 86
}
87
 
121 ashish 88
exception InventoryServiceException{
85 ashish 89
	1:i64 id,
90
	2:string message
91
}
92
 
121 ashish 93
service InventoryService{
763 rajveer 94
 
95
	/**
96
	* For closing the open session in sqlalchemy
97
	*/
98
	void closeSession(),
99
 
85 ashish 100
/**
101
	Availability and inventory attributes	
102
*/
103
	//all add and update methods - added by Ashish
123 ashish 104
	i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
105
	i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
121 ashish 106
	i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
632 rajveer 107
	bool isActive(1:i64 itemId) throws (1:InventoryServiceException isex),
483 rajveer 108
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
109
	// commented right now. write on based of requirement
110
	// void updatePrice(1:i64 item_id, 2:i64 warehouse_id, 3:double price) throws (1:InventoryServiceException cex),
103 ashish 111
	//all delete methods
121 ashish 112
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
103 ashish 113
 
114
	//Item management apis
121 ashish 115
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
116
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
117
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
85 ashish 118
	//Other accessor methods - added by Ashish
121 ashish 119
	Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 120
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
121 ashish 121
	list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
122
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
123
	ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 124
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
125
	//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
121 ashish 126
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
720 chandransh 127
	bool markItemAsContentComplete(1:i64 entityId) throws (1:InventoryServiceException cex),
646 chandransh 128
 
129
	/**
130
	  Returns the id of the warehouse with the largest inventory of the item and the inventory size in the given locations.
131
	  The size of list will always be 2.
132
	 */
133
	list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
121 ashish 134
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
135
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
136
	list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
502 rajveer 137
	list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
138
 
862 chandransh 139
	/**
140
	 Increases the reservation count for an item in a warehouse. Should always succeed normally.
141
	*/
142
	bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
143
 
144
	/**
145
	 Decreases the reservation count for an item in a warehouse. Should always succeed normally.
146
	*/
147
	bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
148
 
502 rajveer 149
	// for home page .... best deals, best sellers and latest arrivals
588 chandransh 150
	list<Item> getBestSellers() throws (1:InventoryServiceException isex),
623 chandransh 151
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 152
	i64 getBestSellersCount() throws (1:InventoryServiceException cex),
153
 
154
	list<Item> getBestDeals() throws (1:InventoryServiceException isex),
623 chandransh 155
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 156
	i64 getBestDealsCount() throws (1:InventoryServiceException cex),
157
 
158
	list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
623 chandransh 159
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 category) throws (1:InventoryServiceException cex),
632 rajveer 160
	i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
161
 
162
	bool putCategoryObject(1:binary object),
163
	binary getCategoryObject()
85 ashish 164
}
165