diff --git a/bin/auth-api/src/routes/workspace.routes.ts b/bin/auth-api/src/routes/workspace.routes.ts index 72416c8eae..1f41deec03 100644 --- a/bin/auth-api/src/routes/workspace.routes.ts +++ b/bin/auth-api/src/routes/workspace.routes.ts @@ -80,9 +80,9 @@ router.post("/workspaces/new", async (ctx) => { const reqBody = validate(ctx.request.body, z.object({ instanceUrl: z.string().url(), displayName: z.string(), + isDefault: z.boolean(), })); - // isDefaultWorkspace: z.boolean(), let workspaceEnvType; if (reqBody.instanceUrl === "https://app.systeminit.com") { workspaceEnvType = InstanceEnvType.SI; @@ -98,7 +98,7 @@ router.post("/workspaces/new", async (ctx) => { workspaceEnvType, reqBody.instanceUrl, reqBody.displayName, - false, + reqBody.isDefault, ); ctx.body = { diff --git a/bin/auth-api/src/services/users.service.ts b/bin/auth-api/src/services/users.service.ts index fffbe25c98..1ae10fb53d 100644 --- a/bin/auth-api/src/services/users.service.ts +++ b/bin/auth-api/src/services/users.service.ts @@ -30,8 +30,10 @@ export async function getUserById(id: UserId) { }); if (!userWithTosAgreement) return null; - const agreedTosVersion = userWithTosAgreement?.TosAgreement?.[0]?.tosVersionId; - const needsTosUpdate = !agreedTosVersion || agreedTosVersion < LATEST_TOS_VERSION_ID; + const agreedTosVersion = + userWithTosAgreement?.TosAgreement?.[0]?.tosVersionId; + const needsTosUpdate = + !agreedTosVersion || agreedTosVersion < LATEST_TOS_VERSION_ID; return { ..._.omit(userWithTosAgreement, "TosAgreement"), @@ -119,6 +121,8 @@ export async function createOrUpdateUserFromAuth0Details( // create a default saas workspace // await createWorkspace(user, InstanceEnvType.SI, "https://app.systeminit.com", `${user.nickname}'s Production Workspace`); + // we want to check if this is the first production workspace that a user has and if so, we are going to set it as the default + // when we launch this feature! await createWorkspace( user, InstanceEnvType.LOCAL,