FRONTEND-535: Strict global variable names (#444)

This commit is contained in:
Rinat Arsaev 2021-04-26 18:17:59 +03:00 committed by GitHub
parent 42b8c1389d
commit e6908909fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
155 changed files with 433 additions and 373 deletions

View File

@ -48,10 +48,27 @@ module.exports = {
// Naming conversation // Naming conversation
'@typescript-eslint/naming-convention': [ '@typescript-eslint/naming-convention': [
'error', 'error',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
},
{ {
selector: 'typeLike', selector: 'typeLike',
format: ['StrictPascalCase'], format: ['StrictPascalCase'],
}, },
{
selector: 'variable',
modifiers: ['const', 'global'],
format: ['UPPER_CASE'],
},
{
selector: 'variable',
modifiers: ['const', 'global'],
// Objects are functions too
types: ['function'],
format: ['UPPER_CASE', 'camelCase'],
},
{ {
selector: 'enumMember', selector: 'enumMember',
format: ['StrictPascalCase'], format: ['StrictPascalCase'],

View File

@ -5,5 +5,6 @@ import { AnalyticsService as BaseAnalyticsService } from './swagger-codegen/api/
@Injectable() @Injectable()
export class AnalyticsService extends BaseAnalyticsService { export class AnalyticsService extends BaseAnalyticsService {
// eslint-disable-next-line @typescript-eslint/naming-convention
defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' }); defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' });
} }

View File

@ -5,5 +5,6 @@ import { ReportsService as BaseReportsService } from './swagger-codegen/api/repo
@Injectable() @Injectable()
export class ReportsService extends BaseReportsService { export class ReportsService extends BaseReportsService {
// eslint-disable-next-line @typescript-eslint/naming-convention
defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' }); defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' });
} }

View File

@ -5,5 +5,6 @@ import { InvoicesService as BaseInvoicesService } from './swagger-codegen/api/in
@Injectable() @Injectable()
export class InvoicesService extends BaseInvoicesService { export class InvoicesService extends BaseInvoicesService {
// eslint-disable-next-line @typescript-eslint/naming-convention
defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' }); defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' });
} }

View File

@ -5,5 +5,6 @@ import { ShopsService as BaseShopsService } from './swagger-codegen/api/shops.se
@Injectable() @Injectable()
export class ShopsService extends BaseShopsService { export class ShopsService extends BaseShopsService {
// eslint-disable-next-line @typescript-eslint/naming-convention
defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' }); defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' });
} }

View File

@ -5,5 +5,6 @@ import { ClaimsService as BaseClaimsService } from './swagger-codegen/api/claims
@Injectable() @Injectable()
export class ClaimsService extends BaseClaimsService { export class ClaimsService extends BaseClaimsService {
// eslint-disable-next-line @typescript-eslint/naming-convention
defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' }); defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' });
} }

View File

@ -8,6 +8,7 @@ import { Configuration } from './swagger-codegen';
export class DarkApiConfigService extends Configuration { export class DarkApiConfigService extends Configuration {
constructor(keycloakService: KeycloakService, { apiEndpoint }: ConfigService) { constructor(keycloakService: KeycloakService, { apiEndpoint }: ConfigService) {
super({ super({
// eslint-disable-next-line @typescript-eslint/naming-convention
apiKeys: { Authorization: `Bearer ${keycloakService.getKeycloakInstance().token}` }, apiKeys: { Authorization: `Bearer ${keycloakService.getKeycloakInstance().token}` },
basePath: `${apiEndpoint}/dark-api/v1`, basePath: `${apiEndpoint}/dark-api/v1`,
}); });

View File

@ -5,5 +5,6 @@ import { FilesService as BaseFilesService } from './swagger-codegen/api/files.se
@Injectable() @Injectable()
export class FilesService extends BaseFilesService { export class FilesService extends BaseFilesService {
// eslint-disable-next-line @typescript-eslint/naming-convention
defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json' }); defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json' });
} }

View File

@ -12,6 +12,7 @@ export class GetQuestionaryService extends DefaultService {
@Optional() configuration: Configuration @Optional() configuration: Configuration
) { ) {
super(httpClient, basePath, configuration); super(httpClient, basePath, configuration);
// eslint-disable-next-line @typescript-eslint/naming-convention
this.defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' }); this.defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' });
} }
} }

View File

@ -5,5 +5,6 @@ import { WalletsService as BaseWalletsService } from './swagger-codegen/api/wall
@Injectable() @Injectable()
export class WalletService extends BaseWalletsService { export class WalletService extends BaseWalletsService {
// eslint-disable-next-line @typescript-eslint/naming-convention
defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' }); defaultHeaders = new HttpHeaders({ 'Content-Type': 'application/json; charset=utf-8' });
} }

View File

@ -17,7 +17,7 @@ import {
ShopLocationUrl, ShopLocationUrl,
} from '@dsh/api-codegen/capi'; } from '@dsh/api-codegen/capi';
const defaultClaimContractor: RussianLegalEntity = { const DEFAULT_CLAIM_CONTRACTOR: RussianLegalEntity = {
contractorType: 'LegalEntity', contractorType: 'LegalEntity',
entityType: 'RussianLegalEntity', entityType: 'RussianLegalEntity',
registeredName: 'Test registered name', registeredName: 'Test registered name',
@ -36,7 +36,7 @@ const defaultClaimContractor: RussianLegalEntity = {
}, },
}; };
const defaultPayoutToolDetails: PayoutToolDetailsBankAccount = { const DEFAULT_PAYOUT_TOOL_DETAILS: PayoutToolDetailsBankAccount = {
detailsType: 'PayoutToolDetailsBankAccount', detailsType: 'PayoutToolDetailsBankAccount',
account: '00000000000000000000', account: '00000000000000000000',
bankName: 'Test bank name', bankName: 'Test bank name',
@ -44,7 +44,7 @@ const defaultPayoutToolDetails: PayoutToolDetailsBankAccount = {
bankBik: '000000000', bankBik: '000000000',
}; };
const defaultLegalAgreement: LegalAgreement = { const DEFAULT_LEGAL_AGREEMENT: LegalAgreement = {
id: '000000/00', id: '000000/00',
signedAt: moment().subtract(1, 'days').utc().format() as any, signedAt: moment().subtract(1, 'days').utc().format() as any,
}; };
@ -59,7 +59,7 @@ const contractCreationChange = (
contractID, contractID,
contractModificationType: 'ContractCreation', contractModificationType: 'ContractCreation',
paymentInstitutionID, paymentInstitutionID,
contractor: contractor || defaultClaimContractor, contractor: contractor || DEFAULT_CLAIM_CONTRACTOR,
}; };
}; };
@ -75,7 +75,7 @@ const contractPayoutToolCreationChange = (
contractModificationType: 'ContractPayoutToolCreation', contractModificationType: 'ContractPayoutToolCreation',
payoutToolID, payoutToolID,
currency, currency,
details: details || defaultPayoutToolDetails, details: details || DEFAULT_PAYOUT_TOOL_DETAILS,
} as ContractPayoutToolCreation; } as ContractPayoutToolCreation;
}; };
@ -87,7 +87,7 @@ const contractLegalAgreementBindingChange = (
partyModificationType: 'ContractModification', partyModificationType: 'ContractModification',
contractID, contractID,
contractModificationType: 'ContractLegalAgreementBinding', contractModificationType: 'ContractLegalAgreementBinding',
legalAgreement: legalAgreement || defaultLegalAgreement, legalAgreement: legalAgreement || DEFAULT_LEGAL_AGREEMENT,
}; };
}; };

View File

@ -18,14 +18,14 @@ import {
} from '../claim-contractor-modification'; } from '../claim-contractor-modification';
import { createShopCreationModification, makeShopLocation } from '../claim-shop-modification'; import { createShopCreationModification, makeShopLocation } from '../claim-shop-modification';
const testRussianBankAccount: Omit<RussianBankAccount, 'payoutToolType'> = { const TEST_RUSSIAN_BANK_ACCOUNT: Omit<RussianBankAccount, 'payoutToolType'> = {
account: '00000000000000000000', account: '00000000000000000000',
bankName: 'Test bank name', bankName: 'Test bank name',
bankPostAccount: '00000000000000000000', bankPostAccount: '00000000000000000000',
bankBik: '000000000', bankBik: '000000000',
}; };
const testRussianLegalEntity: Omit<RussianLegalEntity, 'legalEntityType'> = { const TEST_RUSSIAN_LEGAL_ENTITY: Omit<RussianLegalEntity, 'legalEntityType'> = {
registeredName: 'Test registered name', registeredName: 'Test registered name',
registeredNumber: '0000000000000', registeredNumber: '0000000000000',
inn: '0000000000', inn: '0000000000',
@ -34,7 +34,7 @@ const testRussianLegalEntity: Omit<RussianLegalEntity, 'legalEntityType'> = {
representativePosition: 'Test representative position', representativePosition: 'Test representative position',
representativeFullName: 'Test representative full name', representativeFullName: 'Test representative full name',
representativeDocument: 'Test representative document', representativeDocument: 'Test representative document',
russianBankAccount: createRussianBankAccountModification(testRussianBankAccount), russianBankAccount: createRussianBankAccountModification(TEST_RUSSIAN_BANK_ACCOUNT),
}; };
const createTestLegalAgreement = (): LegalAgreement => ({ const createTestLegalAgreement = (): LegalAgreement => ({
@ -42,7 +42,7 @@ const createTestLegalAgreement = (): LegalAgreement => ({
legalAgreementID: '000000/00', legalAgreementID: '000000/00',
}); });
const testShopCreation: Omit<ShopCreationModification, 'shopModificationType' | 'contractID' | 'payoutToolID'> = { const TEST_SHOP_CREATION: Omit<ShopCreationModification, 'shopModificationType' | 'contractID' | 'payoutToolID'> = {
category: { category: {
categoryID: 1, categoryID: 1,
}, },
@ -64,9 +64,9 @@ export const createTestShopModifications = ({
shopID: string; shopID: string;
payoutToolID: string; payoutToolID: string;
}): Modification[] => [ }): Modification[] => [
createRussianLegalEntityModification(contractorID, testRussianLegalEntity), createRussianLegalEntityModification(contractorID, TEST_RUSSIAN_LEGAL_ENTITY),
createContractCreationModification(contractID, { contractorID }), createContractCreationModification(contractID, { contractorID }),
createContractLegalAgreementBindingModification(contractID, createTestLegalAgreement()), createContractLegalAgreementBindingModification(contractID, createTestLegalAgreement()),
createRussianContractPayoutToolModification(contractID, payoutToolID, testRussianBankAccount), createRussianContractPayoutToolModification(contractID, payoutToolID, TEST_RUSSIAN_BANK_ACCOUNT),
createShopCreationModification(shopID, { ...testShopCreation, contractID, payoutToolID }), createShopCreationModification(shopID, { ...TEST_SHOP_CREATION, contractID, payoutToolID }),
]; ];

View File

@ -13,7 +13,7 @@ import {
import { mapResult, noContinuationToken } from '../../custom-operators'; import { mapResult, noContinuationToken } from '../../custom-operators';
import { genXRequestID } from '../utils'; import { genXRequestID } from '../utils';
export const ClaimStatus = StatusModificationUnit.StatusEnum; export const CLAIM_STATUS = StatusModificationUnit.StatusEnum;
// TODO: refactor this service as claim requests service // TODO: refactor this service as claim requests service
@Injectable() @Injectable()

View File

@ -8,10 +8,10 @@ import {
import { createUnionTypeGuardCreator } from '../../utils'; import { createUnionTypeGuardCreator } from '../../utils';
const Type = ClaimModificationType.ClaimModificationTypeEnum; const TYPE = ClaimModificationType.ClaimModificationTypeEnum;
const createTypeGuard = createUnionTypeGuardCreator<ClaimModificationType>('claimModificationType'); const createTypeGuard = createUnionTypeGuardCreator<ClaimModificationType>('claimModificationType');
export const isFileModificationUnit = createTypeGuard<FileModificationUnit>(Type.FileModificationUnit); export const isFileModificationUnit = createTypeGuard<FileModificationUnit>(TYPE.FileModificationUnit);
export const isCommentModificationUnit = createTypeGuard<CommentModificationUnit>(Type.CommentModificationUnit); export const isCommentModificationUnit = createTypeGuard<CommentModificationUnit>(TYPE.CommentModificationUnit);
export const isStatusModificationUnit = createTypeGuard<StatusModificationUnit>(Type.StatusModificationUnit); export const isStatusModificationUnit = createTypeGuard<StatusModificationUnit>(TYPE.StatusModificationUnit);
export const isDocumentModificationUnit = createTypeGuard<DocumentModificationUnit>(Type.DocumentModificationUnit); export const isDocumentModificationUnit = createTypeGuard<DocumentModificationUnit>(TYPE.DocumentModificationUnit);

View File

@ -2,7 +2,7 @@ import { DocumentCreated, DocumentModification } from '@dsh/api-codegen/claim-ma
import { createUnionTypeGuardCreator } from '../../utils'; import { createUnionTypeGuardCreator } from '../../utils';
const Type = DocumentModification.DocumentModificationTypeEnum; const TYPE = DocumentModification.DocumentModificationTypeEnum;
const createTypeGuard = createUnionTypeGuardCreator<DocumentModification>('documentModificationType'); const createTypeGuard = createUnionTypeGuardCreator<DocumentModification>('documentModificationType');
export const isDocumentCreated = createTypeGuard<DocumentCreated>(Type.DocumentCreated); export const isDocumentCreated = createTypeGuard<DocumentCreated>(TYPE.DocumentCreated);

View File

@ -2,8 +2,8 @@ import { ClaimModification, Modification, PartyModification } from '@dsh/api-cod
import { createUnionTypeGuardCreator } from '../../utils'; import { createUnionTypeGuardCreator } from '../../utils';
const Type = Modification.ModificationTypeEnum; const TYPE = Modification.ModificationTypeEnum;
const createTypeGuard = createUnionTypeGuardCreator<Modification>('modificationType'); const createTypeGuard = createUnionTypeGuardCreator<Modification>('modificationType');
export const isClaimModification = createTypeGuard<ClaimModification>(Type.ClaimModification); export const isClaimModification = createTypeGuard<ClaimModification>(TYPE.ClaimModification);
export const isPartyModification = createTypeGuard<PartyModification>(Type.PartyModification); export const isPartyModification = createTypeGuard<PartyModification>(TYPE.PartyModification);

View File

@ -2,6 +2,7 @@ import { FileModification, FileModificationUnit } from '@dsh/api-codegen/claim-m
import { SpecificClaimModificationUnit } from './specific-claim-modification-unit'; import { SpecificClaimModificationUnit } from './specific-claim-modification-unit';
// eslint-disable-next-line @typescript-eslint/naming-convention
const FileModificationType = FileModification.FileModificationTypeEnum; const FileModificationType = FileModification.FileModificationTypeEnum;
type FileModificationType = FileModification.FileModificationTypeEnum; type FileModificationType = FileModification.FileModificationTypeEnum;

View File

@ -16,12 +16,14 @@ type FullParamsByRequestType = Mapping<
RequestType, RequestType,
DaDataRequest, DaDataRequest,
{ {
/* eslint-disable @typescript-eslint/naming-convention */
AddressQuery: AddressQuery; AddressQuery: AddressQuery;
BankQuery: BankQuery; BankQuery: BankQuery;
FioQuery: FioQuery; FioQuery: FioQuery;
FmsUnitQuery: FmsUnitQuery; FmsUnitQuery: FmsUnitQuery;
OkvedQuery: OkvedQuery; OkvedQuery: OkvedQuery;
PartyQuery: PartyQuery; PartyQuery: PartyQuery;
/* eslint-enable @typescript-eslint/naming-convention */
} }
>; >;

View File

@ -11,19 +11,20 @@ import {
import { Mapping } from '../../../type-utils'; import { Mapping } from '../../../type-utils';
const RequestType = DaDataRequest.DaDataRequestTypeEnum; // can be safely removed
type RequestType = DaDataRequest.DaDataRequestTypeEnum; type RequestType = DaDataRequest.DaDataRequestTypeEnum;
export type ResponseByRequestType = Mapping< export type ResponseByRequestType = Mapping<
RequestType, RequestType,
DaDataResponse, DaDataResponse,
{ {
/* eslint-disable @typescript-eslint/naming-convention */
AddressQuery: AddressResponse; AddressQuery: AddressResponse;
BankQuery: BankResponse; BankQuery: BankResponse;
FioQuery: FioResponse; FioQuery: FioResponse;
FmsUnitQuery: FmsUnitResponse; FmsUnitQuery: FmsUnitResponse;
OkvedQuery: OkvedResponse; OkvedQuery: OkvedResponse;
PartyQuery: PartyResponse; PartyQuery: PartyResponse;
/* eslint-enable @typescript-eslint/naming-convention */
} }
>; >;

View File

@ -41,8 +41,10 @@ export class FilesService {
private uploadFileToUrl(file: File, url: string): Observable<any> { private uploadFileToUrl(file: File, url: string): Observable<any> {
return this.http.put(url, file, { return this.http.put(url, file, {
headers: { headers: {
/* eslint-disable @typescript-eslint/naming-convention */
'Content-Disposition': `attachment;filename=${encodeURI(file.name)}`, 'Content-Disposition': `attachment;filename=${encodeURI(file.name)}`,
'Content-Type': '', 'Content-Type': '',
/* eslint-enable @typescript-eslint/naming-convention */
}, },
}); });
} }

View File

@ -18,17 +18,18 @@ import {
import { Mapping } from '../../../type-utils'; import { Mapping } from '../../../type-utils';
const RequestType = KonturFocusRequest.KonturFocusRequestTypeEnum;
type RequestType = KonturFocusRequest.KonturFocusRequestTypeEnum; type RequestType = KonturFocusRequest.KonturFocusRequestTypeEnum;
type ParamsByRequestType = Mapping< type ParamsByRequestType = Mapping<
RequestType, RequestType,
KonturFocusRequest, KonturFocusRequest,
{ {
/* eslint-disable @typescript-eslint/naming-convention */
ReqQuery: ReqQuery; ReqQuery: ReqQuery;
EgrDetailsQuery: EgrDetailsQuery; EgrDetailsQuery: EgrDetailsQuery;
LicencesQuery: LicencesQuery; LicencesQuery: LicencesQuery;
BeneficialOwnerQuery: BeneficialOwnerQuery; BeneficialOwnerQuery: BeneficialOwnerQuery;
/* eslint-enable @typescript-eslint/naming-convention */
} }
>; >;
@ -36,10 +37,12 @@ export type ResponsesByRequestType = Mapping<
RequestType, RequestType,
KonturFocusResponse, KonturFocusResponse,
{ {
/* eslint-disable @typescript-eslint/naming-convention */
ReqQuery: ReqResponses; ReqQuery: ReqResponses;
EgrDetailsQuery: EgrDetailsResponses; EgrDetailsQuery: EgrDetailsResponses;
LicencesQuery: LicencesResponses; LicencesQuery: LicencesResponses;
BeneficialOwnerQuery: BeneficialOwnerResponses; BeneficialOwnerQuery: BeneficialOwnerResponses;
/* eslint-enable @typescript-eslint/naming-convention */
} }
>; >;

View File

@ -1,10 +1,10 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BaseConfig } from './config'; import { BASE_CONFIG } from './config';
import { config as appConfig } from './config-stub'; import { config as appConfig } from './config-stub';
@Injectable() @Injectable()
export class ConfigStubService extends BaseConfig { export class ConfigStubService extends BASE_CONFIG {
constructor() { constructor() {
super(); super();
for (const [name, config] of Object.entries(appConfig)) { for (const [name, config] of Object.entries(appConfig)) {

View File

@ -1,10 +1,10 @@
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BaseConfig, Config } from './config'; import { BASE_CONFIG, Config } from './config';
@Injectable() @Injectable()
export class ConfigService extends BaseConfig { export class ConfigService extends BASE_CONFIG {
constructor(private http: HttpClient) { constructor(private http: HttpClient) {
super(); super();
} }

View File

@ -2,4 +2,4 @@ import type AppConfig from '../../appConfig.json';
import { getBaseClass } from '../../utils'; import { getBaseClass } from '../../utils';
export type Config = typeof AppConfig; export type Config = typeof AppConfig;
export const BaseConfig = getBaseClass<Config>(); export const BASE_CONFIG = getBaseClass<Config>();

View File

@ -23,18 +23,18 @@ interface Option<S extends Suggestion> {
value: S; value: S;
} }
const ReqType = DaDataRequest.DaDataRequestTypeEnum; const REQ_TYPE = DaDataRequest.DaDataRequestTypeEnum;
type ReqType = DaDataRequest.DaDataRequestTypeEnum; type ReqType = DaDataRequest.DaDataRequestTypeEnum;
const requestTypeByType: { [name in Type]: ReqType } = { const REQUEST_TYPE_BY_TYPE: { [name in Type]: ReqType } = {
address: ReqType.AddressQuery, address: REQ_TYPE.AddressQuery,
bank: ReqType.BankQuery, bank: REQ_TYPE.BankQuery,
fio: ReqType.FioQuery, fio: REQ_TYPE.FioQuery,
fmsUnit: ReqType.FmsUnitQuery, fmsUnit: REQ_TYPE.FmsUnitQuery,
okved: ReqType.OkvedQuery, okved: REQ_TYPE.OkvedQuery,
party: ReqType.PartyQuery, party: REQ_TYPE.PartyQuery,
}; };
type RequestTypeByType = typeof requestTypeByType; type RequestTypeByType = typeof REQUEST_TYPE_BY_TYPE;
@Component({ @Component({
selector: 'dsh-dadata-autocomplete', selector: 'dsh-dadata-autocomplete',
@ -100,7 +100,7 @@ export class DaDataAutocompleteComponent<
private loadSuggestions() { private loadSuggestions() {
const params = { query: this.formControl.value as string } as ParamsByRequestType[R]; const params = { query: this.formControl.value as string } as ParamsByRequestType[R];
return this.daDataService.suggest(requestTypeByType[this.type], this.withSpecificParams(params)); return this.daDataService.suggest(REQUEST_TYPE_BY_TYPE[this.type], this.withSpecificParams(params));
} }
private withSpecificParams(params: ParamsByRequestType[R]): ParamsByRequestType[R] { private withSpecificParams(params: ParamsByRequestType[R]): ParamsByRequestType[R] {

View File

@ -1,2 +1,2 @@
export const type = ['address', 'party', 'bank', 'fio', 'fmsUnit', 'okved'] as const; export const TYPE = ['address', 'party', 'bank', 'fio', 'fmsUnit', 'okved'] as const;
export type Type = typeof type[number]; export type Type = typeof TYPE[number];

View File

@ -14,11 +14,13 @@ export interface HumanizeConfig extends humanizeDuration.HumanizerOptions {
@Injectable() @Injectable()
export class HumanizeDurationService { export class HumanizeDurationService {
/* eslint-disable @typescript-eslint/naming-convention */
static HOUR_MS = 3600000; static HOUR_MS = 3600000;
static MIN_HUMANIZE_DURATION_UPDATE_MS = 1000; static MIN_HUMANIZE_DURATION_UPDATE_MS = 1000;
static MOMENT_HUMANIZE_ALLOWED_DELAY_BETWEEN_UPDATES_FOR_MINUTE_UPDATES_MS = 20000; static MOMENT_HUMANIZE_ALLOWED_DELAY_BETWEEN_UPDATES_FOR_MINUTE_UPDATES_MS = 20000;
static MOMENT_HUMANIZE_ALLOWED_DELAY_BETWEEN_UPDATES_FOR_HOURLY_AND_LONGER_UPDATES_MS = 600000; static MOMENT_HUMANIZE_ALLOWED_DELAY_BETWEEN_UPDATES_FOR_HOURLY_AND_LONGER_UPDATES_MS = 600000;
static LESS_THAN_FEW_SECONDS = 3000; static LESS_THAN_FEW_SECONDS = 3000;
/* eslint-enable @typescript-eslint/naming-convention */
private get duration() { private get duration() {
return humanizeDuration.humanizer({ return humanizeDuration.humanizer({

View File

@ -3,7 +3,7 @@ import localeRu from '@angular/common/locales/ru';
import { Language } from './language'; import { Language } from './language';
export const angularLocaleData: { [language in Language]: any } = { export const ANGULAR_LOCALE_DATA: { [language in Language]: any } = {
[Language.Ru]: localeRu, [Language.Ru]: localeRu,
[Language.En]: localeEn, [Language.En]: localeEn,
}; };

View File

@ -4,11 +4,12 @@ import { TranslocoService } from '@ngneat/transloco';
import * as moment from 'moment'; import * as moment from 'moment';
import { SettingsService } from '../settings'; import { SettingsService } from '../settings';
import { angularLocaleData } from './angular-locale-data'; import { ANGULAR_LOCALE_DATA } from './angular-locale-data';
import { Language } from './language'; import { Language } from './language';
@Injectable() @Injectable()
export class LanguageService { export class LanguageService {
// eslint-disable-next-line @typescript-eslint/naming-convention
private static readonly KEY = 'language'; private static readonly KEY = 'language';
active: Language; active: Language;
@ -22,7 +23,7 @@ export class LanguageService {
} }
async change(language: Language) { async change(language: Language) {
registerLocaleData(angularLocaleData[language], language); registerLocaleData(ANGULAR_LOCALE_DATA[language], language);
if (language !== Language.En) { if (language !== Language.En) {
await import(`moment/locale/${language}`); await import(`moment/locale/${language}`);
} }

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { ClaimComponent } from './claim.component'; import { ClaimComponent } from './claim.component';
const claimRoutes: Routes = [ const CLAIM_ROUTES: Routes = [
{ {
path: ':claimId', path: ':claimId',
component: ClaimComponent, component: ClaimComponent,
@ -11,7 +11,7 @@ const claimRoutes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(claimRoutes)], imports: [RouterModule.forChild(CLAIM_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class ClaimRoutingModule {} export class ClaimRoutingModule {}

View File

@ -14,29 +14,29 @@ import {
import { TimelineAction } from './model'; import { TimelineAction } from './model';
function getStatusModificationTimelineAction(unit: StatusModificationUnit): TimelineAction | null { function getStatusModificationTimelineAction(unit: StatusModificationUnit): TimelineAction | null {
const Status = StatusModificationUnit.StatusEnum; const status = StatusModificationUnit.StatusEnum;
switch (unit.status) { switch (unit.status) {
case Status.Accepted: case status.Accepted:
return TimelineAction.StatusAccepted; return TimelineAction.StatusAccepted;
case Status.Denied: case status.Denied:
return TimelineAction.StatusDenied; return TimelineAction.StatusDenied;
case Status.Pending: case status.Pending:
return TimelineAction.StatusPending; return TimelineAction.StatusPending;
case Status.Review: case status.Review:
return TimelineAction.StatusReview; return TimelineAction.StatusReview;
case Status.Revoked: case status.Revoked:
return TimelineAction.StatusRevoked; return TimelineAction.StatusRevoked;
case Status.PendingAcceptance: case status.PendingAcceptance:
return null; return null;
} }
} }
function getFileModificationTimelineAction(unit: FileModificationUnit): TimelineAction { function getFileModificationTimelineAction(unit: FileModificationUnit): TimelineAction {
const Type = FileModification.FileModificationTypeEnum; const type = FileModification.FileModificationTypeEnum;
switch (unit.fileModification.fileModificationType) { switch (unit.fileModification.fileModificationType) {
case Type.FileCreated: case type.FileCreated:
return TimelineAction.FilesAdded; return TimelineAction.FilesAdded;
case Type.FileDeleted: case type.FileDeleted:
return TimelineAction.FilesDeleted; return TimelineAction.FilesDeleted;
} }
} }

View File

@ -7,7 +7,7 @@ import { RowModule } from '@dsh/components/layout';
import * as ru from '../../../../../../assets/i18n/ru.json'; import * as ru from '../../../../../../assets/i18n/ru.json';
import { ClaimRowHeaderComponent } from './claim-row-header.component'; import { ClaimRowHeaderComponent } from './claim-row-header.component';
const translationConfig = { const TRANSLATION_CONFIG = {
ru, ru,
}; };
@ -19,7 +19,7 @@ describe('ClaimRowHeaderComponent', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
RowModule, RowModule,
TranslocoTestingModule.withLangs(translationConfig, { TranslocoTestingModule.withLangs(TRANSLATION_CONFIG, {
availableLangs: ['ru'], availableLangs: ['ru'],
defaultLang: 'ru', defaultLang: 'ru',
}), }),

View File

@ -12,7 +12,7 @@ import * as ru from '../../../../../../assets/i18n/ru.json';
import { generateMockClaim } from '../../../tests/generate-mock-claim'; import { generateMockClaim } from '../../../tests/generate-mock-claim';
import { ClaimRowComponent } from './claim-row.component'; import { ClaimRowComponent } from './claim-row.component';
const translationConfig = { const TRANSLATION_CONFIG = {
ru, ru,
}; };
@ -24,7 +24,7 @@ describe('ClaimRowComponent', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
RowModule, RowModule,
TranslocoTestingModule.withLangs(translationConfig, { TranslocoTestingModule.withLangs(TRANSLATION_CONFIG, {
availableLangs: ['ru'], availableLangs: ['ru'],
defaultLang: 'ru', defaultLang: 'ru',
}), }),

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { ClaimsComponent } from './claims.component'; import { ClaimsComponent } from './claims.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: ClaimsComponent, component: ClaimsComponent,
@ -11,7 +11,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class ClaimsRoutingModule {} export class ClaimsRoutingModule {}

View File

@ -8,7 +8,7 @@ import { FetchClaimsService } from './services/fetch-claims/fetch-claims.service
class MockApiClaimsService {} class MockApiClaimsService {}
const translationConfig = { const TRANSLATION_CONFIG = {
ru, ru,
}; };
@ -24,7 +24,7 @@ describe('FetchClaimsService', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
MatSnackBarModule, MatSnackBarModule,
TranslocoTestingModule.withLangs(translationConfig, { TranslocoTestingModule.withLangs(TRANSLATION_CONFIG, {
availableLangs: ['ru'], availableLangs: ['ru'],
defaultLang: 'ru', defaultLang: 'ru',
}), }),

View File

@ -5,7 +5,7 @@ import moment from 'moment';
import { InvoiceLineTaxVAT, InvoiceTemplateAndToken, Shop } from '@dsh/api-codegen/capi'; import { InvoiceLineTaxVAT, InvoiceTemplateAndToken, Shop } from '@dsh/api-codegen/capi';
import { CostType, CreateInvoiceTemplateService, TemplateType, withoutVAT } from './create-invoice-template.service'; import { CostType, CreateInvoiceTemplateService, TemplateType, WITHOUT_VAT } from './create-invoice-template.service';
@Component({ @Component({
selector: 'dsh-create-invoice-template', selector: 'dsh-create-invoice-template',
@ -23,7 +23,7 @@ export class CreateInvoiceTemplateComponent implements OnInit {
minDate = moment().add('1', 'day').startOf('day').toDate(); minDate = moment().add('1', 'day').startOf('day').toDate();
taxModes = Object.values(InvoiceLineTaxVAT.RateEnum); taxModes = Object.values(InvoiceLineTaxVAT.RateEnum);
withoutVAT = withoutVAT; withoutVAT = WITHOUT_VAT;
templateType = TemplateType; templateType = TemplateType;
costType = CostType; costType = CostType;

View File

@ -38,7 +38,7 @@ export enum CostType {
Range = 'InvoiceTemplateLineCostRange', Range = 'InvoiceTemplateLineCostRange',
} }
export const withoutVAT = Symbol('without VAT'); export const WITHOUT_VAT = Symbol('without VAT');
@Injectable() @Injectable()
export class CreateInvoiceTemplateService { export class CreateInvoiceTemplateService {
@ -165,7 +165,7 @@ export class CreateInvoiceTemplateService {
costType: CostType.Unlim, costType: CostType.Unlim,
templateType: TemplateType.SingleLine, templateType: TemplateType.SingleLine,
product: '', product: '',
taxMode: withoutVAT, taxMode: WITHOUT_VAT,
cart: this.fb.array([this.createProductFormGroup()]), cart: this.fb.array([this.createProductFormGroup()]),
range: this.fb.group({ range: this.fb.group({
lowerBound: null, lowerBound: null,
@ -180,7 +180,7 @@ export class CreateInvoiceTemplateService {
product: '', product: '',
quantity: null, quantity: null,
price: null, price: null,
taxMode: withoutVAT, taxMode: WITHOUT_VAT,
}); });
} }
@ -256,8 +256,8 @@ export class CreateInvoiceTemplateService {
} }
} }
private getInvoiceLineTaxMode(rate: typeof withoutVAT | InvoiceLineTaxVAT.RateEnum) { private getInvoiceLineTaxMode(rate: typeof WITHOUT_VAT | InvoiceLineTaxVAT.RateEnum) {
return rate === withoutVAT return rate === WITHOUT_VAT
? {} ? {}
: { : {
taxMode: { taxMode: {

View File

@ -9,7 +9,7 @@ import { coerceBoolean } from '../../../utils';
import { CreatePaymentLinkService } from './services/create-payment-link.service'; import { CreatePaymentLinkService } from './services/create-payment-link.service';
import { HoldExpiration } from './types/hold-expiration'; import { HoldExpiration } from './types/hold-expiration';
import { InvoiceType } from './types/invoice-type'; import { InvoiceType } from './types/invoice-type';
import { orderedPaymentMethodsNames } from './types/ordered-payment-methods-names'; import { ORDERED_PAYMENT_METHODS_NAMES } from './types/ordered-payment-methods-names';
@Component({ @Component({
selector: 'dsh-create-payment-link', selector: 'dsh-create-payment-link',
@ -53,7 +53,7 @@ export class CreatePaymentLinkComponent implements OnInit {
link$ = this.createPaymentLinkService.paymentLink$; link$ = this.createPaymentLinkService.paymentLink$;
isLoading$ = this.createPaymentLinkService.isLoading$; isLoading$ = this.createPaymentLinkService.isLoading$;
orderedPaymentMethodsNames = orderedPaymentMethodsNames; orderedPaymentMethodsNames = ORDERED_PAYMENT_METHODS_NAMES;
paymentMethodsEnabled = Object.fromEntries( paymentMethodsEnabled = Object.fromEntries(
Object.entries(this.createPaymentLinkService.paymentMethodsFormGroup.controls).map(([k, v]) => [ Object.entries(this.createPaymentLinkService.paymentMethodsFormGroup.controls).map(([k, v]) => [

View File

@ -34,7 +34,7 @@ import { ConfigService } from '../../../config';
import { filterError, filterPayload, replaceError } from '../../../custom-operators'; import { filterError, filterPayload, replaceError } from '../../../custom-operators';
import { HoldExpiration } from '../types/hold-expiration'; import { HoldExpiration } from '../types/hold-expiration';
import { InvoiceType } from '../types/invoice-type'; import { InvoiceType } from '../types/invoice-type';
import { orderedPaymentMethodsNames } from '../types/ordered-payment-methods-names'; import { ORDERED_PAYMENT_METHODS_NAMES } from '../types/ordered-payment-methods-names';
export class PaymentLinkParams { export class PaymentLinkParams {
invoiceID?: string; invoiceID?: string;
@ -57,9 +57,9 @@ export class PaymentLinkParams {
yandexPay?: boolean; yandexPay?: boolean;
} }
const Method = PaymentMethod.MethodEnum; const METHOD = PaymentMethod.MethodEnum;
const TokenProvider = BankCard.TokenProvidersEnum; const TOKEN_PROVIDER = BankCard.TokenProvidersEnum;
const TerminalProvider = PaymentTerminal.ProvidersEnum; const TERMINAL_PROVIDER = PaymentTerminal.ProvidersEnum;
@Injectable() @Injectable()
export class CreatePaymentLinkService { export class CreatePaymentLinkService {
@ -214,7 +214,7 @@ export class CreatePaymentLinkService {
redirectUrl: '', redirectUrl: '',
paymentMethods: this.fb.group( paymentMethods: this.fb.group(
Object.fromEntries( Object.fromEntries(
orderedPaymentMethodsNames.map((name) => [name, { value: name === 'bankCard', disabled: true }]) ORDERED_PAYMENT_METHODS_NAMES.map((name) => [name, { value: name === 'bankCard', disabled: true }])
) )
), ),
paymentFlowHold: false, paymentFlowHold: false,
@ -227,21 +227,21 @@ export class CreatePaymentLinkService {
Object.values(paymentMethodsControls).forEach((c) => c.disable()); Object.values(paymentMethodsControls).forEach((c) => c.disable());
paymentMethods.forEach((item) => { paymentMethods.forEach((item) => {
switch (item.method) { switch (item.method) {
case Method.BankCard: { case METHOD.BankCard: {
const bankCard = item as BankCard; const bankCard = item as BankCard;
if (Array.isArray(bankCard.tokenProviders) && bankCard.tokenProviders.length) { if (Array.isArray(bankCard.tokenProviders) && bankCard.tokenProviders.length) {
for (const provider of bankCard.tokenProviders) { for (const provider of bankCard.tokenProviders) {
switch (provider) { switch (provider) {
case TokenProvider.Applepay: case TOKEN_PROVIDER.Applepay:
paymentMethodsControls.applePay.enable(); paymentMethodsControls.applePay.enable();
break; break;
case TokenProvider.Googlepay: case TOKEN_PROVIDER.Googlepay:
paymentMethodsControls.googlePay.enable(); paymentMethodsControls.googlePay.enable();
break; break;
case TokenProvider.Samsungpay: case TOKEN_PROVIDER.Samsungpay:
paymentMethodsControls.samsungPay.enable(); paymentMethodsControls.samsungPay.enable();
break; break;
case TokenProvider.Yandexpay: case TOKEN_PROVIDER.Yandexpay:
paymentMethodsControls.yandexPay.enable(); paymentMethodsControls.yandexPay.enable();
break; break;
default: default:
@ -254,19 +254,19 @@ export class CreatePaymentLinkService {
} }
break; break;
} }
case Method.DigitalWallet: case METHOD.DigitalWallet:
paymentMethodsControls.wallets.enable(); paymentMethodsControls.wallets.enable();
break; break;
case Method.PaymentTerminal: case METHOD.PaymentTerminal:
(item as PaymentTerminal).providers.forEach((p) => { (item as PaymentTerminal).providers.forEach((p) => {
switch (p) { switch (p) {
case TerminalProvider.Euroset: case TERMINAL_PROVIDER.Euroset:
paymentMethodsControls.euroset.enable(); paymentMethodsControls.euroset.enable();
break; break;
case TerminalProvider.Qps: case TERMINAL_PROVIDER.Qps:
paymentMethodsControls.qps.enable(); paymentMethodsControls.qps.enable();
break; break;
case TerminalProvider.Uzcard: case TERMINAL_PROVIDER.Uzcard:
paymentMethodsControls.uzcard.enable(); paymentMethodsControls.uzcard.enable();
break; break;
default: default:
@ -275,7 +275,7 @@ export class CreatePaymentLinkService {
} }
}); });
break; break;
case Method.MobileCommerce: case METHOD.MobileCommerce:
paymentMethodsControls.mobileCommerce.enable(); paymentMethodsControls.mobileCommerce.enable();
break; break;
default: default:

View File

@ -1,4 +1,4 @@
export const orderedPaymentMethodsNames = [ export const ORDERED_PAYMENT_METHODS_NAMES = [
'bankCard', 'bankCard',
'yandexPay', 'yandexPay',
'applePay', 'applePay',

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { InvoiceDetailsComponent } from './invoice-details.component'; import { InvoiceDetailsComponent } from './invoice-details.component';
const invoiceDetailsRoutes: Routes = [ const INVOICE_DETAILS_ROUTES: Routes = [
{ {
path: ':invoiceID', path: ':invoiceID',
component: InvoiceDetailsComponent, component: InvoiceDetailsComponent,
@ -11,7 +11,7 @@ const invoiceDetailsRoutes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(invoiceDetailsRoutes)], imports: [RouterModule.forChild(INVOICE_DETAILS_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class InvoiceDetailsRoutingModule {} export class InvoiceDetailsRoutingModule {}

View File

@ -4,7 +4,7 @@ import { TranslocoService } from '@ngneat/transloco';
import { combineLatest, Observable } from 'rxjs'; import { combineLatest, Observable } from 'rxjs';
import { pluck } from 'rxjs/operators'; import { pluck } from 'rxjs/operators';
import { ClaimsService, ClaimStatus } from '@dsh/api/claims'; import { ClaimsService, CLAIM_STATUS } from '@dsh/api/claims';
import { ApiShopsService } from '@dsh/api/shop'; import { ApiShopsService } from '@dsh/api/shop';
import { booleanDelay, takeError } from '../../../../custom-operators'; import { booleanDelay, takeError } from '../../../../custom-operators';
@ -25,9 +25,9 @@ export class PaymentsService {
private transloco: TranslocoService private transloco: TranslocoService
) { ) {
const claims = this.claimService.search1000Claims([ const claims = this.claimService.search1000Claims([
ClaimStatus.Pending, CLAIM_STATUS.Pending,
ClaimStatus.PendingAcceptance, CLAIM_STATUS.PendingAcceptance,
ClaimStatus.Review, CLAIM_STATUS.Review,
]); ]);
const contentConfig = toContentConf(this.shopService.shops$, claims); const contentConfig = toContentConf(this.shopService.shops$, claims);
this.actionBtnContent$ = contentConfig.pipe(pluck('actionBtnContent')); this.actionBtnContent$ = contentConfig.pipe(pluck('actionBtnContent'));

View File

@ -1,14 +1,14 @@
import { combineLatest, Observable } from 'rxjs'; import { combineLatest, Observable } from 'rxjs';
import { Claim } from '@dsh/api-codegen/claim-management'; import { Claim } from '@dsh/api-codegen/claim-management';
import { ClaimStatus } from '@dsh/api/claims'; import { CLAIM_STATUS } from '@dsh/api/claims';
import { filterByProp } from '../../../../../custom-operators'; import { filterByProp } from '../../../../../custom-operators';
import { filterQuestionaryClaims, takeClaimByPriority } from '../operators'; import { filterQuestionaryClaims, takeClaimByPriority } from '../operators';
export const mapToTargetClaim = (s: Observable<Claim[]>): Observable<Claim> => { export const mapToTargetClaim = (s: Observable<Claim[]>): Observable<Claim> => {
const questionaryClaims = s.pipe(filterQuestionaryClaims); const questionaryClaims = s.pipe(filterQuestionaryClaims);
const pendingClaims = questionaryClaims.pipe(filterByProp('status', ClaimStatus.Pending)); const pendingClaims = questionaryClaims.pipe(filterByProp('status', CLAIM_STATUS.Pending));
const reviewClaims = questionaryClaims.pipe(filterByProp('status', ClaimStatus.Review)); const reviewClaims = questionaryClaims.pipe(filterByProp('status', CLAIM_STATUS.Review));
return combineLatest([pendingClaims, reviewClaims]).pipe(takeClaimByPriority); return combineLatest([pendingClaims, reviewClaims]).pipe(takeClaimByPriority);
}; };

View File

@ -14,7 +14,7 @@ import { mapToSubheading } from './map-to-subheading';
import { mapToTargetClaim } from './map-to-target-claim'; import { mapToTargetClaim } from './map-to-target-claim';
import { mapToTestEnvBtnContent } from './map-to-test-env-btn-content'; import { mapToTestEnvBtnContent } from './map-to-test-env-btn-content';
const initialConf = { const INITIAL_CONF = {
subheading: `pristine`, subheading: `pristine`,
actionBtnContent: { actionBtnContent: {
actionLabel: `details`, actionLabel: `details`,
@ -35,11 +35,11 @@ export const toContentConf = (shops: Observable<Shop[]>, claims: Observable<Clai
const testEnvBtnContent$ = shops.pipe( const testEnvBtnContent$ = shops.pipe(
map(toTestShops), map(toTestShops),
map(negate(isEmpty)), map(negate(isEmpty)),
mapToTestEnvBtnContent(initialConf.testEnvBtnContent) mapToTestEnvBtnContent(INITIAL_CONF.testEnvBtnContent)
); );
const state = new BehaviorSubject<ContentConfig>(initialConf); const state = new BehaviorSubject<ContentConfig>(INITIAL_CONF);
return applyToSate(state.asObservable(), actionBtnContent$, subheading$, testEnvBtnContent$).pipe( return applyToSate(state.asObservable(), actionBtnContent$, subheading$, testEnvBtnContent$).pipe(
startWith(initialConf), startWith(INITIAL_CONF),
tap((r) => state.next(r)), tap((r) => state.next(r)),
shareReplay(1) shareReplay(1)
); );

View File

@ -13,7 +13,7 @@ import {
} from './forms'; } from './forms';
import { StepName } from './step-flow'; import { StepName } from './step-flow';
export const routes: Routes = [ export const ROUTES: Routes = [
{ {
path: 'step', path: 'step',
component: DataFlowComponent, component: DataFlowComponent,
@ -51,7 +51,7 @@ export const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class DataFlowRoutingModule {} export class DataFlowRoutingModule {}

View File

@ -18,7 +18,7 @@ import { toFormValue } from './to-form-value';
type AccountantInfoType = AccountantInfo.AccountantInfoTypeEnum; type AccountantInfoType = AccountantInfo.AccountantInfoTypeEnum;
const accountantTypes: AccountantInfoType[] = [ const ACCOUNTANT_TYPES: AccountantInfoType[] = [
'WithoutChiefHeadAccounting', 'WithoutChiefHeadAccounting',
'WithoutChiefIndividualAccountant', 'WithoutChiefIndividualAccountant',
'WithoutChiefAccountingOrganization', 'WithoutChiefAccountingOrganization',
@ -32,7 +32,7 @@ export class FinancialAndEconomicActivityService extends QuestionaryFormService
private form: FormGroup; private form: FormGroup;
readonly accountantOptionTypes = accountantTypes; readonly accountantOptionTypes = ACCOUNTANT_TYPES;
isAccountantInfoVisible$ = this.accountantInfoVisible$.asObservable(); isAccountantInfoVisible$ = this.accountantInfoVisible$.asObservable();
isAccountantOrgInnVisible$ = this.accountantOrgInnVisible$.asObservable(); isAccountantOrgInnVisible$ = this.accountantOrgInnVisible$.asObservable();
isResidencyInfoVisible$ = this.residencyInfoVisible$.asObservable(); isResidencyInfoVisible$ = this.residencyInfoVisible$.asObservable();

View File

@ -3,6 +3,7 @@ import { FormBuilder, FormGroup } from '@angular/forms';
@Injectable() @Injectable()
export class AuthorityConfirmingDocumentService { export class AuthorityConfirmingDocumentService {
// eslint-disable-next-line @typescript-eslint/naming-convention
static readonly CustomType = Symbol('custom'); static readonly CustomType = Symbol('custom');
constructor(private fb: FormBuilder) {} constructor(private fb: FormBuilder) {}

View File

@ -4,7 +4,7 @@ import { map } from 'rxjs/operators';
import { Contractor, QuestionaryData } from '@dsh/api-codegen/questionary'; import { Contractor, QuestionaryData } from '@dsh/api-codegen/questionary';
import { IndividualEntityStepFlow, LegalEntityStepFlow } from './step-flows'; import { INDIVIDUAL_ENTITY_STEP_FLOW, LEGAL_ENTITY_STEP_FLOW } from './step-flows';
import { StepName } from './step-name'; import { StepName } from './step-name';
export const mapToStepFlow = (s: Observable<QuestionaryData>): Observable<StepName[] | null> => export const mapToStepFlow = (s: Observable<QuestionaryData>): Observable<StepName[] | null> =>
@ -14,9 +14,9 @@ export const mapToStepFlow = (s: Observable<QuestionaryData>): Observable<StepNa
const t = Contractor.ContractorTypeEnum; const t = Contractor.ContractorTypeEnum;
switch (contractorType) { switch (contractorType) {
case t.LegalEntityContractor: case t.LegalEntityContractor:
return LegalEntityStepFlow; return LEGAL_ENTITY_STEP_FLOW;
case t.IndividualEntityContractor: case t.IndividualEntityContractor:
return IndividualEntityStepFlow; return INDIVIDUAL_ENTITY_STEP_FLOW;
} }
return null; return null;
}) })

View File

@ -1,6 +1,6 @@
import { StepName } from './step-name'; import { StepName } from './step-name';
const BasicStepFlow = [ const BASIC_STEP_FLOW = [
StepName.BasicInfo, StepName.BasicInfo,
null, null,
StepName.FinancialAndEconomicActivity, StepName.FinancialAndEconomicActivity,
@ -9,7 +9,7 @@ const BasicStepFlow = [
StepName.UploadDocuments, StepName.UploadDocuments,
]; ];
const insertStepToBasicFlow = (step: StepName): StepName[] => BasicStepFlow.map((s) => (s === null ? step : s)); const insertStepToBasicFlow = (step: StepName): StepName[] => BASIC_STEP_FLOW.map((s) => (s === null ? step : s));
export const IndividualEntityStepFlow = insertStepToBasicFlow(StepName.RussianPrivateEntity); export const INDIVIDUAL_ENTITY_STEP_FLOW = insertStepToBasicFlow(StepName.RussianPrivateEntity);
export const LegalEntityStepFlow = insertStepToBasicFlow(StepName.RussianLegalOwner); export const LEGAL_ENTITY_STEP_FLOW = insertStepToBasicFlow(StepName.RussianLegalOwner);

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { CompanySearchComponent } from './company-search'; import { CompanySearchComponent } from './company-search';
export const routes: Routes = [ export const ROUTES: Routes = [
{ {
path: '', path: '',
component: CompanySearchComponent, component: CompanySearchComponent,
@ -15,7 +15,7 @@ export const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class OnboardingRoutingModule {} export class OnboardingRoutingModule {}

View File

@ -44,6 +44,7 @@ export class ChangeRolesTableComponent implements OnInit {
roleIds: RoleId[] = []; roleIds: RoleId[] = [];
shops$ = this.shopsService.shops$; shops$ = this.shopsService.shops$;
// eslint-disable-next-line @typescript-eslint/naming-convention
RoleId = RoleId; RoleId = RoleId;
get availableRoles(): RoleId[] { get availableRoles(): RoleId[] {

View File

@ -26,8 +26,8 @@ describe('CreateInvitationDialogComponent', () => {
let mockErrorService: ErrorService; let mockErrorService: ErrorService;
let mockShopsService: ApiShopsService; let mockShopsService: ApiShopsService;
const SHOP_ID = 'shop_id'; const shopId = 'shop_id';
const SOME_EMAIL = 'some@ema.il'; const someEmail = 'some@ema.il';
beforeEach(() => { beforeEach(() => {
mockDialogRef = mock(MatDialogRef); mockDialogRef = mock(MatDialogRef);
@ -36,7 +36,7 @@ describe('CreateInvitationDialogComponent', () => {
mockErrorService = mock(ErrorService); mockErrorService = mock(ErrorService);
mockShopsService = mock(ApiShopsService); mockShopsService = mock(ApiShopsService);
when(mockShopsService.shops$).thenReturn(of([{ id: SHOP_ID } as Shop])); when(mockShopsService.shops$).thenReturn(of([{ id: shopId } as Shop]));
when(mockOrganizationsService.createInvitation(MOCK_ORG.id, anything())).thenReturn(of(MOCK_INVITATION)); when(mockOrganizationsService.createInvitation(MOCK_ORG.id, anything())).thenReturn(of(MOCK_INVITATION));
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@ -75,7 +75,7 @@ describe('CreateInvitationDialogComponent', () => {
describe('create', () => { describe('create', () => {
it('should be created', () => { it('should be created', () => {
component.emailControl.patchValue(SOME_EMAIL); component.emailControl.patchValue(someEmail);
component.create(); component.create();
verify( verify(
mockOrganizationsService.createInvitation( mockOrganizationsService.createInvitation(
@ -84,7 +84,7 @@ describe('CreateInvitationDialogComponent', () => {
invitee: { invitee: {
contact: { contact: {
type: InviteeContact.TypeEnum.EMail, type: InviteeContact.TypeEnum.EMail,
email: SOME_EMAIL, email: someEmail,
}, },
roles: [], roles: [],
}, },
@ -98,7 +98,7 @@ describe('CreateInvitationDialogComponent', () => {
it("shouldn't create", () => { it("shouldn't create", () => {
const error = new Error('Error 1'); const error = new Error('Error 1');
component.emailControl.patchValue(SOME_EMAIL); component.emailControl.patchValue(someEmail);
when(mockOrganizationsService.createInvitation(MOCK_ORG.id, anything())).thenReturn(throwError(error)); when(mockOrganizationsService.createInvitation(MOCK_ORG.id, anything())).thenReturn(throwError(error));
component.create(); component.create();
verify(mockErrorService.error(error)).once(); verify(mockErrorService.error(error)).once();

View File

@ -3,10 +3,10 @@ import { RouterModule, Routes } from '@angular/router';
import { InvitationsComponent } from './invitations.component'; import { InvitationsComponent } from './invitations.component';
const routes: Routes = [{ path: '', component: InvitationsComponent }]; const ROUTES: Routes = [{ path: '', component: InvitationsComponent }];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class InvitationsRoutingModule {} export class InvitationsRoutingModule {}

View File

@ -23,7 +23,7 @@ describe('InvitationsComponent', () => {
let mockOrganizationsService: OrganizationsService; let mockOrganizationsService: OrganizationsService;
let mockDialog: MatDialog; let mockDialog: MatDialog;
const MOCK_INVITATIONS_RESULT: InvitationListResult = { const mockInvitationsResult: InvitationListResult = {
result: new Array(5).fill(MOCK_INVITATION), result: new Array(5).fill(MOCK_INVITATION),
}; };
@ -45,7 +45,7 @@ describe('InvitationsComponent', () => {
when(mockRoute.params).thenReturn(of({ orgId: MOCK_ORG.id })); when(mockRoute.params).thenReturn(of({ orgId: MOCK_ORG.id }));
when(mockOrganizationsService.getOrg(MOCK_ORG.id)).thenReturn(of(MOCK_ORG)); when(mockOrganizationsService.getOrg(MOCK_ORG.id)).thenReturn(of(MOCK_ORG));
when(mockOrganizationsService.listInvitations(MOCK_ORG.id)).thenReturn(of(MOCK_INVITATIONS_RESULT)); when(mockOrganizationsService.listInvitations(MOCK_ORG.id)).thenReturn(of(mockInvitationsResult));
fixture = TestBed.createComponent(InvitationsComponent); fixture = TestBed.createComponent(InvitationsComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
@ -65,7 +65,7 @@ describe('InvitationsComponent', () => {
}); });
it('should load invitations$', () => { it('should load invitations$', () => {
const expected$ = cold('(a)', { a: MOCK_INVITATIONS_RESULT.result }); const expected$ = cold('(a)', { a: mockInvitationsResult.result });
expect(component.invitations$).toBeObservable(expected$); expect(component.invitations$).toBeObservable(expected$);
}); });
@ -80,7 +80,7 @@ describe('InvitationsComponent', () => {
component.invitations$.subscribe(); component.invitations$.subscribe();
component.refresh(); component.refresh();
verify(mockOrganizationsService.listInvitations(MOCK_ORG.id)).twice(); verify(mockOrganizationsService.listInvitations(MOCK_ORG.id)).twice();
const expected$ = cold('(a)', { a: MOCK_INVITATIONS_RESULT.result }); const expected$ = cold('(a)', { a: mockInvitationsResult.result });
expect(component.invitations$).toBeObservable(expected$); expect(component.invitations$).toBeObservable(expected$);
}); });
}); });

View File

@ -3,10 +3,10 @@ import { RouterModule, Routes } from '@angular/router';
import { MembersComponent } from './members.component'; import { MembersComponent } from './members.component';
const routes: Routes = [{ path: '', component: MembersComponent }]; const ROUTES: Routes = [{ path: '', component: MembersComponent }];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class MembersRoutingModule {} export class MembersRoutingModule {}

View File

@ -28,7 +28,7 @@ describe('MembersComponent', () => {
let mockOrganizationsService: OrganizationsService; let mockOrganizationsService: OrganizationsService;
let mockRoute: ActivatedRoute; let mockRoute: ActivatedRoute;
const MOCK_MEMBERS: MemberOrgListResult = { const mockMembers: MemberOrgListResult = {
result: new Array(11).fill(MOCK_MEMBER), result: new Array(11).fill(MOCK_MEMBER),
}; };
@ -47,7 +47,7 @@ describe('MembersComponent', () => {
when(mockRoute.params).thenReturn(of({ orgId: MOCK_ORG.id })); when(mockRoute.params).thenReturn(of({ orgId: MOCK_ORG.id }));
when(mockOrganizationsService.getOrg(MOCK_ORG.id)).thenReturn(of(MOCK_ORG)); when(mockOrganizationsService.getOrg(MOCK_ORG.id)).thenReturn(of(MOCK_ORG));
when(mockOrganizationsService.listOrgMembers(MOCK_ORG.id)).thenReturn(of(MOCK_MEMBERS)); when(mockOrganizationsService.listOrgMembers(MOCK_ORG.id)).thenReturn(of(mockMembers));
fixture = TestBed.createComponent(HostComponent); fixture = TestBed.createComponent(HostComponent);
debugElement = fixture.debugElement.query(By.directive(MembersComponent)); debugElement = fixture.debugElement.query(By.directive(MembersComponent));
@ -69,7 +69,7 @@ describe('MembersComponent', () => {
}); });
it('should load members$', () => { it('should load members$', () => {
const expected$ = cold('(a)', { a: MOCK_MEMBERS.result }); const expected$ = cold('(a)', { a: mockMembers.result });
expect(component.members$).toBeObservable(expected$); expect(component.members$).toBeObservable(expected$);
}); });
@ -84,7 +84,7 @@ describe('MembersComponent', () => {
component.members$.subscribe(); component.members$.subscribe();
component.refresh(); component.refresh();
verify(mockOrganizationsService.listOrgMembers(MOCK_ORG.id)).twice(); verify(mockOrganizationsService.listOrgMembers(MOCK_ORG.id)).twice();
const expected$ = cold('(a)', { a: MOCK_MEMBERS.result }); const expected$ = cold('(a)', { a: mockMembers.result });
expect(component.members$).toBeObservable(expected$); expect(component.members$).toBeObservable(expected$);
}); });
}); });

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { OrganizationDetailsComponent } from './organization-details.component'; import { OrganizationDetailsComponent } from './organization-details.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: OrganizationDetailsComponent, component: OrganizationDetailsComponent,
@ -25,7 +25,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class OrganizationDetailsRoutingModule {} export class OrganizationDetailsRoutingModule {}

View File

@ -3,10 +3,10 @@ import { RouterModule, Routes } from '@angular/router';
import { AcceptInvitationComponent } from './accept-invitation.component'; import { AcceptInvitationComponent } from './accept-invitation.component';
const routes: Routes = [{ path: ':token', component: AcceptInvitationComponent }]; const ROUTES: Routes = [{ path: ':token', component: AcceptInvitationComponent }];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class AcceptInvitationRoutingModule {} export class AcceptInvitationRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { OrganizationsComponent } from './organizations.component'; import { OrganizationsComponent } from './organizations.component';
export const routes: Routes = [ export const ROUTES: Routes = [
{ {
path: '', path: '',
children: [ children: [
@ -20,7 +20,7 @@ export const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class OrganizationsRoutingModule {} export class OrganizationsRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { PageNotFoundComponent } from './page-not-found.component'; import { PageNotFoundComponent } from './page-not-found.component';
export const routes: Routes = [ export const ROUTES: Routes = [
{ {
path: '', path: '',
component: PageNotFoundComponent, component: PageNotFoundComponent,
@ -11,7 +11,7 @@ export const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class PageNotFoundRoutingModule {} export class PageNotFoundRoutingModule {}

View File

@ -6,8 +6,8 @@ import { PaymentFlowHold, PaymentSearchResult, PaymentStatus } from '@dsh/api-co
import { CancelHoldComponent, CancelHoldData } from './cancel-hold/cancel-hold.component'; import { CancelHoldComponent, CancelHoldData } from './cancel-hold/cancel-hold.component';
import { ConfirmHoldComponent, ConfirmHoldData } from './confirm-hold/confirm-hold.component'; import { ConfirmHoldComponent, ConfirmHoldData } from './confirm-hold/confirm-hold.component';
const paymentStatusEnum = PaymentStatus.StatusEnum; const PAYMENT_STATUS_ENUM = PaymentStatus.StatusEnum;
const onHoldExpirationEnum = PaymentFlowHold.OnHoldExpirationEnum; const ON_HOLD_EXPIRATION_ENUM = PaymentFlowHold.OnHoldExpirationEnum;
@Component({ @Component({
selector: 'dsh-hold-details', selector: 'dsh-hold-details',
@ -26,18 +26,18 @@ export class HoldDetailsComponent {
getActiveHoldText(): string { getActiveHoldText(): string {
switch (this.flowHold.onHoldExpiration) { switch (this.flowHold.onHoldExpiration) {
case onHoldExpirationEnum.Capture: case ON_HOLD_EXPIRATION_ENUM.Capture:
return 'holdWithCapture'; return 'holdWithCapture';
case onHoldExpirationEnum.Cancel: case ON_HOLD_EXPIRATION_ENUM.Cancel:
return 'holdWithCancel'; return 'holdWithCancel';
} }
} }
getExpiredHoldText(): string { getExpiredHoldText(): string {
switch (this.payment.status) { switch (this.payment.status) {
case paymentStatusEnum.Captured: case PAYMENT_STATUS_ENUM.Captured:
return 'capturedHoldMessage'; return 'capturedHoldMessage';
case paymentStatusEnum.Cancelled: case PAYMENT_STATUS_ENUM.Cancelled:
return 'cancelledHoldMessage'; return 'cancelledHoldMessage';
} }
} }

View File

@ -15,6 +15,7 @@ export enum PayerType {
export class PayerDetailsComponent { export class PayerDetailsComponent {
@Input() payer: Payer; @Input() payer: Payer;
// eslint-disable-next-line @typescript-eslint/naming-convention
PayerType = PayerType; PayerType = PayerType;
payerEmail: string; payerEmail: string;

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { PaymentDetailsComponent } from './payment-details.component'; import { PaymentDetailsComponent } from './payment-details.component';
const paymentDetailsRoutes: Routes = [ const PAYMENT_DETAILS_ROUTES: Routes = [
{ {
path: ':paymentID', path: ':paymentID',
component: PaymentDetailsComponent, component: PaymentDetailsComponent,
@ -11,7 +11,7 @@ const paymentDetailsRoutes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(paymentDetailsRoutes)], imports: [RouterModule.forChild(PAYMENT_DETAILS_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class PaymentDetailsRoutingModule {} export class PaymentDetailsRoutingModule {}

View File

@ -15,7 +15,9 @@ export class PaymentDetailsComponent {
payment$ = this.receivePaymentService.payment$; payment$ = this.receivePaymentService.payment$;
isLoading$ = this.receivePaymentService.isLoading$; isLoading$ = this.receivePaymentService.isLoading$;
// eslint-disable-next-line @typescript-eslint/naming-convention
PayerType = PayerType; PayerType = PayerType;
// eslint-disable-next-line @typescript-eslint/naming-convention
PaymentFlow = PaymentFlow.TypeEnum; PaymentFlow = PaymentFlow.TypeEnum;
constructor(private receivePaymentService: ReceivePaymentService) {} constructor(private receivePaymentService: ReceivePaymentService) {}

View File

@ -10,5 +10,6 @@ import { PaymentToolDetailsType } from '@dsh/api/capi';
export class PaymentToolComponent { export class PaymentToolComponent {
@Input() paymentToolDetails: PaymentToolDetails; @Input() paymentToolDetails: PaymentToolDetails;
// eslint-disable-next-line @typescript-eslint/naming-convention
Type = PaymentToolDetailsType; Type = PaymentToolDetailsType;
} }

View File

@ -10,7 +10,7 @@ import { Duration, PaymentSearchService } from '@dsh/api/search';
import { filterError, filterPayload, progress, replaceError, SHARE_REPLAY_CONF } from '../../custom-operators'; import { filterError, filterPayload, progress, replaceError, SHARE_REPLAY_CONF } from '../../custom-operators';
const completedStatuses: PaymentSearchResult.StatusEnum[] = [ const COMPLETED_STATUSES: PaymentSearchResult.StatusEnum[] = [
PaymentSearchResult.StatusEnum.Captured, PaymentSearchResult.StatusEnum.Captured,
PaymentSearchResult.StatusEnum.Cancelled, PaymentSearchResult.StatusEnum.Cancelled,
]; ];
@ -39,7 +39,7 @@ export class ReceivePaymentService {
return type === ReceivePaymentType.Hold return type === ReceivePaymentType.Hold
? timer(TIME_UNTIL_START, TIMER_PERIOD).pipe( ? timer(TIME_UNTIL_START, TIMER_PERIOD).pipe(
switchMap(() => this.paymentSearchService.getPaymentByDuration(duration, invoiceID, paymentID)), switchMap(() => this.paymentSearchService.getPaymentByDuration(duration, invoiceID, paymentID)),
filter((p) => completedStatuses.includes(p?.status)), filter((p) => COMPLETED_STATUSES.includes(p?.status)),
first(), first(),
timeout(TIMER_TIMEOUT) timeout(TIMER_TIMEOUT)
) )

View File

@ -7,7 +7,7 @@ import { PaymentSearchResult } from '@dsh/api-codegen/anapi/swagger-codegen';
import { RefundsService } from './refunds.service'; import { RefundsService } from './refunds.service';
const PaymentStatuses = PaymentSearchResult.StatusEnum; const PAYMENT_STATUSES = PaymentSearchResult.StatusEnum;
@Component({ @Component({
selector: 'dsh-refunds', selector: 'dsh-refunds',
@ -58,6 +58,6 @@ export class RefundsComponent implements OnChanges {
} }
refundAvailable(): boolean { refundAvailable(): boolean {
return this.status === PaymentStatuses.Captured; return this.status === PAYMENT_STATUSES.Captured;
} }
} }

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { AnalyticsComponent } from './analytics.component'; import { AnalyticsComponent } from './analytics.component';
const operationsRoutes: Routes = [ const OPERATIONS_ROUTES: Routes = [
{ {
path: '', path: '',
component: AnalyticsComponent, component: AnalyticsComponent,
@ -11,7 +11,7 @@ const operationsRoutes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(operationsRoutes)], imports: [RouterModule.forChild(OPERATIONS_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class AnalyticsRoutingModule {} export class AnalyticsRoutingModule {}

View File

@ -5,7 +5,7 @@ import { OffsetCount, SplitCountResult, SplitUnit, StatusOffsetCount } from '@ds
import { getOffsets } from '../utils'; import { getOffsets } from '../utils';
const statuses: StatusOffsetCount.StatusEnum[] = ['captured', 'cancelled', 'failed']; const STATUSES: StatusOffsetCount.StatusEnum[] = ['captured', 'cancelled', 'failed'];
const fixExtraInterval = (offsetCounts: OffsetCount[]): OffsetCount[] => const fixExtraInterval = (offsetCounts: OffsetCount[]): OffsetCount[] =>
sortBy(offsetCounts, 'offset').reduce( sortBy(offsetCounts, 'offset').reduce(
@ -52,7 +52,7 @@ export const prepareSplitCount = (
splitCounts.map(({ splitUnit, currency, statusOffsetCounts }) => ({ splitCounts.map(({ splitUnit, currency, statusOffsetCounts }) => ({
splitUnit, splitUnit,
currency, currency,
statusOffsetCounts: statuses.map((status) => ({ statusOffsetCounts: STATUSES.map((status) => ({
status, status,
offsetCount: fillSplitCountByZeroValues( offsetCount: fillSplitCountByZeroValues(
statusOffsetCounts.find((o) => o.status === status)?.offsetCount, statusOffsetCounts.find((o) => o.status === status)?.offsetCount,

View File

@ -1,4 +1,4 @@
export const knownErrors = [ export const KNOWN_ERRORS = [
'operation_timeout', 'operation_timeout',
'authorization_failed', 'authorization_failed',
'preauthorization_failed', 'preauthorization_failed',

View File

@ -2,10 +2,10 @@ import { PaymentsSubErrorsDistributionResult } from '@dsh/api-codegen/anapi/swag
import { SubError } from '@dsh/api-codegen/capi/swagger-codegen'; import { SubError } from '@dsh/api-codegen/capi/swagger-codegen';
import { ErrorDistribution } from './error-distribution'; import { ErrorDistribution } from './error-distribution';
import { knownErrors } from './known-errors'; import { KNOWN_ERRORS } from './known-errors';
const subErrorToDistribution = (error: SubError, percents: number): ErrorDistribution => ({ const subErrorToDistribution = (error: SubError, percents: number): ErrorDistribution => ({
errorCode: knownErrors.includes(error.code) ? error.code : 'other', errorCode: KNOWN_ERRORS.includes(error.code) ? error.code : 'other',
subErrors: error.subError ? [subErrorToDistribution(error.subError, percents)] : [], subErrors: error.subError ? [subErrorToDistribution(error.subError, percents)] : [],
percents, percents,
}); });
@ -31,7 +31,7 @@ const groupDistribution = (distribution: ErrorDistribution[]): ErrorDistribution
export const subErrorsToErrorDistribution = (errors: PaymentsSubErrorsDistributionResult[]): ErrorDistribution[] => { export const subErrorsToErrorDistribution = (errors: PaymentsSubErrorsDistributionResult[]): ErrorDistribution[] => {
const errorDistribution: ErrorDistribution[] = errors.map(({ error, percents }) => ({ const errorDistribution: ErrorDistribution[] = errors.map(({ error, percents }) => ({
errorCode: knownErrors.includes(error.code) ? error.code : 'other', errorCode: KNOWN_ERRORS.includes(error.code) ? error.code : 'other',
subErrors: error.subError ? [subErrorToDistribution(error.subError, percents)] : [], subErrors: error.subError ? [subErrorToDistribution(error.subError, percents)] : [],
percents, percents,
})); }));

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { ApiKeyComponent } from './api-key.component'; import { ApiKeyComponent } from './api-key.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: ApiKeyComponent, component: ApiKeyComponent,
@ -11,6 +11,6 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
}) })
export class ApiKeyRoutingModule {} export class ApiKeyRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { IntegrationsComponent } from './integrations.component'; import { IntegrationsComponent } from './integrations.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: IntegrationsComponent, component: IntegrationsComponent,
@ -33,7 +33,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class IntegrationsRoutingModule {} export class IntegrationsRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { PaymentLinkComponent } from './payment-link.component'; import { PaymentLinkComponent } from './payment-link.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: PaymentLinkComponent, component: PaymentLinkComponent,
@ -11,6 +11,6 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
}) })
export class PaymentLinkRoutingModule {} export class PaymentLinkRoutingModule {}

View File

@ -11,7 +11,7 @@ describe('ShopSelectorService', () => {
let service: ShopOptionsSelectionService; let service: ShopOptionsSelectionService;
let mockFetchShopsService: FetchShopsService; let mockFetchShopsService: FetchShopsService;
const MAIN_CONFIG = { const mainConfig = {
providers: [ providers: [
ShopOptionsSelectionService, ShopOptionsSelectionService,
{ {
@ -22,7 +22,7 @@ describe('ShopSelectorService', () => {
}; };
function configureTestingModule() { function configureTestingModule() {
TestBed.configureTestingModule(MAIN_CONFIG); TestBed.configureTestingModule(mainConfig);
service = TestBed.inject(ShopOptionsSelectionService); service = TestBed.inject(ShopOptionsSelectionService);
} }

View File

@ -7,7 +7,7 @@ import { RowModule } from '@dsh/components/layout';
import { ShopRowHeaderComponent } from './shop-row-header.component'; import { ShopRowHeaderComponent } from './shop-row-header.component';
const translationConfig = { const TRANSLATION_CONFIG = {
en: { en: {
shops: { shops: {
panel: { panel: {
@ -26,7 +26,7 @@ describe('ShopRowHeaderComponent', () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [ imports: [
RowModule, RowModule,
TranslocoTestingModule.withLangs(translationConfig, { TranslocoTestingModule.withLangs(TRANSLATION_CONFIG, {
availableLangs: ['en'], availableLangs: ['en'],
defaultLang: 'en', defaultLang: 'en',
}), }),
@ -55,8 +55,8 @@ describe('ShopRowHeaderComponent', () => {
it('should render columns with names from translation config', () => { it('should render columns with names from translation config', () => {
const columns = fixture.debugElement.queryAll(By.css('dsh-row dsh-row-header-label')); const columns = fixture.debugElement.queryAll(By.css('dsh-row dsh-row-header-label'));
expect(columns[0].nativeElement.textContent.trim()).toBe(translationConfig.en.shops.panel.name); expect(columns[0].nativeElement.textContent.trim()).toBe(TRANSLATION_CONFIG.en.shops.panel.name);
expect(columns[1].nativeElement.textContent.trim()).toBe(translationConfig.en.shops.panel.balance); expect(columns[1].nativeElement.textContent.trim()).toBe(TRANSLATION_CONFIG.en.shops.panel.balance);
}); });
}); });
}); });

View File

@ -21,7 +21,7 @@ import { ShopBalanceModule } from './shop-balance';
import { ShopDetailsModule } from './shop-details'; import { ShopDetailsModule } from './shop-details';
import { ShopsListComponent } from './shops-list.component'; import { ShopsListComponent } from './shops-list.component';
const translationConfig = { const TRANSLATION_CONFIG = {
en: { en: {
shops: { shops: {
panel: { panel: {
@ -56,7 +56,7 @@ describe('ShopsListComponent', () => {
SpinnerModule, SpinnerModule,
ShopDetailsModule, ShopDetailsModule,
FlexLayoutModule, FlexLayoutModule,
TranslocoTestingModule.withLangs(translationConfig, { TranslocoTestingModule.withLangs(TRANSLATION_CONFIG, {
availableLangs: ['en'], availableLangs: ['en'],
defaultLang: 'en', defaultLang: 'en',
}), }),

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { ShopsComponent } from './shops.component'; import { ShopsComponent } from './shops.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: ShopsComponent, component: ShopsComponent,
@ -11,6 +11,6 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
}) })
export class ShopsRoutingModule {} export class ShopsRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { WebhooksComponent } from './webhooks.component'; import { WebhooksComponent } from './webhooks.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: WebhooksComponent, component: WebhooksComponent,
@ -11,6 +11,6 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
}) })
export class WebhooksRoutingModule {} export class WebhooksRoutingModule {}

View File

@ -3,10 +3,10 @@ import { RouterModule, Routes } from '@angular/router';
import { InvoicesComponent } from './invoices.component'; import { InvoicesComponent } from './invoices.component';
const invoicesRoutes: Routes = [{ path: '', component: InvoicesComponent }]; const INVOICES_ROUTES: Routes = [{ path: '', component: InvoicesComponent }];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(invoicesRoutes)], imports: [RouterModule.forChild(INVOICES_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class InvoicesRoutingModule {} export class InvoicesRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { OperationsComponent } from './operations.component'; import { OperationsComponent } from './operations.component';
const operationsRoutes: Routes = [ const OPERATIONS_ROUTES: Routes = [
{ {
path: '', path: '',
component: OperationsComponent, component: OperationsComponent,
@ -29,7 +29,7 @@ const operationsRoutes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(operationsRoutes)], imports: [RouterModule.forChild(OPERATIONS_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class OperationsRoutingModule {} export class OperationsRoutingModule {}

View File

@ -7,7 +7,7 @@ import { RowModule } from '@dsh/components/layout';
import { PaymentsRowHeaderComponent } from './payments-row-header.component'; import { PaymentsRowHeaderComponent } from './payments-row-header.component';
const translationConfig = { const TRANSLATION_CONFIG = {
ru: { ru: {
operations: { operations: {
payments: { payments: {
@ -31,7 +31,7 @@ describe('PaymentsRowHeaderComponent', () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [ imports: [
RowModule, RowModule,
TranslocoTestingModule.withLangs(translationConfig, { TranslocoTestingModule.withLangs(TRANSLATION_CONFIG, {
availableLangs: ['ru'], availableLangs: ['ru'],
defaultLang: 'ru', defaultLang: 'ru',
}), }),

View File

@ -3,7 +3,7 @@ import { PaymentSearchResult } from '@dsh/api-codegen/capi';
import { StatusColor } from '../../../../../../../../theme-manager'; import { StatusColor } from '../../../../../../../../theme-manager';
import { PaymentStatusColorPipe } from './status-color.pipe'; import { PaymentStatusColorPipe } from './status-color.pipe';
const statusEnum = PaymentSearchResult.StatusEnum; const STATUS_ENUM = PaymentSearchResult.StatusEnum;
describe('PaymentStatusColorPipe', () => { describe('PaymentStatusColorPipe', () => {
let pipe: PaymentStatusColorPipe; let pipe: PaymentStatusColorPipe;
@ -18,21 +18,21 @@ describe('PaymentStatusColorPipe', () => {
describe('transform', () => { describe('transform', () => {
it('should return "success" color for Captured or Processed statuses', () => { it('should return "success" color for Captured or Processed statuses', () => {
expect(pipe.transform(statusEnum.Captured)).toBe(StatusColor.Success); expect(pipe.transform(STATUS_ENUM.Captured)).toBe(StatusColor.Success);
expect(pipe.transform(statusEnum.Processed)).toBe(StatusColor.Success); expect(pipe.transform(STATUS_ENUM.Processed)).toBe(StatusColor.Success);
}); });
it('should return "warn" color for Failed or Cancelled statuses', () => { it('should return "warn" color for Failed or Cancelled statuses', () => {
expect(pipe.transform(statusEnum.Failed)).toBe(StatusColor.Warn); expect(pipe.transform(STATUS_ENUM.Failed)).toBe(StatusColor.Warn);
expect(pipe.transform(statusEnum.Cancelled)).toBe(StatusColor.Warn); expect(pipe.transform(STATUS_ENUM.Cancelled)).toBe(StatusColor.Warn);
}); });
it('should return "pending" color for Pending status', () => { it('should return "pending" color for Pending status', () => {
expect(pipe.transform(statusEnum.Pending)).toBe(StatusColor.Pending); expect(pipe.transform(STATUS_ENUM.Pending)).toBe(StatusColor.Pending);
}); });
it('should return "neutral" color for Refunded status', () => { it('should return "neutral" color for Refunded status', () => {
expect(pipe.transform(statusEnum.Refunded)).toBe(StatusColor.Neutral); expect(pipe.transform(STATUS_ENUM.Refunded)).toBe(StatusColor.Neutral);
}); });
}); });
}); });

View File

@ -10,5 +10,6 @@ import { PaymentToolDetailsType } from '@dsh/api/capi';
export class PaymentToolComponent { export class PaymentToolComponent {
@Input() paymentToolDetails: PaymentToolDetails; @Input() paymentToolDetails: PaymentToolDetails;
// eslint-disable-next-line @typescript-eslint/naming-convention
Type = PaymentToolDetailsType; Type = PaymentToolDetailsType;
} }

View File

@ -3,10 +3,10 @@ import { RouterModule, Routes } from '@angular/router';
import { PaymentsComponent } from './payments.component'; import { PaymentsComponent } from './payments.component';
const paymentsRoutes: Routes = [{ path: '', component: PaymentsComponent }]; const PAYMENTS_ROUTES: Routes = [{ path: '', component: PaymentsComponent }];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(paymentsRoutes)], imports: [RouterModule.forChild(PAYMENTS_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class PaymentsRoutingModule {} export class PaymentsRoutingModule {}

View File

@ -3,10 +3,10 @@ import { RouterModule, Routes } from '@angular/router';
import { RefundsComponent } from './refunds.component'; import { RefundsComponent } from './refunds.component';
const refundsRoutes: Routes = [{ path: '', component: RefundsComponent }]; const REFUNDS_ROUTES: Routes = [{ path: '', component: RefundsComponent }];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(refundsRoutes)], imports: [RouterModule.forChild(REFUNDS_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class RefundsRoutingModule {} export class RefundsRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { PaymentSectionComponent } from './payment-section.component'; import { PaymentSectionComponent } from './payment-section.component';
const paymentSectionRoutes: Routes = [ const PAYMENT_SECTION_ROUTES: Routes = [
{ {
path: 'realm/:realm', path: 'realm/:realm',
component: PaymentSectionComponent, component: PaymentSectionComponent,
@ -33,7 +33,7 @@ const paymentSectionRoutes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(paymentSectionRoutes)], imports: [RouterModule.forChild(PAYMENT_SECTION_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class PaymentSectionRoutingModule {} export class PaymentSectionRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { PayoutsComponent } from './payouts.component'; import { PayoutsComponent } from './payouts.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: PayoutsComponent, component: PayoutsComponent,
@ -11,7 +11,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class PayoutsRoutingModule {} export class PayoutsRoutingModule {}

View File

@ -11,7 +11,7 @@ import { ApiShopsService } from '@dsh/api/shop';
import { filterShopsByRealm, mapToShopInfo } from '../../operations/operators'; import { filterShopsByRealm, mapToShopInfo } from '../../operations/operators';
import { CreateReportDialogService } from './create-report-dialog.service'; import { CreateReportDialogService } from './create-report-dialog.service';
const timePattern = /^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/; const TIME_PATTERN = /^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/;
@Component({ @Component({
templateUrl: 'create-report-dialog.component.html', templateUrl: 'create-report-dialog.component.html',
@ -24,9 +24,9 @@ export class CreateReportDialogComponent implements OnInit {
shopsInfo$ = of(this.data.realm).pipe(filterShopsByRealm(this.shopService.shops$), mapToShopInfo); shopsInfo$ = of(this.data.realm).pipe(filterShopsByRealm(this.shopService.shops$), mapToShopInfo);
form = this.fb.group({ form = this.fb.group({
fromDate: [moment().startOf('month').format(), Validators.required], fromDate: [moment().startOf('month').format(), Validators.required],
fromTime: ['00:00:00', Validators.pattern(timePattern)], fromTime: ['00:00:00', Validators.pattern(TIME_PATTERN)],
toDate: [moment().endOf('month').add(1).format(), Validators.required], toDate: [moment().endOf('month').add(1).format(), Validators.required],
toTime: ['00:00:00', Validators.pattern(timePattern)], toTime: ['00:00:00', Validators.pattern(TIME_PATTERN)],
shopID: null, shopID: null,
}); });

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { ReportsComponent } from './reports.component'; import { ReportsComponent } from './reports.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: ReportsComponent, component: ReportsComponent,
@ -11,7 +11,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class ReportsRoutingModule {} export class ReportsRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { MainComponent } from './main'; import { MainComponent } from './main';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: MainComponent, component: MainComponent,
@ -51,7 +51,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forRoot(routes, { paramsInheritanceStrategy: 'always', relativeLinkResolution: 'legacy' })], imports: [RouterModule.forRoot(ROUTES, { paramsInheritanceStrategy: 'always', relativeLinkResolution: 'legacy' })],
exports: [RouterModule], exports: [RouterModule],
}) })
export class SectionsRoutingModule {} export class SectionsRoutingModule {}

View File

@ -8,15 +8,15 @@ export const DEFAULT_SEARCH_LIMIT = 10;
export type DialogConfig = { small: MatDialogConfig; medium: MatDialogConfig; large: MatDialogConfig }; export type DialogConfig = { small: MatDialogConfig; medium: MatDialogConfig; large: MatDialogConfig };
export const DIALOG_CONFIG = new InjectionToken<DialogConfig>('dialogConfig'); export const DIALOG_CONFIG = new InjectionToken<DialogConfig>('dialogConfig');
const baseConfig: MatDialogConfig = { const BASE_CONFIG: MatDialogConfig = {
maxHeight: '90vh', maxHeight: '90vh',
disableClose: true, disableClose: true,
autoFocus: false, autoFocus: false,
}; };
export const DEFAULT_DIALOG_CONFIG: DialogConfig = { export const DEFAULT_DIALOG_CONFIG: DialogConfig = {
small: { ...baseConfig, width: '360px' }, small: { ...BASE_CONFIG, width: '360px' },
medium: { ...baseConfig, width: '552px' }, medium: { ...BASE_CONFIG, width: '552px' },
large: { ...baseConfig, width: '648px' }, large: { ...BASE_CONFIG, width: '648px' },
}; };
export const DEFAULT_CHARTS_THEME: ChartsThemeProvider = { export const DEFAULT_CHARTS_THEME: ChartsThemeProvider = {

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { WalletDetailsComponent } from './wallet-details.component'; import { WalletDetailsComponent } from './wallet-details.component';
const walletDetailsRoutes: Routes = [ const WALLET_DETAILS_ROUTES: Routes = [
{ {
path: ':walletID', path: ':walletID',
component: WalletDetailsComponent, component: WalletDetailsComponent,
@ -11,7 +11,7 @@ const walletDetailsRoutes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(walletDetailsRoutes)], imports: [RouterModule.forChild(WALLET_DETAILS_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class WalletDetailsRoutingModule {} export class WalletDetailsRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { DepositsComponent } from './deposits.component'; import { DepositsComponent } from './deposits.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: DepositsComponent, component: DepositsComponent,
@ -11,7 +11,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class DepositsRoutingModule {} export class DepositsRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { IntegrationsComponent } from './integrations.component'; import { IntegrationsComponent } from './integrations.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: IntegrationsComponent, component: IntegrationsComponent,
@ -21,7 +21,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class IntegrationsRoutingModule {} export class IntegrationsRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { WebhooksComponent } from './webhooks.component'; import { WebhooksComponent } from './webhooks.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: WebhooksComponent, component: WebhooksComponent,
@ -11,6 +11,6 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
}) })
export class WebhooksRoutingModule {} export class WebhooksRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { WalletSectionComponent } from './wallet-section.component'; import { WalletSectionComponent } from './wallet-section.component';
const walletSectionRoutes: Routes = [ const WALLET_SECTION_ROUTES: Routes = [
{ {
path: '', path: '',
component: WalletSectionComponent, component: WalletSectionComponent,
@ -33,7 +33,7 @@ const walletSectionRoutes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(walletSectionRoutes)], imports: [RouterModule.forChild(WALLET_SECTION_ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class WalletSectionRoutingModule {} export class WalletSectionRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { WalletsComponent } from './wallets.component'; import { WalletsComponent } from './wallets.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: WalletsComponent, component: WalletsComponent,
@ -11,7 +11,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class WalletsRoutingModule {} export class WalletsRoutingModule {}

View File

@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { WithdrawalsComponent } from './withdrawals.component'; import { WithdrawalsComponent } from './withdrawals.component';
const routes: Routes = [ const ROUTES: Routes = [
{ {
path: '', path: '',
component: WithdrawalsComponent, component: WithdrawalsComponent,
@ -11,7 +11,7 @@ const routes: Routes = [
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(ROUTES)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class WithdrawalsRoutingModule {} export class WithdrawalsRoutingModule {}

View File

@ -1,10 +1,12 @@
import { RoleId } from '@dsh/api-codegen/organizations'; import { RoleId } from '@dsh/api-codegen/organizations';
export const ROLE_PRIORITY_DESC: Record<RoleId, number> = { export const ROLE_PRIORITY_DESC: Record<RoleId, number> = {
/* eslint-disable @typescript-eslint/naming-convention */
Administrator: 0, Administrator: 0,
Manager: 1, Manager: 1,
Accountant: 2, Accountant: 2,
Integrator: 3, Integrator: 3,
/* eslint-enable @typescript-eslint/naming-convention */
}; };
export function sortRoleIds(a: RoleId, b: RoleId) { export function sortRoleIds(a: RoleId, b: RoleId) {

Some files were not shown because too many files have changed in this diff Show More