search startDate and endDate
This commit is contained in:
parent
ee610c5686
commit
0aba9f9865
20 changed files with 123 additions and 32 deletions
|
|
@ -27,7 +27,7 @@ import { isSystem } from "../utils/keycloak";
|
|||
import { filterStatus } from "../services/prisma";
|
||||
import { deleteFile, deleteFolder, fileLocation, getFile, listFile, setFile } from "../utils/minio";
|
||||
import { isUsedError, notFoundError, relationError } from "../utils/error";
|
||||
import { queryOrNot } from "../utils/relation";
|
||||
import { queryOrNot, whereDateQuery } from "../utils/relation";
|
||||
|
||||
const MANAGE_ROLES = [
|
||||
"system",
|
||||
|
|
@ -139,6 +139,8 @@ export class ProductController extends Controller {
|
|||
@Query() orderField?: keyof Product,
|
||||
@Query() orderBy?: "asc" | "desc",
|
||||
@Query() activeOnly?: boolean,
|
||||
@Query() startDate?: Date,
|
||||
@Query() endDate?: Date,
|
||||
) {
|
||||
// NOTE: will be used to scope product within product group that is shared between branch but not company when select shared product if user is system
|
||||
const targetGroup =
|
||||
|
|
@ -194,6 +196,7 @@ export class ProductController extends Controller {
|
|||
: []),
|
||||
],
|
||||
},
|
||||
...whereDateQuery(startDate, endDate),
|
||||
} satisfies Prisma.ProductWhereInput;
|
||||
|
||||
const [result, total] = await prisma.$transaction([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue