-
-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/chandel-aman/talawa-api …
…into feature/feed-file-upload
- Loading branch information
Showing
20 changed files
with
431 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { QueryResolvers } from "../../types/generatedGraphQLTypes"; | ||
import { Event } from "../../models"; | ||
import { getSort } from "./helperFunctions/getSort"; | ||
|
||
/** | ||
* This query will fetch all the events for which user attended from the database. | ||
* @param _parent- | ||
* @param args - An object that contains `id` of the user and `orderBy`. | ||
* @returns An object that contains the Event data. | ||
* @remarks The query function uses `getSort()` function to sort the data in specified. | ||
*/ | ||
export const eventsAttendedByUser: QueryResolvers["eventsAttendedByUser"] = | ||
async (_parent, args) => { | ||
const sort = getSort(args.orderBy); | ||
|
||
return await Event.find({ | ||
registrants: { | ||
$elemMatch: { | ||
userId: args.id, | ||
status: "ACTIVE", | ||
}, | ||
}, | ||
}) | ||
.sort(sort) | ||
.populate("creatorId", "-password") | ||
.populate("admins", "-password") | ||
.lean(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { QueryResolvers } from "../../types/generatedGraphQLTypes"; | ||
import { Event } from "../../models"; | ||
import type { InterfaceEvent } from "../../models/Event"; | ||
/** | ||
* This query will fetch all the events with the same BaseRecurringEventId from the database. | ||
* @param _parent - | ||
* @param args - An object that contains `baseRecurringEventId` of the base recurring event. | ||
* @returns An array of `Event` objects that are instances of the base recurring event. | ||
*/ | ||
|
||
export const getRecurringEvents: QueryResolvers["getRecurringEvents"] = async ( | ||
_parent, | ||
args, | ||
) => { | ||
try { | ||
const recurringEvents = await Event.find({ | ||
baseRecurringEventId: args.baseRecurringEventId, | ||
}).lean(); | ||
|
||
return recurringEvents as InterfaceEvent[]; | ||
} catch (error) { | ||
console.error("Error fetching recurring events:", error); | ||
throw error; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.