- 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)
21 lines
548 B
TypeScript
21 lines
548 B
TypeScript
import type { ILabel } from "../IShrimpType"
|
|
|
|
export class RootShrimpPower {
|
|
children: ShrimpPower[] = []
|
|
constructor(public powerKey: string, public label: ILabel) {
|
|
}
|
|
get key(): string {
|
|
return this.powerKey
|
|
}
|
|
}
|
|
|
|
export class ShrimpPower extends RootShrimpPower {
|
|
constructor(public parent: RootShrimpPower, public powerKey: string, public label: ILabel) {
|
|
super(powerKey, label)
|
|
parent.children.push(this)
|
|
}
|
|
get key(): string {
|
|
return this.parent.key + "." + this.powerKey
|
|
}
|
|
}
|