-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add user-specific data fetching and initialization
- Added getAllCompleted action to fetch all completed tasks for a user. - Added getCompletedCount action to fetch the count of completed tasks for a user. - Updated
- Loading branch information
1 parent
c6dabf6
commit 16a3045
Showing
6 changed files
with
50 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { prisma } from '@/lib/prisma' | ||
import type { User } from '@/types/prisma' | ||
|
||
export async function getAllCompleted(user: User) { | ||
return prisma.completed.findMany({ | ||
where: { userId: user?.id }, | ||
include: { category: true }, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { prisma } from '@/lib/prisma' | ||
import type { User } from '@/types/prisma' | ||
|
||
export async function getCompletedCount(user: User) { | ||
return prisma.completed.count({ | ||
where: { userId: user?.id }, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function Spinner() { | ||
return <span className="loading loading-spinner loading-lg"></span> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters