[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2026-03-19 07:32:43 +00:00
committed by GitHub
parent 8304513501
commit 1d7509dfc2
+24 -26
View File
@@ -64,36 +64,34 @@ export const tagRouter = createTRPCRouter({
} }
}), }),
one: protectedProcedure one: protectedProcedure.input(apiFindOneTag).query(async ({ input, ctx }) => {
.input(apiFindOneTag) try {
.query(async ({ input, ctx }) => { const tag = await db.query.tags.findFirst({
try { where: and(
const tag = await db.query.tags.findFirst({ eq(tags.tagId, input.tagId),
where: and( eq(tags.organizationId, ctx.session.activeOrganizationId),
eq(tags.tagId, input.tagId), ),
eq(tags.organizationId, ctx.session.activeOrganizationId), });
),
});
if (!tag) { if (!tag) {
throw new TRPCError({
code: "NOT_FOUND",
message: "Tag not found",
});
}
return tag;
} catch (error) {
if (error instanceof TRPCError) {
throw error;
}
throw new TRPCError({ throw new TRPCError({
code: "INTERNAL_SERVER_ERROR", code: "NOT_FOUND",
message: `Error fetching tag: ${error instanceof Error ? error.message : error}`, message: "Tag not found",
cause: error,
}); });
} }
}),
return tag;
} catch (error) {
if (error instanceof TRPCError) {
throw error;
}
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
message: `Error fetching tag: ${error instanceof Error ? error.message : error}`,
cause: error,
});
}
}),
update: withPermission("tag", "update") update: withPermission("tag", "update")
.input(apiUpdateTag) .input(apiUpdateTag)