mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
add dashboard
This commit is contained in:
12
dashboard/server/api/project/list.ts
Normal file
12
dashboard/server/api/project/list.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ProjectModel, TProject } from "@schema/ProjectSchema";
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
|
||||
const userData = getRequestUser(event);
|
||||
if (!userData?.logged) return [];
|
||||
|
||||
|
||||
const userProjects = await ProjectModel.find({ owner: userData.id });
|
||||
return userProjects.map(e => e.toJSON()) as TProject[];
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user