mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
new selfhosted version
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
|
||||
import { FeedbackModel } from '@schema/FeedbackSchema';
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
const data = await getRequestDataOld(event);
|
||||
if (!data) return;
|
||||
|
||||
const { text } = await readBody(event);
|
||||
|
||||
const save = await FeedbackModel.create({
|
||||
user_id: data.user.id,
|
||||
project_id: data.project_id,
|
||||
text
|
||||
});
|
||||
|
||||
return { ok: true }
|
||||
|
||||
});
|
||||
18
dashboard/server/api/feedback/send.post.ts
Normal file
18
dashboard/server/api/feedback/send.post.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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 })
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user