diff --git a/packages/core/src/project/copy.ts b/packages/core/src/project/copy.ts index 7a2b156df17..879c6258367 100644 --- a/packages/core/src/project/copy.ts +++ b/packages/core/src/project/copy.ts @@ -158,7 +158,7 @@ const layer = Layer.effect( const source = Effect.fnUntraced(function* (input: AbsolutePath, projectID: Project.ID) { const sourceDirectory = yield* canonical(input) - if (!(yield* directories.contains({ projectID, directory: sourceDirectory }))) + if ((yield* directories.get({ projectID, directory: sourceDirectory })) === undefined) return yield* new SourceDirectoryNotFoundError({ directory: sourceDirectory }) return sourceDirectory }) diff --git a/packages/core/src/project/directories.ts b/packages/core/src/project/directories.ts index ef0064c5d8f..0ee2b85f8aa 100644 --- a/packages/core/src/project/directories.ts +++ b/packages/core/src/project/directories.ts @@ -41,7 +41,6 @@ export interface Interface { projectID: ProjectSchema.ID directory: AbsolutePath }) => Effect.Effect - readonly contains: (input: { projectID: ProjectSchema.ID; directory: AbsolutePath }) => Effect.Effect readonly create: (input: CreateInput, tx?: Transaction) => Effect.Effect readonly remove: (input: RemoveInput, tx?: Transaction) => Effect.Effect } @@ -99,25 +98,6 @@ const layer = Layer.effect( return rows.map((row) => ({ directory: row.directory, strategy: row.strategy ?? undefined })) }) - const contains = Effect.fn("ProjectDirectories.contains")(function* (input: { - projectID: ProjectSchema.ID - directory: AbsolutePath - }) { - return ( - (yield* db - .select({ directory: ProjectDirectoryTable.directory }) - .from(ProjectDirectoryTable) - .where( - and( - eq(ProjectDirectoryTable.project_id, input.projectID), - eq(ProjectDirectoryTable.directory, input.directory), - ), - ) - .get() - .pipe(Effect.orDie)) !== undefined - ) - }) - const get = Effect.fn("ProjectDirectories.get")(function* (input: { projectID: ProjectSchema.ID directory: AbsolutePath @@ -139,7 +119,6 @@ const layer = Layer.effect( return Service.of({ list, get, - contains, create, remove, })