|
@ -196,19 +196,19 @@ export class OrderService { |
|
|
|
|
|
|
|
|
public async deleteOrders({ |
|
|
public async deleteOrders({ |
|
|
filters, |
|
|
filters, |
|
|
where |
|
|
userCurrency, |
|
|
|
|
|
userId |
|
|
}: { |
|
|
}: { |
|
|
filters?: Filter[]; |
|
|
filters?: Filter[]; |
|
|
where: Prisma.OrderWhereInput; |
|
|
userCurrency: string; |
|
|
|
|
|
userId: string; |
|
|
}): Promise<number> { |
|
|
}): Promise<number> { |
|
|
const userId = where.userId as string; |
|
|
|
|
|
const userCurrency = where.currency as string; |
|
|
|
|
|
const { activities } = await this.getOrders({ |
|
|
const { activities } = await this.getOrders({ |
|
|
filters, |
|
|
filters, |
|
|
userId, |
|
|
userId, |
|
|
userCurrency |
|
|
userCurrency |
|
|
}); |
|
|
}); |
|
|
const orderIds = activities.map((order) => order.id); |
|
|
|
|
|
const { count } = await this.prismaService.order.deleteMany({ |
|
|
const { count } = await this.prismaService.order.deleteMany({ |
|
|
where: { |
|
|
where: { |
|
|
id: { |
|
|
id: { |
|
@ -221,9 +221,7 @@ export class OrderService { |
|
|
|
|
|
|
|
|
this.eventEmitter.emit( |
|
|
this.eventEmitter.emit( |
|
|
PortfolioChangedEvent.getName(), |
|
|
PortfolioChangedEvent.getName(), |
|
|
new PortfolioChangedEvent({ |
|
|
new PortfolioChangedEvent({ userId }) |
|
|
userId: <string>where.userId |
|
|
|
|
|
}) |
|
|
|
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
return count; |
|
|
return count; |
|
|