示例#1
0
func (f MeFacade) LoginMe(name, avatarURL, location string) (*models.User, error) {
	meService := services.NewMeService(f.ctx)
	me, err := meService.GetMeByName(name)
	// Exist me and no error
	if me != nil && err == nil {
		return me, nil
	}
	// Create new user record
	me, err = meService.CreateMe(name, avatarURL, location)
	if err != nil {
		return nil, err
	}
	return me, nil
}
示例#2
0
func (f MeFacade) GetMe(accessToken string) (*models.User, error) {
	meService := services.NewMeService(f.ctx)
	return meService.GetMeByAccessToken(accessToken)
}