Subversion Repositories SmartDukaan

Rev

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