fix: some api bug
This commit is contained in:
@@ -8,6 +8,30 @@ import (
|
||||
"juwan-backend/app/users/rpc/internal/models"
|
||||
)
|
||||
|
||||
// The UserFollowsFunc type is an adapter to allow the use of ordinary
|
||||
// function as UserFollows mutator.
|
||||
type UserFollowsFunc func(context.Context, *models.UserFollowsMutation) (models.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f UserFollowsFunc) Mutate(ctx context.Context, m models.Mutation) (models.Value, error) {
|
||||
if mv, ok := m.(*models.UserFollowsMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *models.UserFollowsMutation", m)
|
||||
}
|
||||
|
||||
// The UserPreferencesFunc type is an adapter to allow the use of ordinary
|
||||
// function as UserPreferences mutator.
|
||||
type UserPreferencesFunc func(context.Context, *models.UserPreferencesMutation) (models.Value, error)
|
||||
|
||||
// Mutate calls f(ctx, m).
|
||||
func (f UserPreferencesFunc) Mutate(ctx context.Context, m models.Mutation) (models.Value, error) {
|
||||
if mv, ok := m.(*models.UserPreferencesMutation); ok {
|
||||
return f(ctx, mv)
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *models.UserPreferencesMutation", m)
|
||||
}
|
||||
|
||||
// The UsersFunc type is an adapter to allow the use of ordinary
|
||||
// function as Users mutator.
|
||||
type UsersFunc func(context.Context, *models.UsersMutation) (models.Value, error)
|
||||
|
||||
Reference in New Issue
Block a user