"use server"; cache: "no-store"; import { ReactNode } from "react"; import { deletePost, getPostsWithBucketsAndProject, updatePost, GetPostsAttributes, PostServerActions, } from "@/app/lib/actions/entityManagement/post/postActions"; import { getProjects } from "@/app/lib/actions/entityManagement/post/projectActions"; import { Bucket, Project, Post, dbSync, Attachment } from "@/models"; import { handleActionResult } from "@/app/lib/actions/clientActionHandler"; import { ClientPostView } from "@/views/admin/post"; type Props = { children?: ReactNode; }; export async function PostView(props: Props) { const sync = await dbSync; const headings: string[] = [ "#", "Title", "Content", "Project", "CreatedAt", "UpdatedAt", ]; const actions: PostServerActions = { deletePost: deletePost, getPosts: getPostsWithBucketsAndProject, getProjects: getProjects, savePost: updatePost, // uploadAttachment:tryCreateAttachment }; const posts: GetPostsAttributes[] | undefined = handleActionResult( await getPostsWithBucketsAndProject() ); const projects = await Project.findAll().then((projects) => projects.map((project) => JSON.parse(JSON.stringify(project))) ); return (
); }