protectedProcedure
.input(
type({
url: type("string.url > 0").configure({
message: () => "URL is invalid.",
}),
}),
)
.mutation(async ({ ctx, input }) => {
const urlAlreadyExists = false // check against DB or API
type({
"url": type("true").configure({
message: "URL already exists.",
}),
}).assert({ "url": urlAlreadyExists });
// Do something with the URL
})
protectedProcedure
.input(
type({
url: type("string.url > 0").configure({
message: () => "URL is invalid.",
}),
}),
)
.mutation(async ({ ctx, input }) => {
const urlAlreadyExists = false // check against DB or API
type({
"url": type("true").configure({
message: "URL already exists.",
}),
}).assert({ "url": urlAlreadyExists });
// Do something with the URL
})