Subversion Repositories SmartDukaan

Rev

Rev 7221 | Rev 8020 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
116 ashish 1
namespace java in.shop2020.utils
2
namespace py shop2020.thriftpy.utils
3
 
3374 rajveer 4
include "GenericService.thrift"
5
 
116 ashish 6
/**
7
Helper service
8
created by @ashish
9
**/
10
 
4693 mandeep.dh 11
struct Agent {
12
    1:i64 id,
13
    2:string name,
14
    3:string emailId,
15
    4:optional i64 managerId,
16
    5:string password,
17
    6:bool isActive
18
}
19
 
121 ashish 20
struct Mail{
21
	1:list<string> to,
22
	2:string subject,
23
	3:string data,
351 ashish 24
	4:string sender,
25
	5:list<string> attachments,
26
	6:string password
121 ashish 27
}
28
 
29
struct TextMessage{
30
	1:string number,
31
	2:string message,
32
	3:i64 dispatchTime,
33
	4:i64 deliveryTime
34
}
35
 
116 ashish 36
exception HelperServiceException{
37
	1:i64 id,
38
	2:string message
39
}
40
 
121 ashish 41
struct Message{
42
	1:i64 id,
43
	2:string message
44
}
45
 
2780 chandransh 46
enum Role{
47
	WAREHOUSE_EXECUTIVE = 0,
48
	ADMIN = 1,
4358 rajveer 49
	WAREHOUSE_MONITOR = 2
2780 chandransh 50
}
51
 
495 rajveer 52
struct DashboardUser{
53
	1:string username,
54
	2:string password,
2442 chandransh 55
	3:i64 warehouseId,
2780 chandransh 56
	4:Role role
495 rajveer 57
}
58
 
751 chandransh 59
struct LogisticsUser{
60
	1:string username,
61
	2:i64 providerId
62
}
63
 
1611 ankur.sing 64
struct StatisticsUser{
1891 ankur.sing 65
	1:string username
1611 ankur.sing 66
}
67
 
2023 ankur.sing 68
struct CatalogDashboardUser{
69
	1:string username,
2356 ankur.sing 70
	2:string password,
71
	3:i64 role
2023 ankur.sing 72
}
73
 
1397 varun.gupt 74
struct UserEmail{
1422 varun.gupt 75
	1:i64 id,
5864 rajveer 76
	2:list<string> emailTo,
1422 varun.gupt 77
	3:string emailFrom,
78
	4:string subject,
79
	5:string body,
80
	6:string source,
81
	7:string emailType,
82
	8:bool status,
5864 rajveer 83
	9:i64 timestamp,
84
	10:list<string> cc,
85
	11:list<string> bcc
1397 varun.gupt 86
}
87
 
1891 ankur.sing 88
struct ReportUser{
89
	1:string username,
90
	2:i64 role
91
}
92
 
93
struct Report{
94
	1:i64 id,
95
	2:string description,
96
	3:string controller
97
}
98
 
4806 varun.gupt 99
struct QuickLink	{
4996 varun.gupt 100
	1:i64 id,
101
	2:string url,
102
	3:string text
4806 varun.gupt 103
}
104
 
7410 amar.kumar 105
struct AgentWarehouseMapping{
106
	1:i64 agentId,
107
	2:i64 warehouseId
108
}
109
 
3374 rajveer 110
service HelperService extends GenericService.GenericService{
763 rajveer 111
	/**
3206 mandeep.dh 112
	* Save email details, to be sent later; Also returns its identifier.
2455 varun.gupt 113
	*/
5864 rajveer 114
	i64 saveUserEmailForSending(1:list<string> emailTo, 2:string emailFrom, 3:string subject, 4:string body, 5:string source, 6:string emailType, 7:list<string> cc, 8:list<string> bcc,) throws (1:HelperServiceException se),
2455 varun.gupt 115
 
116
	/**
117
	* Retreives all the emails pending for dispatch
118
	*/
3086 rajveer 119
	list<UserEmail> getEmailsToBeSent() throws (1:HelperServiceException se),
2455 varun.gupt 120
 
121
	/**
122
	* Marks email as sent after successful dispatch
123
	*/
1422 varun.gupt 124
	void markEmailAsSent(1:i64 emailId) throws (1:HelperServiceException se),
1397 varun.gupt 125
 
121 ashish 126
	void sendMail(1:Mail mail) throws (1:HelperServiceException se),
127
	void sendText(1:TextMessage message) throws (1:HelperServiceException se),
128
 
351 ashish 129
	void addMessage(1:Message message) throws (1:HelperServiceException se),
121 ashish 130
	void updateMessage(1:i64 id, 2:string message) throws (1:HelperServiceException se),
351 ashish 131
	Message getMessage(1:i64 id) throws (1:HelperServiceException se),
495 rajveer 132
	Message getSubstitutedMessage(1:i64 id, 2:map<string,string> params) throws (1:HelperServiceException se),
133
 
134
	//authenticate dashboard users
135
	bool addUser(1:string username, 2:string password, 3:i64 warehouseId) throws (1:HelperServiceException se),
136
	bool deleteUser(1:string username) throws (1:HelperServiceException se),
2442 chandransh 137
 
751 chandransh 138
	/**
2442 chandransh 139
	 Returns the dashboard user if the supplied username and password match. Raises an exception otherwise.
140
	 The loggedOn timestamp for the dashboard user is updated .
751 chandransh 141
	*/
2442 chandransh 142
	DashboardUser authenticateDashboardUser(1:string username, 2:string password) throws (1:HelperServiceException se),
143
 
144
	/**
145
	Update the password of the dashboard user. Currently, there is no place where this method is called.
146
	*/
751 chandransh 147
	bool updatePassword(1:string username, 2:string oldPassword, 3:string newPassword) throws (1:HelperServiceException se),
148
 
149
	/**
150
	 Returns the LogisticsUser struct associated with the given username and password if they match.
151
	 Throws an exception otherwise.
152
	*/
153
	LogisticsUser authenticateLogisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse)
1611 ankur.sing 154
 
155
	/**
156
	 Returns the StatisticsUser struct associated with the given username and password if they match.
157
	 Throws an exception otherwise.
158
	*/
1891 ankur.sing 159
	StatisticsUser authenticateStatisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
160
 
161
	/**
162
	 Returns the ReportUser struct associated with the given username and password if they match.
163
	 Throws an exception otherwise.
164
	*/
165
	ReportUser authenticateReportUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
166
 
167
	/**
168
	Returns list of reports which are configured for the given role. 
169
	*/
2023 ankur.sing 170
	list<Report> getReports(1:i64 role),
171
 
172
	/**
2356 ankur.sing 173
	 Returns the CatalogDashboardUser struct associated with the given username, password and role if they match.
2023 ankur.sing 174
	 Throws an exception otherwise.
175
	*/
6788 rajveer 176
	CatalogDashboardUser authenticateCatalogUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
4544 varun.gupt 177
 
178
	/**
179
	Saves the list of entity Ids to be shared with an email address 
180
	*/
4693 mandeep.dh 181
	void shareEntities(1:list<i64> entityIds, 2:string email) throws(1:HelperServiceException hse),
182
 
183
    // Methods to read agent information
4806 varun.gupt 184
    list<Agent> getAgents(),
185
    bool validateLogIn(1:string emailId, 2:string password),
186
    void updatePasswordForAgent(1:string agentEmailId, 2:string password),
4693 mandeep.dh 187
 
188
    // Methods to read roles and permissions information
4806 varun.gupt 189
    list<string> getRoleNamesForAgent(1:string agentEmailId),
4996 varun.gupt 190
    list<string> getPermissionsForRoleName(1:string roleName),
4806 varun.gupt 191
 
192
    //Methods to save and read QuickLinks
193
    void saveQuickLink(1:string url, 2:string text) throws(1:HelperServiceException hse),
4996 varun.gupt 194
    list<QuickLink> getQuickLinks() throws(1:HelperServiceException hse),
5055 varun.gupt 195
    void updateQuickLink(1:i64 id, 2:string url, 3:string text) throws(1:HelperServiceException hse),
196
 
197
	/**
198
	Returns a list of emails to which product notifications have been sent in a given date range
199
	*/
6322 amar.kumar 200
	list<string> getEmailsForNotificationsSent(1:i64 startDatetime, 2:i64 endDatetime) throws(1:HelperServiceException hse),
201
 
202
	//Returns body of mail sent for order confirmation
7410 amar.kumar 203
	string getOrderConfirmationMail(1:i64 orderId),
7221 kshitij.so 204
 
205
	//Returns body of mail sent for delivery success
7410 amar.kumar 206
	string getOrderDeliveryMail(1:i64 orderId),
207
 
208
	list<i64> getWarehouseIdsForAgent(1:string agentEmailId),
209
 
116 ashish 210
}