Subversion Repositories SmartDukaan

Rev

Rev 5864 | Rev 6788 | 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
 
3374 rajveer 105
service HelperService extends GenericService.GenericService{
763 rajveer 106
	/**
3206 mandeep.dh 107
	* Save email details, to be sent later; Also returns its identifier.
2455 varun.gupt 108
	*/
5864 rajveer 109
	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 110
 
111
	/**
112
	* Retreives all the emails pending for dispatch
113
	*/
3086 rajveer 114
	list<UserEmail> getEmailsToBeSent() throws (1:HelperServiceException se),
2455 varun.gupt 115
 
116
	/**
117
	* Marks email as sent after successful dispatch
118
	*/
1422 varun.gupt 119
	void markEmailAsSent(1:i64 emailId) throws (1:HelperServiceException se),
1397 varun.gupt 120
 
121 ashish 121
	void sendMail(1:Mail mail) throws (1:HelperServiceException se),
122
	void sendText(1:TextMessage message) throws (1:HelperServiceException se),
123
 
351 ashish 124
	void addMessage(1:Message message) throws (1:HelperServiceException se),
121 ashish 125
	void updateMessage(1:i64 id, 2:string message) throws (1:HelperServiceException se),
351 ashish 126
	Message getMessage(1:i64 id) throws (1:HelperServiceException se),
495 rajveer 127
	Message getSubstitutedMessage(1:i64 id, 2:map<string,string> params) throws (1:HelperServiceException se),
128
 
129
	//authenticate dashboard users
130
	bool addUser(1:string username, 2:string password, 3:i64 warehouseId) throws (1:HelperServiceException se),
131
	bool deleteUser(1:string username) throws (1:HelperServiceException se),
2442 chandransh 132
 
751 chandransh 133
	/**
2442 chandransh 134
	 Returns the dashboard user if the supplied username and password match. Raises an exception otherwise.
135
	 The loggedOn timestamp for the dashboard user is updated .
751 chandransh 136
	*/
2442 chandransh 137
	DashboardUser authenticateDashboardUser(1:string username, 2:string password) throws (1:HelperServiceException se),
138
 
139
	/**
140
	Update the password of the dashboard user. Currently, there is no place where this method is called.
141
	*/
751 chandransh 142
	bool updatePassword(1:string username, 2:string oldPassword, 3:string newPassword) throws (1:HelperServiceException se),
143
 
144
	/**
145
	 Returns the LogisticsUser struct associated with the given username and password if they match.
146
	 Throws an exception otherwise.
147
	*/
148
	LogisticsUser authenticateLogisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse)
1611 ankur.sing 149
 
150
	/**
151
	 Returns the StatisticsUser struct associated with the given username and password if they match.
152
	 Throws an exception otherwise.
153
	*/
1891 ankur.sing 154
	StatisticsUser authenticateStatisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
155
 
156
	/**
157
	 Returns the ReportUser struct associated with the given username and password if they match.
158
	 Throws an exception otherwise.
159
	*/
160
	ReportUser authenticateReportUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
161
 
162
	/**
163
	Returns list of reports which are configured for the given role. 
164
	*/
2023 ankur.sing 165
	list<Report> getReports(1:i64 role),
166
 
167
	/**
2356 ankur.sing 168
	 Returns the CatalogDashboardUser struct associated with the given username, password and role if they match.
2023 ankur.sing 169
	 Throws an exception otherwise.
170
	*/
2356 ankur.sing 171
	CatalogDashboardUser authenticateCatalogUser(1:string username, 2:string password, 3:i64 role) throws(1:HelperServiceException hse),
4544 varun.gupt 172
 
173
	/**
174
	Saves the list of entity Ids to be shared with an email address 
175
	*/
4693 mandeep.dh 176
	void shareEntities(1:list<i64> entityIds, 2:string email) throws(1:HelperServiceException hse),
177
 
178
    // Methods to read agent information
4806 varun.gupt 179
    list<Agent> getAgents(),
180
    bool validateLogIn(1:string emailId, 2:string password),
181
    void updatePasswordForAgent(1:string agentEmailId, 2:string password),
4693 mandeep.dh 182
 
183
    // Methods to read roles and permissions information
4806 varun.gupt 184
    list<string> getRoleNamesForAgent(1:string agentEmailId),
4996 varun.gupt 185
    list<string> getPermissionsForRoleName(1:string roleName),
4806 varun.gupt 186
 
187
    //Methods to save and read QuickLinks
188
    void saveQuickLink(1:string url, 2:string text) throws(1:HelperServiceException hse),
4996 varun.gupt 189
    list<QuickLink> getQuickLinks() throws(1:HelperServiceException hse),
5055 varun.gupt 190
    void updateQuickLink(1:i64 id, 2:string url, 3:string text) throws(1:HelperServiceException hse),
191
 
192
	/**
193
	Returns a list of emails to which product notifications have been sent in a given date range
194
	*/
6322 amar.kumar 195
	list<string> getEmailsForNotificationsSent(1:i64 startDatetime, 2:i64 endDatetime) throws(1:HelperServiceException hse),
196
 
197
	//Returns body of mail sent for order confirmation
198
	string getOrderConfirmationMail(1:i64 orderId)
116 ashish 199
}