rename column

This commit is contained in:
Philipinho
2025-08-31 12:28:21 -07:00
parent de48e36c7d
commit 9fc9a74f26
5 changed files with 17 additions and 19 deletions

View File

@ -16,7 +16,7 @@ const ssoSchema = z.object({
oidcClientSecret: z.string().min(1, "Client secret is required"),
isEnabled: z.boolean(),
allowSignup: z.boolean(),
isGroupSyncEnabled: z.boolean(),
groupSync: z.boolean(),
});
type SSOFormValues = z.infer<typeof ssoSchema>;
@ -37,7 +37,7 @@ export function SsoOIDCForm({ provider, onClose }: SsoFormProps) {
oidcClientSecret: provider.oidcClientSecret || "",
isEnabled: provider.isEnabled,
allowSignup: provider.allowSignup,
isGroupSyncEnabled: provider.isGroupSyncEnabled || false,
groupSync: provider.groupSync || false,
},
validate: zodResolver(ssoSchema),
});
@ -69,8 +69,8 @@ export function SsoOIDCForm({ provider, onClose }: SsoFormProps) {
if (form.isDirty("allowSignup")) {
ssoData.allowSignup = values.allowSignup;
}
if (form.isDirty("isGroupSyncEnabled")) {
ssoData.isGroupSyncEnabled = values.isGroupSyncEnabled;
if (form.isDirty("groupSync")) {
ssoData.groupSync = values.groupSync;
}
await updateSsoProviderMutation.mutateAsync(ssoData);
@ -128,8 +128,8 @@ export function SsoOIDCForm({ provider, onClose }: SsoFormProps) {
<div>{t("Group sync")}</div>
<Switch
className={classes.switch}
checked={form.values.isGroupSyncEnabled}
{...form.getInputProps("isGroupSyncEnabled")}
checked={form.values.groupSync}
{...form.getInputProps("groupSync")}
/>
</Group>

View File

@ -26,7 +26,7 @@ const ssoSchema = z.object({
samlCertificate: z.string().min(1, "SAML Idp Certificate is required"),
isEnabled: z.boolean(),
allowSignup: z.boolean(),
isGroupSyncEnabled: z.boolean(),
groupSync: z.boolean(),
});
type SSOFormValues = z.infer<typeof ssoSchema>;
@ -46,7 +46,7 @@ export function SsoSamlForm({ provider, onClose }: SsoFormProps) {
samlCertificate: provider.samlCertificate || "",
isEnabled: provider.isEnabled,
allowSignup: provider.allowSignup,
isGroupSyncEnabled: provider.isGroupSyncEnabled || false,
groupSync: provider.groupSync || false,
},
validate: zodResolver(ssoSchema),
});
@ -77,8 +77,8 @@ export function SsoSamlForm({ provider, onClose }: SsoFormProps) {
if (form.isDirty("allowSignup")) {
ssoData.allowSignup = values.allowSignup;
}
if (form.isDirty("isGroupSyncEnabled")) {
ssoData.isGroupSyncEnabled = values.isGroupSyncEnabled;
if (form.isDirty("groupSync")) {
ssoData.groupSync = values.groupSync;
}
await updateSsoProviderMutation.mutateAsync(ssoData);
@ -141,8 +141,8 @@ export function SsoSamlForm({ provider, onClose }: SsoFormProps) {
<div>{t("Group sync")}</div>
<Switch
className={classes.switch}
checked={form.values.isGroupSyncEnabled}
{...form.getInputProps("isGroupSyncEnabled")}
checked={form.values.groupSync}
{...form.getInputProps("groupSync")}
/>
</Group>

View File

@ -11,7 +11,7 @@ export interface IAuthProvider {
oidcClientSecret: string;
allowSignup: boolean;
isEnabled: boolean;
isGroupSyncEnabled: boolean;
groupSync: boolean;
creatorId: string;
workspaceId: string;
createdAt: Date;

View File

@ -3,15 +3,13 @@ import { type Kysely } from 'kysely';
export async function up(db: Kysely<any>): Promise<void> {
await db.schema
.alterTable('auth_providers')
.addColumn('is_group_sync_enabled', 'boolean', (col) =>
col.defaultTo(false).notNull(),
)
.addColumn('group_sync', 'boolean', (col) => col.defaultTo(false).notNull())
.execute();
}
export async function down(db: Kysely<any>): Promise<void> {
await db.schema
.alterTable('auth_providers')
.dropColumn('is_group_sync_enabled')
.dropColumn('group_sync')// enable_group_sync
.execute();
}

View File

@ -62,7 +62,7 @@ export interface AuthProviders {
deletedAt: Timestamp | null;
id: Generated<string>;
isEnabled: Generated<boolean>;
isGroupSyncEnabled: Generated<boolean>;
groupSync: Generated<boolean>;
name: string;
oidcClientId: string | null;
oidcClientSecret: string | null;