This commit is contained in:
Jordi Enric
2024-09-29 11:59:09 +02:00
parent deae0061aa
commit f66a51128a
5 changed files with 16 additions and 6 deletions
+5 -2
View File
@@ -34,8 +34,10 @@ const handler = createNextHandler(
const limit = query.limit || 30;
const posts = await supabase
.from("posts")
.select("title, published_at, created_at, slug, cover_image")
.from("posts_v5")
.select(
"title, published_at, created_at, slug, cover_image, category_name, category_slug"
)
.eq("deleted", false)
.eq("published", true)
.eq("blog_id", blog.id)
@@ -51,6 +53,7 @@ const handler = createNextHandler(
},
});
}
console.log("🟢 Posts:", posts.data[0].category_name);
return {
status: 200,
+8
View File
@@ -31,6 +31,14 @@ const BasePostSchema = z.object({
title: z
.string()
.openapi({ description: "The title of the post", example: "Hello World!" }),
category_name: z.string().nullable().openapi({
description: "The name of the category",
example: "Tutorials",
}),
category_slug: z.string().nullable().openapi({
description: "The slug of the category",
example: "tutorials",
}),
});
const GetPostsSchema = BasePostSchema;
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "api-deprecated",
"name": "api",
"version": "0.1.0",
"private": true,
"scripts": {
+1 -2
View File
@@ -5,10 +5,9 @@ import { motion } from "framer-motion";
import Notifications from "@/components/Notifications";
import Feedback from "@/components/Feedback";
import Footer from "@/components/Footer";
import { useIsSubscribed, usePlan } from "@/queries/subscription";
import { usePlan } from "@/queries/subscription";
import AppChecks from "@/components/LoggedInUserChecks";
import { Loader } from "lucide-react";
import { HiOutlineInformationCircle } from "react-icons/hi";
import { useUser } from "@/utils/supabase/browser";
import { useRouter } from "next/router";
import { useEffect } from "react";
+1 -1
View File
@@ -8,7 +8,7 @@
- [] Add tags to posts API
- [] Fix deleting tags with posts
- [] Use a JWT with the blog id to authenticate the API, should make api faster by removing one req to get the blog id
- [] Add tags to posts API
- [] Add categories to posts API
- [] fix creating tags in tags tab
- [] fix metadata format so that its {key:value} not [{key:foo,value:bar}]