You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
701 B
Go

//
// Copyright (C) 2024 veypi <i@veypi.com>
// 2025-03-04 16:08:06
// Distributed under terms of the MIT license.
//
package providers
import (
"github.com/veypi/vbase/cfg"
"github.com/veypi/vbase/models"
"github.com/veypi/vigo"
)
// GetRequest 获取详情请求
type GetRequest struct {
Code string `src:"path" desc:"提供商代码"`
}
// get 获取 OAuth 提供商详情
func get(x *vigo.X, req *GetRequest) (*models.OAuthProvider, error) {
var provider models.OAuthProvider
if err := cfg.DB().Where("code = ?", req.Code).First(&provider).Error; err != nil {
return nil, vigo.ErrNotFound.WithError(err)
}
// 敏感字段置空
provider.ClientSecret = ""
return &provider, nil
}