Subversion Repositories SmartDukaan

Rev

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