mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-09 23:48:36 +01:00
add dashboard
This commit is contained in:
16
dashboard/server/LIVE_DEMO_DATA.ts
Normal file
16
dashboard/server/LIVE_DEMO_DATA.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { AuthContext } from "./middleware/01-authorization";
|
||||
import { ProjectModel } from "~/../shared/schema/ProjectSchema";
|
||||
import { LITLYX_PROJECT_ID } from '@data/LITLYX'
|
||||
|
||||
export async function getUserProjectFromId(project_id: string, user: AuthContext | undefined) {
|
||||
if (project_id == LITLYX_PROJECT_ID) {
|
||||
const project = await ProjectModel.findOne({ _id: project_id });
|
||||
return project;
|
||||
} else {
|
||||
if (!user?.logged) return;
|
||||
const project = await ProjectModel.findOne({ _id: project_id, owner: user.id });
|
||||
return project;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user