Subversion Repositories SmartDukaan

Rev

Rev 2780 | Rev 3206 | 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
 
4
/**
5
Helper service
6
created by @ashish
7
**/
8
 
121 ashish 9
struct Mail{
10
	1:list<string> to,
11
	2:string subject,
12
	3:string data,
351 ashish 13
	4:string sender,
14
	5:list<string> attachments,
15
	6:string password
121 ashish 16
}
17
 
18
struct TextMessage{
19
	1:string number,
20
	2:string message,
21
	3:i64 dispatchTime,
22
	4:i64 deliveryTime
23
}
24
 
116 ashish 25
exception HelperServiceException{
26
	1:i64 id,
27
	2:string message
28
}
29
 
121 ashish 30
struct Message{
31
	1:i64 id,
32
	2:string message
33
}
34
 
2780 chandransh 35
enum Role{
36
	WAREHOUSE_EXECUTIVE = 0,
37
	ADMIN = 1,
38
	CATEGORY_MANAGER = 2
39
}
40
 
495 rajveer 41
struct DashboardUser{
42
	1:string username,
43
	2:string password,
2442 chandransh 44
	3:i64 warehouseId,
2780 chandransh 45
	4:Role role
495 rajveer 46
}
47
 
751 chandransh 48
struct LogisticsUser{
49
	1:string username,
50
	2:i64 providerId
51
}
52
 
1611 ankur.sing 53
struct StatisticsUser{
1891 ankur.sing 54
	1:string username
1611 ankur.sing 55
}
56
 
2023 ankur.sing 57
struct CatalogDashboardUser{
58
	1:string username,
2356 ankur.sing 59
	2:string password,
60
	3:i64 role
2023 ankur.sing 61
}
62
 
1397 varun.gupt 63
struct UserEmail{
1422 varun.gupt 64
	1:i64 id,
65
	2:string emailTo,
66
	3:string emailFrom,
67
	4:string subject,
68
	5:string body,
69
	6:string source,
70
	7:string emailType,
71
	8:bool status,
72
	9:i64 timestamp
1397 varun.gupt 73
}
74
 
1891 ankur.sing 75
struct ReportUser{
76
	1:string username,
77
	2:i64 role
78
}
79
 
80
struct Report{
81
	1:i64 id,
82
	2:string description,
83
	3:string controller
84
}
85
 
302 ashish 86
service HelperService{
763 rajveer 87
	/**
88
	* For closing the open session in sqlalchemy
89
	*/
90
	void closeSession(),
91
 
2455 varun.gupt 92
	/**
93
	* Save email details, to be sent later
94
	*/
1397 varun.gupt 95
	void 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 96
 
97
	/**
98
	* Retreives all the emails pending for dispatch
99
	*/
3086 rajveer 100
	list<UserEmail> getEmailsToBeSent() throws (1:HelperServiceException se),
2455 varun.gupt 101
 
102
	/**
103
	* Marks email as sent after successful dispatch
104
	*/
1422 varun.gupt 105
	void markEmailAsSent(1:i64 emailId) throws (1:HelperServiceException se),
1397 varun.gupt 106
 
121 ashish 107
	void sendMail(1:Mail mail) throws (1:HelperServiceException se),
108
	void sendText(1:TextMessage message) throws (1:HelperServiceException se),
109
 
351 ashish 110
	void addMessage(1:Message message) throws (1:HelperServiceException se),
121 ashish 111
	void updateMessage(1:i64 id, 2:string message) throws (1:HelperServiceException se),
351 ashish 112
	Message getMessage(1:i64 id) throws (1:HelperServiceException se),
495 rajveer 113
	Message getSubstitutedMessage(1:i64 id, 2:map<string,string> params) throws (1:HelperServiceException se),
114
 
115
	//authenticate dashboard users
116
	bool addUser(1:string username, 2:string password, 3:i64 warehouseId) throws (1:HelperServiceException se),
117
	bool deleteUser(1:string username) throws (1:HelperServiceException se),
2442 chandransh 118
 
751 chandransh 119
	/**
2442 chandransh 120
	 Returns the dashboard user if the supplied username and password match. Raises an exception otherwise.
121
	 The loggedOn timestamp for the dashboard user is updated .
751 chandransh 122
	*/
2442 chandransh 123
	DashboardUser authenticateDashboardUser(1:string username, 2:string password) throws (1:HelperServiceException se),
124
 
125
	/**
126
	Update the password of the dashboard user. Currently, there is no place where this method is called.
127
	*/
751 chandransh 128
	bool updatePassword(1:string username, 2:string oldPassword, 3:string newPassword) throws (1:HelperServiceException se),
129
 
130
	/**
131
	 Returns the LogisticsUser struct associated with the given username and password if they match.
132
	 Throws an exception otherwise.
133
	*/
134
	LogisticsUser authenticateLogisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse)
1611 ankur.sing 135
 
136
	/**
137
	 Returns the StatisticsUser struct associated with the given username and password if they match.
138
	 Throws an exception otherwise.
139
	*/
1891 ankur.sing 140
	StatisticsUser authenticateStatisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
141
 
142
	/**
143
	 Returns the ReportUser struct associated with the given username and password if they match.
144
	 Throws an exception otherwise.
145
	*/
146
	ReportUser authenticateReportUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
147
 
148
	/**
149
	Returns list of reports which are configured for the given role. 
150
	*/
2023 ankur.sing 151
	list<Report> getReports(1:i64 role),
152
 
153
	/**
2356 ankur.sing 154
	 Returns the CatalogDashboardUser struct associated with the given username, password and role if they match.
2023 ankur.sing 155
	 Throws an exception otherwise.
156
	*/
2356 ankur.sing 157
	CatalogDashboardUser authenticateCatalogUser(1:string username, 2:string password, 3:i64 role) throws(1:HelperServiceException hse),
116 ashish 158
}