Add streak counter to flashcards
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m17s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m17s
This commit is contained in:
parent
a6af3a49ad
commit
32bce673ac
6 changed files with 452 additions and 6 deletions
|
|
@ -49,6 +49,49 @@ export async function getShareLink(token: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Names, descriptions and counts only — enough to build social/link-preview
|
||||
* metadata without loading every card, question and option.
|
||||
*/
|
||||
export async function getShareLinkMeta(token: string) {
|
||||
return prisma.shareLink.findUnique({
|
||||
where: { id: token },
|
||||
select: {
|
||||
deck: {
|
||||
select: {
|
||||
name: true,
|
||||
description: true,
|
||||
class: { select: { slug: true, name: true } },
|
||||
_count: { select: { cards: true } },
|
||||
},
|
||||
},
|
||||
quizSet: {
|
||||
select: {
|
||||
name: true,
|
||||
description: true,
|
||||
class: { select: { slug: true, name: true } },
|
||||
_count: { select: { questions: true } },
|
||||
},
|
||||
},
|
||||
group: {
|
||||
select: {
|
||||
name: true,
|
||||
type: true,
|
||||
class: { select: { slug: true, name: true } },
|
||||
decks: {
|
||||
select: { id: true, name: true, description: true, _count: { select: { cards: true } } },
|
||||
orderBy: { sortOrder: "asc" },
|
||||
},
|
||||
quizSets: {
|
||||
select: { id: true, name: true, description: true, _count: { select: { questions: true } } },
|
||||
orderBy: { sortOrder: "asc" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function getShareLinkForContent(targetType: "DECK" | "QUIZ" | "GROUP", contentId: string) {
|
||||
if (targetType === "DECK") {
|
||||
return prisma.shareLink.findUnique({ where: { deckId: contentId } });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue