Commit 92b0fd61 authored by “Yevgeniy's avatar “Yevgeniy

#161 let to const rename, remove unused imports.

parent 3faff256
......@@ -5,10 +5,7 @@ import {
CreateDateColumn,
BaseEntity,
ManyToOne,
OneToOne,
JoinTable,
OneToMany,
JoinColumn
} from 'typeorm';
import {User} from './User';
import {Project} from './Project';
......
......@@ -35,7 +35,7 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
const {user,title,description,project,executor,dateTimeStart,dateTimeDue, dateTimeDeadLine,priority, calendar} = req.body;
let dateTimeDueFinal = dateTimeDue
let dateTimeStartFinal = dateTimeStart
let dateTimeDeadlineFinal= dateTimeDeadLine
const dateTimeDeadlineFinal= dateTimeDeadLine
if (!dateTimeDue && dateTimeDeadLine) {
dateTimeDueFinal = dateTimeDeadLine
dateTimeStartFinal = subtractHours(dateTimeDueFinal, 1)
......@@ -122,7 +122,6 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>
const newTask = new Task();
newTask.title = title;
newTask.description = description;
const currentTime = new Date();
if (project) {
const watcherOfProject = await dataSource
.getRepository(Project)
......@@ -288,9 +287,9 @@ router.get('/related', auth,async (req: Request, res: Response):Promise<Response
.where("member.userId = :userId", {userId:user.id})
.getMany()
let projectIds:any[] = []
let projectIds: string[] = []
if (tasks.length>0){
for (let task of tasks){
for (const task of tasks){
const projectId = task?.project?.id
projectIds.push(projectId)
}
......@@ -389,7 +388,7 @@ router.put('/:taskId',auth,authAuthorOrExecutorOfTask,async(req:Request, res:Res
/** search all tasks on given projects: project Id array[] */
router.post('/project',async (req: Request, res: Response):Promise<Response>=>{
let projectArray :string[]= req.body;
const projectArray :string[]= req.body;
try{
if (projectArray.length===0) {
const rawTasks = await
......@@ -455,7 +454,7 @@ router.get('/users-tasks', auth,async (req: Request, res: Response):Promise<Resp
if (!projectsWithTasks) return res.status(404).send({Message:'projects not found'})
let tasks:Task[] = []
if (projectsWithTasks.length>0) {
for (let project of projectsWithTasks){
for (const project of projectsWithTasks){
if (project?.tasks) {
tasks=tasks.concat(project.tasks)
}
......
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