Subversion Repositories SmartDukaan

Rev

Rev 414 | Rev 513 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
48 ashish 1
namespace java in.shop2020.model.v1.user
95 ashish 2
namespace py shop2020.thriftpy.model.v1.user
48 ashish 3
 
4
/**
5
Exceptions
6
*/
7
 
8
 
9
exception AuthenticationException{
10
	1:string message,
11
	2:i32 errorCode
12
}
13
 
14
exception UserContextException{
15
	1:i32 errorCode,
16
	2:string message
17
}
18
 
121 ashish 19
enum AddressType{
130 ashish 20
	WORK = 0,
21
	HOME = 1
48 ashish 22
}
23
 
130 ashish 24
enum PhoneType{
25
	WORK = 0,
26
	HOME = 1,
27
	MOBILE = 2
28
}
29
 
30
enum AccountStatus{
31
	ACTIVE = 0,
32
	DELETED = 1,
33
	INACTIVE = 2,
34
	INCOMPLETE = 3
35
}
36
 
48 ashish 37
/**
121 ashish 38
All the social handles
48 ashish 39
*/
121 ashish 40
struct SocialHandles{
48 ashish 41
	1:string facebook,
42
	2:string opensocial,
43
	3:string twitter
44
}
45
 
121 ashish 46
/**
47
Address
48
*/
49
struct Address{
48 ashish 50
	1:string line1,
51
	2:string line2,
52
	3:string landmark,
53
	4:string city,
54
	5:string state,
55
	6:string pin,
56
	7:string country,
57
	8:i64 id,
58
	9:bool enabled,
123 ashish 59
	10:AddressType type,
414 ashish 60
	11:i64 addedOn,
61
	12:string name,
62
	13:string phone
48 ashish 63
}
64
 
130 ashish 65
/**Phone
66
**/
67
struct Phone{
68
	1:i64 id,
69
	2:string countryCode,
70
	3:string areaCode,
71
	4:string number,
72
	5:string extension,
73
	6:PhoneType type,
74
}
75
 
121 ashish 76
/**
77
Primary information of the user
78
**/
79
struct UserPrimaryInfo{
48 ashish 80
	1:i64 userId,
81
	2:string title,
82
	3:string firstName,
83
	4:string lastName,
84
	5:string pictureUrl,
85
	6:string email,
130 ashish 86
	7:string dummy,
87
	8:set<Phone> phones,
48 ashish 88
	9:string userHandle,
89
	10:string password,
121 ashish 90
	11:SocialHandles socialHandles,
48 ashish 91
	12:i64 dateOfBirth,
92
	13:i64 anniversary,
121 ashish 93
	14:set<Address> addresses,
48 ashish 94
	16:i32 shipmentOption,
95
	17:string middleName,
130 ashish 96
	18:string occupation,
97
	19:string hintQuestion,
506 rajveer 98
	20:string hintAnswer,
99
	21:i64 defaultAddressId,
100
	22:string communicationEmail
48 ashish 101
}
102
 
121 ashish 103
/**
104
Internal information to be used by system. various variables which aid in serving the user are identified and put here
105
**/
106
 
107
struct UserInternalInfo{
48 ashish 108
	1:i64 userId,
121 ashish 109
	2:i64 geoZone,
110
	3:i64 shipmentZone,
48 ashish 111
	4:i64 taxZone,
112
	5:double userRankScore
113
}
114
 
121 ashish 115
/**
116
structure representing timestamp and ip at which user logged into the system
117
**/
118
struct IPMap{
119
	1:i64 timestamp
123 ashish 120
	2:string ip
48 ashish 121
}
122
 
121 ashish 123
/**
124
dynamic user state 
125
**/
126
struct UserState{
48 ashish 127
	1:i64 userId,
128
	2:bool isEmailVerified,
129
	3:i64 lastLogin,
130
	4:i64 lastLogout,
131
	5:i64 emailVerificationSentOn,
132
	6:i64 smsVerificationSentOn,
133
	7:bool isSMSVerified,
134
	8:i64 activeSince,
135
	9:bool isLoggedIn,
123 ashish 136
	10:list<IPMap> ips,
130 ashish 137
	11:i64 shoppingCartHandle,
138
	12:AccountStatus status
48 ashish 139
}
140
 
121 ashish 141
/**
142
complete user structre
143
**/
144
struct UserContext{
145
	1:UserPrimaryInfo primaryInfo,
146
	2:UserInternalInfo internalInfo,
147
	3:UserState userState,
48 ashish 148
	4:i64 id
121 ashish 149
	5:i64 sessionid //in case user is not logged in, the id would be -1 and session id would help to uniquely identify the user
48 ashish 150
}
151
 
152
/**
153
service
154
*/
155
 
156
service UserContextService{
121 ashish 157
	UserContext createContext(1: UserContext context, 2: bool updateExisting) throws (1:UserContextException cex),
158
	UserContext getContextFromId(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
159
	UserContext getContextFromEmailOrHandle(1:string emailorhandle, 2:bool isEmail) throws (1:UserContextException ucx),
160
	UserState getState(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
161
	UserPrimaryInfo getPrimaryInfo(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
162
	UserInternalInfo getInternalInfo(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
163
	UserContext getContext(1:string email, 2:string password) throws (1:AuthenticationException ax),
123 ashish 164
	bool authenticateUser(1:string handle, 2:string password, 3:bool isEmail) throws (1:AuthenticationException ax),
48 ashish 165
	bool userExists(1:string email)throws (1:UserContextException ucx),
166
	bool addIpAdressForUser(1:string ip, 2:i64 timestamp, 3:i64 userId)throws (1:UserContextException ucx),
121 ashish 167
	bool addAddressForUser(1:Address address, 2:i64 userid, 3:i64 timestamp)throws (1:UserContextException ucx),
48 ashish 168
	bool removeAddressForUser(1:i64 userid, 2:i64 addressId)throws (1:UserContextException ucx),
169
	bool setUserAsLoggedIn(1:i64 userId, 2:i64 timestamp)throws (1:UserContextException ucx),
170
	bool setUserAsLoggedOut(1:i64 userid, 2:i64 timestamp)throws (1:UserContextException ucx),
506 rajveer 171
	bool setDefaultAddress(1:i64 userid, 2:i64 addressId)throws (1:UserContextException ucx),
48 ashish 172
	bool updatePassword(1:i64 userid, 2:string password)throws (1:UserContextException ucx),
121 ashish 173
	bool deleteUser(1:i64 userid, 2:bool isSessionId)throws (1:UserContextException ucx),
48 ashish 174
	bool sendEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
175
	bool sendSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
176
	bool confirmEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
177
	bool confirmSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
130 ashish 178
	bool addSocialhandle(1:i64 userid, 2:string socialService, 3:string handle)throws (1:UserContextException ucx),
179
	bool sendNewPasswordById(1:i64 userid) throws (1:UserContextException ucx),
180
	bool sendNewPasswordByHandle(1:string emailOrHandle, 2:bool isEmail)throws (1:UserContextException ucx)
48 ashish 181
}
182