| 
									
										
										
										
											2018-02-09 06:13:58 +08:00
										 |  |  | package models | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 05:09:49 +08:00
										 |  |  | import ( | 
					
						
							|  |  |  | 	"time" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-09 06:13:58 +08:00
										 |  |  | type UserAuth struct { | 
					
						
							|  |  |  | 	Id         int64 | 
					
						
							|  |  |  | 	UserId     int64 | 
					
						
							|  |  |  | 	AuthModule string | 
					
						
							|  |  |  | 	AuthId     string | 
					
						
							| 
									
										
										
										
											2018-03-20 05:09:49 +08:00
										 |  |  | 	Created    time.Time | 
					
						
							| 
									
										
										
										
											2018-02-09 06:13:58 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type ExternalUserInfo struct { | 
					
						
							|  |  |  | 	AuthModule string | 
					
						
							|  |  |  | 	AuthId     string | 
					
						
							|  |  |  | 	UserId     int64 | 
					
						
							|  |  |  | 	Email      string | 
					
						
							|  |  |  | 	Login      string | 
					
						
							|  |  |  | 	Name       string | 
					
						
							|  |  |  | 	OrgRoles   map[int64]RoleType | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // ---------------------
 | 
					
						
							|  |  |  | // COMMANDS
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type UpsertUserCommand struct { | 
					
						
							|  |  |  | 	ExternalUser  *ExternalUserInfo | 
					
						
							|  |  |  | 	SignupAllowed bool | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-23 23:16:11 +08:00
										 |  |  | 	Result *User | 
					
						
							| 
									
										
										
										
											2018-02-09 06:13:58 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type SetAuthInfoCommand struct { | 
					
						
							|  |  |  | 	AuthModule string | 
					
						
							|  |  |  | 	AuthId     string | 
					
						
							|  |  |  | 	UserId     int64 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type DeleteAuthInfoCommand struct { | 
					
						
							|  |  |  | 	UserAuth *UserAuth | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // ----------------------
 | 
					
						
							|  |  |  | // QUERIES
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type LoginUserQuery struct { | 
					
						
							|  |  |  | 	Username  string | 
					
						
							|  |  |  | 	Password  string | 
					
						
							|  |  |  | 	User      *User | 
					
						
							|  |  |  | 	IpAddress string | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type GetUserByAuthInfoQuery struct { | 
					
						
							|  |  |  | 	AuthModule string | 
					
						
							|  |  |  | 	AuthId     string | 
					
						
							|  |  |  | 	UserId     int64 | 
					
						
							|  |  |  | 	Email      string | 
					
						
							|  |  |  | 	Login      string | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	User     *User | 
					
						
							|  |  |  | 	UserAuth *UserAuth | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type GetAuthInfoQuery struct { | 
					
						
							|  |  |  | 	AuthModule string | 
					
						
							|  |  |  | 	AuthId     string | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	UserAuth *UserAuth | 
					
						
							|  |  |  | } |