( id: string, unsafeData: z.infer<typeof courseSchema> )
| 28 | } |
| 29 | |
| 30 | export async function updateCourse( |
| 31 | id: string, |
| 32 | unsafeData: z.infer<typeof courseSchema> |
| 33 | ) { |
| 34 | const { success, data } = courseSchema.safeParse(unsafeData) |
| 35 | |
| 36 | if (!success || !canUpdateCourses(await getCurrentUser())) { |
| 37 | return { error: true, message: "There was an error updating your course" } |
| 38 | } |
| 39 | |
| 40 | await updateCourseDb(id, data) |
| 41 | |
| 42 | return { error: false, message: "Successfully updated your course" } |
| 43 | } |
| 44 | |
| 45 | export async function deleteCourse(id: string) { |
| 46 | if (!canDeleteCourses(await getCurrentUser())) { |
nothing calls this directly
no test coverage detected