feat: create a banner with custom text by admin

This commit is contained in:
Ephraim Atta-Duncan
2024-02-22 20:13:17 +00:00
parent 15e191f62d
commit c436559787
15 changed files with 291 additions and 12 deletions

View File

@ -0,0 +1,27 @@
import { TRPCError } from '@trpc/server';
import { upsertBanner } from '@documenso/lib/server-only/banner/upsert-banner';
import { adminProcedure, router } from '../trpc';
import { ZCreateBannerByAdminSchema } from './schema';
export const bannerRouter = router({
updateBanner: adminProcedure
.input(ZCreateBannerByAdminSchema)
.mutation(async ({ input, ctx }) => {
const { show, text } = input;
try {
return await upsertBanner({
userId: ctx.user.id,
show,
text,
});
} catch (err) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: 'We were unable to update your banner. Please try again.',
});
}
}),
});