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
632e753c
Commit
632e753c
authored
Feb 22, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#167
trim of the title in the moment of creation of new project
parent
121ad939
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
projects.ts
planner-api/src/routers/projects.ts
+7
-2
No files found.
planner-api/src/routers/projects.ts
View file @
632e753c
...
...
@@ -17,6 +17,10 @@ router.get('/',async (req:Request, res:Response): Promise<Response>=> {
}
})
/**get projects were user is member, by user token */
router
.
get
(
'/my'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
try
{
...
...
@@ -56,11 +60,12 @@ router.post('/',auth, async (req:Request, res:Response): Promise<Response> => {
try
{
if
(
!
req
.
body
)
return
res
.
status
(
400
).
send
({
Message
:
'problem in incoming req.body'
})
const
{
user
,
title
,
color
}
=
req
.
body
;
const
titleTrimed
=
title
.
trim
()
const
projectCheck
=
await
dataSource
.
getRepository
(
Project
)
.
find
({
where
:{
title
:
title
title
:
title
Trimed
}})
if
(
projectCheck
.
length
>
0
)
{
return
res
.
status
(
400
).
send
({
message
:
"suchc Project already exists"
})}
const
member
:
Member
=
new
Member
;
...
...
@@ -68,7 +73,7 @@ router.post('/',auth, async (req:Request, res:Response): Promise<Response> => {
member
.
roleProject
=
MemberRole
.
ADMIN
;
await
member
.
save
();
const
project
:
Project
=
new
Project
()
project
.
title
=
title
;
project
.
title
=
title
Trimed
;
project
.
color
=
color
;
project
.
members
=
[
member
]
await
project
.
save
()
...
...
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