SUPPORT-8971: fix naming
This commit is contained in:
parent
f9ec8a77cd
commit
fa1df28901
4 changed files with 8 additions and 12 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<boolean>;
|
||||
protected abstract checkValueExists(value: string): Promise<boolean>;
|
||||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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<boolean> {
|
||||
return from(this.rpcService.valueExists(value));
|
||||
protected checkValueExists(value: string): Promise<boolean> {
|
||||
return this.rpcService.valueExists(value);
|
||||
}
|
||||
|
||||
protected isPatternValid(value: string): boolean {
|
||||
|
|
|
|||
|
|
@ -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<boolean> {
|
||||
return from(this.rpcService.valueExists(value));
|
||||
protected checkValueExists(value: string): Promise<boolean> {
|
||||
return this.rpcService.valueExists(value);
|
||||
}
|
||||
|
||||
protected cleanValue(value: string): string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue