Subversion Repositories SmartDukaan

Rev

Rev 12256 | Rev 12696 | 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,
8910 amar.kumar 49
	WAREHOUSE_MONITOR = 2,
50
	WAREHOUSE_OBSERVER = 3
2780 chandransh 51
}
52
 
495 rajveer 53
struct DashboardUser{
54
	1:string username,
55
	2:string password,
2442 chandransh 56
	3:i64 warehouseId,
8303 amar.kumar 57
	4:Role role,
58
	5:i64 source
495 rajveer 59
}
60
 
751 chandransh 61
struct LogisticsUser{
62
	1:string username,
63
	2:i64 providerId
64
}
65
 
1611 ankur.sing 66
struct StatisticsUser{
1891 ankur.sing 67
	1:string username
1611 ankur.sing 68
}
69
 
2023 ankur.sing 70
struct CatalogDashboardUser{
71
	1:string username,
2356 ankur.sing 72
	2:string password,
73
	3:i64 role
2023 ankur.sing 74
}
75
 
1397 varun.gupt 76
struct UserEmail{
1422 varun.gupt 77
	1:i64 id,
5864 rajveer 78
	2:list<string> emailTo,
1422 varun.gupt 79
	3:string emailFrom,
80
	4:string subject,
81
	5:string body,
82
	6:string source,
83
	7:string emailType,
84
	8:bool status,
5864 rajveer 85
	9:i64 timestamp,
86
	10:list<string> cc,
87
	11:list<string> bcc
1397 varun.gupt 88
}
89
 
1891 ankur.sing 90
struct ReportUser{
91
	1:string username,
12256 kshitij.so 92
	2:i64 role,
93
	3:string email
1891 ankur.sing 94
}
95
 
96
struct Report{
97
	1:i64 id,
98
	2:string description,
99
	3:string controller
100
}
101
 
4806 varun.gupt 102
struct QuickLink	{
4996 varun.gupt 103
	1:i64 id,
104
	2:string url,
105
	3:string text
4806 varun.gupt 106
}
107
 
7410 amar.kumar 108
struct AgentWarehouseMapping{
109
	1:i64 agentId,
110
	2:i64 warehouseId
111
}
112
 
12691 manish.sha 113
enum SmsType{
114
	TRANSACTIONAL,
115
	PROMOTIONAL,
116
	SERVICE_ALERT
117
}
118
 
119
enum SmsStatus{
120
	IN_PROCESS,
121
	DELIVERED,
122
	UNDELIVERED,
123
	SERVICE_ERROR,
124
	USER_ABSENT,
125
	MEMORY_FULL,
126
	NDLC_FAIL,
127
	INVALID_NUMBER
128
}
129
 
130
enum SmsDeliveryStatus{
131
	NOT_SENT,
132
	SENT_TO_OPERATOR,
133
	SUBMITTED_TO_SMSC,
134
	GOT_STATUS_CODE
135
}
136
 
137
struct UserSms{
138
	1:i64 id,
139
	2:i64 user_id,
140
	3:string mobileNumber,
141
	4:string smsText,
142
	5:SmsType type,
143
	6:SmsStatus status,
144
	7:i64 attempts,
145
	8:i64 createdTimestamp,
146
	9:string responseId,
147
	10:string responseText
148
	11:SmsDeliveryStatus deliveryStatus,  
149
}
150
 
151
struct UserSmsInfo{
152
	1:i64 userId,
153
	2:string mobileNo,
154
	3:i32 dailyCount,
155
	4:i32 weeklyCount,
156
	5:bool dndStatus,
157
	6:bool smsSubscribed,
158
	7:i64 createdTimestamp,
159
	8:i64 updateTimestamp
160
}
161
 
3374 rajveer 162
service HelperService extends GenericService.GenericService{
763 rajveer 163
	/**
3206 mandeep.dh 164
	* Save email details, to be sent later; Also returns its identifier.
2455 varun.gupt 165
	*/
8020 rajveer 166
	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, 9:i64 sourceId) throws (1:HelperServiceException se),
2455 varun.gupt 167
 
168
	/**
169
	* Retreives all the emails pending for dispatch
170
	*/
3086 rajveer 171
	list<UserEmail> getEmailsToBeSent() throws (1:HelperServiceException se),
2455 varun.gupt 172
 
173
	/**
174
	* Marks email as sent after successful dispatch
175
	*/
1422 varun.gupt 176
	void markEmailAsSent(1:i64 emailId) throws (1:HelperServiceException se),
1397 varun.gupt 177
 
121 ashish 178
	void sendMail(1:Mail mail) throws (1:HelperServiceException se),
179
	void sendText(1:TextMessage message) throws (1:HelperServiceException se),
180
 
351 ashish 181
	void addMessage(1:Message message) throws (1:HelperServiceException se),
121 ashish 182
	void updateMessage(1:i64 id, 2:string message) throws (1:HelperServiceException se),
351 ashish 183
	Message getMessage(1:i64 id) throws (1:HelperServiceException se),
495 rajveer 184
	Message getSubstitutedMessage(1:i64 id, 2:map<string,string> params) throws (1:HelperServiceException se),
185
 
186
	//authenticate dashboard users
187
	bool addUser(1:string username, 2:string password, 3:i64 warehouseId) throws (1:HelperServiceException se),
188
	bool deleteUser(1:string username) throws (1:HelperServiceException se),
2442 chandransh 189
 
751 chandransh 190
	/**
2442 chandransh 191
	 Returns the dashboard user if the supplied username and password match. Raises an exception otherwise.
192
	 The loggedOn timestamp for the dashboard user is updated .
751 chandransh 193
	*/
2442 chandransh 194
	DashboardUser authenticateDashboardUser(1:string username, 2:string password) throws (1:HelperServiceException se),
195
 
196
	/**
197
	Update the password of the dashboard user. Currently, there is no place where this method is called.
198
	*/
751 chandransh 199
	bool updatePassword(1:string username, 2:string oldPassword, 3:string newPassword) throws (1:HelperServiceException se),
200
 
201
	/**
202
	 Returns the LogisticsUser struct associated with the given username and password if they match.
203
	 Throws an exception otherwise.
204
	*/
205
	LogisticsUser authenticateLogisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse)
1611 ankur.sing 206
 
207
	/**
208
	 Returns the StatisticsUser struct associated with the given username and password if they match.
209
	 Throws an exception otherwise.
210
	*/
1891 ankur.sing 211
	StatisticsUser authenticateStatisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
212
 
213
	/**
214
	 Returns the ReportUser struct associated with the given username and password if they match.
215
	 Throws an exception otherwise.
216
	*/
217
	ReportUser authenticateReportUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
218
 
219
	/**
220
	Returns list of reports which are configured for the given role. 
221
	*/
2023 ankur.sing 222
	list<Report> getReports(1:i64 role),
223
 
224
	/**
2356 ankur.sing 225
	 Returns the CatalogDashboardUser struct associated with the given username, password and role if they match.
2023 ankur.sing 226
	 Throws an exception otherwise.
227
	*/
6788 rajveer 228
	CatalogDashboardUser authenticateCatalogUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
4544 varun.gupt 229
 
230
	/**
231
	Saves the list of entity Ids to be shared with an email address 
232
	*/
4693 mandeep.dh 233
	void shareEntities(1:list<i64> entityIds, 2:string email) throws(1:HelperServiceException hse),
234
 
235
    // Methods to read agent information
4806 varun.gupt 236
    list<Agent> getAgents(),
237
    bool validateLogIn(1:string emailId, 2:string password),
238
    void updatePasswordForAgent(1:string agentEmailId, 2:string password),
4693 mandeep.dh 239
 
240
    // Methods to read roles and permissions information
4806 varun.gupt 241
    list<string> getRoleNamesForAgent(1:string agentEmailId),
4996 varun.gupt 242
    list<string> getPermissionsForRoleName(1:string roleName),
4806 varun.gupt 243
 
244
    //Methods to save and read QuickLinks
245
    void saveQuickLink(1:string url, 2:string text) throws(1:HelperServiceException hse),
4996 varun.gupt 246
    list<QuickLink> getQuickLinks() throws(1:HelperServiceException hse),
5055 varun.gupt 247
    void updateQuickLink(1:i64 id, 2:string url, 3:string text) throws(1:HelperServiceException hse),
248
 
249
	/**
250
	Returns a list of emails to which product notifications have been sent in a given date range
251
	*/
6322 amar.kumar 252
	list<string> getEmailsForNotificationsSent(1:i64 startDatetime, 2:i64 endDatetime) throws(1:HelperServiceException hse),
253
 
254
	//Returns body of mail sent for order confirmation
7410 amar.kumar 255
	string getOrderConfirmationMail(1:i64 orderId),
7221 kshitij.so 256
 
257
	//Returns body of mail sent for delivery success
7410 amar.kumar 258
	string getOrderDeliveryMail(1:i64 orderId),
259
 
260
	list<i64> getWarehouseIdsForAgent(1:string agentEmailId),
261
 
12691 manish.sha 262
	i64 saveUserSmsForSending(1:i64 userId, 2:string mobileNo, 3:string text, 4:SmsType type) throws (1:HelperServiceException se),
263
 
264
	list<UserSms> getSmsToBeSent() throws (1:HelperServiceException se),
265
 
266
	void addUserSmsInfo(1:UserSmsInfo userSmsInfo) throws (1:HelperServiceException se),
267
 
268
	bool updateUserSmsInfo(1:UserSmsInfo userSmsInfo) throws (1:HelperServiceException se),
269
 
270
	UserSmsInfo getUserSmsInfo(1:i64 userId) throws (1:HelperServiceException se),
271
 
272
	list<UserSmsInfo> getAllUsersSmsInfo(1:bool dndStatus, 2:bool smsSubscribed) throws (1:HelperServiceException se),
273
 
274
	list<UserSms> listSmsToGetDeliveryInfo() throws (1:HelperServiceException se),
275
 
276
	bool markMessagesAsSentToOperator(list<UserSms> userSmsList)
277
 
278
	bool markMessagesAsSubmittedToSmsc(list<UserSms> userSmsList)
279
 
280
	bool markMessagesAsSent(list<UserSms> userSmsList)
281
 
282
	bool markMessagesAsRetry(list<UserSms> userSmsList)
116 ashish 283
}