Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Nov 2, 2024
1 parent e722a37 commit cd1d575
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,11 @@ export const DELETE = request()
.use(
authz(async ({ can, extra }) => {
const { workspaceId, identifier } = extra.params;
const decodedIdentifier = decodeURIComponent(identifier);

console.log("workspaceId", workspaceId);
console.log("identifier", identifier);
console.log("decodedIdentifier", decodedIdentifier);

const target = await db.query.target.findFirst({
where: and(
eq(schema.target.workspaceId, workspaceId),
eq(schema.target.identifier, decodedIdentifier),
eq(schema.target.identifier, identifier),
),
});

Expand All @@ -82,17 +77,16 @@ export const DELETE = request()
)
.handle<unknown, { params: { workspaceId: string; identifier: string } }>(
async (_, { params }) => {
const decodedIdentifier = decodeURIComponent(params.identifier);
const target = await db.query.target.findFirst({
where: and(
eq(schema.target.workspaceId, params.workspaceId),
eq(schema.target.identifier, decodedIdentifier),
eq(schema.target.identifier, params.identifier),
),
});

if (target == null) {
return NextResponse.json(
{ error: `Target not found for identifier: ${decodedIdentifier}` },
{ error: `Target not found for identifier: ${params.identifier}` },
{ status: 404 },
);
}
Expand Down

0 comments on commit cd1d575

Please sign in to comment.