fix user creation relationships bug

This commit is contained in:
Martin McKeaveney 2021-02-25 15:24:54 +00:00
parent 51ed23d0a7
commit bf7bc51566
1 changed files with 6 additions and 1 deletions

View File

@ -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)