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

#161 let to const rename, remove unused imports.

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