Browse Source

Refactoring

pull/5065/head
Thomas Kaul 2 days ago
parent
commit
3d2986483c
  1. 1
      apps/api/src/services/property/interfaces/interfaces.ts
  2. 6
      apps/api/src/services/property/property.service.ts

1
apps/api/src/services/property/interfaces/interfaces.ts

@ -0,0 +1 @@
export type PropertyValue = boolean | object | string | string[];

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

@ -6,7 +6,7 @@ import {
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
type Value = boolean | object | string | string[]; import { PropertyValue } from './interfaces/interfaces';
@Injectable() @Injectable()
export class PropertyService { export class PropertyService {
@ -20,7 +20,7 @@ export class PropertyService {
public async get() { public async get() {
const response: { const response: {
[key: string]: Value; [key: string]: PropertyValue;
} = { } = {
[PROPERTY_CURRENCIES]: [] [PROPERTY_CURRENCIES]: []
}; };
@ -40,7 +40,7 @@ export class PropertyService {
return response; return response;
} }
public async getByKey<TValue extends Value>(aKey: string) { public async getByKey<TValue extends PropertyValue>(aKey: string) {
const properties = await this.get(); const properties = await this.get();
return properties[aKey] as TValue; return properties[aKey] as TValue;
} }

Loading…
Cancel
Save