#106 edit copy task by author enabled

parent 808b2857
...@@ -23,6 +23,12 @@ router.post("/make-copy",authAuthorOrExecutorOfTask, async(req:Request, res:Resp ...@@ -23,6 +23,12 @@ router.post("/make-copy",authAuthorOrExecutorOfTask, async(req:Request, res:Resp
router.put("/change-copy/:dateTimeTaskId", authAuthorOrExecutorOfTask, async(req:Request, res: Response):Promise<Response>=>{ router.put("/change-copy/:dateTimeTaskId", authAuthorOrExecutorOfTask, async(req:Request, res: Response):Promise<Response>=>{
const {dateTimeTaskId} = req.params const {dateTimeTaskId} = req.params
const {executorStatus,authorStatus, task, dateTimeStart, dateTimeDue, description, title, priority} = req.body const {executorStatus,authorStatus, task, dateTimeStart, dateTimeDue, description, title, priority} = req.body
if(authorStatus){
task.title = title;
task.description = description;
task.priority= priority;
await task.save()
}
const dateTimeTask = await dataSource const dateTimeTask = await dataSource
.createQueryBuilder() .createQueryBuilder()
.select('dateTimeTask') .select('dateTimeTask')
...@@ -103,12 +109,10 @@ router.delete('/:dateTimeTaskId',authAuthorOrExecutorOfDateTimeTask, async(req:R ...@@ -103,12 +109,10 @@ router.delete('/:dateTimeTaskId',authAuthorOrExecutorOfDateTimeTask, async(req:R
if (dateTimeTasks.length ===1 ) { if (dateTimeTasks.length ===1 ) {
if ( authorStatus) { if ( authorStatus) {
Task.remove(task) Task.remove(task)
return res.send({message:"task delete succesfully"}) return res.send({message:"task delete succesfully"})
} else{ } else{
return res.send({message:"not uathorized to delete task"}) return res.send({message:"not uathorized to delete task"})
} }
} }
} }
......
import {Button, Menu, MenuItem} from "@mui/material"; import {Button, Menu, MenuItem} from "@mui/material";
import { useState, useEffect } from "react"; import { useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import {NavLink, useNavigate} from "react-router-dom"; import {NavLink, useNavigate} from "react-router-dom";
import { fetchUsersAllFields, fetchUsers, logoutUser } from "../../../store/actions/usersActions"; import { fetchUsersAllFields, logoutUser } from "../../../store/actions/usersActions";
import SwitchUserModal from "../../SwitchUserModal/SwitchUserModal"; import SwitchUserModal from "../../SwitchUserModal/SwitchUserModal";
const ProfileBlock = () => { const ProfileBlock = () => {
......
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