Skip to content

Commit

Permalink
👕
Browse files Browse the repository at this point in the history
  • Loading branch information
flvndvd committed Oct 21, 2024
1 parent aa73104 commit ac128c6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
1 change: 0 additions & 1 deletion front/lib/swr/vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ export function useUpdateVault({ owner }: { owner: LightWorkspaceType }) {
},
body: JSON.stringify({
name: newName,
isRestricted,
}),
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
DataSourceViewType,
WithAPIErrorResponse,
} from "@dust-tt/types";
import { PostDataSourceViewSchema } from "@dust-tt/types";
import { ContentSchema } from "@dust-tt/types";
import { isLeft } from "fp-ts/lib/Either";
import * as reporter from "io-ts-reporters";
import type { NextApiRequest, NextApiResponse } from "next";
Expand Down Expand Up @@ -35,6 +35,8 @@ export type PostVaultDataSourceViewsResponseBody = {
dataSourceView: DataSourceViewType;
};

const PostDataSourceViewSchema = ContentSchema;

async function handler(
req: NextApiRequest,
res: NextApiResponse<
Expand Down
4 changes: 1 addition & 3 deletions front/pages/api/w/[wId]/vaults/[vId]/members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { isLeft } from "fp-ts/lib/Either";
import * as reporter from "io-ts-reporters";
import type { NextApiRequest, NextApiResponse } from "next";

import { updateVaultPermissions } from "@app/lib/api/vaults";
import { withSessionAuthenticationForWorkspace } from "@app/lib/api/wrappers";
import type { Authenticator } from "@app/lib/auth";
import { DustError } from "@app/lib/error";
Expand Down Expand Up @@ -71,9 +70,8 @@ async function handler(
});
}

const updateRes = await updateVaultPermissions(
const updateRes = await vault.updatePermissions(
auth,
vault,
bodyValidation.right
);
if (updateRes.isErr()) {
Expand Down
16 changes: 16 additions & 0 deletions types/src/front/api_handlers/internal/vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,19 @@ export const PatchVaultMembersRequestBodySchema = t.union([
PostRestrictedVault,
PostUnrestrictedVault,
]);

export const ContentSchema = t.type({
dataSourceId: t.string,
parentsIn: t.array(t.string),
});

export const PatchVaultRequestBodySchema = t.type({
name: t.union([t.string, t.undefined]),
content: t.union([t.array(ContentSchema), t.undefined]),
});

export type PatchVaultRequestBodyType = t.TypeOf<
typeof PatchVaultRequestBodySchema
>;

export const PostDataSourceViewSchema = ContentSchema;
18 changes: 0 additions & 18 deletions types/src/front/api_handlers/public/vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ import * as t from "io-ts";

import { ContentNodeType } from "../../lib/connectors_api";

export const ContentSchema = t.type({
dataSourceId: t.string,
parentsIn: t.array(t.string),
});

export const PostDataSourceViewSchema = ContentSchema;

export type PostDataSourceViewType = t.TypeOf<typeof PostDataSourceViewSchema>;

const ParentsToAddRemoveSchema = t.type({
parentsToAdd: t.union([t.array(t.string), t.undefined]),
parentsToRemove: t.union([t.array(t.string), t.undefined]),
Expand All @@ -29,15 +20,6 @@ export type PatchDataSourceViewType = t.TypeOf<
typeof PatchDataSourceViewSchema
>;

export const PatchVaultRequestBodySchema = t.type({
name: t.union([t.string, t.undefined]),
content: t.union([t.array(ContentSchema), t.undefined]),
});

export type PatchVaultRequestBodyType = t.TypeOf<
typeof PatchVaultRequestBodySchema
>;

export type LightContentNode = {
dustDocumentId: string | null;
expandable: boolean;
Expand Down

0 comments on commit ac128c6

Please sign in to comment.