forked from PalisadoesFoundation/talawa-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
feat : Event agendas - Minor improvements and fixes (PalisadoesFounda…
…tion#2254) * Added a unit test for app user profile * Updated 100% coverage for updateAdvertisement * ran prettier * fixed linting error * Ran prettier again * Changed user to users * Added a field level resolver for Users * Removed redundant isNote boolean type * Added a new note model * Added mutation resolvers for notes * Added queries for notes * test * Added tests for delta files * Ran prettier * Added necessary tests for note specific queries * Fixed formatting errors * Minor changes * test * Test * format fix --------- Co-authored-by: Peter Harrison <16875803+palisadoes@users.noreply.github.com>
1 parent
03fe1b8
commit 5f7b155
Showing
30 changed files
with
1,583 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { Model, PopulatedDoc, Types } from "mongoose"; | ||
import { Schema, model, models } from "mongoose"; | ||
import type { InterfaceUser } from "./User"; | ||
|
||
export interface InterfaceNote { | ||
_id: Types.ObjectId; // Unique identifier for the note. | ||
content: string; // Content of the note. | ||
createdBy: PopulatedDoc<InterfaceUser & Document>; // Reference to the user who created the note. | ||
updatedBy: PopulatedDoc<InterfaceUser & Document>; // Reference to the user who last updated the note. | ||
createdAt: Date; // Date when the note was created. | ||
updatedAt: Date; // Date when the note was last updated. | ||
agendaItemId: Types.ObjectId; // Reference to the agenda item associated with the note. | ||
} | ||
|
||
export const NoteSchema = new Schema({ | ||
content: { | ||
type: String, | ||
required: true, | ||
}, | ||
createdBy: { | ||
type: Schema.Types.ObjectId, | ||
ref: "User", | ||
required: true, | ||
}, | ||
updatedBy: { | ||
type: Schema.Types.ObjectId, | ||
ref: "User", | ||
}, | ||
createdAt: { | ||
type: Date, | ||
required: true, | ||
default: Date.now, | ||
}, | ||
updatedAt: { | ||
type: Date, | ||
default: Date.now, | ||
}, | ||
agendaItemId: { | ||
type: Schema.Types.ObjectId, | ||
ref: "AgendaItem", | ||
required: true, | ||
}, | ||
}); | ||
|
||
const noteModel = (): Model<InterfaceNote> => | ||
model<InterfaceNote>("Note", NoteSchema); | ||
|
||
export const NoteModel = (models.Note || noteModel()) as ReturnType< | ||
typeof noteModel | ||
>; |
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,8 @@ | ||
import type { AgendaItemResolvers } from "../../types/generatedGraphQLTypes"; | ||
import { User } from "../../models"; | ||
|
||
export const users: AgendaItemResolvers["users"] = async (parent) => { | ||
const userIds = parent.users; // Assuming parent.users is an array of user ids | ||
const users = await User.find({ _id: { $in: userIds } }); // Assuming User.find() returns a promise | ||
return users; | ||
}; |
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.