diff --git a/app/log/[postid]/page.tsx b/app/log/[postid]/page.tsx
index c1e2959..5992128 100644
--- a/app/log/[postid]/page.tsx
+++ b/app/log/[postid]/page.tsx
@@ -1,43 +1,35 @@
import BlogPostController from "@/server/controllers/blogpost.controller";
import Image from "next/image";
+import { MDXRemote } from "next-mdx-remote";
+import { serialize } from "next-mdx-remote/serialize";
+import { notFound } from "next/navigation";
export default async function PostById({ params }: { params: { postid: string }}) {
const { postid } = params;
const controller = new BlogPostController();
+
+ console.log({ postid });
+
const post = await controller.getByID(postid);
+ if (!post) notFound();
+
+ const mdxSource = await serialize(post.content);
+
return (
Post {postid}
Coming soon...
- { post && (
-
- {post.title}
- {post.author}
- {post.posted.toDateString()}
- { post.updated ? {post.updated.toDateString()}
: null }
+
+ {post.title}
+ {post.author}
+ { post.written && {post.written.toLocaleDateString()}
}
- { post.images && post.images.map((src, idx) => (
-
- ))}
-
-
-
- {post.content}
-
-
- { post.tags?.map((tag, idx) => {
- return (
-
- )
- })}
-
-
- )}
+
+
+
)
}
diff --git a/app/log/layout.tsx b/app/log/layout.tsx
deleted file mode 100644
index e69de29..0000000
diff --git a/components/Log/PostComponent.tsx b/components/Log/PostComponent.tsx
new file mode 100644
index 0000000..39518e9
--- /dev/null
+++ b/components/Log/PostComponent.tsx
@@ -0,0 +1,8 @@
+// import { MDXRemote } from "next-mdx-remote";
+// import { serialize } from "next-mdx-remote/serialize";
+// import { BlogPost } from "@/server/db/schema";
+
+// export default async function PostComponent(post: BlogPost) {
+// const mdxSource = await serialize(post.content);
+// return
+// }
diff --git a/env.mjs b/env.mjs
index 758fc80..e12426c 100644
--- a/env.mjs
+++ b/env.mjs
@@ -9,10 +9,6 @@ const env = createEnv({
MONGO_USER: z.string().optional(),
MONGO_PASSWORD: z.string().optional(),
- POSTGRES_URL: z.string().url(),
- POSTGRES_USER: z.string(),
- POSTGRES_PASSWORD: z.string(),
-
S3_ENDPOINT: z.string().url(),
S3_REGION: z.string(),
S3_ACCESS_KEY: z.string(),
@@ -22,10 +18,6 @@ const env = createEnv({
KV_URL: z.string(),
},
runtimeEnv: {
- POSTGRES_URL: process.env.POSTGRES_URL,
- POSTGRES_USER: process.env.POSTGRES_USER,
- POSTGRES_PASSWORD: process.env.POSTGRES_PASSWORD,
-
MONGO_URL: process.env.MONGO_URL,
MONGO_USER: process.env.MONGO_USER,
MONGO_PASSWORD: process.env.MONGO_PASSWORD,
diff --git a/package.json b/package.json
index d55069e..685656f 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
"ioredis": "^5.3.2",
"mongodb": "^6.3.0",
"next": "^14.0.1",
+ "next-mdx-remote": "^4.4.1",
"pg": "^8.11.3",
"react": "18.2.0",
"react-dom": "18.2.0",
diff --git a/server/controllers/base.controller.ts b/server/controllers/base.controller.ts
index b7883f2..cce08a3 100644
--- a/server/controllers/base.controller.ts
+++ b/server/controllers/base.controller.ts
@@ -1,7 +1,7 @@
import { createDBClient } from '../db/createClient';
import { Maybe } from '@/util/helpers';
import { ParseParams } from 'zod';
-import { MongoClient, WithId, Filter, InsertOneResult } from 'mongodb';
+import { MongoClient, WithId, ObjectId, InsertOneResult, Filter } from 'mongodb';
type FullParserType = (data: any, params?: Partial) => T;
@@ -12,8 +12,8 @@ type ControllerOptions = {
export default abstract class BaseController {
protected client: MongoClient
- collectionName: string
- parse: FullParserType
+ protected collectionName: string
+ protected parse: FullParserType
constructor(options: ControllerOptions) {
this.collectionName = options.tableName;
@@ -27,7 +27,7 @@ export default abstract class BaseController(this.collectionName)
+ result = await this.client.db('mikayladotdev').collection(this.collectionName)
.find()
.toArray();