Subversion Repositories SmartDukaan

Rev

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