mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-21 19:38:47 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user