search startDate and endDate
This commit is contained in:
parent
ee610c5686
commit
0aba9f9865
20 changed files with 123 additions and 32 deletions
|
|
@ -18,6 +18,7 @@ import prisma from "../db";
|
|||
import { RequestWithUser } from "../interfaces/user";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
import { isUsedError, notFoundError } from "../utils/error";
|
||||
import { whereDateQuery } from "../utils/relation";
|
||||
|
||||
type WorkCreate = {
|
||||
order: number;
|
||||
|
|
@ -45,9 +46,12 @@ export class WorkController extends Controller {
|
|||
@Query() query: string = "",
|
||||
@Query() page: number = 1,
|
||||
@Query() pageSize: number = 30,
|
||||
@Query() startDate?: Date,
|
||||
@Query() endDate?: Date,
|
||||
) {
|
||||
const where = {
|
||||
OR: [{ name: { contains: query }, serviceId: baseOnly ? null : undefined }],
|
||||
...whereDateQuery(startDate, endDate),
|
||||
} satisfies Prisma.WorkWhereInput;
|
||||
|
||||
const [result, total] = await prisma.$transaction([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue