feat: Let users with multiple clients choose client while creating RTS

This commit is contained in:
2026-01-30 12:53:11 +05:30
parent 1499ff9804
commit fe61e60b49

View File

@@ -27,10 +27,13 @@ export async function createRts(
user: AuthenticatedUser, user: AuthenticatedUser,
) { ) {
let defaultClient = input.client; let defaultClient = input.client;
if (!defaultClient) {
const userInDb = await getUserWithoutPopulate(user.userId); const userInDb = await getUserWithoutPopulate(user.userId);
if (userInDb && userInDb.orgId) { if (userInDb && userInDb.orgId) {
defaultClient = userInDb.orgId[0]?.toString(); defaultClient = userInDb.orgId[0]?.toString();
} }
}
if (!input.stage) { if (!input.stage) {
input.stage = { input.stage = {