Merge branch 'develop'
This commit is contained in:
commit
4691d559f5
1 changed files with 41 additions and 0 deletions
|
|
@ -170,6 +170,10 @@ export class CustomerController extends Controller {
|
||||||
@Query() activeBranchOnly?: boolean,
|
@Query() activeBranchOnly?: boolean,
|
||||||
@Query() startDate?: Date,
|
@Query() startDate?: Date,
|
||||||
@Query() endDate?: Date,
|
@Query() endDate?: Date,
|
||||||
|
@Query() businessType?: string,
|
||||||
|
@Query() province?: string,
|
||||||
|
@Query() district?: string,
|
||||||
|
@Query() subDistrict?: string,
|
||||||
) {
|
) {
|
||||||
const where = {
|
const where = {
|
||||||
OR: queryOrNot<Prisma.CustomerWhereInput[]>(query, [
|
OR: queryOrNot<Prisma.CustomerWhereInput[]>(query, [
|
||||||
|
|
@ -192,6 +196,35 @@ export class CustomerController extends Controller {
|
||||||
: permissionCond(req.user, { activeOnly: activeBranchOnly }),
|
: permissionCond(req.user, { activeOnly: activeBranchOnly }),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
branch: {
|
||||||
|
some: {
|
||||||
|
AND: [
|
||||||
|
businessType
|
||||||
|
? {
|
||||||
|
OR: [{ businessType: { id: businessType } }],
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
|
||||||
|
province
|
||||||
|
? {
|
||||||
|
OR: [{ province: { id: province } }],
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
|
||||||
|
district
|
||||||
|
? {
|
||||||
|
OR: [{ district: { id: district } }],
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
|
||||||
|
subDistrict
|
||||||
|
? {
|
||||||
|
OR: [{ subDistrict: { id: subDistrict } }],
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
...whereDateQuery(startDate, endDate),
|
...whereDateQuery(startDate, endDate),
|
||||||
} satisfies Prisma.CustomerWhereInput;
|
} satisfies Prisma.CustomerWhereInput;
|
||||||
|
|
||||||
|
|
@ -597,6 +630,10 @@ export class CustomerExportController extends CustomerController {
|
||||||
@Query() activeBranchOnly?: boolean,
|
@Query() activeBranchOnly?: boolean,
|
||||||
@Query() startDate?: Date,
|
@Query() startDate?: Date,
|
||||||
@Query() endDate?: Date,
|
@Query() endDate?: Date,
|
||||||
|
@Query() businessType?: string,
|
||||||
|
@Query() province?: string,
|
||||||
|
@Query() district?: string,
|
||||||
|
@Query() subDistrict?: string,
|
||||||
) {
|
) {
|
||||||
const ret = await this.list(
|
const ret = await this.list(
|
||||||
req,
|
req,
|
||||||
|
|
@ -610,6 +647,10 @@ export class CustomerExportController extends CustomerController {
|
||||||
activeBranchOnly,
|
activeBranchOnly,
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
|
businessType,
|
||||||
|
province,
|
||||||
|
district,
|
||||||
|
subDistrict,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.setHeader("Content-Type", "text/csv");
|
this.setHeader("Content-Type", "text/csv");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue