Fix merge conflicts

This commit is contained in:
Tuan Dang
2024-09-11 10:38:47 -07:00
95 changed files with 4213 additions and 401 deletions
+2 -3
View File
@@ -82,10 +82,9 @@ export const userDALFactory = (db: TDbClient) => {
}
};
const findUserEncKeyByUserId = async (userId: string) => {
const findUserEncKeyByUserId = async (userId: string, tx?: Knex) => {
try {
const user = await db
.replicaNode()(TableName.Users)
const user = await (tx || db.replicaNode())(TableName.Users)
.where(`${TableName.Users}.id`, userId)
.join(TableName.UserEncryptionKey, `${TableName.Users}.id`, `${TableName.UserEncryptionKey}.userId`)
.first();
+5 -9
View File
@@ -4,18 +4,14 @@ import { alphaNumericNanoId } from "@app/lib/nanoid";
import { TUserDALFactory } from "@app/services/user/user-dal";
export const normalizeUsername = async (username: string, userDAL: Pick<TUserDALFactory, "findOne">) => {
let attempt = slugify(`${username}-${alphaNumericNanoId(4)}`);
let attempt: string;
let user;
let user = await userDAL.findOne({ username: attempt });
if (!user) return attempt;
while (true) {
do {
attempt = slugify(`${username}-${alphaNumericNanoId(4)}`);
// eslint-disable-next-line no-await-in-loop
user = await userDAL.findOne({ username: attempt });
} while (user);
if (!user) {
return attempt;
}
}
return attempt;
};
+5
View File
@@ -3,3 +3,8 @@ import { TOrgPermission } from "@app/lib/types";
export type TListUserGroupsDTO = {
username: string;
} & Omit<TOrgPermission, "orgId">;
export enum UserEncryption {
V1 = 1,
V2 = 2
}