( id: string, unsafeData: z.infer<typeof lessonSchema> )
| 31 | } |
| 32 | |
| 33 | export async function updateLesson( |
| 34 | id: string, |
| 35 | unsafeData: z.infer<typeof lessonSchema> |
| 36 | ) { |
| 37 | const { success, data } = lessonSchema.safeParse(unsafeData) |
| 38 | |
| 39 | if (!success || !canUpdateLessons(await getCurrentUser())) { |
| 40 | return { error: true, message: "There was an error updating your lesson" } |
| 41 | } |
| 42 | |
| 43 | await updateLessonDb(id, data) |
| 44 | |
| 45 | return { error: false, message: "Successfully updated your lesson" } |
| 46 | } |
| 47 | |
| 48 | export async function deleteLesson(id: string) { |
| 49 | if (!canDeleteLessons(await getCurrentUser())) { |
nothing calls this directly
no test coverage detected