-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/routes-enum
- Loading branch information
Showing
17 changed files
with
337 additions
and
302 deletions.
There are no files selected for viewing
7 changes: 2 additions & 5 deletions
7
src/app/(main)/dashboard/billing/_components/manage-subscription-form.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { z } from "zod"; | ||
|
||
export const listPostsSchema = z.object({ | ||
page: z.number().int().default(1), | ||
perPage: z.number().int().default(12), | ||
}); | ||
export type ListPostsInput = z.infer<typeof listPostsSchema>; | ||
|
||
export const getPostSchema = z.object({ | ||
id: z.string(), | ||
}); | ||
export type GetPostInput = z.infer<typeof getPostSchema>; | ||
|
||
export const createPostSchema = z.object({ | ||
title: z.string().min(3).max(255), | ||
excerpt: z.string().min(3).max(255), | ||
content: z.string().min(3), | ||
}); | ||
export type CreatePostInput = z.infer<typeof createPostSchema>; | ||
|
||
export const updatePostSchema = createPostSchema.extend({ | ||
id: z.string(), | ||
}); | ||
export type UpdatePostInput = z.infer<typeof updatePostSchema>; | ||
|
||
export const deletePostSchema = z.object({ | ||
id: z.string(), | ||
}); | ||
export type DeletePostInput = z.infer<typeof deletePostSchema>; | ||
|
||
export const myPostsSchema = z.object({ | ||
page: z.number().int().default(1), | ||
perPage: z.number().int().default(12), | ||
}); | ||
export type MyPostsInput = z.infer<typeof myPostsSchema>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { createTRPCRouter, protectedProcedure } from "../../trpc"; | ||
import * as inputs from "./post.input"; | ||
import * as services from "./post.service"; | ||
|
||
export const postRouter = createTRPCRouter({ | ||
list: protectedProcedure | ||
.input(inputs.listPostsSchema) | ||
.query(({ ctx, input }) => services.listPosts(ctx, input)), | ||
|
||
get: protectedProcedure | ||
.input(inputs.getPostSchema) | ||
.query(({ ctx, input }) => services.getPost(ctx, input)), | ||
|
||
create: protectedProcedure | ||
.input(inputs.createPostSchema) | ||
.mutation(({ ctx, input }) => services.createPost(ctx, input)), | ||
|
||
update: protectedProcedure | ||
.input(inputs.updatePostSchema) | ||
.mutation(({ ctx, input }) => services.updatePost(ctx, input)), | ||
|
||
delete: protectedProcedure | ||
.input(inputs.deletePostSchema) | ||
.mutation(async ({ ctx, input }) => services.deletePost(ctx, input)), | ||
|
||
myPosts: protectedProcedure | ||
.input(inputs.myPostsSchema) | ||
.query(({ ctx, input }) => services.myPosts(ctx, input)), | ||
}); |
Oops, something went wrong.