From 89d44f6b432ddc706af8dcb3e27261fc4bcd8995 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sat, 4 Dec 2021 09:45:50 +0100 Subject: [PATCH] Convert the symbol to uppercase to avoid case-sensitive duplicates --- apps/api/src/app/order/order.service.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index e5bfaa1a5..ace5756da 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -45,19 +45,22 @@ export class OrderService { public async createOrder(data: Prisma.OrderCreateInput): Promise { const isDraft = isAfter(data.date as Date, endOfToday()); + // Convert the symbol to uppercase to avoid case-sensitive duplicates + const symbol = data.symbol.toUpperCase(); + if (!isDraft) { // Gather symbol data of order in the background, if not draft this.dataGatheringService.gatherSymbols([ { + symbol, dataSource: data.dataSource, - date: data.date, - symbol: data.symbol + date: data.date } ]); } this.dataGatheringService.gatherProfileData([ - { dataSource: data.dataSource, symbol: data.symbol } + { symbol, dataSource: data.dataSource } ]); await this.cacheService.flush(); @@ -65,7 +68,8 @@ export class OrderService { return this.prismaService.order.create({ data: { ...data, - isDraft + isDraft, + symbol } }); }