-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"Flag Obnoxious", Spell check on system prompt
- Loading branch information
1 parent
9fe1787
commit a38dc54
Showing
5 changed files
with
40 additions
and
16 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
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,24 @@ | ||
import { z } from "zod"; | ||
import { procedure } from "../trpc"; | ||
import { prismaClient } from "../prisma-client"; | ||
|
||
/** Flag cards that are leeches or excessively hard. */ | ||
export const flagObnoxious = procedure | ||
.input(z.object({})) | ||
.output(z.object({ message: z.string() })) | ||
.mutation(async ({ ctx }) => { | ||
const userId = ctx.user?.id; | ||
if (!userId) { | ||
return { message: `["No user ID"]` }; | ||
} | ||
const { count } = await prismaClient.card.updateMany({ | ||
where: { | ||
userId, | ||
OR: [{ lapses: { gte: 7 } }, { ease: { lte: 1.31 } }], | ||
}, | ||
data: { | ||
flagged: true, | ||
}, | ||
}); | ||
return { message: JSON.stringify([`Flagged ${count} cards.`]) }; | ||
}); |
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