feat(auth): implement session token creation and verification for enhanced security
feat(api): require session authentication for admin routes and improve error handling fix(api): streamline project image generation by fetching data directly from the database fix(api): optimize project import/export functionality with session validation and improved error handling fix(api): enhance analytics dashboard and email manager with session token for admin requests fix(components): improve loading states and dynamic imports for better user experience chore(security): update Content Security Policy to avoid unsafe-eval in production chore(deps): update package.json scripts for consistent environment handling in linting and testing
This commit is contained in:
@@ -159,14 +159,16 @@ export const projectService = {
|
||||
prisma.userInteraction.groupBy({
|
||||
by: ['type'],
|
||||
where: { projectId },
|
||||
_count: { _all: true },
|
||||
})
|
||||
]);
|
||||
|
||||
const analytics: Record<string, number> = { views: pageViews, likes: 0, shares: 0 };
|
||||
|
||||
interactions.forEach(interaction => {
|
||||
if (interaction.type === 'LIKE') analytics.likes = 0;
|
||||
if (interaction.type === 'SHARE') analytics.shares = 0;
|
||||
const count = (interaction as unknown as { _count?: { _all?: number } })._count?._all ?? 0;
|
||||
if (interaction.type === 'LIKE') analytics.likes = count;
|
||||
if (interaction.type === 'SHARE') analytics.shares = count;
|
||||
});
|
||||
|
||||
return analytics;
|
||||
|
||||
Reference in New Issue
Block a user