mongoose#DocumentDefinition TypeScript Examples
The following examples show how to use
mongoose#DocumentDefinition.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Application.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
addApplication = async (request: Request, applicationData: DocumentDefinition<IApplication>) => {
return await ApplicationModel.create(applicationData)
.then(async (application) => {
const email = {
templateName: EmailTemplate.Application,
to: application.email,
subject: "MS Club SLIIT - Application Received",
body: {
studentId: application.studentId,
name: application.name,
email: application.email,
contactNumber: application.contactNumber,
currentAcademicYear: application.currentAcademicYear,
linkedIn: application.linkedIn,
gitHub: application.gitHub,
skillsAndTalents: application.skillsAndTalents,
},
status: EmailStatus.Waiting,
type: EmailType.Application,
};
// Add email information to email collection
await EmailModel.create(email);
return application;
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #2
Source File: TopSpeaker.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
insertTopSpeaker = async (topSpeakerData: DocumentDefinition<ITopSpeaker>) => {
return await TopSpeakerModel.create(topSpeakerData)
.then(async (topSpeaker) => {
const initialUpdatedBy: IUpdatedBy = {
user: topSpeaker.createdBy,
updatedAt: new Date(),
};
topSpeaker.updatedBy.push(initialUpdatedBy);
await topSpeaker.save();
return topSpeaker;
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #3
Source File: Organization.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
updateOrganizationInfo = async (
organizationId: string,
updateInfo: DocumentDefinition<IOrganization>,
user: Schema.Types.ObjectId
) => {
if (organizationId) {
return OrganizationModel.findById(organizationId)
.then(async (organization) => {
if (organization) {
if (updateInfo.name) organization.name = updateInfo.name;
if (updateInfo.email) organization.email = updateInfo.email;
if (updateInfo.phoneNumber) organization.phoneNumber = updateInfo.phoneNumber;
if (updateInfo.university) organization.university = updateInfo.university;
if (updateInfo.address) organization.address = updateInfo.address;
if (updateInfo.website) organization.website = updateInfo.website;
if (updateInfo.imagePath) organization.imagePath = updateInfo.imagePath;
const updateUserInfo: IUpdatedBy = {
user: user,
updatedAt: new Date(),
};
organization.updatedBy.push(updateUserInfo);
return await organization.save();
}
})
.catch((error) => {
throw new Error(error.message);
});
} else {
throw new Error("Organization ID not Passed");
}
}
Example #4
Source File: Organization.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
createOrganization = async (
organizationData: DocumentDefinition<IOrganization>,
user: Schema.Types.ObjectId
) => {
return OrganizationModel.create(organizationData)
.then(async (organization) => {
const initialUpdatedBy: IUpdatedBy = {
user: user,
updatedAt: new Date(),
};
organization.updatedBy.push(initialUpdatedBy);
return await organization.save();
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #5
Source File: Meeting.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
scheduleInterviewMeetingMSTeams = (meetingData: DocumentDefinition<IMeetingRequest>) => {
return axios
.post(`${process.env.MS_MEETING_MANAGER_API}/api/msteams/schedule`, meetingData)
.then(async (sceduleMeeting) => {
const meetingInfo = new MeetingModel({
meetingId: sceduleMeeting.data.body.id,
meetingName: meetingData.meetingName,
startDateTime: sceduleMeeting.data.body.start.dateTime,
endDateTime: sceduleMeeting.data.body.end.dateTime,
emailList: meetingData.emailList,
scheduledLink: sceduleMeeting.data.body.onlineMeeting.joinUrl,
type: "INTERVIEW",
});
return await meetingInfo
.save()
.then((createdMeeting) => {
return createdMeeting;
})
.catch((error) => {
throw new Error(error.message);
});
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #6
Source File: Meeting.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
scheduleInternalMeetingMSTeams = (request: Request, meetingData: DocumentDefinition<IMeeting>) => {
return axios
.post(`${process.env.MS_MEETING_MANAGER_API}/api/msteams/internalmeeting/schedule`, meetingData)
.then(async (sceduleMeeting) => {
const meetingInfo = new MeetingModel({
meetingId: sceduleMeeting.data.body.id,
meetingName: meetingData.meetingName,
startDateTime: meetingData.startDateTime,
endDateTime: meetingData.endDateTime,
emailList: meetingData.emailList,
scheduledLink: sceduleMeeting.data.body.onlineMeeting.joinUrl,
type: "INTERNAL",
});
return await meetingInfo
.save()
.then((createdMeeting) => {
return createdMeeting;
})
.catch((error) => {
throw new Error(error.message);
});
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #7
Source File: ExecutiveBoard.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
updateExecutiveBoardDetails = async (
boardId: string,
updateData: DocumentDefinition<IExecutiveBoard>,
updatedBy: Schema.Types.ObjectId
) => {
return await ExecutiveBoardModel.findById(boardId)
.then(async (executiveBoardDetails) => {
if (executiveBoardDetails) {
executiveBoardDetails.year = updateData.year;
const updateUserInfo: IUpdatedBy = {
user: updatedBy,
updatedAt: new Date(),
};
executiveBoardDetails.updatedBy.push(updateUserInfo);
return await executiveBoardDetails.save();
} else {
return null;
}
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #8
Source File: ExecutiveBoard.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
addBoardMember = async (
executiveBoardId: string,
insertData: DocumentDefinition<IBoardMember>,
updatedBy: Schema.Types.ObjectId
) => {
return await insertBoardMember(insertData)
.then(async (createdBoardMember: IBoardMember) => {
const executiveBoard = await ExecutiveBoardModel.findById(executiveBoardId);
if (executiveBoard) {
executiveBoard.board.unshift(createdBoardMember);
const updateUserInfo: IUpdatedBy = {
user: updatedBy,
updatedAt: new Date(),
};
executiveBoard.updatedBy.push(updateUserInfo);
return await executiveBoard.save();
} else {
return null;
}
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #9
Source File: ExecutiveBoard.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
insertExecutiveBoard = async (executiveBoardData: DocumentDefinition<IExecutiveBoard>) => {
return await ExecutiveBoardModel.create(executiveBoardData)
.then(async (executiveBoard) => {
const initialUpdatedBy: IUpdatedBy = {
user: executiveBoard.createdBy,
updatedAt: new Date(),
};
executiveBoard.updatedBy.push(initialUpdatedBy);
await executiveBoard.save();
return executiveBoard;
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #10
Source File: Event.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
insertEvent = async (eventData: DocumentDefinition<IEvent>) => {
return await EventModel.create(eventData)
.then(async (event) => {
const initialUpdatedBy: IUpdatedBy = {
user: event.createdBy,
updatedAt: new Date(),
};
event.updatedBy.push(initialUpdatedBy);
await event.save();
return event;
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #11
Source File: Contact.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
replyInquiry = async (
request: Request,
inquiryId: string,
replyData: DocumentDefinition<IInquiryReply>
) => {
return await ContactModel.findById(inquiryId)
.then(async (data) => {
if (data) {
const to = data.email;
const subject = "MS Club of SLIIT";
const email = {
to: to,
subject: subject,
body: replyData,
};
const channel = request.channel;
request.queue.publishMessage(channel, JSON.stringify(email));
data.replies.push(replyData.reply);
return await data.save();
} else {
return null;
}
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #12
Source File: Contact.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
insertContact = async (request: Request, contactData: DocumentDefinition<IContact>) => {
return await ContactModel.create(contactData)
.then(async (data) => {
const email = {
templateName: EmailTemplate.ContactUs,
to: data.email,
subject: "MS Club SLIIT - Contact Us",
body: {
name: data.name,
email: data.email,
message: data.message,
date_time: moment(data.createdAt).format("LLL"),
},
status: EmailStatus.Waiting,
type: EmailType.ContactUs,
};
await EmailModel.create(email);
return data;
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #13
Source File: Webinar.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
insertWebinar = async (webinarData: DocumentDefinition<IWebinar>) => {
return await WebinarModel.create(webinarData)
.then(async (webinar) => {
const initialUpdatedBy: IUpdatedBy = {
user: webinar.createdBy,
updatedAt: new Date(),
};
webinar.updatedBy.push(initialUpdatedBy);
await webinar.save();
return webinar;
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #14
Source File: BoardMember.service.ts From msclub-backend with GNU General Public License v3.0 | 6 votes |
insertBoardMember = async (BoardMemberData: DocumentDefinition<IBoardMember>) => {
return await BoardMemberModel.create(BoardMemberData)
.then(async (boardMember) => {
const initialUpdatedBy: IUpdatedBy = {
user: boardMember.createdBy,
updatedAt: new Date(),
};
boardMember.updatedBy.push(initialUpdatedBy);
await boardMember.save();
return boardMember;
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #15
Source File: User.service.ts From msclub-backend with GNU General Public License v3.0 | 5 votes |
adminUpdateUser = async (updateData: DocumentDefinition<IUser>) => {
return await UserModel.findById(updateData._id)
.then(async (userDetails) => {
if (userDetails) {
if (userDetails.deletedAt === null) {
if (updateData.firstName) {
userDetails.firstName = updateData.firstName;
}
if (updateData.lastName) {
userDetails.lastName = updateData.lastName;
}
if (updateData.phoneNumber01) {
userDetails.phoneNumber01 = updateData.phoneNumber01;
}
if (updateData.phoneNumber02) {
userDetails.phoneNumber02 = updateData.phoneNumber02;
}
if (updateData.email) {
userDetails.email = updateData.email;
}
if (updateData.userName) {
userDetails.userName = updateData.userName;
}
if (updateData.password) {
userDetails.password = updateData.password;
}
if (updateData.profileImage) {
userDetails.profileImage = updateData.profileImage;
const config = {
headers: {
"Content-Type": "application/json",
"Ocp-Apim-Subscription-Key": process.env.FACE_API_KEY || "null",
},
};
const profileImageDetails = {
url: process.env.FACE_API_STORAGE_BUCKET_URL + updateData.profileImage,
};
await axios
.post(
`${process.env.FACE_API_HOST}/face/v1.0/largefacelists/${process.env.FACE_API_LARGE_LIST}/persistedfaces?detectionModel=detection_01`,
profileImageDetails,
config
)
.then(async (response) => {
userDetails.persistedFaceId = response.data.persistedFaceId;
await axios.post(
`${process.env.FACE_API_HOST}/face/v1.0/largefacelists/${process.env.FACE_API_LARGE_LIST}/train`,
"",
config
);
});
}
if (updateData.permissionLevel) {
userDetails.permissionLevel = updateData.permissionLevel;
}
return await userDetails.save();
} else {
throw new Error("User is not found");
}
} else {
throw new Error("User already removed");
}
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #16
Source File: User.service.ts From msclub-backend with GNU General Public License v3.0 | 5 votes |
updateUser = async (userId: string, updateData: DocumentDefinition<IUser>) => {
return await UserModel.findById(userId)
.then(async (userDetails) => {
if (userDetails) {
if (userDetails.deletedAt === null) {
if (updateData.firstName) {
userDetails.firstName = updateData.firstName;
}
if (updateData.lastName) {
userDetails.lastName = updateData.lastName;
}
if (updateData.phoneNumber01) {
userDetails.phoneNumber01 = updateData.phoneNumber01;
}
if (updateData.phoneNumber02) {
userDetails.phoneNumber02 = updateData.phoneNumber02;
}
if (updateData.email) {
userDetails.email = updateData.email;
}
if (updateData.userName) {
userDetails.userName = updateData.userName;
}
if (updateData.password) {
userDetails.password = updateData.password;
}
if (updateData.profileImage) {
userDetails.profileImage = updateData.profileImage;
const config = {
headers: {
"Content-Type": "application/json",
"Ocp-Apim-Subscription-Key": process.env.FACE_API_KEY || "null",
},
};
const profileImageDetails = {
url: process.env.FACE_API_STORAGE_BUCKET_URL + updateData.profileImage,
};
await axios
.post(
`${process.env.FACE_API_HOST}/face/v1.0/largefacelists/${process.env.FACE_API_LARGE_LIST}/persistedfaces?detectionModel=detection_01`,
profileImageDetails,
config
)
.then(async (response) => {
userDetails.persistedFaceId = response.data.persistedFaceId;
await axios.post(
`${process.env.FACE_API_HOST}/face/v1.0/largefacelists/${process.env.FACE_API_LARGE_LIST}/train`,
"",
config
);
});
}
if (updateData.permissionLevel) {
userDetails.permissionLevel = updateData.permissionLevel;
}
return await userDetails.save();
} else {
throw new Error("User is not found");
}
} else {
throw new Error("User already removed");
}
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #17
Source File: Webinar.service.ts From msclub-backend with GNU General Public License v3.0 | 5 votes |
updateWebinar = async (
webinarId: string,
webinarData: DocumentDefinition<IWebinar>,
updatedBy: Schema.Types.ObjectId
) => {
return await WebinarModel.findById(webinarId)
.then(async (webinarDetails) => {
if (webinarDetails) {
if (!webinarDetails.deletedAt) {
if (webinarData.title) {
webinarDetails.title = webinarData.title;
}
if (webinarData.description) {
webinarDetails.description = webinarData.description;
}
if (webinarData.imageUrl) {
webinarDetails.imageUrl = webinarData.imageUrl;
}
if (webinarData.dateTime) {
webinarDetails.dateTime = webinarData.dateTime;
}
if (webinarData.tags) {
webinarDetails.tags = webinarData.tags;
}
if (webinarData.link) {
webinarDetails.link = webinarData.link;
}
if (webinarData.registrationLink) {
webinarDetails.registrationLink = webinarData.registrationLink;
}
if (webinarData.webinarType) {
webinarDetails.webinarType = webinarData.webinarType;
}
const updateUserInfo: IUpdatedBy = {
user: updatedBy,
updatedAt: new Date(),
};
webinarDetails.updatedBy.push(updateUserInfo);
return await webinarDetails.save();
} else {
throw new Error("Webinar is not found");
}
} else {
return null;
}
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #18
Source File: User.service.ts From msclub-backend with GNU General Public License v3.0 | 5 votes |
insertUser = async (userData: DocumentDefinition<IUserRequest>) => {
const config = {
headers: {
"Content-Type": "application/json",
"Ocp-Apim-Subscription-Key": process.env.FACE_API_KEY || "null",
},
};
const profileImageDetails = {
url: process.env.FACE_API_STORAGE_BUCKET_URL + userData.profileImage,
};
return await axios
.post(
`${process.env.FACE_API_HOST}/face/v1.0/largefacelists/${process.env.FACE_API_LARGE_LIST}/persistedfaces?detectionModel=detection_01`,
profileImageDetails,
config
)
.then(async (response) => {
userData.persistedFaceId = response.data.persistedFaceId;
return await UserModel.create(userData)
.then(async (user) => {
return await axios
.post(
`${process.env.FACE_API_HOST}/face/v1.0/largefacelists/${process.env.FACE_API_LARGE_LIST}/train`,
"",
config
)
.then(async () => {
await user.generateAuthToken();
return user;
})
.catch((error) => {
return axios
.delete(
`${process.env.FACE_API_HOST}/face/v1.0/largefacelists/${process.env.FACE_API_LARGE_LIST}/persistedfaces/${response.data.persistedFaceId}`,
config
)
.then(() => {
return axios
.post(
`${process.env.FACE_API_HOST}/face/v1.0/largefacelists/${process.env.FACE_API_LARGE_LIST}/train`,
"",
config
)
.then(() => {
return user;
})
.catch(() => {
throw new Error(error.message);
});
})
.catch(() => {
throw new Error(error.message);
});
});
})
.catch((error) => {
throw new Error(error.message);
});
});
}
Example #19
Source File: TopSpeaker.service.ts From msclub-backend with GNU General Public License v3.0 | 5 votes |
updateTopSpeaker = async (
topSpeakerId: string,
updateData: DocumentDefinition<ITopSpeaker>,
updatedBy: Schema.Types.ObjectId
) => {
return await TopSpeakerModel.findById(topSpeakerId)
.then(async (topSpeakerDetails) => {
if (topSpeakerDetails) {
if (updateData.title) {
topSpeakerDetails.title = updateData.title;
}
if (updateData.description) {
topSpeakerDetails.description = updateData.description;
}
if (updateData.imageUrl) {
topSpeakerDetails.imageUrl = updateData.imageUrl;
}
if (updateData.socialMediaURLs && updateData.socialMediaURLs.facebook) {
topSpeakerDetails.socialMediaURLs.facebook = updateData.socialMediaURLs.facebook;
}
if (updateData.socialMediaURLs && updateData.socialMediaURLs.instagram) {
topSpeakerDetails.socialMediaURLs.instagram = updateData.socialMediaURLs.instagram;
}
if (updateData.socialMediaURLs && updateData.socialMediaURLs.linkedIn) {
topSpeakerDetails.socialMediaURLs.linkedIn = updateData.socialMediaURLs.linkedIn;
}
if (updateData.socialMediaURLs && updateData.socialMediaURLs.twitter) {
topSpeakerDetails.socialMediaURLs.twitter = updateData.socialMediaURLs.twitter;
}
if (updateData.socialMediaURLs && updateData.socialMediaURLs.web) {
topSpeakerDetails.socialMediaURLs.web = updateData.socialMediaURLs.web;
}
const updateUserInfo: IUpdatedBy = {
user: updatedBy,
updatedAt: new Date(),
};
topSpeakerDetails.updatedBy.push(updateUserInfo);
return await topSpeakerDetails.save();
} else {
return null;
}
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #20
Source File: Meeting.service.ts From msclub-backend with GNU General Public License v3.0 | 5 votes |
updateMeeting = async (
meetingId: string,
updateInfo: DocumentDefinition<IMeeting>,
user: Schema.Types.ObjectId
) => {
const meeting = await MeetingModel.findById(meetingId);
if (meeting) {
return axios
.patch(`${process.env.MS_MEETING_MANAGER_API}/api/msteams/meeting/${meeting.meetingId}`, updateInfo)
.then(async (res) => {
if (res.status === 200) {
if (updateInfo.meetingId) {
meeting.meetingId = updateInfo.meetingId;
}
if (updateInfo.meetingName) {
meeting.meetingName = updateInfo.meetingName;
}
if (updateInfo.startDateTime) {
meeting.startDateTime = updateInfo.startDateTime;
}
if (updateInfo.endDateTime) {
meeting.endDateTime = updateInfo.endDateTime;
}
if (updateInfo.emailList) {
meeting.emailList = updateInfo.emailList;
}
if (updateInfo.scheduledLink) {
meeting.scheduledLink = updateInfo.scheduledLink;
}
const updateUserInfo: IUpdatedBy = {
user: user,
updatedAt: new Date(),
};
meeting.updatedBy.push(updateUserInfo);
return await meeting.save();
} else {
throw new Error("Meeting ID not found");
}
})
.catch((error) => {
throw new Error(error.message);
});
} else {
return "Meeting not found";
}
}
Example #21
Source File: Event.service.ts From msclub-backend with GNU General Public License v3.0 | 5 votes |
updateEvent = async (
eventId: string,
eventData: DocumentDefinition<IEvent>,
updatedBy: Schema.Types.ObjectId
) => {
return await EventModel.findById(eventId)
.then(async (eventDetails) => {
if (eventDetails) {
if (!eventDetails.deletedAt) {
if (eventData.title) {
eventDetails.title = eventData.title;
}
if (eventData.description) {
eventDetails.description = eventData.description;
}
if (eventData.imageUrl) {
eventDetails.imageUrl = eventData.imageUrl;
}
if (eventData.link) {
eventDetails.link = eventData.link;
}
if (eventData.registrationLink) {
eventDetails.registrationLink = eventData.registrationLink;
}
if (eventData.tags) {
eventDetails.tags = eventData.tags;
}
if (eventData.dateTime) {
eventDetails.dateTime = eventData.dateTime;
}
if (eventData.eventType) {
eventDetails.eventType = eventData.eventType;
}
const updateUserInfo: IUpdatedBy = {
user: updatedBy,
updatedAt: new Date(),
};
eventDetails.updatedBy.push(updateUserInfo);
return await eventDetails.save();
} else {
throw new Error("Event is not found");
}
} else {
return null;
}
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #22
Source File: BoardMember.service.ts From msclub-backend with GNU General Public License v3.0 | 5 votes |
updateBoardMemberDetails = async (
boardMemberId: string,
updateData: DocumentDefinition<IBoardMember>,
updatedBy: Schema.Types.ObjectId
) => {
return await BoardMemberModel.findById(boardMemberId)
.then(async (boardMemberDetails) => {
if (boardMemberDetails) {
if (!boardMemberDetails.deletedAt) {
if (updateData.name) {
boardMemberDetails.name = updateData.name;
}
if (updateData.position) {
boardMemberDetails.position = updateData.position;
}
if (updateData.imageUrl) {
boardMemberDetails.imageUrl = updateData.imageUrl;
}
if (updateData.socialMedia) {
if (updateData.socialMedia.facebook) {
boardMemberDetails.socialMedia.facebook = updateData.socialMedia.facebook;
}
if (updateData.socialMedia.instagram) {
boardMemberDetails.socialMedia.instagram = updateData.socialMedia.instagram;
}
if (updateData.socialMedia.linkedIn) {
boardMemberDetails.socialMedia.linkedIn = updateData.socialMedia.linkedIn;
}
if (updateData.socialMedia.twitter) {
boardMemberDetails.socialMedia.twitter = updateData.socialMedia.twitter;
}
}
const updateUserInfo: IUpdatedBy = {
user: updatedBy,
updatedAt: new Date(),
};
boardMemberDetails.updatedBy.push(updateUserInfo);
return await boardMemberDetails.save();
} else {
throw new Error("Board Member is not found");
}
} else {
return null;
}
})
.catch((error) => {
throw new Error(error.message);
});
}
Example #23
Source File: Application.service.ts From msclub-backend with GNU General Public License v3.0 | 5 votes |
changeApplicationStatusIntoInterview = async (
request: Request,
applicationId: string,
interviewData: DocumentDefinition<IInterview>
) => {
return await ApplicationModel.findById(applicationId)
.then(async (application) => {
if (application) {
// Send email
const emailTemplate = "Interview-Email-Template.html";
const to = application.email;
const subject = "MS Club of SLIIT - Interview";
const emailBodyData = {
name: application.name,
email: application.email,
date: moment.utc(interviewData.startDateTime).format("LL"),
time: moment.utc(interviewData.startDateTime).format("LTS"),
format: interviewData.format,
};
const email = {
template: emailTemplate,
to: to,
subject: subject,
body: emailBodyData,
};
const applicantMail = `${application.studentId.toLowerCase()}@my.sliit.lk`;
const emailList = interviewData.attendees;
emailList.push(applicantMail);
const interviewScheduleDetails: DocumentDefinition<IMeetingRequest> = {
meetingName: application.name,
startDateTime: interviewData.startDateTime,
endDateTime: interviewData.endDateTime,
emailList: emailList,
};
// Send email data to message queue
const channel = request.channel;
request.queue.publishMessage(channel, JSON.stringify(email));
application.status = "INTERVIEW";
return await MeetingService.scheduleInterviewMeetingMSTeams(interviewScheduleDetails)
.then(async (data: any) => {
application.meeting = data;
return await application
.save()
.then((application) => {
return application;
})
.catch((error: any) => {
throw new Error(error.message);
});
})
.catch((error: any) => {
throw new Error(error.message);
});
} else {
return null;
}
})
.catch((error) => {
throw new Error(error.message);
});
}