fix registration error

This commit is contained in:
vchikalkin 2025-10-08 22:43:24 +03:00
parent 0a43d63c2c
commit d32a7dc54e

View File

@ -3,7 +3,6 @@ import { logHandle } from '@/bot/helpers/logging';
import { KEYBOARD_REMOVE, mainMenu } from '@/config/keyboards'; import { KEYBOARD_REMOVE, mainMenu } from '@/config/keyboards';
import { parseContact } from '@/utils/contact'; import { parseContact } from '@/utils/contact';
import { isValidPhoneNumber, normalizePhoneNumber } from '@/utils/phone'; import { isValidPhoneNumber, normalizePhoneNumber } from '@/utils/phone';
import { CustomersService } from '@repo/graphql/api/customers';
import { RegistrationService } from '@repo/graphql/api/registration'; import { RegistrationService } from '@repo/graphql/api/registration';
import { Composer } from 'grammy'; import { Composer } from 'grammy';
@ -18,8 +17,8 @@ feature.on(':contact', logHandle('contact-registration'), async (ctx) => {
const { name, surname } = parseContact(contact); const { name, surname } = parseContact(contact);
// Проверяем, не зарегистрирован ли уже пользователь // Проверяем, не зарегистрирован ли уже пользователь
const customerService = new CustomersService({ telegramId }); const registrationService = new RegistrationService();
const { customer: existingCustomer } = await customerService.getCustomer({ telegramId }); const { customer: existingCustomer } = await registrationService.getCustomer({ telegramId });
if (existingCustomer) { if (existingCustomer) {
return ctx.reply(ctx.t('msg-already-registered'), { return ctx.reply(ctx.t('msg-already-registered'), {
@ -39,8 +38,6 @@ feature.on(':contact', logHandle('contact-registration'), async (ctx) => {
return ctx.reply(ctx.t('msg-invalid-phone')); return ctx.reply(ctx.t('msg-invalid-phone'));
} }
const registrationService = new RegistrationService();
try { try {
const { customer } = await registrationService.getCustomer({ phone }); const { customer } = await registrationService.getCustomer({ phone });