feat: implement resolvers

This commit is contained in:
Lakhan Samani
2022-07-10 21:49:33 +05:30
parent 09c3eafe6b
commit e91a819067
87 changed files with 1807 additions and 428 deletions

View File

@@ -1,6 +1,7 @@
package provider_template
import (
"context"
"time"
"github.com/authorizerdev/authorizer/server/constants"
@@ -11,7 +12,7 @@ import (
)
// AddUser to save user information in database
func (p *provider) AddUser(user models.User) (models.User, error) {
func (p *provider) AddUser(ctx context.Context, user models.User) (models.User, error) {
if user.ID == "" {
user.ID = uuid.New().String()
}
@@ -31,30 +32,30 @@ func (p *provider) AddUser(user models.User) (models.User, error) {
}
// UpdateUser to update user information in database
func (p *provider) UpdateUser(user models.User) (models.User, error) {
func (p *provider) UpdateUser(ctx context.Context, user models.User) (models.User, error) {
user.UpdatedAt = time.Now().Unix()
return user, nil
}
// DeleteUser to delete user information from database
func (p *provider) DeleteUser(user models.User) error {
func (p *provider) DeleteUser(ctx context.Context, user models.User) error {
return nil
}
// ListUsers to get list of users from database
func (p *provider) ListUsers(pagination model.Pagination) (*model.Users, error) {
func (p *provider) ListUsers(ctx context.Context, pagination model.Pagination) (*model.Users, error) {
return nil, nil
}
// GetUserByEmail to get user information from database using email address
func (p *provider) GetUserByEmail(email string) (models.User, error) {
func (p *provider) GetUserByEmail(ctx context.Context, email string) (models.User, error) {
var user models.User
return user, nil
}
// GetUserByID to get user information from database using user ID
func (p *provider) GetUserByID(id string) (models.User, error) {
func (p *provider) GetUserByID(ctx context.Context, id string) (models.User, error) {
var user models.User
return user, nil