From 27e77ac31ab93823a85be6b65e6e1d9aef48c186 Mon Sep 17 00:00:00 2001 From: ZigBalthazar Date: Wed, 8 Jan 2025 23:04:50 +0330 Subject: [PATCH] fix: change limitations to limitation --- .../controllers/config-grpc.controller.ts | 2 +- src/modules/config/dto/nip11.dto.ts | 34 +++++++++---------- src/modules/config/entities/nip11.entity.ts | 34 +++++++++---------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/modules/config/controllers/config-grpc.controller.ts b/src/modules/config/controllers/config-grpc.controller.ts index c0f8104..4e6d986 100644 --- a/src/modules/config/controllers/config-grpc.controller.ts +++ b/src/modules/config/controllers/config-grpc.controller.ts @@ -16,7 +16,7 @@ export class ConfigGrpcController implements ParametersController { if (!token) { throw new GrpcInvalidArgumentException("input 'x-identifier' is not valid."); } - const { url, limitations } = await this.configService.getNip11(); + const { url, limitation: limitations } = await this.configService.getNip11(); return { url, diff --git a/src/modules/config/dto/nip11.dto.ts b/src/modules/config/dto/nip11.dto.ts index faa4a86..0c3a733 100644 --- a/src/modules/config/dto/nip11.dto.ts +++ b/src/modules/config/dto/nip11.dto.ts @@ -81,7 +81,7 @@ export class Nip11DTO extends AbstractDto { @ApiProperty({ type: () => LimitationDto, required: false }) @IsOptional() - limitations?: LimitationDto; + limitation?: LimitationDto; constructor(e: Nip11Entity) { super(e); @@ -130,23 +130,23 @@ export class Nip11DTO extends AbstractDto { } : undefined; - // Handle Limitations - this.limitations = e.limitations + // Handle Limitation + this.limitation = e.limitation ? { - auth_required: e.limitations.auth_required ?? undefined, - max_message_length: e.limitations.max_message_length ?? undefined, - max_subid_length: e.limitations.max_subid_length ?? undefined, - max_filters: e.limitations.max_filters ?? undefined, - max_subscriptions: e.limitations.max_subscriptions ?? undefined, - min_pow_difficulty: e.limitations.min_pow_difficulty ?? undefined, - payment_required: e.limitations.payment_required ?? undefined, - restricted_writes: e.limitations.restricted_writes ?? undefined, - max_event_tags: e.limitations.max_event_tags ?? undefined, - max_content_length: e.limitations.max_content_length ?? undefined, - created_at_lower_limit: e.limitations.created_at_lower_limit ?? undefined, - created_at_upper_limit: e.limitations.created_at_upper_limit ?? undefined, - default_query_limit: e.limitations.default_query_limit ?? undefined, - max_limit: e.limitations.max_limit ?? undefined, + auth_required: e.limitation.auth_required ?? undefined, + max_message_length: e.limitation.max_message_length ?? undefined, + max_subid_length: e.limitation.max_subid_length ?? undefined, + max_filters: e.limitation.max_filters ?? undefined, + max_subscriptions: e.limitation.max_subscriptions ?? undefined, + min_pow_difficulty: e.limitation.min_pow_difficulty ?? undefined, + payment_required: e.limitation.payment_required ?? undefined, + restricted_writes: e.limitation.restricted_writes ?? undefined, + max_event_tags: e.limitation.max_event_tags ?? undefined, + max_content_length: e.limitation.max_content_length ?? undefined, + created_at_lower_limit: e.limitation.created_at_lower_limit ?? undefined, + created_at_upper_limit: e.limitation.created_at_upper_limit ?? undefined, + default_query_limit: e.limitation.default_query_limit ?? undefined, + max_limit: e.limitation.max_limit ?? undefined, } : undefined; } diff --git a/src/modules/config/entities/nip11.entity.ts b/src/modules/config/entities/nip11.entity.ts index 72292d3..e33ef2d 100644 --- a/src/modules/config/entities/nip11.entity.ts +++ b/src/modules/config/entities/nip11.entity.ts @@ -62,7 +62,7 @@ export class Nip11Entity extends AbstractEntity { fees?: FeesEntity | null; @Column() - limitations?: LimitationEntity | null; + limitation?: LimitationEntity | null; constructor(item?: Partial>) { super(); @@ -101,24 +101,24 @@ export class Nip11Entity extends AbstractEntity { // Handle Fees this.fees = item.fees ?? this.fees ?? null; - // Handle Limitations - this.limitations = { - max_message_length: item.limitations?.max_message_length ?? this.limitations?.max_message_length ?? null, - max_subscriptions: item.limitations?.max_subscriptions ?? this.limitations?.max_subscriptions ?? null, - max_filters: item.limitations?.max_filters ?? this.limitations?.max_filters ?? null, - max_subid_length: item.limitations?.max_subid_length ?? this.limitations?.max_subid_length ?? null, - min_pow_difficulty: item.limitations?.min_pow_difficulty ?? this.limitations?.min_pow_difficulty ?? null, - auth_required: item.limitations?.auth_required ?? this.limitations?.auth_required ?? null, - payment_required: item.limitations?.payment_required ?? this.limitations?.payment_required ?? null, - restricted_writes: item.limitations?.restricted_writes ?? this.limitations?.restricted_writes ?? null, - max_event_tags: item.limitations?.max_event_tags ?? this.limitations?.max_event_tags ?? null, - max_content_length: item.limitations?.max_content_length ?? this.limitations?.max_content_length ?? null, + // Handle Limitation + this.limitation = { + max_message_length: item.limitation?.max_message_length ?? this.limitation?.max_message_length ?? null, + max_subscriptions: item.limitation?.max_subscriptions ?? this.limitation?.max_subscriptions ?? null, + max_filters: item.limitation?.max_filters ?? this.limitation?.max_filters ?? null, + max_subid_length: item.limitation?.max_subid_length ?? this.limitation?.max_subid_length ?? null, + min_pow_difficulty: item.limitation?.min_pow_difficulty ?? this.limitation?.min_pow_difficulty ?? null, + auth_required: item.limitation?.auth_required ?? this.limitation?.auth_required ?? null, + payment_required: item.limitation?.payment_required ?? this.limitation?.payment_required ?? null, + restricted_writes: item.limitation?.restricted_writes ?? this.limitation?.restricted_writes ?? null, + max_event_tags: item.limitation?.max_event_tags ?? this.limitation?.max_event_tags ?? null, + max_content_length: item.limitation?.max_content_length ?? this.limitation?.max_content_length ?? null, created_at_lower_limit: - item.limitations?.created_at_lower_limit ?? this.limitations?.created_at_lower_limit ?? null, + item.limitation?.created_at_lower_limit ?? this.limitation?.created_at_lower_limit ?? null, created_at_upper_limit: - item.limitations?.created_at_upper_limit ?? this.limitations?.created_at_upper_limit ?? null, - max_limit: item.limitations?.max_limit ?? this.limitations?.max_limit ?? null, - default_query_limit: item.limitations?.default_query_limit ?? this.limitations?.default_query_limit ?? null, + item.limitation?.created_at_upper_limit ?? this.limitation?.created_at_upper_limit ?? null, + max_limit: item.limitation?.max_limit ?? this.limitation?.max_limit ?? null, + default_query_limit: item.limitation?.default_query_limit ?? this.limitation?.default_query_limit ?? null, }; } }