fix: Dsync bugs (#14027)
* Fix dsync create mutation * Small fixes * Don't throw error when deleting dsync data * Change to deleteMany
This commit is contained in:
@@ -94,7 +94,11 @@ const ConfigureDirectorySync = ({ organizationId }: { organizationId: number | n
|
||||
</div>
|
||||
<DialogFooter showDivider>
|
||||
<DialogClose />
|
||||
<Button color="primary" data-testid="delete-account-confirm" onClick={onDeleteConfirmation}>
|
||||
<Button
|
||||
color="primary"
|
||||
data-testid="delete-account-confirm"
|
||||
onClick={onDeleteConfirmation}
|
||||
loading={deleteMutation.isPending}>
|
||||
{t("directory_sync_delete_connection")}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
|
||||
@@ -57,7 +57,7 @@ const CreateDirectory = ({ orgId }: { orgId: number | null }) => {
|
||||
handleSubmit={(values) => {
|
||||
mutation.mutate({
|
||||
...values,
|
||||
orgId,
|
||||
organizationId: orgId,
|
||||
});
|
||||
}}>
|
||||
<div className="mb-5 mt-1">
|
||||
@@ -112,7 +112,7 @@ const CreateDirectory = ({ orgId }: { orgId: number | null }) => {
|
||||
tabIndex={-1}>
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
<Button type="submit" loading={form.formState.isSubmitting}>
|
||||
<Button type="submit" loading={form.formState.isSubmitting || mutation.isPending}>
|
||||
{t("save")}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
|
||||
@@ -18,10 +18,10 @@ type Options = {
|
||||
|
||||
// Create directory sync connection for a team
|
||||
export const createHandler = async ({ ctx, input }: Options) => {
|
||||
const { orgId } = input;
|
||||
const { organizationId } = input;
|
||||
const { dsyncController } = await jackson();
|
||||
|
||||
const { message, access } = await canAccess(ctx.user, orgId);
|
||||
const { message, access } = await canAccess(ctx.user, organizationId);
|
||||
|
||||
if (!access) {
|
||||
throw new TRPCError({
|
||||
@@ -30,7 +30,7 @@ export const createHandler = async ({ ctx, input }: Options) => {
|
||||
});
|
||||
}
|
||||
|
||||
const tenant = orgId ? `${tenantPrefix}${orgId}` : (samlTenantID as string);
|
||||
const tenant = organizationId ? `${tenantPrefix}${organizationId}` : (samlTenantID as string);
|
||||
|
||||
const { data, error } = await dsyncController.directories.create({
|
||||
tenant,
|
||||
@@ -48,7 +48,7 @@ export const createHandler = async ({ ctx, input }: Options) => {
|
||||
data: {
|
||||
directoryId: data.id,
|
||||
tenant,
|
||||
...(orgId && { orgId }),
|
||||
...(organizationId && { organizationId }),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const ZCreateInputSchema = z.object({
|
||||
orgId: z.union([z.number(), z.null()]),
|
||||
organizationId: z.union([z.number(), z.null()]),
|
||||
name: z.string(),
|
||||
provider: z.string(),
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ export const deleteHandler = async ({ ctx, input }: Options) => {
|
||||
});
|
||||
}
|
||||
|
||||
await prisma.dSyncData.delete({
|
||||
await prisma.dSyncData.deleteMany({
|
||||
where: {
|
||||
organizationId: input.organizationId || undefined,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user