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

Function insertCourse

src/features/courses/db/courses.ts:6–12  ·  view source on GitHub ↗
(data: typeof CourseTable.$inferInsert)

Source from the content-addressed store, hash-verified

4import { eq } from "drizzle-orm"
5
6export async function insertCourse(data: typeof CourseTable.$inferInsert) {
7 const [newCourse] = await db.insert(CourseTable).values(data).returning()
8 if (newCourse == null) throw new Error("Failed to create course")
9 revalidateCourseCache(newCourse.id)
10
11 return newCourse
12}
13
14export async function updateCourse(
15 id: string,

Callers 1

createCourseFunction · 0.90

Calls 1

revalidateCourseCacheFunction · 0.90

Tested by

no test coverage detected