Fix in news, first android notification service
Some checks failed
Code Analysis and Production Deploy / analyze (push) Failing after 7m50s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Has been skipped

This commit is contained in:
Torsten Schulz (local)
2026-06-10 13:47:33 +02:00
parent e8a50e55ca
commit 5da11d2e4d
28 changed files with 1277 additions and 43 deletions

View File

@@ -1,5 +1,6 @@
import { verifyToken, getUserById, hasAnyRole } from '../utils/auth.js'
import { saveNews } from '../utils/news.js'
import { sendNewNewsPush } from '../utils/push-notifications.js'
export default defineEventHandler(async (event) => {
try {
@@ -41,7 +42,7 @@ export default defineEventHandler(async (event) => {
})
}
await saveNews({
const newsEntry = {
id: id || undefined,
title,
content,
@@ -49,7 +50,13 @@ export default defineEventHandler(async (event) => {
expiresAt: expiresAt || undefined,
isHidden: isHidden || false,
author: user.name
})
}
await saveNews(newsEntry)
if (!id && !newsEntry.isHidden) {
sendNewNewsPush(newsEntry).catch(error => {
console.error('News-Push konnte nicht gesendet werden:', error)
})
}
return {
success: true,