WaspW
Wasp15mo ago
NEROX

Action in loop

After modifying this:

export const updateCurrentUser: UpdateCurrentUser<Partial<User>, User> = async (args, context) => { if (!context.user) { throw new Error('Usuario no autenticado'); } const { firstName, lastName, gender, age, height, currentWeight, trainingGoal, experienceLevel, trainingFrequency, sessionDuration, healthConditions, equipmentAccess, dietaryPreferences, availableTime, exercisePreference } = args; const updatedUser = await context.entities.User.update({ where: { id: context.user.id }, data: { firstName, lastName, gender, age: age !== undefined ? parseInt(age.toString()) : undefined, height: height !== undefined ? parseFloat(height.toString()) : undefined, currentWeight: currentWeight !== undefined ? parseFloat(currentWeight.toString()) : undefined, trainingGoal, experienceLevel, trainingFrequency, sessionDuration, healthConditions, equipmentAccess, dietaryPreferences, availableTime, exercisePreference } }); return updatedUser; };

Based on

model User { id String @id @default(uuid()) createdAt DateTime @default(now()) email String? @unique username String? @unique lastActiveTimestamp DateTime @default(now()) isAdmin Boolean @default(false) stripeId String? @unique checkoutSessionId String? subscriptionStatus String? // 'active', 'canceled', 'past_due', 'deleted' subscriptionPlan String? // 'hobby', 'pro' sendNewsletter Boolean @default(false) datePaid DateTime? credits Int @default(3) firstName String? lastName String? gender Gender @default(OTHER) age Int? height Float? currentWeight Float? trainingGoal TrainingGoal? experienceLevel ExperienceLevel? trainingFrequency TrainingFrequency? sessionDuration SessionDuration? healthConditions String? equipmentAccess EquipmentAccess? dietaryPreferences DietaryPreference? availableTime AvailableTime? exercisePreference ExercisePreference[] gptResponses GptResponse[] contactFormMessages ContactFormMessage[] tasks Task[] files File[] weightLogs WeightLog[] // Relación uno a muchos con registros de peso workouts Workout[] // Relación de uno a muchos con rutinas monthlyPlans MonthlyPlan[] // Relación de uno a muchos con los planes mensuales }


I get:
[ Server ] POST /operations/update-current-user 200 11.305 ms - 809 [ Server ] GET /auth/me 304 6.430 ms - - [ Server ] POST /operations/update-current-user 200 10.870 ms - 809 [ Server ] GET /auth/me 304 6.616 ms - - [ Server ] POST /operations/update-current-user 200 11.727 ms - 809 [ Server ] GET /auth/me 304 6.926 ms - - [ Server ] POST /operations/update-current-user 200 13.249 ms - 809 [ Server ] GET /auth/me 304 9.781 ms - - [ Server ] POST /operations/update-current-user 200 14.145 ms - 809 [ Server ] GET /auth/me 304 5.962 ms -

It is running all the time in a loop.
https://gyazo.com/b4e078f0823fd7901889df19929de06b
Was this page helpful?