|
@ -70,12 +70,7 @@ export class OrderService { |
|
|
const updateAccountBalance = data.updateAccountBalance ?? false; |
|
|
const updateAccountBalance = data.updateAccountBalance ?? false; |
|
|
const userId = data.userId; |
|
|
const userId = data.userId; |
|
|
|
|
|
|
|
|
if ( |
|
|
if (['FEE', 'INTEREST', 'ITEM', 'LIABILITY'].includes(data.type)) { |
|
|
data.type === 'FEE' || |
|
|
|
|
|
data.type === 'INTEREST' || |
|
|
|
|
|
data.type === 'ITEM' || |
|
|
|
|
|
data.type === 'LIABILITY' |
|
|
|
|
|
) { |
|
|
|
|
|
const assetClass = data.assetClass; |
|
|
const assetClass = data.assetClass; |
|
|
const assetSubClass = data.assetSubClass; |
|
|
const assetSubClass = data.assetSubClass; |
|
|
currency = data.SymbolProfile.connectOrCreate.create.currency; |
|
|
currency = data.SymbolProfile.connectOrCreate.create.currency; |
|
@ -130,13 +125,9 @@ export class OrderService { |
|
|
|
|
|
|
|
|
const orderData: Prisma.OrderCreateInput = data; |
|
|
const orderData: Prisma.OrderCreateInput = data; |
|
|
|
|
|
|
|
|
const isDraft = |
|
|
const isDraft = ['FEE', 'INTEREST', 'ITEM', 'LIABILITY'].includes(data.type) |
|
|
data.type === 'FEE' || |
|
|
? false |
|
|
data.type === 'INTEREST' || |
|
|
: isAfter(data.date as Date, endOfToday()); |
|
|
data.type === 'ITEM' || |
|
|
|
|
|
data.type === 'LIABILITY' |
|
|
|
|
|
? false |
|
|
|
|
|
: isAfter(data.date as Date, endOfToday()); |
|
|
|
|
|
|
|
|
|
|
|
const order = await this.prismaService.order.create({ |
|
|
const order = await this.prismaService.order.create({ |
|
|
data: { |
|
|
data: { |
|
@ -180,12 +171,7 @@ export class OrderService { |
|
|
where |
|
|
where |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
if ( |
|
|
if (['FEE', 'INTEREST', 'ITEM', 'LIABILITY'].includes(order.type)) { |
|
|
order.type === 'FEE' || |
|
|
|
|
|
order.type === 'INTEREST' || |
|
|
|
|
|
order.type === 'ITEM' || |
|
|
|
|
|
order.type === 'LIABILITY' |
|
|
|
|
|
) { |
|
|
|
|
|
await this.symbolProfileService.deleteById(order.symbolProfileId); |
|
|
await this.symbolProfileService.deleteById(order.symbolProfileId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -369,15 +355,13 @@ export class OrderService { |
|
|
where |
|
|
where |
|
|
}: { |
|
|
}: { |
|
|
data: Prisma.OrderUpdateInput & { |
|
|
data: Prisma.OrderUpdateInput & { |
|
|
Account?: |
|
|
|
|
|
| { connect: { id_userId: { id: string; userId: string } } } |
|
|
|
|
|
| { disconnect: true }; |
|
|
|
|
|
assetClass?: AssetClass; |
|
|
assetClass?: AssetClass; |
|
|
assetSubClass?: AssetSubClass; |
|
|
assetSubClass?: AssetSubClass; |
|
|
currency?: string; |
|
|
currency?: string; |
|
|
dataSource?: DataSource; |
|
|
dataSource?: DataSource; |
|
|
symbol?: string; |
|
|
symbol?: string; |
|
|
tags?: Tag[]; |
|
|
tags?: Tag[]; |
|
|
|
|
|
type?: ActivityType; |
|
|
}; |
|
|
}; |
|
|
where: Prisma.OrderWhereUniqueInput; |
|
|
where: Prisma.OrderWhereUniqueInput; |
|
|
}): Promise<Order> { |
|
|
}): Promise<Order> { |
|
@ -389,14 +373,9 @@ export class OrderService { |
|
|
|
|
|
|
|
|
let isDraft = false; |
|
|
let isDraft = false; |
|
|
|
|
|
|
|
|
if ( |
|
|
if (['FEE', 'INTEREST', 'ITEM', 'LIABILITY'].includes(data.type)) { |
|
|
data.type === 'FEE' || |
|
|
|
|
|
data.type === 'INTEREST' || |
|
|
|
|
|
data.type === 'ITEM' || |
|
|
|
|
|
data.type === 'LIABILITY' |
|
|
|
|
|
) { |
|
|
|
|
|
delete data.SymbolProfile.connect; |
|
|
delete data.SymbolProfile.connect; |
|
|
console.log('llega aqui'); |
|
|
|
|
|
if (data.Account?.connect?.id_userId?.id === null) { |
|
|
if (data.Account?.connect?.id_userId?.id === null) { |
|
|
data.Account = { disconnect: true }; |
|
|
data.Account = { disconnect: true }; |
|
|
} |
|
|
} |
|
|