#136 added projects creation on the moment of user creation

parent 8d19d7f9
......@@ -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
......
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