Lint code

Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
2024-04-20 01:33:40 +02:00
parent a29f6bc0f6
commit 5ca0137c4e
67 changed files with 2671 additions and 2671 deletions

View File

@@ -1,30 +1,30 @@
import {z} from 'zod'
const MessageValidator = z.object({
message: z.string(),
message: z.string(),
}).parse
export default defineEventHandler(async (event) => {
const { message } = await readValidatedBody(event, MessageValidator)
const { user } = await requireUserSession(event)
const config = useRuntimeConfig(event)
const { message } = await readValidatedBody(event, MessageValidator)
const { user } = await requireUserSession(event)
const config = useRuntimeConfig(event)
await sendDiscordWebhookMessage(config, {
title: 'New guestbook message ✨',
description: `**${user.username}** has signed the book : "*${message}*"`,
color: 15893567,
})
return useDB().insert(tables.guestbookMessages)
.values({
message,
email: user.email,
username: user.username,
image: user.picture,
})
.onConflictDoUpdate({
target: tables.guestbookMessages.email,
set: {
message,
},
})
await sendDiscordWebhookMessage(config, {
title: 'New guestbook message ✨',
description: `**${user.username}** has signed the book : "*${message}*"`,
color: 15893567,
})
return useDB().insert(tables.guestbookMessages)
.values({
message,
email: user.email,
username: user.username,
image: user.picture,
})
.onConflictDoUpdate({
target: tables.guestbookMessages.email,
set: {
message,
},
})
})