#110 remove consoles and comments

parent 5c5a9798
......@@ -212,11 +212,7 @@ export let transporter = nodemailer.createTransport({
export const subtractHours= (date:Date, hours:number)=> {
const dateCopy = new Date(date);
console.log('dateCopy ', dateCopy)
dateCopy.setHours(dateCopy.getHours() - hours);
console.log('dateCopy afterset ', dateCopy)
return dateCopy;
}
......
......@@ -121,7 +121,6 @@ router.get('/user/:userId', async (req : Request, res : Response): Promise<Respo
router.post('/add-user/', authAdminProject, async (req: Request, res: Response):Promise<Response>=>{
const {userId, projectId, roleProject} = req.body;
console.log("req body" + req.body)
const newMember:Member = new Member();
try{
newMember.user= userId;
......@@ -139,10 +138,8 @@ router.post('/add-user/', authAdminProject, async (req: Request, res: Response):
/** Remove user from specific project by userId */
router.delete('/remove-user/:userId', authAdminProject,async (req: Request, res: Response):Promise<Response>=> {
console.log('req.body ', req.body)
const {projectId} = req.body;
const {userId }=req.params;
console.log('projectId ', projectId, 'userId ',userId )
try{
const projectMember = await dataSource
......@@ -161,10 +158,8 @@ router.delete('/remove-user/:userId', authAdminProject,async (req: Request, res:
}
}
})
console.log('projectMember ', projectMember)
if(!projectMember) return res.status(404).send({message:"this member is not present"})
await Member.delete({id:projectMember.id})
console.log('projectMember deleted successfully')
return res.send({message:"User removed from project successfully" })
} catch(e){
return res.send({message:'Failed to remove user from project'})
......
......@@ -27,7 +27,6 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => {
/**create new task for table MyTask*/
router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
const {user,title,description,project,executor,dateTimeStart,dateTimeDue, dateTimeDeadLine,priority} = req.body;
console.log('dateTimeStart ', dateTimeStart, 'dateTimeDue ', dateTimeDue, 'dateTimeDeadLine ', dateTimeDeadLine)
//** if dateTimeDue is null , then dateTimeDeadLine copied to dateTimeDue and dateTimeStart = dateTimeDue - 1 hour*/
let dateTimeDueFinal = dateTimeDue
let dateTimeStartFinal = dateTimeStart
......@@ -36,7 +35,6 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
dateTimeDueFinal = dateTimeDeadLine
dateTimeStartFinal = subtractHours(dateTimeDueFinal, 1)
}
console.log('dateTimeDueFinal ', dateTimeDueFinal, 'dateTimeStartFinal ', dateTimeStartFinal, 'dateTimeDeadLine ', dateTimeDeadLine,' dateTimeDeadlineFinal ', dateTimeDeadlineFinal)
const newTask = new Task();
newTask.title = title;
......@@ -112,7 +110,6 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>{
const {user,title,description,project,executor,dateTimeStart,dateTimeDue, dateTimeDeadLine,priority} = req.body;
const newTask = new Task();
console.log('project ', project, )
newTask.title = title;
newTask.description = description;
if (project) {
......@@ -252,7 +249,6 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{
/**return tasks & users of projects in which current user is involved, search by token*/
router.get('/related', auth,async (req: Request, res: Response):Promise<Response>=>{
console.log('related')
const user = req.body.user
const tasks = await dataSource
.createQueryBuilder()
......@@ -313,7 +309,6 @@ router.put('/:taskId',authAuthorOrExecutorOfTask,async(req:Request, res:Response
const {taskId} = req.params
const {authorStatus,executorStatus,title,description,note, archive,project,dateTimeTaskId,dateTimeStart,
dateTimeDue,executor,accomplish,dateTimeDeadLine, dateTimeFactDeadLine,priority} = req.body;
console.log('dateTimeTaskId ', dateTimeTaskId)
const task = await taskFinderById(taskId)
if (!task) return res.status(404).send({Message:'task not found'})
let dateTimeTask = null;
......
......@@ -69,7 +69,6 @@ export default function NewTaskForm({
const onProjectChange = (e, task) => {
const value = e.target.value;
console.log(' onProjectChange value ', value, 'task ', task)
const project = projects.find((project) => project.id === value);
setCurrentProject(project)
const newTask = { ...task };
......
......@@ -35,10 +35,6 @@ export default function EnhancedTable() {
task: null,
});
// useEffect(() => {
// dispatch(fetchAllTasks());
// // filterProjectsNamesFromTasks();
// }, [dispatch]);
useEffect(() => {
dispatch(fetchAllTasks());
......@@ -47,9 +43,6 @@ export default function EnhancedTable() {
}
}, [ tasks?.length,addTaskForm, setAddTaskForm, dispatch]);
console.log('tasks ', tasks, 'projects ', projects)
// useEffect(() => {
// dispatch(fetchAllTasks());
// }, [addTaskForm, setAddTaskForm, dispatch]);
......@@ -163,16 +156,9 @@ export default function EnhancedTable() {
};
const deleteDateTimeTaskHandle=(dateTimeTaskId)=>{
console.log('delete by dateTimeTaskId ', dateTimeTaskId)
dispatch(deleteDateTimeTask(dateTimeTaskId))
}
const handleEditDateTimeTask=(dateTimeTask)=>{
console.log('edit by dateTImeTask')
// dispatch(handleEditDateTimeTask(dateTimeTask))
}
const onModalOpen = (event, task) => {
event.stopPropagation();
setModal({ ...modal, open: true, id: task.id });
......@@ -187,30 +173,14 @@ export default function EnhancedTable() {
const [filterProjectTumbler, setFilterProjectTumbler] = React.useState(false);
const onClose=(projectIdListForTaskSelect)=>{
console.log('projectIdListForTaskSelect ', projectIdListForTaskSelect)
let tasksFilteredByProject = tasks
if (projectIdListForTaskSelect.length>0) {
tasksFilteredByProject = tasks.filter(task=>projectIdListForTaskSelect.includes(task.project?.id))
}
console.log('tasksFilteredByProject ', tasksFilteredByProject)
setRecievedTasks(tasksFilteredByProject)
setFilterProjectTumbler(true)
}
// const rawProjects = tasks?.map((task) => task.project);
// const uniqueProjects = rawProjects?.reduce((results, value, index) => {
// const exist = results.find((v) => {
// return v !== null && v.id === value?.id;
// });
// if (!exist && value !== null) {
// results.push(value);
// }
// return results;
// }, []);
// console.log('tasks', tasks)
if (
tasks &&
tasks?.length > 0 &&
......@@ -255,7 +225,6 @@ export default function EnhancedTable() {
task={task}
deleteHandle={deleteHandle}
handleEditTask ={handleEditTask}
handleEditDateTimeTask={handleEditDateTimeTask}
deleteDateTimeTask={deleteDateTimeTaskHandle}
onChange={onChange}
onModalOpen={onModalOpen}
......
......@@ -46,15 +46,8 @@ export default function UsersTasks() {
}
}, [dispatch,
tasks?.length,
// tasks,
addTaskForm, setAddTaskForm]);
// useEffect(() => {
// dispatch(fetchAllTasksByMembership());
// }, [addTaskForm, setAddTaskForm]);
const handleRequestSort = ( property) => {
const isAsc = orderBy === property && order === "asc";
setOrder(isAsc ? "desc" : "asc");
......@@ -106,7 +99,6 @@ export default function UsersTasks() {
for (let member of project.members){
executorList.push(member.user)
}
console.log('executorList ', executorList)
}
setExecutors(executorList)
......@@ -199,12 +191,10 @@ export default function UsersTasks() {
const onClose=(projectIdListForTaskSelect)=>{
console.log('projectIdListForTaskSelect ', projectIdListForTaskSelect)
let tasksFilteredByProject = tasks
if (projectIdListForTaskSelect.length>0) {
tasksFilteredByProject = tasks.filter(task=>projectIdListForTaskSelect.includes(task.project?.id))
}
console.log('tasksFilteredByProject ', tasksFilteredByProject)
setRecievedTasks(tasksFilteredByProject)
setFilterProjectTumbler(true)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment