|
|
@ -5,10 +5,13 @@ import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; |
|
|
import { DataGatheringService } from '@ghostfolio/api/services/queues/data-gathering/data-gathering.service'; |
|
|
import { DataGatheringService } from '@ghostfolio/api/services/queues/data-gathering/data-gathering.service'; |
|
|
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; |
|
|
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; |
|
|
import { getAssetProfileIdentifier } from '@ghostfolio/common/helper'; |
|
|
import { getAssetProfileIdentifier } from '@ghostfolio/common/helper'; |
|
|
import { WatchlistResponse } from '@ghostfolio/common/interfaces'; |
|
|
import { |
|
|
|
|
|
AssetProfileIdentifier, |
|
|
|
|
|
WatchlistResponse |
|
|
|
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
|
|
|
|
|
|
import { BadRequestException, Injectable } from '@nestjs/common'; |
|
|
import { BadRequestException, Injectable } from '@nestjs/common'; |
|
|
import { DataSource, Prisma } from '@prisma/client'; |
|
|
import { Prisma } from '@prisma/client'; |
|
|
|
|
|
|
|
|
@Injectable() |
|
|
@Injectable() |
|
|
export class WatchlistService { |
|
|
export class WatchlistService { |
|
|
@ -25,11 +28,7 @@ export class WatchlistService { |
|
|
dataSource, |
|
|
dataSource, |
|
|
symbol, |
|
|
symbol, |
|
|
userId |
|
|
userId |
|
|
}: { |
|
|
}: { userId: string } & AssetProfileIdentifier): Promise<void> { |
|
|
dataSource: DataSource; |
|
|
|
|
|
symbol: string; |
|
|
|
|
|
userId: string; |
|
|
|
|
|
}): Promise<void> { |
|
|
|
|
|
const symbolProfile = await this.prismaService.symbolProfile.findUnique({ |
|
|
const symbolProfile = await this.prismaService.symbolProfile.findUnique({ |
|
|
where: { |
|
|
where: { |
|
|
dataSource_symbol: { dataSource, symbol } |
|
|
dataSource_symbol: { dataSource, symbol } |
|
|
@ -73,11 +72,7 @@ export class WatchlistService { |
|
|
dataSource, |
|
|
dataSource, |
|
|
symbol, |
|
|
symbol, |
|
|
userId |
|
|
userId |
|
|
}: { |
|
|
}: { userId: string } & AssetProfileIdentifier) { |
|
|
dataSource: DataSource; |
|
|
|
|
|
symbol: string; |
|
|
|
|
|
userId: string; |
|
|
|
|
|
}) { |
|
|
|
|
|
await this.prismaService.user.update({ |
|
|
await this.prismaService.user.update({ |
|
|
data: { |
|
|
data: { |
|
|
watchlist: { |
|
|
watchlist: { |
|
|
|