Subversion Repositories SmartDukaan

Rev

Rev 130 | Rev 506 | 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,
98
	20:string hintAnswer
48 ashish 99
}
100
 
121 ashish 101
/**
102
Internal information to be used by system. various variables which aid in serving the user are identified and put here
103
**/
104
 
105
struct UserInternalInfo{
48 ashish 106
	1:i64 userId,
121 ashish 107
	2:i64 geoZone,
108
	3:i64 shipmentZone,
48 ashish 109
	4:i64 taxZone,
110
	5:double userRankScore
111
}
112
 
121 ashish 113
/**
114
structure representing timestamp and ip at which user logged into the system
115
**/
116
struct IPMap{
117
	1:i64 timestamp
123 ashish 118
	2:string ip
48 ashish 119
}
120
 
121 ashish 121
/**
122
dynamic user state 
123
**/
124
struct UserState{
48 ashish 125
	1:i64 userId,
126
	2:bool isEmailVerified,
127
	3:i64 lastLogin,
128
	4:i64 lastLogout,
129
	5:i64 emailVerificationSentOn,
130
	6:i64 smsVerificationSentOn,
131
	7:bool isSMSVerified,
132
	8:i64 activeSince,
133
	9:bool isLoggedIn,
123 ashish 134
	10:list<IPMap> ips,
130 ashish 135
	11:i64 shoppingCartHandle,
136
	12:AccountStatus status
48 ashish 137
}
138
 
121 ashish 139
/**
140
complete user structre
141
**/
142
struct UserContext{
143
	1:UserPrimaryInfo primaryInfo,
144
	2:UserInternalInfo internalInfo,
145
	3:UserState userState,
48 ashish 146
	4:i64 id
121 ashish 147
	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 148
}
149
 
150
/**
151
service
152
*/
153
 
154
service UserContextService{
121 ashish 155
	UserContext createContext(1: UserContext context, 2: bool updateExisting) throws (1:UserContextException cex),
156
	UserContext getContextFromId(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
157
	UserContext getContextFromEmailOrHandle(1:string emailorhandle, 2:bool isEmail) throws (1:UserContextException ucx),
158
	UserState getState(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
159
	UserPrimaryInfo getPrimaryInfo(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
160
	UserInternalInfo getInternalInfo(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
161
	UserContext getContext(1:string email, 2:string password) throws (1:AuthenticationException ax),
123 ashish 162
	bool authenticateUser(1:string handle, 2:string password, 3:bool isEmail) throws (1:AuthenticationException ax),
48 ashish 163
	bool userExists(1:string email)throws (1:UserContextException ucx),
164
	bool addIpAdressForUser(1:string ip, 2:i64 timestamp, 3:i64 userId)throws (1:UserContextException ucx),
121 ashish 165
	bool addAddressForUser(1:Address address, 2:i64 userid, 3:i64 timestamp)throws (1:UserContextException ucx),
48 ashish 166
	bool removeAddressForUser(1:i64 userid, 2:i64 addressId)throws (1:UserContextException ucx),
167
	bool setUserAsLoggedIn(1:i64 userId, 2:i64 timestamp)throws (1:UserContextException ucx),
168
	bool setUserAsLoggedOut(1:i64 userid, 2:i64 timestamp)throws (1:UserContextException ucx),
169
	bool updatePassword(1:i64 userid, 2:string password)throws (1:UserContextException ucx),
121 ashish 170
	bool deleteUser(1:i64 userid, 2:bool isSessionId)throws (1:UserContextException ucx),
48 ashish 171
	bool sendEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
172
	bool sendSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
173
	bool confirmEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
174
	bool confirmSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
130 ashish 175
	bool addSocialhandle(1:i64 userid, 2:string socialService, 3:string handle)throws (1:UserContextException ucx),
176
	bool sendNewPasswordById(1:i64 userid) throws (1:UserContextException ucx),
177
	bool sendNewPasswordByHandle(1:string emailOrHandle, 2:bool isEmail)throws (1:UserContextException ucx)
48 ashish 178
}
179