Subversion Repositories SmartDukaan

Rev

Rev 123 | Rev 414 | 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,
48 ashish 60
	11:i64 addedOn
61
}
62
 
130 ashish 63
/**Phone
64
**/
65
struct Phone{
66
	1:i64 id,
67
	2:string countryCode,
68
	3:string areaCode,
69
	4:string number,
70
	5:string extension,
71
	6:PhoneType type,
72
}
73
 
121 ashish 74
/**
75
Primary information of the user
76
**/
77
struct UserPrimaryInfo{
48 ashish 78
	1:i64 userId,
79
	2:string title,
80
	3:string firstName,
81
	4:string lastName,
82
	5:string pictureUrl,
83
	6:string email,
130 ashish 84
	7:string dummy,
85
	8:set<Phone> phones,
48 ashish 86
	9:string userHandle,
87
	10:string password,
121 ashish 88
	11:SocialHandles socialHandles,
48 ashish 89
	12:i64 dateOfBirth,
90
	13:i64 anniversary,
121 ashish 91
	14:set<Address> addresses,
48 ashish 92
	16:i32 shipmentOption,
93
	17:string middleName,
130 ashish 94
	18:string occupation,
95
	19:string hintQuestion,
96
	20:string hintAnswer
48 ashish 97
}
98
 
121 ashish 99
/**
100
Internal information to be used by system. various variables which aid in serving the user are identified and put here
101
**/
102
 
103
struct UserInternalInfo{
48 ashish 104
	1:i64 userId,
121 ashish 105
	2:i64 geoZone,
106
	3:i64 shipmentZone,
48 ashish 107
	4:i64 taxZone,
108
	5:double userRankScore
109
}
110
 
121 ashish 111
/**
112
structure representing timestamp and ip at which user logged into the system
113
**/
114
struct IPMap{
115
	1:i64 timestamp
123 ashish 116
	2:string ip
48 ashish 117
}
118
 
121 ashish 119
/**
120
dynamic user state 
121
**/
122
struct UserState{
48 ashish 123
	1:i64 userId,
124
	2:bool isEmailVerified,
125
	3:i64 lastLogin,
126
	4:i64 lastLogout,
127
	5:i64 emailVerificationSentOn,
128
	6:i64 smsVerificationSentOn,
129
	7:bool isSMSVerified,
130
	8:i64 activeSince,
131
	9:bool isLoggedIn,
123 ashish 132
	10:list<IPMap> ips,
130 ashish 133
	11:i64 shoppingCartHandle,
134
	12:AccountStatus status
48 ashish 135
}
136
 
121 ashish 137
/**
138
complete user structre
139
**/
140
struct UserContext{
141
	1:UserPrimaryInfo primaryInfo,
142
	2:UserInternalInfo internalInfo,
143
	3:UserState userState,
48 ashish 144
	4:i64 id
121 ashish 145
	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 146
}
147
 
148
/**
149
service
150
*/
151
 
152
service UserContextService{
121 ashish 153
	UserContext createContext(1: UserContext context, 2: bool updateExisting) throws (1:UserContextException cex),
154
	UserContext getContextFromId(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
155
	UserContext getContextFromEmailOrHandle(1:string emailorhandle, 2:bool isEmail) throws (1:UserContextException ucx),
156
	UserState getState(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
157
	UserPrimaryInfo getPrimaryInfo(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
158
	UserInternalInfo getInternalInfo(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
159
	UserContext getContext(1:string email, 2:string password) throws (1:AuthenticationException ax),
123 ashish 160
	bool authenticateUser(1:string handle, 2:string password, 3:bool isEmail) throws (1:AuthenticationException ax),
48 ashish 161
	bool userExists(1:string email)throws (1:UserContextException ucx),
162
	bool addIpAdressForUser(1:string ip, 2:i64 timestamp, 3:i64 userId)throws (1:UserContextException ucx),
121 ashish 163
	bool addAddressForUser(1:Address address, 2:i64 userid, 3:i64 timestamp)throws (1:UserContextException ucx),
48 ashish 164
	bool removeAddressForUser(1:i64 userid, 2:i64 addressId)throws (1:UserContextException ucx),
165
	bool setUserAsLoggedIn(1:i64 userId, 2:i64 timestamp)throws (1:UserContextException ucx),
166
	bool setUserAsLoggedOut(1:i64 userid, 2:i64 timestamp)throws (1:UserContextException ucx),
167
	bool updatePassword(1:i64 userid, 2:string password)throws (1:UserContextException ucx),
121 ashish 168
	bool deleteUser(1:i64 userid, 2:bool isSessionId)throws (1:UserContextException ucx),
48 ashish 169
	bool sendEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
170
	bool sendSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
171
	bool confirmEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
172
	bool confirmSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
130 ashish 173
	bool addSocialhandle(1:i64 userid, 2:string socialService, 3:string handle)throws (1:UserContextException ucx),
174
	bool sendNewPasswordById(1:i64 userid) throws (1:UserContextException ucx),
175
	bool sendNewPasswordByHandle(1:string emailOrHandle, 2:bool isEmail)throws (1:UserContextException ucx)
48 ashish 176
}
177