refactor: 重构待办事项模块,统一路由与数据操作逻辑
- 将客户端导出改为私有常量,避免外部直接访问。 - 添加待办事项的完整 CRUD 操作,包括列表查询、创建、更新和删除功能,并使用 Zod 进行输入输出验证和 Drizzle ORM 操作数据库。 - 导出客户端和路由器模块的公共接口 - 添加路由配置,将 todo 处理程序注册到路由系统中。 - 删除已废弃的路由定义文件 - 删除待办事项相关路由和接口定义 - 删除未使用的 TodoSchema 模式定义以清理代码库。 - 将 Todo 路由重命名为复数形式并迁移数据获取与操作逻辑至 Orpc 客户端调用 - 将路由名称和路径从 `/todo` 更新为 `/todos`,并同步更新相关类型定义和引用。
This commit is contained in:
@@ -9,13 +9,13 @@
|
||||
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
||||
|
||||
import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as TodoRouteImport } from './routes/todo'
|
||||
import { Route as TodosRouteImport } from './routes/todos'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as ApiRpcSplatRouteImport } from './routes/api/rpc.$'
|
||||
|
||||
const TodoRoute = TodoRouteImport.update({
|
||||
id: '/todo',
|
||||
path: '/todo',
|
||||
const TodosRoute = TodosRouteImport.update({
|
||||
id: '/todos',
|
||||
path: '/todos',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const IndexRoute = IndexRouteImport.update({
|
||||
@@ -31,41 +31,41 @@ const ApiRpcSplatRoute = ApiRpcSplatRouteImport.update({
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/todo': typeof TodoRoute
|
||||
'/todos': typeof TodosRoute
|
||||
'/api/rpc/$': typeof ApiRpcSplatRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/todo': typeof TodoRoute
|
||||
'/todos': typeof TodosRoute
|
||||
'/api/rpc/$': typeof ApiRpcSplatRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
'/': typeof IndexRoute
|
||||
'/todo': typeof TodoRoute
|
||||
'/todos': typeof TodosRoute
|
||||
'/api/rpc/$': typeof ApiRpcSplatRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths: '/' | '/todo' | '/api/rpc/$'
|
||||
fullPaths: '/' | '/todos' | '/api/rpc/$'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to: '/' | '/todo' | '/api/rpc/$'
|
||||
id: '__root__' | '/' | '/todo' | '/api/rpc/$'
|
||||
to: '/' | '/todos' | '/api/rpc/$'
|
||||
id: '__root__' | '/' | '/todos' | '/api/rpc/$'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
TodoRoute: typeof TodoRoute
|
||||
TodosRoute: typeof TodosRoute
|
||||
ApiRpcSplatRoute: typeof ApiRpcSplatRoute
|
||||
}
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
interface FileRoutesByPath {
|
||||
'/todo': {
|
||||
id: '/todo'
|
||||
path: '/todo'
|
||||
fullPath: '/todo'
|
||||
preLoaderRoute: typeof TodoRouteImport
|
||||
'/todos': {
|
||||
id: '/todos'
|
||||
path: '/todos'
|
||||
fullPath: '/todos'
|
||||
preLoaderRoute: typeof TodosRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/': {
|
||||
@@ -87,7 +87,7 @@ declare module '@tanstack/react-router' {
|
||||
|
||||
const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
TodoRoute: TodoRoute,
|
||||
TodosRoute: TodosRoute,
|
||||
ApiRpcSplatRoute: ApiRpcSplatRoute,
|
||||
}
|
||||
export const routeTree = rootRouteImport
|
||||
|
||||
Reference in New Issue
Block a user