fix user creation relationships bug
This commit is contained in:
parent
51ed23d0a7
commit
bf7bc51566
|
@ -7,6 +7,7 @@ const {
|
|||
DocumentTypes,
|
||||
SEPARATOR,
|
||||
ViewNames,
|
||||
generateUserID,
|
||||
} = require("../../db/utils")
|
||||
const usersController = require("./user")
|
||||
const {
|
||||
|
@ -140,8 +141,12 @@ exports.save = async function(ctx) {
|
|||
}
|
||||
|
||||
if (!inputs._rev && !inputs._id) {
|
||||
if (inputs.tableId === ViewNames.USERS) {
|
||||
inputs._id = generateUserID(inputs.email)
|
||||
} else {
|
||||
inputs._id = generateRowID(inputs.tableId)
|
||||
}
|
||||
}
|
||||
|
||||
// this returns the table and row incase they have been updated
|
||||
const dbTable = await db.get(inputs.tableId)
|
||||
|
|
Loading…
Reference in New Issue