|
|
@ -3,6 +3,7 @@ import { |
|
|
PROPERTY_CURRENCIES, |
|
|
PROPERTY_CURRENCIES, |
|
|
PROPERTY_IS_USER_SIGNUP_ENABLED |
|
|
PROPERTY_IS_USER_SIGNUP_ENABLED |
|
|
} from '@ghostfolio/common/config'; |
|
|
} from '@ghostfolio/common/config'; |
|
|
|
|
|
import { PropertyKey } from '@ghostfolio/common/types'; |
|
|
|
|
|
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
|
|
|
|
|
@ -12,7 +13,7 @@ import { PropertyValue } from './interfaces/interfaces'; |
|
|
export class PropertyService { |
|
|
export class PropertyService { |
|
|
public constructor(private readonly prismaService: PrismaService) {} |
|
|
public constructor(private readonly prismaService: PrismaService) {} |
|
|
|
|
|
|
|
|
public async delete({ key }: { key: string }) { |
|
|
public async delete({ key }: { key: PropertyKey }) { |
|
|
return this.prismaService.property.delete({ |
|
|
return this.prismaService.property.delete({ |
|
|
where: { key } |
|
|
where: { key } |
|
|
}); |
|
|
}); |
|
|
@ -40,7 +41,7 @@ export class PropertyService { |
|
|
return response; |
|
|
return response; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async getByKey<TValue extends PropertyValue>(aKey: string) { |
|
|
public async getByKey<TValue extends PropertyValue>(aKey: PropertyKey) { |
|
|
const properties = await this.get(); |
|
|
const properties = await this.get(); |
|
|
return properties[aKey] as TValue; |
|
|
return properties[aKey] as TValue; |
|
|
} |
|
|
} |
|
|
@ -51,7 +52,7 @@ export class PropertyService { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async put({ key, value }: { key: string; value: string }) { |
|
|
public async put({ key, value }: { key: PropertyKey; value: string }) { |
|
|
return this.prismaService.property.upsert({ |
|
|
return this.prismaService.property.upsert({ |
|
|
create: { key, value }, |
|
|
create: { key, value }, |
|
|
update: { value }, |
|
|
update: { value }, |
|
|
|