Skip to content

Commit

Permalink
small migration and error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vincanger committed Nov 19, 2024
1 parent a8654e3 commit 85fcc8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.

This file was deleted.

5 changes: 4 additions & 1 deletion template/app/src/analytics/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ export const getDailyStats: GetDailyStats<void, DailyStatsValues> = async (_args
if (!context.user?.isAdmin) {
throw new HttpError(401);
}
const dailyStats = await context.entities.DailyStats.findFirstOrThrow({
const dailyStats = await context.entities.DailyStats.findFirst({
orderBy: {
date: 'desc',
},
include: {
sources: true,
},
});
if (!dailyStats) {
throw new HttpError(204, 'No daily stats generated yet.');
}

const weeklyStats = await context.entities.DailyStats.findMany({
orderBy: {
Expand Down

0 comments on commit 85fcc8b

Please sign in to comment.