Feature/symbol to uppercase to avoid duplicates (#514)
* Convert the symbol to uppercase to avoid case-sensitive duplicates * Update changelog
This commit is contained in:
parent
e96e6c717c
commit
563f354e7e
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Improved the historical data view in the admin control panel (hide invalid and future dates)
|
||||
- Enabled the import functionality for transactions by default
|
||||
- Converted the symbols to uppercase to avoid case-sensitive duplicates in the symbol profile model
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -45,19 +45,22 @@ export class OrderService {
|
||||
public async createOrder(data: Prisma.OrderCreateInput): Promise<Order> {
|
||||
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: <Date>data.date,
|
||||
symbol: data.symbol
|
||||
date: <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
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user