Skip to content

Commit

Permalink
fix: write guid to egghead for new lessons
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhooks committed Nov 19, 2024
1 parent 7db1baf commit 694ae99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/egghead/src/lib/egghead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ export async function getEggheadLesson(eggheadLessonId: number) {
export async function createEggheadLesson(input: {
title: string
slug: string
guid: string
instructorId: string | number
}) {
const { title, slug, instructorId } = input
const { title, slug, guid, instructorId } = input
const eggheadLessonResult = await eggheadPgQuery(
`INSERT INTO lessons (title, instructor_id, slug, resource_type, state,
created_at, updated_at, visibility_state)
VALUES ($1, $2, $3, $4, $5,NOW(), NOW(), $6)
created_at, updated_at, visibility_state, guid)
VALUES ($1, $2, $3, $4, $5,NOW(), NOW(), $6, $7)
RETURNING id`,
[
title,
Expand All @@ -90,6 +91,7 @@ export async function createEggheadLesson(input: {
EGGHEAD_LESSON_TYPE,
EGGHEAD_INITIAL_LESSON_STATE,
'hidden',
guid,
],
)

Expand Down
1 change: 1 addition & 0 deletions apps/egghead/src/lib/posts-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ export async function writeNewPostToDatabase(input: {
title: title,
slug: `${slugify(title)}~${postGuid}`,
instructorId: eggheadInstructorId,
guid: postGuid,
})

await db
Expand Down

0 comments on commit 694ae99

Please sign in to comment.