v0.5.0: 重新组织目录结构,按职责拆分
- Shrimp.ts (875 行) 按类拆分到 Shrimp/(7 文件: Shrimp, ShrimpModule, ShrimpTableModule, ShrimpPower, ShrimpCrud, UserRoleModule, OperationLogModule) - forMongo/: MongoShrimpCrud + MongoShrimp(原 ShrimpServer 的 mongo 装配部分,无 express) - forExpress/: buildShrimpRouter + jwtAuth + types - main/: index(0 依赖核心) + expmon(express+mongo 整合,导出 ShrimpServer) + types(纯协议) - 入口子路径 server → expmon(express+mongo 整合方案命名更准确) - 删除冗余的 index.ts / core.ts(合并为 main/index.ts)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import type { IShrimpQuery, IShrimpPopulate, IPageResult } from "../IShrimpType"
|
||||
|
||||
export interface ShrimpCrud<T> {
|
||||
findOne(query?: any): Promise<T | null>
|
||||
list(query?: IShrimpQuery): Promise<IPageResult<T>>
|
||||
get(id: string): Promise<T | null>
|
||||
add(item: Omit<T, '_id'>): Promise<T>
|
||||
edit(id: string, item: Partial<T>): Promise<T | null>
|
||||
delete(id: string): Promise<boolean>
|
||||
clear(): Promise<boolean>
|
||||
populateItems(items: any[], populates: IShrimpPopulate[], crudRegistry?: Map<string, ShrimpCrud<any>>): Promise<void>
|
||||
}
|
||||
Reference in New Issue
Block a user