From c7f75c78d21dd032cce7d1e013b15ca70a91abc8 Mon Sep 17 00:00:00 2001 From: RinYato Date: Thu, 10 Oct 2024 19:08:49 +0700 Subject: [PATCH] feat(api): filter deleted checkouts (#3) --- apps/api/src/service/checkout.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/service/checkout.service.ts b/apps/api/src/service/checkout.service.ts index 466ede3..64edcdd 100644 --- a/apps/api/src/service/checkout.service.ts +++ b/apps/api/src/service/checkout.service.ts @@ -1,4 +1,4 @@ -import { count, desc, eq } from "drizzle-orm"; +import { and, count, desc, eq, isNull } from "drizzle-orm"; import type { User } from "lucia"; import { z } from "@hono/zod-openapi"; import { err, ok, type Result } from "@justmiracle/result"; @@ -160,7 +160,7 @@ export class CheckoutService { } async findMany(userId: string, opts: { page: number; perPage: number }) { - const condition = eq(TB_checkout.userId, userId); + const condition = and(eq(TB_checkout.userId, userId), isNull(TB_checkout.deletedAt)); const query = db.query.TB_checkout.findMany({ where: condition,