From c48e79802ca04fcf758214ae9b64a3f49d5c93e9 Mon Sep 17 00:00:00 2001 From: lhmin0604 Date: Tue, 15 Sep 2026 06:08:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(orders):=20getOwned=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E5=B8=A6=20relations=EF=BC=8C=E4=BF=AE=E5=A4=8D=20include=20?= =?UTF-8?q?=E5=88=86=E6=94=AF=E7=9A=84=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude --- src/orders/orders.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); }