mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
implement website share functionality using share table
- Add support for multiple share URLs per website with server-generated slugs - Create shares API endpoint for listing and creating website shares - Add SharesTable, ShareEditButton, ShareDeleteButton components - Move share management to website settings, remove header share button - Remove shareId from website update API (now uses separate share table) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
3a498333a6
commit
0eb598c817
13 changed files with 374 additions and 127 deletions
|
|
@ -1,14 +1,15 @@
|
|||
import type { Prisma } from '@/generated/prisma/client';
|
||||
import prisma from '@/lib/prisma';
|
||||
import type { QueryFilters } from '@/lib/types';
|
||||
|
||||
export async function findShare(criteria: Prisma.ShareFindUniqueArgs) {
|
||||
return prisma.client.share.findUnique(criteria);
|
||||
}
|
||||
|
||||
export async function getShare(entityId: string) {
|
||||
export async function getShare(shareId: string) {
|
||||
return findShare({
|
||||
where: {
|
||||
id: entityId,
|
||||
id: shareId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -21,6 +22,23 @@ export async function getShareByCode(slug: string) {
|
|||
});
|
||||
}
|
||||
|
||||
export async function getSharesByEntityId(entityId: string, filters?: QueryFilters) {
|
||||
const { pagedQuery } = prisma;
|
||||
|
||||
return pagedQuery(
|
||||
'share',
|
||||
{
|
||||
where: {
|
||||
entityId,
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
},
|
||||
filters,
|
||||
);
|
||||
}
|
||||
|
||||
export async function createShare(
|
||||
data: Prisma.ShareCreateInput | Prisma.ShareUncheckedCreateInput,
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue