From fa1df28901e6f9418f6ebfd9ca12e049659cefad Mon Sep 17 00:00:00 2001 From: Emir Suleimanov Date: Wed, 12 Mar 2025 12:35:02 +0300 Subject: [PATCH] SUPPORT-8971: fix naming --- .../component/rpc/IdmValidatorRpcService.java | 4 ++-- .../component/field/AbstractIdmValidator.ts | 6 ++---- .../component/field/IdmLoginValidator.ts | 5 ++--- .../component/field/IdmSnilsValidator.ts | 5 ++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/backend/src/main/java/ru/micord/ervu/account_applications/component/rpc/IdmValidatorRpcService.java b/backend/src/main/java/ru/micord/ervu/account_applications/component/rpc/IdmValidatorRpcService.java index a31cc65a..5370aa7d 100644 --- a/backend/src/main/java/ru/micord/ervu/account_applications/component/rpc/IdmValidatorRpcService.java +++ b/backend/src/main/java/ru/micord/ervu/account_applications/component/rpc/IdmValidatorRpcService.java @@ -16,7 +16,7 @@ public class IdmValidatorRpcService extends Behavior { public IdmValidatorService validatorService; @RpcCall - public boolean valueExists(String login) { - return validatorService.valueExists(login); + public boolean valueExists(String value) { + return validatorService.valueExists(value); } } diff --git a/frontend/src/ts/account_applications/component/field/AbstractIdmValidator.ts b/frontend/src/ts/account_applications/component/field/AbstractIdmValidator.ts index 123f9863..5899e4d4 100644 --- a/frontend/src/ts/account_applications/component/field/AbstractIdmValidator.ts +++ b/frontend/src/ts/account_applications/component/field/AbstractIdmValidator.ts @@ -1,13 +1,11 @@ import {SimpleValidator, TextField} from "@webbpm/base-package"; -import {Observable} from "rxjs"; import { IdmValidatorRpcService } from "../../../generated/ru/micord/ervu/account_applications/component/rpc/IdmValidatorRpcService"; -import {first} from "rxjs/operators"; export abstract class AbstractIdmValidator extends SimpleValidator { protected abstract ERROR_MESSAGE: string; - protected abstract checkValueExists(value: string): Observable; + protected abstract checkValueExists(value: string): Promise; protected textField: TextField; protected rpcService: IdmValidatorRpcService; @@ -28,7 +26,7 @@ export abstract class AbstractIdmValidator extends SimpleValidator { const cleanedValue = this.cleanValue(inputValue); if (!this.isPatternValid(cleanedValue)) return Promise.resolve(false); - return this.checkValueExists(cleanedValue).pipe(first()).toPromise() + return this.checkValueExists(cleanedValue) .then(exists => { this.pushError(!exists, this.ERROR_MESSAGE); return !exists; diff --git a/frontend/src/ts/account_applications/component/field/IdmLoginValidator.ts b/frontend/src/ts/account_applications/component/field/IdmLoginValidator.ts index 61bb0370..c174e960 100644 --- a/frontend/src/ts/account_applications/component/field/IdmLoginValidator.ts +++ b/frontend/src/ts/account_applications/component/field/IdmLoginValidator.ts @@ -1,11 +1,10 @@ -import {from, Observable} from "rxjs"; import {AbstractIdmValidator} from "./AbstractIdmValidator"; export class IdmLoginValidator extends AbstractIdmValidator { protected ERROR_MESSAGE = "Пользователь с указанным логином уже существует"; - protected checkValueExists(value: string): Observable { - return from(this.rpcService.valueExists(value)); + protected checkValueExists(value: string): Promise { + return this.rpcService.valueExists(value); } protected isPatternValid(value: string): boolean { diff --git a/frontend/src/ts/account_applications/component/field/IdmSnilsValidator.ts b/frontend/src/ts/account_applications/component/field/IdmSnilsValidator.ts index 9d26d633..a598bd4b 100644 --- a/frontend/src/ts/account_applications/component/field/IdmSnilsValidator.ts +++ b/frontend/src/ts/account_applications/component/field/IdmSnilsValidator.ts @@ -1,11 +1,10 @@ -import {from, Observable} from "rxjs"; import {AbstractIdmValidator} from "./AbstractIdmValidator"; export class IdmSnilsValidator extends AbstractIdmValidator { protected ERROR_MESSAGE = "Пользователь с указанным СНИЛС уже существует"; - protected checkValueExists(value: string): Observable { - return from(this.rpcService.valueExists(value)); + protected checkValueExists(value: string): Promise { + return this.rpcService.valueExists(value); } protected cleanValue(value: string): string {