Songs & dates

This commit is contained in:
2025-10-02 08:59:05 -04:00
parent dfe3517ac6
commit 27fcedfcd5
6 changed files with 207 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ export default defineEventHandler(async (event) => {
}
const body = await readBody(event)
const { slug, title, date, bible_references, personal_appliance, pastors_challenge } = body
const { slug, title, date, dates, bible_references, personal_appliance, pastors_challenge, worship_songs } = body
if (!slug || !title || !date || !bible_references || !personal_appliance || !pastors_challenge) {
throw createError({
@@ -25,9 +25,11 @@ export default defineEventHandler(async (event) => {
slug,
title,
date,
dates,
bible_references,
personal_appliance,
pastors_challenge
pastors_challenge,
worship_songs
})
return {

View File

@@ -20,7 +20,7 @@ export default defineEventHandler(async (event) => {
}
const body = await readBody(event)
const { slug, title, date, bible_references, personal_appliance, pastors_challenge } = body
const { slug, title, date, dates, bible_references, personal_appliance, pastors_challenge, worship_songs } = body
if (!slug || !title || !date || !bible_references || !personal_appliance || !pastors_challenge) {
throw createError({
@@ -33,10 +33,10 @@ export default defineEventHandler(async (event) => {
const db = getDatabase()
const result = db.prepare(`
UPDATE sermons
SET slug = ?, title = ?, date = ?, bible_references = ?,
personal_appliance = ?, pastors_challenge = ?
SET slug = ?, title = ?, date = ?, dates = ?, bible_references = ?,
personal_appliance = ?, pastors_challenge = ?, worship_songs = ?
WHERE id = ?
`).run(slug, title, date, bible_references, personal_appliance, pastors_challenge, parseInt(id))
`).run(slug, title, date, dates || null, bible_references, personal_appliance, pastors_challenge, worship_songs || null, parseInt(id))
if (result.changes === 0) {
throw createError({