+
← Zurück
@@ -78,14 +78,55 @@ export default async function Page({
Diplom- und Abschlussarbeiten ({result.year})
-
{result.title}
+
{result.title}
-
Zielsetzung
-
{result.goal}
-
Problemstellung
-
{result.issue}
-
Ergebnisse
-
{result.result}
+
+
+
+ Zielsetzung
+
+ {result.goal}
+
+
+
+
+ Problemstellung
+
+ {result.issue}
+
+
+
+
+ Ergebnisse
+
+ {result.result}
+
+
+
+
+ Technologien
+
+
+ {result.technologies.map((technology) => (
+
+

+
+
{technology.technology.name}
+
{technology.description}
+
+
+ ))}
+
+
+
+
);
}
diff --git a/src/app/(payload)/api/diplomarbeiten/route.ts b/src/app/(payload)/api/diplomarbeiten/route.ts
index 9ff9779..3ed9fcd 100644
--- a/src/app/(payload)/api/diplomarbeiten/route.ts
+++ b/src/app/(payload)/api/diplomarbeiten/route.ts
@@ -15,13 +15,18 @@ export async function GET(req: NextRequest) {
const response = await payload.find({
collection: 'papers',
where: {
- or: [
- { title: { contains: search } },
- { issue: { contains: search } },
- { goal: { contains: search } },
- { 'technologies.description': { contains: search } },
- { 'prototype.description': { contains: search } },
- { 'authors.description': { contains: search } },
+ and: [
+ { published: { equals: true } },
+ {
+ or: [
+ { title: { contains: search } },
+ { issue: { contains: search } },
+ { goal: { contains: search } },
+ { 'technologies.description': { contains: search } },
+ { 'prototype.description': { contains: search } },
+ { 'authors.description': { contains: search } },
+ ],
+ },
],
},
});
diff --git a/src/collections/Media.ts b/src/collections/Media.ts
index 5de7722..7e0942c 100644
--- a/src/collections/Media.ts
+++ b/src/collections/Media.ts
@@ -18,6 +18,7 @@ export const Media: CollectionConfig = {
create: ({ req: { user } }) => Boolean(user),
update: ({ req: { user } }) => Boolean(user && user.role === 'admin'),
delete: ({ req: { user } }) => Boolean(user && user.role === 'admin'),
+ read: () => true,
},
fields: [
{
diff --git a/src/collections/Papers.ts b/src/collections/Papers.ts
index 5de19a5..77a937e 100644
--- a/src/collections/Papers.ts
+++ b/src/collections/Papers.ts
@@ -11,9 +11,10 @@ export const Papers: CollectionConfig = {
delete: ({ req: { user } }) => Boolean(user?.type === "admin"),
read: () => true,
update: async ({ req: { user, payload }, id }) => {
+ if (!user || !id) return false; // Explicitly handle missing ID
+
if (user?.type === "admin") return true;
- if (!user || !id) return false; // Explicitly handle missing ID
const paper = await payload.findByID({
collection: "papers",
@@ -22,6 +23,7 @@ export const Papers: CollectionConfig = {
});
if (!paper) return false;
+ if(paper.published) return false;
return paper.authors.some((author: any) => author.name === user.name);
},
@@ -34,7 +36,7 @@ export const Papers: CollectionConfig = {
name: "published",
type: "checkbox",
defaultValue: false,
- label: "Veröffentlicht",
+ label: "Veröffentlicht (Auf der Website sichtbar)",
access: {
update: ({ req: { user } }) => Boolean(user?.type === "admin"),
}