Subversion Repositories SmartDukaan

Rev

Rev 632 | Rev 720 | 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
103 ashish 18
}
19
 
646 chandransh 20
enum WarehouseLocation{
21
	Delhi = 0,
22
	Mumbai = 1,
23
	Bangalore = 2,
24
	Kolkata = 3
25
}
26
 
483 rajveer 27
/* 
28
Warehouse fields details
29
location: it is full address
30
vendorString: some key for the warehouse
31
*/
85 ashish 32
struct Warehouse{
33
	1:i64 id,
34
	2:string location,
483 rajveer 35
	3:status warehouseStatus,
36
	4:i64 addedOn,
37
	5:i64 lastCheckedOn,
38
	6:string tinNumber,
39
	7:string pincode,
646 chandransh 40
	8:string vendorString,
41
	9:WarehouseLocation logisticsLocation
85 ashish 42
}
115 ashish 43
/* */
85 ashish 44
struct ItemInventory{
45
	1:i64 id,
483 rajveer 46
	2:map<i64,i64> availability
85 ashish 47
}
48
 
483 rajveer 49
 
85 ashish 50
struct ItemInventoryHistory{
51
	1:i64 item_id,
52
	2:i64 warehouse_id,
53
	3:i64 timestamp,
54
	4:i64 availability
55
}
56
 
57
struct Item{
58
	1:i64 id,
510 rajveer 59
	2:string manufacturerName,
483 rajveer 60
	3:string modelNumber,
61
	4:string modelName,
623 chandransh 62
	5:i64 category,
483 rajveer 63
	6:string comments,
64
	7:i64 catalogItemId,
65
	8:string vendorItemId
121 ashish 66
	10:i64 featureId,
67
	11:string featureDescription,
483 rajveer 68
	12:ItemInventory itemInventory,
69
	13:double mrp, //maxmimum retail price
70
	14:double mop, //market operative price
71
	15:double sellingPrice, //Selling price
72
	16:double weight,
73
	17:i64 addedOn,
74
	18:i64 startDate,
75
	19:i64 retireDate,
76
	20:status itemStatus,
606 chandransh 77
	21:map<string,string> otherInfo,
78
	22:string bestDealText,
79
	23:double bestDealValue,
80
	24:double dealerPrice,
81
	25:i64 updatedOn,
82
	26:string color
85 ashish 83
}
84
 
121 ashish 85
exception InventoryServiceException{
85 ashish 86
	1:i64 id,
87
	2:string message
88
}
89
 
121 ashish 90
service InventoryService{
85 ashish 91
/**
92
	Availability and inventory attributes	
93
*/
94
	//all add and update methods - added by Ashish
123 ashish 95
	i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
96
	i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
121 ashish 97
	i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
632 rajveer 98
	bool isActive(1:i64 itemId) throws (1:InventoryServiceException isex),
483 rajveer 99
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
100
	// commented right now. write on based of requirement
101
	// void updatePrice(1:i64 item_id, 2:i64 warehouse_id, 3:double price) throws (1:InventoryServiceException cex),
103 ashish 102
	//all delete methods
121 ashish 103
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
103 ashish 104
 
105
	//Item management apis
121 ashish 106
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
107
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
108
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
85 ashish 109
	//Other accessor methods - added by Ashish
121 ashish 110
	Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 111
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
121 ashish 112
	list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
113
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
114
	ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 115
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
116
	//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
121 ashish 117
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
646 chandransh 118
 
119
	/**
120
	  Returns the id of the warehouse with the largest inventory of the item and the inventory size in the given locations.
121
	  The size of list will always be 2.
122
	 */
123
	list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
121 ashish 124
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
125
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
126
	list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
502 rajveer 127
	list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
128
 
129
	// for home page .... best deals, best sellers and latest arrivals
588 chandransh 130
	list<Item> getBestSellers() throws (1:InventoryServiceException isex),
623 chandransh 131
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 132
	i64 getBestSellersCount() throws (1:InventoryServiceException cex),
133
 
134
	list<Item> getBestDeals() throws (1:InventoryServiceException isex),
623 chandransh 135
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 136
	i64 getBestDealsCount() throws (1:InventoryServiceException cex),
137
 
138
	list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
623 chandransh 139
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 category) throws (1:InventoryServiceException cex),
632 rajveer 140
	i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
141
 
142
	bool putCategoryObject(1:binary object),
143
	binary getCategoryObject()
85 ashish 144
}
145