various changes

This commit is contained in:
2024-06-23 02:52:50 +02:00
committed by andreas
parent c3a8469371
commit adc02f2e5b
19 changed files with 268 additions and 155 deletions
@@ -1,14 +1,13 @@
cache: 'no-store'
import { tryFetchPosts } from "@/app/api/post/route";
import { Post } from "@/model/Post";
import { constructAPIUrl } from "@/util/Utils";
import { ReactNode, useEffect } from "react";
import TableGen from "../../../client/TableGen";
import PostTable from "@/components/client/admin/PostTable";
import { deletePost, getPosts, updatePost } from "@/app/lib/actions/entityManagement/postActions";
import { getProjects } from "@/app/lib/actions/entityManagement/projectActions";
import { Project } from "@/model/Project";
import { Bucket, Project, Post, dbSync, Attachment } from "@/model/Models";
type Props = {
children?:ReactNode
@@ -16,6 +15,8 @@ type Props = {
export default async function PostView(props:Props){
await dbSync;
const headings = [
'#',
'Title',
@@ -32,7 +33,8 @@ export default async function PostView(props:Props){
getProjects,
savePost:updatePost
};
const posts:Post[] = await Post.findAll().then(posts=>posts.map((e)=>JSON.parse(JSON.stringify(e))));
const posts:Post[] = await Post.findAll({include: {model: Bucket, include: {model: Attachment}}}).then(posts=>posts.map((e)=>JSON.parse(JSON.stringify(e))));
const projects = await Project.findAll().then(projects=>projects.map((e)=>JSON.parse(JSON.stringify(e))));
return (