Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
planner-team-one
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
21
Issues
21
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Евгений Положенцев
planner-team-one
Commits
eafabf99
Commit
eafabf99
authored
Dec 21, 2022
by
Ibadullina Inabat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
реализовано удаление проекта
parent
81461d91
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
75 deletions
+73
-75
helpers.ts
planner-api/src/helpers.ts
+1
-1
projects.ts
planner-api/src/routers/projects.ts
+2
-2
ProjectItem.js
...c/components/ProjectComponents/ProjectItem/ProjectItem.js
+13
-12
ProjectMembersItem.js
...rojectComponents/ProjectMembersItem/ProjectMembersItem.js
+6
-9
ProjectsList.js
...components/ProjectComponents/ProjectsList/ProjectsList.js
+1
-1
FullProject.js
planner-front/src/containers/FullProject/FullProject.js
+1
-1
projectsActions.js
planner-front/src/store/actions/projectsActions.js
+49
-49
No files found.
planner-api/src/helpers.ts
View file @
eafabf99
planner-api/src/routers/projects.ts
View file @
eafabf99
...
@@ -92,8 +92,8 @@ router.get("/:id",async (req:Request, res:Response): Promise<Response> => {
...
@@ -92,8 +92,8 @@ router.get("/:id",async (req:Request, res:Response): Promise<Response> => {
})
})
/** Delete project by project ID*/
/** Delete project by project ID*/
router
.
delete
(
'/
:projectId
'
,
authAdminProject
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
delete
(
'/'
,
authAdminProject
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
projectId
=
req
.
params
.
projectId
;
const
{
projectId
}
=
req
.
body
;
await
myDataSource
await
myDataSource
.
createQueryBuilder
()
.
createQueryBuilder
()
.
delete
()
.
delete
()
...
...
planner-front/src/components/ProjectComponents/ProjectItem/ProjectItem.js
View file @
eafabf99
...
@@ -5,14 +5,15 @@ import { useDispatch, useSelector } from "react-redux";
...
@@ -5,14 +5,15 @@ import { useDispatch, useSelector } from "react-redux";
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
{
deleteProject
}
from
"../../../store/actions/projectsActions"
;
import
{
deleteProject
}
from
"../../../store/actions/projectsActions"
;
const
ProjectItem
=
({
title
,
tasks
,
i
d
})
=>
{
const
ProjectItem
=
({
title
,
tasks
,
projectI
d
})
=>
{
const
user
=
useSelector
(
state
=>
state
.
users
.
user
);
const
user
=
useSelector
(
state
=>
state
.
users
.
user
);
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
console
.
log
(
id
)
console
.
log
(
user
)
console
.
log
(
user
)
const
deleteHandle
=
(
id
)
=>
{
const
deleteHandle
=
(
projectId
)
=>
{
dispatch
(
deleteProject
(
id
))
console
.
log
(
"project id"
,
projectId
)
dispatch
(
deleteProject
(
projectId
))
};
};
return
<>
return
<>
...
@@ -29,12 +30,12 @@ const ProjectItem = ({ title, tasks, id }) => {
...
@@ -29,12 +30,12 @@ const ProjectItem = ({ title, tasks, id }) => {
<
/strong
>
<
/strong
>
<
/CardContent
>
<
/CardContent
>
<
CardActions
>
<
CardActions
>
{
<
Button
onClick
=
{(
id
)
=>
{
{(
title
!==
"Личные дела"
)
?
<
Button
onClick
=
{(
)
=>
{
deleteHandle
(
i
d
);
deleteHandle
(
projectI
d
);
}}
variant
=
"outlined"
startIcon
=
{
<
DeleteIcon
/>
}
>
}}
variant
=
"outlined"
startIcon
=
{
<
DeleteIcon
/>
}
>
Delete
Delete
<
/Button>
}
<
/Button> : null
}
<
IconButton
component
=
{
Link
}
to
=
{
"/projects/"
+
i
d
}
>
<
IconButton
component
=
{
Link
}
to
=
{
"/projects/"
+
projectI
d
}
>
<
ArrowForwardIcon
/>
<
ArrowForwardIcon
/>
<
/IconButton
>
<
/IconButton
>
...
...
planner-front/src/components/ProjectComponents/ProjectMembersItem/ProjectMembersItem.js
View file @
eafabf99
import
{
Card
,
CardActions
,
CardContent
,
Grid
,
IconButton
,
Tooltip
}
from
"@mui/material"
;
import
{
Card
,
CardContent
,
Grid
,
IconButton
,
Tooltip
}
from
"@mui/material"
;
import
{
Link
,
useParams
}
from
"react-router-dom"
;
import
{
useParams
}
from
"react-router-dom"
;
import
ArrowForwardIcon
from
"@mui/icons-material/ArrowForward"
;
import
{
useDispatch
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
{
deleteMember
}
from
"../../../store/actions/projectsActions"
;
import
{
deleteMember
}
from
"../../../store/actions/projectsActions"
;
const
ProjectMembersItem
=
({
displayName
,
roleProject
,
id
,
roleProjectOfAuthor
,
userId
,
members
,
authorOfProject
})
=>
{
const
ProjectMembersItem
=
({
displayName
,
roleProject
,
id
,
roleProjectOfAuthor
,
userId
,
members
,
authorOfProject
})
=>
{
console
.
log
(
displayName
)
console
.
log
(
displayName
)
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
user
=
useSelector
(
state
=>
state
.
users
)
let
params
=
useParams
()
let
params
=
useParams
()
console
.
log
(
members
)
console
.
log
(
members
)
console
.
log
(
userId
)
console
.
log
(
userId
)
const
{
projects
,
project
}
=
useSelector
(
state
=>
state
.
projects
);
const
deleteHandle
=
(
userId
,
projectId
)
=>
{
const
deleteHandle
=
(
userId
,
projectId
)
=>
{
dispatch
(
deleteMember
(
userId
,
params
.
id
))
dispatch
(
deleteMember
(
userId
,
params
.
id
))
...
...
planner-front/src/components/ProjectComponents/ProjectsList/ProjectsList.js
View file @
eafabf99
...
@@ -13,7 +13,7 @@ const ProjectsList = ({projects}) => {
...
@@ -13,7 +13,7 @@ const ProjectsList = ({projects}) => {
createdAt
=
{
project
.
createdAt
}
createdAt
=
{
project
.
createdAt
}
dateDue
=
{
project
.
dateDue
}
dateDue
=
{
project
.
dateDue
}
admin
=
{
project
.
admin
}
admin
=
{
project
.
admin
}
i
d
=
{
project
.
id
}
projectI
d
=
{
project
.
id
}
key
=
{
project
.
id
}
key
=
{
project
.
id
}
/
>
/
>
})}
})}
...
...
planner-front/src/containers/FullProject/FullProject.js
View file @
eafabf99
import
{
Button
,
Card
,
CardActions
,
CardContent
,
Grid
,
IconButton
}
from
"@mui/material"
;
import
{
Card
,
CardActions
,
CardContent
,
Grid
}
from
"@mui/material"
;
import
{
useParams
}
from
"react-router-dom"
;
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"
;
...
...
planner-front/src/store/actions/projectsActions.js
View file @
eafabf99
import
axios
from
"../../axiosPlanner"
;
import
axios
from
"../../axiosPlanner"
;
import
{
CREATE_MEMBER_SUCCESS
,
CREATE_PROJECT_SUCCESS
,
DELETE_MEMBER_FAILURE
,
DELETE_MEMBER_REQUEST
,
DELETE_MEMBER_SUCCESS
,
DELETE_PROJECT_FAILURE
,
DELETE_PROJECT_REQUEST
,
DELETE_PROJECT_SUCCESS
,
FETCH_ALL_USER_PROJECTS_SUCCESS
,
FETCH_
MEMBERS_ERROR
,
FETCH_MEMBERS_REQUEST
,
FETCH_MEMBERS_SUCCESS
,
FETCH_
PROJECTS_ERROR
,
FETCH_PROJECTS_REQUEST
,
FETCH_PROJECTS_SUCCESS
,
FETCH_PROJECT_SUCCESS
}
from
"../actionTypes/projectsActionTypes"
;
import
{
CREATE_MEMBER_SUCCESS
,
CREATE_PROJECT_SUCCESS
,
DELETE_MEMBER_FAILURE
,
DELETE_MEMBER_REQUEST
,
DELETE_MEMBER_SUCCESS
,
DELETE_PROJECT_FAILURE
,
DELETE_PROJECT_REQUEST
,
DELETE_PROJECT_SUCCESS
,
FETCH_ALL_USER_PROJECTS_SUCCESS
,
FETCH_PROJECTS_ERROR
,
FETCH_PROJECTS_REQUEST
,
FETCH_PROJECTS_SUCCESS
,
FETCH_PROJECT_SUCCESS
}
from
"../actionTypes/projectsActionTypes"
;
import
{
showNotification
}
from
"./commonActions"
;
import
{
showNotification
}
from
"./commonActions"
;
const
fetchProjectsRequest
=
()
=>
{
const
fetchProjectsRequest
=
()
=>
{
return
{
type
:
FETCH_PROJECTS_REQUEST
}
return
{
type
:
FETCH_PROJECTS_REQUEST
}
};
};
const
fetchProjectsSuccess
=
(
projects
)
=>
{
const
fetchProjectsSuccess
=
(
projects
)
=>
{
return
{
type
:
FETCH_PROJECTS_SUCCESS
,
projects
};
return
{
type
:
FETCH_PROJECTS_SUCCESS
,
projects
};
};
};
const
fetchProjectsError
=
(
error
)
=>
{
const
fetchProjectsError
=
(
error
)
=>
{
return
{
type
:
FETCH_PROJECTS_ERROR
,
error
};
return
{
type
:
FETCH_PROJECTS_ERROR
,
error
};
}
}
const
fetchProjectSuccess
=
(
project
)
=>
{
const
fetchProjectSuccess
=
(
project
)
=>
{
return
{
type
:
FETCH_PROJECT_SUCCESS
,
project
};
return
{
type
:
FETCH_PROJECT_SUCCESS
,
project
};
};
};
const
createProjectSuccess
=
()
=>
{
const
createProjectSuccess
=
()
=>
{
return
{
type
:
CREATE_PROJECT_SUCCESS
};
return
{
type
:
CREATE_PROJECT_SUCCESS
};
};
};
const
createMemberSuccess
=
(
member
)
=>
{
const
createMemberSuccess
=
(
member
)
=>
{
return
{
type
:
CREATE_MEMBER_SUCCESS
,
member
};
return
{
type
:
CREATE_MEMBER_SUCCESS
,
member
};
};
};
const
deleteMemberRequest
=
()
=>
{
const
deleteMemberRequest
=
()
=>
{
return
{
type
:
DELETE_MEMBER_REQUEST
}
return
{
type
:
DELETE_MEMBER_REQUEST
}
};
};
const
deleteMemberSuccess
=
()
=>
{
const
deleteMemberSuccess
=
()
=>
{
return
{
type
:
DELETE_MEMBER_SUCCESS
}
return
{
type
:
DELETE_MEMBER_SUCCESS
}
};
};
const
deleteMemberFailure
=
(
error
)
=>
{
const
deleteMemberFailure
=
(
error
)
=>
{
return
{
type
:
DELETE_MEMBER_FAILURE
,
error
}
return
{
type
:
DELETE_MEMBER_FAILURE
,
error
}
};
};
const
deleteProjectRequest
=
()
=>
{
const
deleteProjectRequest
=
()
=>
{
return
{
type
:
DELETE_PROJECT_REQUEST
}
return
{
type
:
DELETE_PROJECT_REQUEST
}
};
};
const
deleteProjectSuccess
=
()
=>
{
const
deleteProjectSuccess
=
()
=>
{
return
{
type
:
DELETE_PROJECT_SUCCESS
}
return
{
type
:
DELETE_PROJECT_SUCCESS
}
};
};
const
deleteProjectFailure
=
(
error
)
=>
{
const
deleteProjectFailure
=
(
error
)
=>
{
return
{
type
:
DELETE_PROJECT_FAILURE
,
error
}
return
{
type
:
DELETE_PROJECT_FAILURE
,
error
}
};
};
export
const
deleteMember
=
(
memberId
,
projectId
)
=>
{
export
const
deleteMember
=
(
memberId
,
projectId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
deleteMemberRequest
());
dispatch
(
deleteMemberRequest
());
try
{
try
{
const
response
=
await
axios
.
delete
(
`/projects/remove-user/
${
memberId
}
`
,
{
data
:
{
projectId
:
projectId
}
});
const
response
=
await
axios
.
delete
(
`/projects/remove-user/
${
memberId
}
`
,
{
data
:
{
projectId
:
projectId
}
});
console
.
log
(
"deleteMember "
,
response
.
data
)
console
.
log
(
"deleteMember "
,
response
.
data
)
dispatch
(
deleteMemberSuccess
())
dispatch
(
deleteMemberSuccess
())
dispatch
(
fetchProject
(
projectId
))
dispatch
(
fetchProject
(
projectId
))
...
@@ -59,13 +59,13 @@ const deleteMemberRequest = () => {
...
@@ -59,13 +59,13 @@ const deleteMemberRequest = () => {
dispatch
(
deleteMemberFailure
(
error
.
response
.
data
));
dispatch
(
deleteMemberFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
export
const
deleteProject
=
(
projectId
,
projects
)
=>
{
export
const
deleteProject
=
(
projectId
,
projects
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
deleteProjectRequest
());
dispatch
(
deleteProjectRequest
());
try
{
try
{
const
response
=
await
axios
.
delete
(
`/projects/
${
projectId
}
`
);
const
response
=
await
axios
.
delete
(
'/projects'
,
{
data
:
{
projectId
:
projectId
}
}
);
console
.
log
(
"deleteMember "
,
response
.
data
)
console
.
log
(
"deleteMember "
,
response
.
data
)
dispatch
(
deleteProjectSuccess
())
dispatch
(
deleteProjectSuccess
())
dispatch
(
fetchProjects
(
projects
))
dispatch
(
fetchProjects
(
projects
))
...
@@ -73,14 +73,14 @@ const deleteMemberRequest = () => {
...
@@ -73,14 +73,14 @@ const deleteMemberRequest = () => {
dispatch
(
deleteProjectFailure
(
error
.
response
.
data
));
dispatch
(
deleteProjectFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
export
const
fetchProjects
=
()
=>
{
export
const
fetchProjects
=
()
=>
{
return
async
dispatch
=>
{
return
async
dispatch
=>
{
dispatch
(
fetchProjectsRequest
());
dispatch
(
fetchProjectsRequest
());
try
{
try
{
const
response
=
await
axios
.
get
(
"/projects/my"
);
const
response
=
await
axios
.
get
(
"/projects/my"
);
dispatch
(
fetchProjectsSuccess
(
response
.
data
));
dispatch
(
fetchProjectsSuccess
(
response
.
data
));
}
catch
(
e
)
{
}
catch
(
e
)
{
dispatch
(
fetchProjectsError
(
e
));
dispatch
(
fetchProjectsError
(
e
));
}
}
};
};
...
@@ -118,7 +118,7 @@ export const createMember = (memberData, navigate) => {
...
@@ -118,7 +118,7 @@ export const createMember = (memberData, navigate) => {
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
try
{
try
{
console
.
log
(
memberData
)
console
.
log
(
memberData
)
const
response
=
await
axios
.
post
(
"/projects/add-user"
,
memberData
);
await
axios
.
post
(
"/projects/add-user"
,
memberData
);
dispatch
(
createMemberSuccess
());
dispatch
(
createMemberSuccess
());
console
.
log
(
memberData
)
console
.
log
(
memberData
)
navigate
(
"/projects/"
)
navigate
(
"/projects/"
)
...
@@ -131,7 +131,7 @@ export const createMember = (memberData, navigate) => {
...
@@ -131,7 +131,7 @@ export const createMember = (memberData, navigate) => {
}
}
const
fetchAllUserProjectsSuccess
=
(
projects
)
=>
{
const
fetchAllUserProjectsSuccess
=
(
projects
)
=>
{
return
{
type
:
FETCH_ALL_USER_PROJECTS_SUCCESS
,
projects
};
return
{
type
:
FETCH_ALL_USER_PROJECTS_SUCCESS
,
projects
};
};
};
export
const
fetchAllUserProjects
=
()
=>
{
export
const
fetchAllUserProjects
=
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment