diff --git a/src/orders/orders.service.ts b/src/orders/orders.service.ts index e7da7bd..733cda6 100644 --- a/src/orders/orders.service.ts +++ b/src/orders/orders.service.ts @@ -29,10 +29,10 @@ export class OrdersService { }; } - private async getOwned(userId: string, id: string, includeRelations = false) { + private async getOwned(userId: string, id: string) { const order = await this.prisma.order.findUnique({ where: { id }, - include: includeRelations ? { items: true, payment: true } : undefined, + include: { items: true, payment: true }, }); if (!order) throw new NotFoundException('订单不存在'); if (order.userId !== userId) throw new ForbiddenException('无权操作该订单'); @@ -62,7 +62,7 @@ export class OrdersService { async findOne(userId: string, id: string) { // 越权 403 / 不存在 404(契约 §6) - const order = await this.getOwned(userId, id, true); + const order = await this.getOwned(userId, id); return this.toClientOrder(order); }