Skip to content

Commit

Permalink
fixDateFilterForSelfServices
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbrui committed Apr 15, 2024
1 parent 92f41ac commit 0f7d777
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/integrations/gei-bookings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gei-bookings",
"version": "0.2.1",
"version": "0.2.2",
"description": "Automatically generated by graphql-editor-cli",
"main": "lib/index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getSelfServices = async (input: FieldResolveInput) =>
const po = preparePageOptions(args?.input?.page);
const pa =
args?.input?.filters &&
Object.fromEntries(Object.entries(args?.input?.filters).filter((v) => v !== null && v !== undefined));
Object.fromEntries(Object.entries(args?.input?.filters).filter((v) => v !== null && v !== undefined && v[0] !== 'fromDate' && v[0] !== 'toDate'));
const fromDate = isScalarDate(args?.input?.filters?.fromDate)
? isScalarDate(args?.input?.filters?.fromDate)
: undefined;
Expand All @@ -25,8 +25,8 @@ export const getSelfServices = async (input: FieldResolveInput) =>
const selfServices = await MongoOrb(ServicesCollection)
.collection.find({
...pa,
...(fromDate && { createdAt: { $gte: new Date(args?.input?.filters?.fromDate as string) } }),
...(toDate && { createdAt: { $lte: new Date(args?.input?.filters?.toDate as string) } }),
...(fromDate && { startDate: { $gte: new Date(args?.input?.filters?.fromDate as string) } }),
...(toDate && { startDate: { $lte: new Date(args?.input?.filters?.toDate as string) } }),
...(args?.input?.filters?.name && { name: { $regex: args?.input.filters.name, $options: 'i' } }),
...(args?.input?.filters?.description && {
description: { $regex: args?.input.filters.description, $options: 'i' },
Expand Down

0 comments on commit 0f7d777

Please sign in to comment.