Skip to content

Commit

Permalink
fix: change limitations to limitation
Browse files Browse the repository at this point in the history
  • Loading branch information
ZigBalthazar committed Jan 8, 2025
1 parent c0c786f commit 27e77ac
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/modules/config/controllers/config-grpc.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class ConfigGrpcController implements ParametersController {
if (!token) {

Check failure on line 16 in src/modules/config/controllers/config-grpc.controller.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/modules/config/controllers/config-grpc.controller.ts#L16

Expected blank line before this statement (padding-line-between-statements)
throw new GrpcInvalidArgumentException("input 'x-identifier' is not valid.");
}
const { url, limitations } = await this.configService.getNip11();
const { url, limitation: limitations } = await this.configService.getNip11();

Check failure on line 19 in src/modules/config/controllers/config-grpc.controller.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/modules/config/controllers/config-grpc.controller.ts#L19

Expected blank line before this statement (padding-line-between-statements)

return {
url,
Expand Down
34 changes: 17 additions & 17 deletions src/modules/config/dto/nip11.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class Nip11DTO extends AbstractDto {

@ApiProperty({ type: () => LimitationDto, required: false })
@IsOptional()
limitations?: LimitationDto;
limitation?: LimitationDto;

constructor(e: Nip11Entity) {

Check failure on line 86 in src/modules/config/dto/nip11.dto.ts

View workflow job for this annotation

GitHub Actions / ESLint

src/modules/config/dto/nip11.dto.ts#L86

Refactor this function to reduce its Cognitive Complexity from 35 to the 15 allowed (sonarjs/cognitive-complexity)
super(e);
Expand Down Expand Up @@ -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;
}
Expand Down
34 changes: 17 additions & 17 deletions src/modules/config/entities/nip11.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class Nip11Entity extends AbstractEntity<Nip11DTO> {
fees?: FeesEntity | null;

@Column()
limitations?: LimitationEntity | null;
limitation?: LimitationEntity | null;

constructor(item?: Partial<Omit<Nip11Entity, 'id'>>) {
super();
Expand Down Expand Up @@ -101,24 +101,24 @@ export class Nip11Entity extends AbstractEntity<Nip11DTO> {
// 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,
};
}
}

0 comments on commit 27e77ac

Please sign in to comment.