mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
feat: move opengraph-image to next.js 13 implementation
This commit is contained in:
committed by
Mythie
parent
57ff77b920
commit
794e575ae9
@ -1,12 +1,13 @@
|
||||
import { TRPCError } from '@trpc/server';
|
||||
|
||||
import { createSharingId } from '@documenso/lib/server-only/share/create-share-id';
|
||||
import { getSharingId } from '@documenso/lib/server-only/share/get-share-id';
|
||||
|
||||
import { procedure, router } from '../trpc';
|
||||
import { ZShareLinkSchema } from './schema';
|
||||
import { ZShareLinkCreateSchema, ZShareLinkGetSchema } from './schema';
|
||||
|
||||
export const shareRouter = router({
|
||||
create: procedure.input(ZShareLinkSchema).mutation(async ({ input }) => {
|
||||
create: procedure.input(ZShareLinkCreateSchema).mutation(async ({ input }) => {
|
||||
try {
|
||||
const { documentId, recipientId } = input;
|
||||
|
||||
@ -14,6 +15,20 @@ export const shareRouter = router({
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
||||
throw new TRPCError({
|
||||
code: 'BAD_REQUEST',
|
||||
message: 'We were unable to create a sharing link.',
|
||||
});
|
||||
}
|
||||
}),
|
||||
get: procedure.input(ZShareLinkGetSchema).query(async ({ input }) => {
|
||||
try {
|
||||
const { shareId } = input;
|
||||
|
||||
return await getSharingId({ shareId });
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
||||
throw new TRPCError({
|
||||
code: 'BAD_REQUEST',
|
||||
message: 'We were unable to create a sharing link.',
|
||||
|
||||
Reference in New Issue
Block a user