mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
refactoring
This commit is contained in:
18
dashboard/server/api/project/links/list.ts
Normal file
18
dashboard/server/api/project/links/list.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
import { UserModel } from "@schema/UserSchema";
|
||||
import { ProjectLinkModel } from "~/shared/schema/project/ProjectLinkSchema";
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
|
||||
const data = await getRequestData(event, [], ['OWNER']);
|
||||
if (!data) return;
|
||||
|
||||
const { project_id, project } = data;
|
||||
|
||||
const owner = await UserModel.findById(project.owner);
|
||||
if (!owner) return setResponseStatus(event, 400, 'No owner');
|
||||
|
||||
const links = await ProjectLinkModel.find({ project_id });
|
||||
return links;
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user