refactor(registration): remove checkBanStatus method and related logic
This commit is contained in:
parent
0934417aaf
commit
16889db3b4
@ -20,10 +20,6 @@ export class RegistrationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getCustomer(variables: VariablesOf<typeof GQL.GetCustomerDocument>) {
|
async getCustomer(variables: VariablesOf<typeof GQL.GetCustomerDocument>) {
|
||||||
if (variables.telegramId) {
|
|
||||||
await this.checkBanStatus(variables.telegramId);
|
|
||||||
}
|
|
||||||
|
|
||||||
const { query } = await getClientWithToken();
|
const { query } = await getClientWithToken();
|
||||||
|
|
||||||
const result = await query({
|
const result = await query({
|
||||||
@ -66,21 +62,4 @@ export class RegistrationService {
|
|||||||
|
|
||||||
return mutationResult.data;
|
return mutationResult.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async checkBanStatus(telegramId: number) {
|
|
||||||
const { query } = await getClientWithToken();
|
|
||||||
|
|
||||||
const result = await query({
|
|
||||||
query: GQL.GetCustomerDocument,
|
|
||||||
variables: { telegramId },
|
|
||||||
});
|
|
||||||
|
|
||||||
const customer = result.data.customers.at(0);
|
|
||||||
|
|
||||||
if (customer && isCustomerBanned(customer)) {
|
|
||||||
throw new Error(ERRORS.NO_PERMISSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
return { customer };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user