Browse Source

code review changes

pull/5065/head
csehatt741 2 days ago
parent
commit
d435f53998
  1. 8
      apps/api/src/services/property/property.service.ts

8
apps/api/src/services/property/property.service.ts

@ -6,6 +6,8 @@ import {
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
type Value = boolean | object | string | string[];
@Injectable() @Injectable()
export class PropertyService { export class PropertyService {
public constructor(private readonly prismaService: PrismaService) {} public constructor(private readonly prismaService: PrismaService) {}
@ -18,7 +20,7 @@ export class PropertyService {
public async get() { public async get() {
const response: { const response: {
[key: string]: boolean | object | string | string[]; [key: string]: Value;
} = { } = {
[PROPERTY_CURRENCIES]: [] [PROPERTY_CURRENCIES]: []
}; };
@ -38,9 +40,9 @@ export class PropertyService {
return response; return response;
} }
public async getByKey<TKey>(aKey: string): Promise<TKey | undefined> { public async getByKey<TValue extends Value>(aKey: string) {
const properties = await this.get(); const properties = await this.get();
return properties?.[aKey] as TKey; return properties[aKey] as TValue;
} }
public async isUserSignupEnabled() { public async isUserSignupEnabled() {

Loading…
Cancel
Save