feat: login with apple

This commit is contained in:
VaalaCat
2024-09-04 18:15:49 +00:00
parent 13148b95e3
commit 0948d23239
13 changed files with 268 additions and 41 deletions

View File

@@ -2,26 +2,30 @@ package dao
import (
"github.com/nose7en/ToyBoomServer/defs"
"github.com/nose7en/ToyBoomServer/storage"
"gorm.io/gorm"
)
type Query interface {
GetUserByAppleUserID(appleUserID string) (defs.UserGettable, error)
GetUserByID(userID int64) (defs.UserGettable, error)
}
type Mutation interface {
CreateUser(user defs.UserGettable) error
FirstOrCreateUser(user defs.UserGettable) (defs.UserGettable, error)
}
var _ Query = (*queryImpl)(nil)
var _ Mutation = (*mutationImpl)(nil)
type queryImpl struct{}
type mutationImpl struct{}
type queryImpl struct{ db *gorm.DB }
type mutationImpl struct{ db *gorm.DB }
func NewQuery() Query {
return &queryImpl{}
return &queryImpl{db: storage.GetDBManager().GetDefaultDB()}
}
func NewMutation() Mutation {
return &mutationImpl{}
return &mutationImpl{db: storage.GetDBManager().GetDefaultDB()}
}