Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier committed Aug 11, 2024
1 parent 53b782d commit a44cb08
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
12 changes: 6 additions & 6 deletions front/lib/resources/data_source_view_resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ export class DataSourceViewResource extends ResourceWithVault<DataSourceViewMode
constructor(
model: ModelStatic<DataSourceViewModel>,
blob: Attributes<DataSourceViewModel>,
vault: VaultResource,
dataSource: DataSourceResource
vault: VaultResource
) {
super(DataSourceViewModel, blob, vault);
this.ds = dataSource;
}

// Creation.
Expand All @@ -53,13 +51,15 @@ export class DataSourceViewResource extends ResourceWithVault<DataSourceViewMode
...blob,
vaultId: vault.id,
});
return new this(DataSourceViewResource.model, key.get(), vault, dataSource);
const dsv = new this(DataSourceViewResource.model, key.get(), vault);
dsv.ds = dataSource;
return dsv;
}

static async createViewInVaultFromDataSource(
vault: VaultResource,
dataSource: DataSourceResource,
parentsIn: string[]
parentsIn: string[] | null
) {
return this.makeNew(
{
Expand Down Expand Up @@ -167,7 +167,7 @@ export class DataSourceViewResource extends ResourceWithVault<DataSourceViewMode
// Updating.
async updateParents(
auth: Authenticator,
parentsIn: string[]
parentsIn: string[] | null
): Promise<Result<undefined, Error>> {
try {
const [, affectedRows] = await this.model.update(
Expand Down
1 change: 0 additions & 1 deletion front/pages/api/registry/[type]/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ async function handleDataSourceView(
if (!dataSource) {
return new Err(new Error("Data source not found for view."));
}

return new Ok({
project_id: parseInt(dataSource.dustAPIProjectId),
data_source_id: dataSource.name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { WithAPIErrorResponse } from "@dust-tt/types";
import type { NextApiRequest, NextApiResponse } from "next";

import type { GetDataSourceContentResponseBody } from "@app/lib/api/vaults";
import type { GetDataSourceOrViewContentResponseBody } from "@app/lib/api/vaults";
import { getContentHandler } from "@app/lib/api/vaults";
import { withSessionAuthenticationForWorkspace } from "@app/lib/api/wrappers";
import type { Authenticator } from "@app/lib/auth";
Expand All @@ -10,7 +10,9 @@ import { apiError } from "@app/logger/withlogging";

async function handler(
req: NextApiRequest,
res: NextApiResponse<WithAPIErrorResponse<GetDataSourceContentResponseBody>>,
res: NextApiResponse<
WithAPIErrorResponse<GetDataSourceOrViewContentResponseBody>
>,
auth: Authenticator
): Promise<void> {
const owner = auth.workspace();
Expand Down

0 comments on commit a44cb08

Please sign in to comment.