fix: Email auth should allow same guest user on multiple subdomains (#2252)

* test: Add email auth tests to establish current state of system

* fix: Update logic to account for dupe emails used between subdomains

* test

* test
This commit is contained in:
Tom Moor
2021-07-02 12:07:43 -07:00
committed by GitHub
parent 2ae74f2834
commit 1c0c694c22
5 changed files with 218 additions and 26 deletions

View File

@ -3,17 +3,15 @@ import { v4 as uuidv4 } from "uuid";
import { User, Document, Collection, Team } from "../models";
import { sequelize } from "../sequelize";
export function flushdb() {
const sql = sequelize.getQueryInterface();
const tables = Object.keys(sequelize.models).map((model) => {
const n = sequelize.models[model].getTableName();
return sql.queryGenerator.quoteTable(
typeof n === "string" ? n : n.tableName
);
});
const sql = sequelize.getQueryInterface();
const tables = Object.keys(sequelize.models).map((model) => {
const n = sequelize.models[model].getTableName();
return sql.queryGenerator.quoteTable(typeof n === "string" ? n : n.tableName);
});
const flushQuery = `TRUNCATE ${tables.join(", ")}`;
const query = `TRUNCATE ${tables.join(", ")} CASCADE`;
return sequelize.query(query);
export function flushdb() {
return sequelize.query(flushQuery);
}
export const seed = async () => {