diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.ts index fe40a299a..2e7f76610 100644 --- a/apps/api/src/app/admin/admin.service.ts +++ b/apps/api/src/app/admin/admin.service.ts @@ -331,39 +331,33 @@ export class AdminService { symbol, symbolMapping }: Prisma.SymbolProfileUpdateInput & UniqueAsset) { - let updatedSymbolProfile: Prisma.SymbolProfileUpdateInput & UniqueAsset = { - assetClass, - assetSubClass, - comment, - countries, - currency, - dataSource, - scraperConfiguration, - sectors, - symbol, - symbolMapping - }; - - if (dataSource === 'MANUAL') { - updatedSymbolProfile = { - ...updatedSymbolProfile, - name - }; - } else { - updatedSymbolProfile = { - ...updatedSymbolProfile, - SymbolProfileOverrides: { - upsert: { - create: { - name: name as string - }, - update: { - name: name as string - } - } - } + const updatedSymbolProfile: Prisma.SymbolProfileUpdateInput & UniqueAsset = + { + assetClass, + assetSubClass, + comment, + countries, + currency, + dataSource, + scraperConfiguration, + sectors, + symbol, + symbolMapping, + ...(dataSource === 'MANUAL' + ? { name } + : { + SymbolProfileOverrides: { + upsert: { + create: { + name: name as string + }, + update: { + name: name as string + } + } + } + }) }; - } await this.symbolProfileService.updateSymbolProfile(updatedSymbolProfile);