mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
24 lines
444 B
Go
24 lines
444 B
Go
package auth
|
|
|
|
import (
|
|
"npm/internal/database"
|
|
)
|
|
|
|
// GetByID finds a auth by ID
|
|
func GetByID(id int) (Model, error) {
|
|
var m Model
|
|
err := m.LoadByID(id)
|
|
return m, err
|
|
}
|
|
|
|
// GetByUserIDType finds a user by email
|
|
func GetByUserIDType(userID uint, authType string) (Model, error) {
|
|
var auth Model
|
|
db := database.GetDB()
|
|
result := db.
|
|
Where("user_id = ?", userID).
|
|
Where("type = ?", authType).
|
|
First(&auth)
|
|
return auth, result.Error
|
|
}
|