Subversion Repositories SmartDukaan

Rev

Rev 95 | Rev 123 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 95 Rev 121
Line 14... Line 14...
14
exception UserContextException{
14
exception UserContextException{
15
	1:i32 errorCode,
15
	1:i32 errorCode,
16
	2:string message
16
	2:string message
17
}
17
}
18
 
18
 
19
enum TAddressType{
19
enum AddressType{
20
	WORK,
20
	WORK,
21
	HOME
21
	HOME
22
}
22
}
23
 
23
 
24
/**
24
/**
25
structs
25
All the social handles
26
*/
26
*/
27
struct TSocialHandles{
27
struct SocialHandles{
28
	1:string facebook,
28
	1:string facebook,
29
	2:string opensocial,
29
	2:string opensocial,
30
	3:string twitter
30
	3:string twitter
31
}
31
}
32
 
32
 
-
 
33
/**
-
 
34
Address
-
 
35
*/
33
struct TAddress{
36
struct Address{
34
	1:string line1,
37
	1:string line1,
35
	2:string line2,
38
	2:string line2,
36
	3:string landmark,
39
	3:string landmark,
37
	4:string city,
40
	4:string city,
38
	5:string state,
41
	5:string state,
Line 42... Line 45...
42
	9:bool enabled,
45
	9:bool enabled,
43
	10:TAddressType type,
46
	10:TAddressType type,
44
	11:i64 addedOn
47
	11:i64 addedOn
45
}
48
}
46
 
49
 
-
 
50
/**
-
 
51
Primary information of the user
-
 
52
**/
47
struct TUserPrimaryInfo{
53
struct UserPrimaryInfo{
48
	1:i64 userId,
54
	1:i64 userId,
49
	2:string title,
55
	2:string title,
50
	3:string firstName,
56
	3:string firstName,
51
	4:string lastName,
57
	4:string lastName,
52
	5:string pictureUrl,
58
	5:string pictureUrl,
53
	6:string email,
59
	6:string email,
54
	7:string mobile,
60
	7:string mobile,
55
	8:string workPhone,
61
	8:string workPhone,
56
	9:string userHandle,
62
	9:string userHandle,
57
	10:string password,
63
	10:string password,
58
	11:TSocialHandles socialHandles,
64
	11:SocialHandles socialHandles,
59
	12:i64 dateOfBirth,
65
	12:i64 dateOfBirth,
60
	13:i64 anniversary,
66
	13:i64 anniversary,
61
	14:set<TAddress> addresses,
67
	14:set<Address> addresses,
62
	16:i32 shipmentOption,
68
	16:i32 shipmentOption,
63
	17:string middleName,
69
	17:string middleName,
64
	18:string occupation
70
	18:string occupation
65
}
71
}
66
 
72
 
-
 
73
/**
-
 
74
Internal information to be used by system. various variables which aid in serving the user are identified and put here
-
 
75
**/
-
 
76
 
67
struct TUserInternalInfo{
77
struct UserInternalInfo{
68
	1:i64 userId,
78
	1:i64 userId,
69
	2:i32 geoZone,
79
	2:i64 geoZone,
70
	3:i32 shipmentZone,
80
	3:i64 shipmentZone,
71
	4:i64 taxZone,
81
	4:i64 taxZone,
72
	5:double userRankScore
82
	5:double userRankScore
73
}
83
}
74
 
84
 
-
 
85
/**
-
 
86
structure representing timestamp and ip at which user logged into the system
-
 
87
**/
75
struct TIPMap{
88
struct IPMap{
76
	1:map<i64,string> ips
89
	1:i64 timestamp
-
 
90
	2:Stirng ip
77
}
91
}
78
 
92
 
-
 
93
/**
-
 
94
dynamic user state 
-
 
95
**/
79
struct TUserState{
96
struct UserState{
80
	1:i64 userId,
97
	1:i64 userId,
81
	2:bool isEmailVerified,
98
	2:bool isEmailVerified,
82
	3:i64 lastLogin,
99
	3:i64 lastLogin,
83
	4:i64 lastLogout,
100
	4:i64 lastLogout,
84
	5:i64 emailVerificationSentOn,
101
	5:i64 emailVerificationSentOn,
85
	6:i64 smsVerificationSentOn,
102
	6:i64 smsVerificationSentOn,
86
	7:bool isSMSVerified,
103
	7:bool isSMSVerified,
87
	8:i64 activeSince,
104
	8:i64 activeSince,
88
	9:bool isLoggedIn,
105
	9:bool isLoggedIn,
89
	10:TIPMap ipMap 
106
	10:list<IPMap> ips 
90
}
107
}
91
 
108
 
-
 
109
/**
-
 
110
complete user structre
-
 
111
**/
92
struct TUserContext{
112
struct UserContext{
93
	1:TUserPrimaryInfo primaryInfo,
113
	1:UserPrimaryInfo primaryInfo,
94
	2:TUserInternalInfo internalInfo,
114
	2:UserInternalInfo internalInfo,
95
	3:TUserState userState,
115
	3:UserState userState,
96
	4:i64 id
116
	4:i64 id
-
 
117
	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
97
}
118
}
98
 
119
 
99
/**
120
/**
100
service
121
service
101
*/
122
*/
102
 
123
 
103
service UserContextService{
124
service UserContextService{
104
	TUserContext createContext(1: TUserContext context, 2: bool updateExisting) throws (1:UserContextException cex),
125
	UserContext createContext(1: UserContext context, 2: bool updateExisting) throws (1:UserContextException cex),
105
	TUserContext getContextFromId(1:i64 userId) throws (1:UserContextException ucx),
126
	UserContext getContextFromId(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
106
	TUserContext getContextFromEmailOrHandle(1:string emailorhandle, 2:bool isEmail) throws (1:UserContextException ucx),
127
	UserContext getContextFromEmailOrHandle(1:string emailorhandle, 2:bool isEmail) throws (1:UserContextException ucx),
107
	TUserState getState(1:i64 userId) throws (1:UserContextException ucx),
128
	UserState getState(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
108
	TUserPrimaryInfo getPrimaryInfo(1:i64 userId) throws (1:UserContextException ucx),
129
	UserPrimaryInfo getPrimaryInfo(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
109
	TUserInternalInfo getInternalInfo(1:i64 userId) throws (1:UserContextException ucx),
130
	UserInternalInfo getInternalInfo(1:i64 userId, 2:bool isSessionId) throws (1:UserContextException ucx),
110
	TUserContext getContext(1:string email, 2:string password) throws (1:AuthenticationException ax),
131
	UserContext getContext(1:string email, 2:string password) throws (1:AuthenticationException ax),
111
	bool userExists(1:string email)throws (1:UserContextException ucx),
132
	bool userExists(1:string email)throws (1:UserContextException ucx),
112
	bool addIpAdressForUser(1:string ip, 2:i64 timestamp, 3:i64 userId)throws (1:UserContextException ucx),
133
	bool addIpAdressForUser(1:string ip, 2:i64 timestamp, 3:i64 userId)throws (1:UserContextException ucx),
113
	bool addAddressForUser(1:TAddress address, 2:i64 userid, 3:i64 timestamp)throws (1:UserContextException ucx),
134
	bool addAddressForUser(1:Address address, 2:i64 userid, 3:i64 timestamp)throws (1:UserContextException ucx),
114
	bool removeAddressForUser(1:i64 userid, 2:i64 addressId)throws (1:UserContextException ucx),
135
	bool removeAddressForUser(1:i64 userid, 2:i64 addressId)throws (1:UserContextException ucx),
115
	bool setUserAsLoggedIn(1:i64 userId, 2:i64 timestamp)throws (1:UserContextException ucx),
136
	bool setUserAsLoggedIn(1:i64 userId, 2:i64 timestamp)throws (1:UserContextException ucx),
116
	bool setUserAsLoggedOut(1:i64 userid, 2:i64 timestamp)throws (1:UserContextException ucx),
137
	bool setUserAsLoggedOut(1:i64 userid, 2:i64 timestamp)throws (1:UserContextException ucx),
117
	bool updatePassword(1:i64 userid, 2:string password)throws (1:UserContextException ucx),
138
	bool updatePassword(1:i64 userid, 2:string password)throws (1:UserContextException ucx),
118
	bool deleteUser(1:i64 userid)throws (1:UserContextException ucx),
139
	bool deleteUser(1:i64 userid, 2:bool isSessionId)throws (1:UserContextException ucx),
119
	bool sendEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
140
	bool sendEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
120
	bool sendSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
141
	bool sendSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
121
	bool confirmEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
142
	bool confirmEmailVerification(1:i64 userid)throws (1:UserContextException ucx),
122
	bool confirmSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
143
	bool confirmSMSVerification(1:i64 userid)throws (1:UserContextException ucx),
123
	bool addSocialhandle(1:i64 userid, 2:string socialService, 3:string handle)throws (1:UserContextException ucx)		
144
	bool addSocialhandle(1:i64 userid, 2:string socialService, 3:string handle)throws (1:UserContextException ucx)	
124
}
145
}
125
 
146