add role on register

This commit is contained in:
Primakov Alexandr Alexandrovich 2022-04-23 21:05:51 +03:00
parent d1a366e88b
commit 9f8feb5e40

View File

@ -3,6 +3,7 @@ import { Db } from 'mongodb'
import { mainDb } from '../../utils/mongo' import { mainDb } from '../../utils/mongo'
import { cleanId } from '../../utils/common' import { cleanId } from '../../utils/common'
import { usersCollection } from '../../__data__/constants' import { usersCollection } from '../../__data__/constants'
import { Roles } from '../../model/roles'
export const registerUser = async ({ username, regtime, role, email, id, ...rest }) => { export const registerUser = async ({ username, regtime, role, email, id, ...rest }) => {
const db: Db = await mainDb const db: Db = await mainDb
@ -13,6 +14,7 @@ export const registerUser = async ({ username, regtime, role, email, id, ...rest
const user = { const user = {
...(registred || {}), ...(registred || {}),
ijlId: id, ijlId: id,
role: Roles.User,
ijlUser: { ijlUser: {
username, username,
regtime, regtime,