mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
update ui
This commit is contained in:
31
dashboard/server/api/admin/feedbacks.ts
Normal file
31
dashboard/server/api/admin/feedbacks.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
import { FeedbackModel } from '@schema/FeedbackSchema';
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
|
||||
const userData = getRequestUser(event);
|
||||
if (!userData?.logged) return;
|
||||
if (!userData.user.roles.includes('ADMIN')) return;
|
||||
|
||||
const feedbacks = await FeedbackModel.aggregate([
|
||||
{
|
||||
$lookup: {
|
||||
from: 'users',
|
||||
localField: 'user_id',
|
||||
foreignField: '_id',
|
||||
as: 'user'
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'projects',
|
||||
localField: 'project_id',
|
||||
foreignField: '_id',
|
||||
as: 'project'
|
||||
}
|
||||
},
|
||||
])
|
||||
|
||||
return feedbacks;
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user