MCPcopy Create free account
hub / github.com/WebDevSimplified/course-platform / updateLesson

Function updateLesson

src/features/lessons/actions/lessons.ts:33–46  ·  view source on GitHub ↗
(
  id: string,
  unsafeData: z.infer<typeof lessonSchema>
)

Source from the content-addressed store, hash-verified

31}
32
33export 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
48export async function deleteLesson(id: string) {
49 if (!canDeleteLessons(await getCurrentUser())) {

Callers

nothing calls this directly

Calls 2

canUpdateLessonsFunction · 0.90
getCurrentUserFunction · 0.90

Tested by

no test coverage detected