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
0d57310f
Commit
0d57310f
authored
Jan 09, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#136
added projects creation on the moment of user creation
parent
8d19d7f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
users.ts
planner-api/src/routers/users.ts
+12
-1
No files found.
planner-api/src/routers/users.ts
View file @
0d57310f
...
...
@@ -93,15 +93,26 @@ router.post('/', upload.single("avatar"), async (req : Request, res : Response):
user
.
role
=
role
;
user
.
generateToken
();
await
user
.
save
();
/**Создание проектов "Личные дела" и "Не определено"
* у только что созданого пользователя*/
const
newProject
=
new
Project
();
newProject
.
title
=
'Личные дела'
;
newProject
.
color
=
'
Green
'
;
newProject
.
color
=
'
#f595ee
'
;
await
newProject
.
save
()
const
newMember
=
new
Member
();
newMember
.
user
=
user
;
newMember
.
project
=
newProject
;
newMember
.
roleProject
=
MemberRole
.
ADMIN
;
await
newMember
.
save
();
const
notDefinedTaskProject
=
new
Project
();
notDefinedTaskProject
.
title
=
'Не определено'
;
notDefinedTaskProject
.
color
=
'#03fcfc'
;
await
notDefinedTaskProject
.
save
()
const
notDefinedTaskProjectMember
=
new
Member
();
notDefinedTaskProjectMember
.
user
=
user
;
notDefinedTaskProjectMember
.
project
=
notDefinedTaskProject
;
notDefinedTaskProjectMember
.
roleProject
=
MemberRole
.
ADMIN
;
await
notDefinedTaskProjectMember
.
save
();
const
userToFront
:
User
|
null
=
await
dataSource
.
manager
.
findOneBy
(
User
,
{
email
:
user
.
email
...
...
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