Skip to content

Commit

Permalink
Merge pull request #802 from Worktez/dev-angular
Browse files Browse the repository at this point in the history
Internal Release 7.3
  • Loading branch information
simran142002 authored Oct 29, 2022
2 parents 7b84710 + 4105694 commit d0265a0
Show file tree
Hide file tree
Showing 68 changed files with 1,164 additions and 489 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ name: ESLint

on:
push:
branches: [ "dev-angular" ]
branches: [ "dev-angular", "master"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "dev-angular" ]
branches: [ "dev-angular", "master" ]
schedule:
- cron: '29 9 * * 5'

Expand Down
1 change: 0 additions & 1 deletion functions/model/application/paymentKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
exports.keyId = "rzp_test_nfhDfN6X5cgp42";
exports.keySecret = "EjWL1pPedHeT4Z1C4laM3u1b";
exports.orderKey = "rzp_test_nfhDfN6X5cgp42";

2 changes: 1 addition & 1 deletion functions/model/contributors/tark/addContributor.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports.addContributor = function(request, response) {
const totalNumberOfContributors = data.TotalNumberOfContributors + 1;

const appDetailsUpdateJson = {
TotalNumberOfContributors: totalNumberOfContributors + 1,
TotalNumberOfContributors: totalNumberOfContributors,
};

const docId = "Contributor"+totalNumberOfContributors;
Expand Down
2 changes: 1 addition & 1 deletion functions/model/performanceChart/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const { db } = require("../application/lib");
* @return {any}
*/
exports.setOrganizationsChart = function(orgDomain, teamId, chartName, inputJson) {
const setChart = db.collection("Organizations").doc(orgDomain).collection("Teams").doc(teamId).collection("Charts").doc(chartName).update(inputJson);
const setChart = db.collection("Organizations").doc(orgDomain).collection("Teams").doc(teamId).collection("Charts").doc(chartName).set(inputJson);
return Promise.resolve(setChart);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
* See the MIT License for more details.
***********************************************************/

const { createSprintName } = require("../../application/lib");
const { getAllSprints, getSprint } = require("../../sprints/lib");
const { getSprint } = require("../../sprints/lib");
const { getTeamUseTeamId } = require("../../teams/lib");
const { updateChart, setOrganizationsChart, getOrganizationsChartDetails } = require("../lib");

Expand Down
29 changes: 29 additions & 0 deletions functions/model/teams/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ exports.getTeam = function(orgDomain, teamName) {
return Promise.resolve(getTeamPromise);
};

/**
* Description
* @param {any} orgDomain
* @return {any}
*/
exports.getAllTeams = function(orgDomain) {
const getTeamPromise = db.collection("Organizations").doc(orgDomain).collection("Teams").get().then((doc) => {
return doc;
});
return Promise.resolve(getTeamPromise);
};

/**
* Description
* @param {any} orgDomain
Expand Down Expand Up @@ -234,6 +246,23 @@ exports.addTeamLabel=function(orgDomain, teamName, scope, docId, displayName, ic
return Promise.resolve(getTeamPromise);
};

/**
* Description
* @param {any} orgDomain
* @param {any} teamName
* @return {any}
*/
exports.getAllLabels = function(orgDomain, teamName) {
const getTeamPromise = db.collection("Organizations").doc(orgDomain).collection("Teams").doc(teamName).collection("LabelProperties").where("Status", "==", "OK").get().then((doc) => {
const data = [];
doc.forEach((labelProperties) => {
data.push(labelProperties.data());
});
return data;
});
return Promise.resolve(getTeamPromise);
};

/**
* Description
* @param {any} orgDomain
Expand Down
49 changes: 49 additions & 0 deletions functions/model/teams/tark/creatTeamIdCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* eslint-disable linebreak-style */
/** *********************************************************
* Copyright (C) 2022
* Worktez
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the MIT License
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the MIT License for more details.
***********************************************************/

/* eslint-disable no-unused-vars */
/* eslint-disable object-curly-spacing */
/* eslint-disable no-undef */
/* eslint-disable eol-last */
/* eslint-disable indent */
/* eslint-disable max-len */
// eslint-disable-next-line no-dupe-else-if

const { getOrg } = require("../../organization/lib");

exports.creatTeamIdCheck = function(request, response) {
let status = 200;
let resultData = "";
const teamId = request.body.data.TeamId;
const orgDomain = request.body.data.OrganizationDomain;
getOrg(orgDomain).then((orgDoc) => {
for (let i = 0; i < orgDoc.TeamsId.length; i++) {
if (orgDoc.TeamsId[i] == teamId) {
resultData = "teamId Already taken";
break;
} else {
resultData = "teamId Available";
}
}
const result = { data: resultData};
return response.status(status).send(result);
}).catch((err) => {
status = 500;
resultData = "teamId Already taken";
console.error("Error : " + err);
const result = { data: resultData };
return response.status(status).send(result);
});
};
50 changes: 50 additions & 0 deletions functions/model/teams/tark/createTeamNameCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* eslint-disable linebreak-style */
/** *********************************************************
* Copyright (C) 2022
* Worktez
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the MIT License
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the MIT License for more details.
***********************************************************/

/* eslint-disable no-unused-vars */
/* eslint-disable object-curly-spacing */
/* eslint-disable no-undef */
/* eslint-disable eol-last */
/* eslint-disable indent */
/* eslint-disable max-len */
// eslint-disable-next-line no-dupe-else-if

const { getOrg } = require("../../organization/lib");

exports.creatTeamNaneCheck = function(request, response) {
let status = 200;
let resultData = "";
const teamId = request.body.data.TeamId;
const teamName = request.body.data.TeamName;
const orgDomain = request.body.data.OrganizationDomain;
getOrg(orgDomain).then((orgDoc) => {
for (let i = 0; i < orgDoc.TeamsName.length; i++) {
if (orgDoc.TeamsName[i] == teamName) {
resultData = "teamName Already taken";
break;
} else {
resultData = "teamName Available";
}
}
const result = { data: resultData};
return response.status(status).send(result);
}).catch((err) => {
status = 500;
resultData = "teamName Already taken";
console.error("Error : " + err);
const result = { data: resultData };
return response.status(status).send(result);
});
};
64 changes: 64 additions & 0 deletions functions/model/teams/tark/getAllLabels.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* eslint-disable linebreak-style */
/** *********************************************************
* Copyright (C) 2022
* Worktez
*
* Author : Sanjay Krishna <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the MIT License
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the MIT License for more details.
***********************************************************/

/* eslint-disable object-curly-spacing*/
// /* eslint-disable no-undef */
/* eslint-disable eol-last */
/* eslint-disable indent */
/* eslint-disable max-len */
// eslint-disable-next-line no-dupe-else-if

const { getAllLabels, getAllTeams } = require("../lib");

exports.getAllLabels = function(request, response) {
const orgDomain = request.body.data.OrganizationDomain;
let status = 200;
let result;
const res = {};

const p = getAllTeams(orgDomain).then((docs) => {
let p2;
docs.forEach((element) => {
const teamdata = element.data();
const teamName = teamdata.TeamName;
const teamId = teamdata.TeamId;
res[teamId]={};
p2 = getAllLabels(orgDomain, teamName).then((data)=>{
data.forEach((d) => {
res[teamId][d.Scope] = {};
});
data.forEach((d) => {
res[teamId][d.Scope][d.DisplayName] = d;
});
});
});
return Promise.resolve(p2);
}).catch((error) => {
status = 500;
console.log("Error: ", error);
});
return Promise.resolve(p).then(() => {
console.log(res);
result = { data: res };
return response.status(status).send(result);
})
.catch((error) => {
result = { data: error };
console.error("Error Getting labels", error);
return response.status(status).send(result);
});
};
46 changes: 46 additions & 0 deletions functions/model/teams/tark/getAllTeamData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* eslint-disable linebreak-style */
/** *********************************************************
* Copyright (C) 2022
* Worktez
*
* Author : Sanjay Krishna <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the MIT License
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the MIT License for more details.
***********************************************************/

/* eslint-disable object-curly-spacing*/
// /* eslint-disable no-undef */
/* eslint-disable eol-last */
/* eslint-disable indent */
/* eslint-disable max-len */
// eslint-disable-next-line no-dupe-else-if

const { getAllTeams } = require("../lib");

exports.getAllTeamData = function(request, response) {
const orgDomain = request.body.data.OrganizationDomain;
let status = 200;
let result;
const teamData = [];
console.log("Orgdomain", orgDomain);

getAllTeams(orgDomain).then((team) => {
team.forEach((element) => {
teamData.push(element.data());
});
result = { data: { status: "OK", resultData: teamData } };
return response.status(status).send(result);
}).catch((error) => {
status = 500;
result = { data: error };
console.error("Error Getting Teams", error);
return response.status(status).send(result);
});
};
2 changes: 1 addition & 1 deletion functions/model/teams/tark/getTeamData.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ exports.getTeamData = function(request, response) {
status = 500;
result = { data: error };
console.error("Error Getting Teams", error);
return response.status(status).send(result);
return response.status(status).json(result);
});
};
49 changes: 48 additions & 1 deletion functions/model/teams/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ const {addLabel} = require("./tark/addLabel");
const {addProjLink} = require("./tark/addProjLink");
const {createDefaultLabels} = require("./tark/createDefaultLabels");
const {getLabelsInScopes} = require("./tark/getTeamLabelsInScope");

const {getAllTeamData} = require("./tark/getAllTeamData");
const {getAllLabels} = require("./tark/getAllLabels");
const {creatTeamNaneCheck} = require("./tark/createTeamNameCheck");
const {creatTeamIdCheck} = require("./tark/creatTeamIdCheck");
/**
* Description
* @param {any} "/addMember"
Expand All @@ -42,6 +45,17 @@ fastify.post("/addMember", (req, res) => {
addMember(req, res);
});

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

/**
* Description
* @param {any} "/createTeam"
Expand Down Expand Up @@ -86,6 +100,28 @@ fastify.post("/removeMember", (req, res) => {
removeMember(req, res);
});

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

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

/**
* Description
* @param {any} "/updateTeam"
Expand Down Expand Up @@ -145,6 +181,17 @@ fastify.post("/getLabelsInScopes", (req, res) => {
getLabelsInScopes(req, res);
});

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

/**
* Description
* @param {any} "/editLabel"
Expand Down
Loading

0 comments on commit d0265a0

Please sign in to comment.