i am getting this error in update method in prisma service in order status

7 Views Asked by At

Type '{ token: string; }' is not assignable to type 'ordersWhereUniqueInput'. Type '{ token: string; }' is not assignable to type '{ orderId: string; } & { orderId?: string; AND?: ordersWhereInput | ordersWhereInput[]; OR?: ordersWhereInput[]; NOT?: ordersWhereInput | ordersWhereInput[]; ... 8 more ...; user?: (Without<...> & userWhereInput) | (Without<...> & UserRelationFilter); }'. Property 'orderId' is missing in type '{ token: string; }' but required in type '{ orderId: string; }'.ts(2322) index.d.ts(5103, 5): The expected type comes from property 'where' which is declared here on type '{ select?: ordersSelect<DefaultArgs>; include?: ordersInclude<DefaultArgs>; data: (Without<ordersUpdateInput, ordersUncheckedUpdateInput> & ordersUncheckedUpdateInput) | (Without<...> & ordersUpdateInput); where: ordersWhereUniqueInput; }'

async cancelOrder(token: string) {
    try {
      // Update the order status to indicate cancellation
      const canceledOrder = await this.prisma.orders.update({
        where: { token },
        data: {
          orderStatus: false,
        },
      });
  
      return { message: 'Order canceled successfully', canceledOrder };
    } catch (error) {
      throw new BadRequestException('Error canceling the order');
    }
  }
  
  
0

There are 0 best solutions below