Subversion Repositories SmartDukaan

Rev

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