#136 solved select projects bug when create new task in Mytask tbl

parent e3590830
...@@ -35,7 +35,6 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{ ...@@ -35,7 +35,6 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
dateTimeDueFinal = dateTimeDeadLine dateTimeDueFinal = dateTimeDeadLine
dateTimeStartFinal = subtractHours(dateTimeDueFinal, 1) dateTimeStartFinal = subtractHours(dateTimeDueFinal, 1)
} }
console.log('datTeimeDeadLine ', dateTimeDeadLine)
const newTask = new Task(); const newTask = new Task();
newTask.title = title; newTask.title = title;
...@@ -199,7 +198,6 @@ router.get('/user/:userId', async (req: Request, res: Response):Promise<Response ...@@ -199,7 +198,6 @@ router.get('/user/:userId', async (req: Request, res: Response):Promise<Response
router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{
let projectsRawId =[] let projectsRawId =[]
try{ try{
const user = req.body.user const user = req.body.user
projectsRawId = await dataSource projectsRawId = await dataSource
.getRepository(Project) .getRepository(Project)
...@@ -207,7 +205,6 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{ ...@@ -207,7 +205,6 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{
select:{ select:{
id:true id:true
}, },
where:{ where:{
title:Not(Equal("Не определено")), title:Not(Equal("Не определено")),
members:{ members:{
...@@ -249,13 +246,10 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{ ...@@ -249,13 +246,10 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{
id:In(projectsList) id:In(projectsList)
} }
}) })
return res.send({tasks, projects}) return res.send({tasks, projects})
} catch(e){ } catch(e){
return res.status(502).send({message:(e as Error).message}) return res.status(502).send({message:(e as Error).message})
} }
}) })
......
...@@ -13,15 +13,17 @@ import { ...@@ -13,15 +13,17 @@ import {
} from "@mui/material"; } from "@mui/material";
import { useState } from "react"; import { useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { AddBox, Luggage } from "@mui/icons-material"; import { AddBox
// , Luggage
} from "@mui/icons-material";
import moment from "moment"; import moment from "moment";
import CustomTableCell from "./CustomTableCell"; import CustomTableCell from "./CustomTableCell";
import MaterialUIPickers from "./DateTimePicker/DateTimePicker"; import MaterialUIPickers from "./DateTimePicker/DateTimePicker";
import BasicSelect from "../UI/Select/Select"; import BasicSelect from "../UI/Select/Select";
import { addTask } from "../../store/actions/tasksActions"; import { addTask } from "../../store/actions/tasksActions";
import TaskModal from "./TaskModal/TaskModal"; import TaskModal from "./TaskModal/TaskModal";
import {dateToISOLikeButLocal} from '../../helpers/CalendarHelpers'; // import {dateToISOLikeButLocal} from '../../helpers/CalendarHelpers';
import DateTimePicker from "../Calendars/UI/DateTimePicker/DateTimePicker"; // import DateTimePicker from "../Calendars/UI/DateTimePicker/DateTimePicker";
export default function NewTaskForm({ projects, setAddTaskForm }) { export default function NewTaskForm({ projects, setAddTaskForm }) {
console.log('new task form') console.log('new task form')
...@@ -38,7 +40,7 @@ export default function NewTaskForm({ projects, setAddTaskForm }) { ...@@ -38,7 +40,7 @@ export default function NewTaskForm({ projects, setAddTaskForm }) {
dateTimeDeadLine: null, dateTimeDeadLine: null,
dateTimeTasks: [], dateTimeTasks: [],
dateTimeDue: null, dateTimeDue: null,
project: null, project: projects?projects.find(project=>project.title==="Личные дела"):null,
accomplish: "opened", accomplish: "opened",
priority: "B", priority: "B",
author: { id: user.id }, author: { id: user.id },
...@@ -54,6 +56,8 @@ export default function NewTaskForm({ projects, setAddTaskForm }) { ...@@ -54,6 +56,8 @@ export default function NewTaskForm({ projects, setAddTaskForm }) {
setModal(true); setModal(true);
}; };
console.log('task ', task)
const handleClose = () => { const handleClose = () => {
setModal(false); setModal(false);
}; };
......
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