mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
feat: create sharing id for each recipient
This commit is contained in:
committed by
Mythie
parent
1bce169228
commit
ebcd7c78e4
20
packages/lib/server-only/share/create-share-id.ts
Normal file
20
packages/lib/server-only/share/create-share-id.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { nanoid } from 'nanoid';
|
||||
|
||||
import { prisma } from '@documenso/prisma';
|
||||
|
||||
export interface CreateSharingIdOptions {
|
||||
documentId: number;
|
||||
recipientId: number;
|
||||
}
|
||||
|
||||
export const createSharingId = async ({ documentId, recipientId }: CreateSharingIdOptions) => {
|
||||
const result = await prisma.share.create({
|
||||
data: {
|
||||
recipientId,
|
||||
documentId,
|
||||
link: nanoid(),
|
||||
},
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
Reference in New Issue
Block a user