mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
18 lines
506 B
TypeScript
18 lines
506 B
TypeScript
import { FeedbackModel } from "~/shared/schema/FeedbackSchema";
|
|
|
|
export default defineEventHandler(async event => {
|
|
|
|
if (isSelfhosted()) return;
|
|
|
|
const ctx = await getRequestContext(event, 'pid');
|
|
const { project_id, user_id } = ctx;
|
|
|
|
const { text } = await readBody(event);
|
|
|
|
if (!text || typeof text != 'string' || text.length == 0) {
|
|
throw createError({ status: 400, message: 'Something went wrong.' })
|
|
}
|
|
|
|
await FeedbackModel.create({ project_id, user_id, text })
|
|
|
|
}); |