Refactor welcome feature to use RegistrationService for customer retrieval
- Replaced CustomersService with RegistrationService in the welcome feature to streamline customer data retrieval. - Updated the command handler to ensure proper integration with the new service.
This commit is contained in:
parent
900cfe2cc2
commit
d191be03e8
@ -2,7 +2,7 @@ import { type Context } from '@/bot/context';
|
||||
import { logHandle } from '@/bot/helpers/logging';
|
||||
import { KEYBOARD_SHARE_PHONE, mainMenu } from '@/config/keyboards';
|
||||
import { combine } from '@/utils/messages';
|
||||
import { CustomersService } from '@repo/graphql/api/customers';
|
||||
import { RegistrationService } from '@repo/graphql/api/registration';
|
||||
import { Composer } from 'grammy';
|
||||
|
||||
const composer = new Composer<Context>();
|
||||
@ -12,8 +12,8 @@ const feature = composer.chatType('private');
|
||||
feature.command('start', logHandle('command-start'), async (ctx) => {
|
||||
const telegramId = ctx.from.id;
|
||||
|
||||
const customerService = new CustomersService({ telegramId });
|
||||
const { customer } = await customerService.getCustomer({ telegramId });
|
||||
const registrationService = new RegistrationService();
|
||||
const { customer } = await registrationService.getCustomer({ telegramId });
|
||||
|
||||
if (customer) {
|
||||
// Пользователь уже зарегистрирован — приветствуем
|
||||
|
||||
@ -46,8 +46,6 @@ export class CustomersService extends BaseService {
|
||||
}
|
||||
|
||||
async getCustomer(variables: VariablesOf<typeof GQL.GetCustomerDocument>) {
|
||||
await this.checkIsBanned();
|
||||
|
||||
const { query } = await getClientWithToken();
|
||||
|
||||
const result = await query({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user