Skip to content

Commit

Permalink
Merge pull request #966 from Worktez/dev-angular
Browse files Browse the repository at this point in the history
Internal Release 8.3
  • Loading branch information
simran142002 authored May 30, 2023
2 parents bb5f21e + 4ac8193 commit 4898638
Show file tree
Hide file tree
Showing 98 changed files with 1,618 additions and 1,012 deletions.
6 changes: 5 additions & 1 deletion functions/model/contributors/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,20 @@ exports.getContributors = function() {
* @param {any} photoUrl
* @param {any} title
* @param {any} name
* @param {any} github
* @param {any} linkedIn
* @return {any}
*/
exports.setContributors = function(docId, email, about, photoUrl, title, name) {
exports.setContributors = function(docId, email, about, photoUrl, title, name, github, linkedIn) {
const P1 = db.collection("Contributors").doc(docId).set({
Email: email,
About: about,
PhotoUrl: photoUrl,
Title: title,
Name: name,
ContributorId: docId,
GithubProfile: github,
LinkedInProfile: linkedIn,
});
return Promise.resolve(P1);
};
4 changes: 3 additions & 1 deletion functions/model/contributors/tark/addContributor.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ exports.addContributor = function(request, response) {
const photoUrl = request.body.data.photoUrl;
const title = request.body.data.title;
const name = request.body.data.name;
const github = request.body.data.Github;
const linkedIn = request.body.data.LinkedIn;

let status = 200;
let result;
Expand All @@ -40,7 +42,7 @@ exports.addContributor = function(request, response) {
const docId = "Contributor"+totalNumberOfContributors;

updateApplication(appDetailsUpdateJson);
setContributors(docId, email, about, photoUrl, title, name).then((doc) => {
setContributors(docId, email, about, photoUrl, title, name, github, linkedIn).then((doc) => {
result = { data: doc };
console.log("Sent contributors successfully");
return response.status(status).send(result);
Expand Down
100 changes: 53 additions & 47 deletions functions/model/meet/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,28 @@ const {db} = require("../application/lib");

/**
* Description
* @param {any} meetDocId
* @param {any} orgDomain
* @param {any} teamId
* @param {any} teamMembers
* @param {any} title
* @param {any} startTime
* @param {any} endTime
* @param {any} hostName
* @param {any} hostEmail
* @param {any} description
* @param {any} date
* @param {any} roomId
* @return {any}
*/
exports.setMeet = function(meetDocId, orgDomain, teamId, teamMembers, title, startTime, endTime, hostName, description, date, roomId) {
const setMeetDoc = db.collection("Meet").doc(meetDocId).set({
MeetDocId: meetDocId,
exports.setMeet = function(orgDomain, teamId, teamMembers, title, startTime, endTime, hostEmail, description, date, roomId) {
const setMeetDoc = db.collection("Meets").doc(roomId).set({
OrgDomain: orgDomain,
TeamId: teamId,
TeamMembers: teamMembers,
Attendees: teamMembers,
Title: title,
StartTime: startTime,
EndTime: endTime,
Status: "OK",
HostName: hostName,
HostEmail: hostEmail,
Description: description,
Date: date,
RoomId: roomId,
Expand All @@ -54,48 +52,45 @@ exports.setMeet = function(meetDocId, orgDomain, teamId, teamMembers, title, sta

/**
* Description
* @param {any} meetDocId
* @param {any} userEmail
* @param {any} orgDomain
* @param {any} teamId
* @param {any} teamMembers
* @param {any} title
* @param {any} startTime
* @param {any} endTime
* @param {any} hostName
* @param {any} hostEmail
* @param {any} description
* @param {any} date
* @param {any} uid
* @param {any} roomId
* @return {any}
*/
exports.setUserMeet = function(meetDocId, orgDomain, teamId, teamMembers, title, startTime, endTime, hostName, description, date, uid, roomId) {
const setMeetDoc1 = db.collection("Users").doc(uid).collection("Meet").doc(meetDocId).set({
MeetDocId: meetDocId,
exports.setUserMeet = function(userEmail, orgDomain, teamId, teamMembers, title, startTime, endTime, hostEmail, description, date, roomId) {
const setMeetDoc1 = db.collection("UserMeets").doc(userEmail).collection("Meets").doc(roomId).set({
OrgDomain: orgDomain,
TeamId: teamId,
TeamMembers: teamMembers,
Title: title,
StartTime: startTime,
EndTime: endTime,
HostName: hostName,
HostEmail: hostEmail,
Status: "OK",
Description: description,
Date: date,
Uid: uid,
RoomId: roomId,
});
return Promise.resolve(setMeetDoc1);
};

/**
* Description
* @param {any} uid
* @param {any} docId
* @param {any} email
* @param {any} roomId
* @param {any} updateMeetDetailsToJson
* @return {any}
*/
exports.updateUserMeetDetails= function(uid, docId, updateMeetDetailsToJson) {
const updateMeet = db.collection("Users").doc(uid).collection("Meet").doc(docId).update(updateMeetDetailsToJson);
exports.updateUserMeetDetails= function(email, roomId, updateMeetDetailsToJson) {
const updateMeet = db.collection("UserMeets").doc(email).collection("Meets").doc(roomId).update(updateMeetDetailsToJson);
return Promise.resolve(updateMeet);
};

Expand All @@ -114,30 +109,18 @@ exports.updateMeetDetails= function(updateJson, meetDocId) {

/**
* Description
* @param {any} meetDocId
* @param {any} email
* @param {any} today
* @return {any}
*/
exports.getWorktezMeetDetails=function(meetDocId) {
const query = db.collection("Meet").doc(meetDocId);
const promise = query.get().then((doc) => {
const data=[];
doc.forEach((element) => {
if (element.exists) {
data.push( element.data());
}
});
return data;
});
return Promise.resolve(promise);
};

/**
* Description
* @param {any} uid
* @return {any}
*/
exports.getMeetDetails=function(uid) {
const query = db.collection("Users").doc(uid).collection("Meet").where("Status", "==", "OK");
exports.getMeetDetails=function(email, today="") {
let query = db.collection("UserMeets").doc(email).collection("Meets").where("Status", "==", "OK");
if (today != "") {
// @TODO Select only meetings future meetings of the day ( by Time )
// @TODO Create a scheduler fn for marking past meetings as 'Completed' or 'Ended', It should run with daily scheduler.
// @TODO Create a scheduler fn for deleting the old meetings from database.S
query = query.where("Date", "==", today);
}
const promise = query.get().then((doc) => {
const data=[];
doc.forEach((element) => {
Expand All @@ -154,24 +137,47 @@ exports.getMeetDetails=function(uid) {
/**
* Description
* @param {any} updateJson
* @param {any} meetDocId
* @param {any} roomId
* @return {any}
*/
exports.updateMeetDetailsAtWorktez= function(updateJson, meetDocId) {
const updateMeet = db.collection("Meet").doc(meetDocId).update(updateJson);
exports.updateMeetDetailsByID = function(updateJson, roomId) {
const updateMeet = db.collection("Meets").doc(roomId).update(updateJson);
return Promise.resolve(updateMeet);
};

/**
* Description
* @param {any} uid
* @param {any} email
* @param {any} docId
* @return {any}
*/
exports.getUserMeetDetailsById = function(uid, docId) {
const getUserMeetDetailsById = db.collection("Users").doc(uid).collection("Meet").doc(docId).get().then((doc) => {
exports.getUserMeetDetailsById = function(email, docId) {
const getUserMeetDetailsById = db.collection("UserMeets").doc(email).collection("Meets").doc(docId).get().then((doc) => {
const data = doc.data();
return data;
});
return Promise.resolve(getUserMeetDetailsById);
};

exports.generateRoomId = function() {
const alphabet = "abcdefghijklmnopqrstuvwxyz";
const idLength = 9;
let id = "";

// Loop through and add a random character to the ID until it reaches the desired length
while (id.length < idLength) {
const randomIndex = Math.floor(Math.random() * alphabet.length);
id += alphabet[randomIndex];
}
console.log("Room id given", id);
return id;
};

exports.getRoomDetailsById = function(id) {
console.log("Checking for", id);
const promise = db.collection("Meets").doc(id).get().then((doc)=>{
const data = doc.data();
return data;
});
return Promise.resolve(promise);
};
49 changes: 19 additions & 30 deletions functions/model/meet/meet.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
***********************************************************/

const {functions, cors, fastify, requestHandler} = require("../application/lib");
const {scheduleMeet} = require("./tark/scheduleMeet");
const {addAttendee} = require("./tark/addAttendee");
// const {addAttendeeAtWorktez} = require("./tark/addAttendeeAtworktez");
const { scheduleMeet } = require("./tark/scheduleMeet");
const { getMeetDetails } = require("./tark/getMeetDetails");
const {deleteMeet} = require("./tark/deleteMeet");
const { deleteMeet } = require("./tark/deleteMeet");
const { ignoreMeet } = require("./tark/ignoreMeet");

/**
* Description
Expand All @@ -37,36 +36,36 @@ fastify.post("/scheduleMeet", (req, res) => {

/**
* Description
* @param {any} "/addAttendee"
* @param {any} "/getMeetDetails"
* @param {any} req
* @param {any} res
* @returns {any}
*/
fastify.post("/addAttendee", (req, res) => {
addAttendee(req, res);
fastify.post("/getMeetDetails", (req, res) => {
getMeetDetails(req, res);
});

/**
* Description
* @param {any} "/getMeetDetails"
* @param {any} "/deleteMeet"
* @param {any} req
* @param {any} res
* @returns {any}
*/
fastify.post("/getMeetDetails", (req, res) => {
getMeetDetails(req, res);
fastify.post("/deleteMeet", (req, res) => {
deleteMeet(req, res);
});

// /**
// * Description
// * @param {any} "/addAttendeeAtWorktez"
// * @param {any} req
// * @param {any} res
// * @returns {any}
// */
// fastify.post("/addAttendeeAtWorktez", (req, res) => {
// addAttendeeAtWorktez(req, res);
// });
/**
* Description
* @param {any} "/ignoreMeet"
* @param {any} req
* @param {any} res
* @returns {any}
*/
fastify.post("/ignoreMeet", (req, res) => {
ignoreMeet(req, res);
});

/**
* Description
Expand All @@ -83,13 +82,3 @@ exports.meet = functions.https.onRequest((req, res) => {
});
});

/**
* Description
* @param {any} "/deleteMeet"
* @param {any} req
* @param {any} res
* @returns {any}
*/
fastify.post("/deleteMeet", (req, res) => {
deleteMeet(req, res);
});
42 changes: 0 additions & 42 deletions functions/model/meet/tark/addAttendee.js

This file was deleted.

42 changes: 0 additions & 42 deletions functions/model/meet/tark/addAttendeeAtworktez.js

This file was deleted.

Loading

0 comments on commit 4898638

Please sign in to comment.