#94 added ProjecetComponents in Components

parent beb6a6e8
...@@ -12,6 +12,7 @@ router.get('/',async (req:Request, res:Response): Promise<Response>=> { ...@@ -12,6 +12,7 @@ router.get('/',async (req:Request, res:Response): Promise<Response>=> {
const projects:Project[] = await dataSource.manager.find(Project) const projects:Project[] = await dataSource.manager.find(Project)
return res.send({projects}) return res.send({projects})
}) })
/**get projects were user is member, by user token */ /**get projects were user is member, by user token */
router.get('/my',auth, async (req:Request, res:Response): Promise<Response>=> { router.get('/my',auth, async (req:Request, res:Response): Promise<Response>=> {
const user = req.body.user const user = req.body.user
...@@ -43,6 +44,9 @@ router.get('/my',auth, async (req:Request, res:Response): Promise<Response>=> { ...@@ -43,6 +44,9 @@ router.get('/my',auth, async (req:Request, res:Response): Promise<Response>=> {
return res.send({projects}) return res.send({projects})
}) })
/**create new project */ /**create new project */
router.post('/',auth, async (req:Request, res:Response): Promise<Response> => { router.post('/',auth, async (req:Request, res:Response): Promise<Response> => {
if (!req.body) return res.status(400).send({Message:'problem in incoming req.body'}) if (!req.body) return res.status(400).send({Message:'problem in incoming req.body'})
...@@ -114,6 +118,10 @@ router.get('/user/:userId', async (req : Request, res : Response): Promise<Respo ...@@ -114,6 +118,10 @@ router.get('/user/:userId', async (req : Request, res : Response): Promise<Respo
}) })
/** Add user to specific project */ /** Add user to specific project */
router.post('/add-user/', authAdminProject, async (req: Request, res: Response):Promise<Response>=>{ router.post('/add-user/', authAdminProject, async (req: Request, res: Response):Promise<Response>=>{
......
...@@ -35,6 +35,22 @@ const users = await dataSource ...@@ -35,6 +35,22 @@ const users = await dataSource
return res.send({users}) return res.send({users})
}) })
//** return all users of DB */
router.get('/all-fields/', async (req : Request, res : Response):Promise<object> => {
const users = await dataSource
.getRepository(User)
.find({
relations:{
members:{
project:true,
user:true
},
}
})
return res.send({users})
})
/**create new user*/ /**create new user*/
router.post('/', upload.single("avatar"), async (req : Request, res : Response):Promise<object> => { router.post('/', upload.single("avatar"), async (req : Request, res : Response):Promise<object> => {
const {name,surname,password,email, role} = req.body; const {name,surname,password,email, role} = req.body;
......
import {Box, Button, Grid, Modal} from "@mui/material"; import {Box, Button, Grid, Modal} from "@mui/material";
import {useState} from "react"; import {useState} from "react";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import FormElement from "../UI/Form/FormElement/FormElement"; import FormElement from "../../UI/Form/FormElement/FormElement";
import {Typography} from "@mui/material"; import {Typography} from "@mui/material";
const style = { const style = {
......
...@@ -10,11 +10,11 @@ import { ...@@ -10,11 +10,11 @@ import {
Paper Paper
} from "@mui/material"; } from "@mui/material";
import { useState } from "react"; import { useState } from "react";
import TaskModal from "../../components/MyTasksCompoments/TaskModal/TaskModal"; import TaskModal from "../../../components/MyTasksCompoments/TaskModal/TaskModal";
import moment from "moment"; import moment from "moment";
import CustomTableCell from "../../components/MyTasksCompoments/CustomTableCell"; import CustomTableCell from "../../../components/MyTasksCompoments/CustomTableCell";
import MaterialUIPickers from "../../components/MyTasksCompoments/DateTimePicker/DateTimePicker"; import MaterialUIPickers from "../../../components/MyTasksCompoments/DateTimePicker/DateTimePicker";
import BasicSelect from "../../components/UI/Select/Select"; import BasicSelect from "../../../components/UI/Select/Select";
import ProjectTasksHeader from "./ProjectTasksHeader"; import ProjectTasksHeader from "./ProjectTasksHeader";
export default function ProjectTasksBody({ tasks }) { export default function ProjectTasksBody({ tasks }) {
......
...@@ -3,9 +3,9 @@ import { useParams } from "react-router-dom"; ...@@ -3,9 +3,9 @@ import { useParams } from "react-router-dom";
import { useSelector, useDispatch } from "react-redux"; import { useSelector, useDispatch } from "react-redux";
import { useEffect } from "react"; import { useEffect } from "react";
import { fetchProject } from "../../store/actions/projectsActions"; import { fetchProject } from "../../store/actions/projectsActions";
import ProjectTasksBody from "../../components/ProjectTasks/ProjectTasksBody"; import ProjectTasksBody from "../../components/ProjectComponents/ProjectTasks/ProjectTasksBody";
import { fetchUsers } from "../../store/actions/usersActions"; import { fetchUsers } from "../../store/actions/usersActions";
import ProjectMembersList from "../../components/ProjectMembersList/ProjectMembersList"; import ProjectMembersList from "../../components/ProjectComponents/ProjectMembersList/ProjectMembersList";
import NewMember from "../NewMember/NewMember"; import NewMember from "../NewMember/NewMember";
const FullProject = () => { const FullProject = () => {
......
...@@ -2,7 +2,7 @@ import {useNavigate} from "react-router-dom"; ...@@ -2,7 +2,7 @@ import {useNavigate} from "react-router-dom";
import {useDispatch, useSelector} from "react-redux"; import {useDispatch, useSelector} from "react-redux";
import { useEffect } from "react"; import { useEffect } from "react";
import ProjectForm from "../../components/ProjectForm/ProjectForm"; import ProjectForm from "../../components/ProjectComponents/ProjectForm/ProjectForm";
import { createMember, createProject, fetchMembers, fetchProjects } from "../../store/actions/projectsActions"; import { createMember, createProject, fetchMembers, fetchProjects } from "../../store/actions/projectsActions";
import MemberForm from "../../components/MemberForm/MemberForm"; import MemberForm from "../../components/MemberForm/MemberForm";
......
...@@ -2,7 +2,7 @@ import {useNavigate} from "react-router-dom"; ...@@ -2,7 +2,7 @@ import {useNavigate} from "react-router-dom";
import {useDispatch, useSelector} from "react-redux"; import {useDispatch, useSelector} from "react-redux";
import { useEffect } from "react"; import { useEffect } from "react";
import ProjectForm from "../../components/ProjectForm/ProjectForm"; import ProjectForm from "../../components/ProjectComponents/ProjectForm/ProjectForm";
import { createProject, fetchProjects } from "../../store/actions/projectsActions"; import { createProject, fetchProjects } from "../../store/actions/projectsActions";
const NewProject = () => { const NewProject = () => {
......
...@@ -5,7 +5,7 @@ import { useDispatch, useSelector } from "react-redux"; ...@@ -5,7 +5,7 @@ import { useDispatch, useSelector } from "react-redux";
import Loader from "../../components/UI/Loader/Loader"; import Loader from "../../components/UI/Loader/Loader";
import HasAccess from "../../components/UI/HasAccess/HasAccess"; import HasAccess from "../../components/UI/HasAccess/HasAccess";
import { fetchProjects } from "../../store/actions/projectsActions"; import { fetchProjects } from "../../store/actions/projectsActions";
import ProjectsList from "../../components/ProjectsList/ProjectsList"; import ProjectsList from "../../components/ProjectComponents/ProjectsList/ProjectsList";
import NewProject from "../NewProject/NewProject"; import NewProject from "../NewProject/NewProject";
const Projects = () => { const Projects = () => {
......
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