fix: some api bug

This commit is contained in:
wwweww
2026-03-31 22:12:06 +08:00
parent c5ff4f0216
commit e7970ac25f
219 changed files with 16195 additions and 2126 deletions
@@ -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)