fix blog not using updated db schema
This commit is contained in:
@@ -5,7 +5,7 @@ type BlogCardProps = {
|
|||||||
image: string,
|
image: string,
|
||||||
name: string,
|
name: string,
|
||||||
tagline: string,
|
tagline: string,
|
||||||
id: string
|
id: number
|
||||||
}
|
}
|
||||||
export default function BlogCard(props: BlogCardProps) {
|
export default function BlogCard(props: BlogCardProps) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { Trash } from 'grommet-icons';
|
|||||||
|
|
||||||
export default function BlogPage() {
|
export default function BlogPage() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const id = router.query.id as string
|
const id = Number(router.query.id)
|
||||||
const { status } = useSession()
|
const { status } = useSession()
|
||||||
|
|
||||||
// trpc stuff
|
// trpc stuff
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ type GenericItemType = {
|
|||||||
name: string,
|
name: string,
|
||||||
image: string,
|
image: string,
|
||||||
tagline: string,
|
tagline: string,
|
||||||
id: string
|
id: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Blog() {
|
export default function Blog() {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export const blogRouter = createTRPCRouter({
|
|||||||
}),
|
}),
|
||||||
delete: protectedProcedure
|
delete: protectedProcedure
|
||||||
.input(
|
.input(
|
||||||
z.string().min(1)
|
z.number().min(1)
|
||||||
)
|
)
|
||||||
.mutation(async ({ctx, input}) => {
|
.mutation(async ({ctx, input}) => {
|
||||||
return ctx.db.blogPost.delete({
|
return ctx.db.blogPost.delete({
|
||||||
@@ -38,7 +38,9 @@ export const blogRouter = createTRPCRouter({
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
getOne: publicProcedure
|
getOne: publicProcedure
|
||||||
.input(String)
|
.input(
|
||||||
|
z.number()
|
||||||
|
)
|
||||||
.query(({ ctx, input }) => {
|
.query(({ ctx, input }) => {
|
||||||
return ctx.db.blogPost.findFirst({
|
return ctx.db.blogPost.findFirst({
|
||||||
where: { id: input },
|
where: { id: input },
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const postRouter = createTRPCRouter({
|
|||||||
|
|
||||||
delete: protectedProcedure
|
delete: protectedProcedure
|
||||||
.input(
|
.input(
|
||||||
z.string().min(1)
|
z.number().min(1)
|
||||||
)
|
)
|
||||||
.mutation(async ({ctx, input}) => {
|
.mutation(async ({ctx, input}) => {
|
||||||
return ctx.db.post.delete({
|
return ctx.db.post.delete({
|
||||||
|
|||||||
Reference in New Issue
Block a user