From 21d8bf95cd8afc5e29fffa3f5a44f2b7acd2f812 Mon Sep 17 00:00:00 2001 From: wkj <278599135@.com> Date: Fri, 26 Apr 2024 10:52:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?user=20=E5=A2=9E=E5=8A=A0accountName=20?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/base-app-domain/User/Schema.d.ts | 6 +++++ lib/base-app-domain/User/Storage.js | 21 +++++++++++++++- lib/base-app-domain/User/Style.js | 4 ++-- lib/entities/User.d.ts | 1 + lib/entities/User.js | 22 +++++++++++++---- src/entities/User.ts | 36 +++++++++++++++++++++------- 6 files changed, 75 insertions(+), 15 deletions(-) diff --git a/lib/base-app-domain/User/Schema.d.ts b/lib/base-app-domain/User/Schema.d.ts index 53708fd..b5ce4e3 100644 --- a/lib/base-app-domain/User/Schema.d.ts +++ b/lib/base-app-domain/User/Schema.d.ts @@ -15,6 +15,7 @@ export type OpSchema = EntityShape & { nickname?: String<64> | null; password?: Text | null; refId?: ForeignKey<"user"> | null; + accountName?: String<32> | null; userState?: UserState | null; }; export type OpAttr = keyof OpSchema; @@ -23,6 +24,7 @@ export type Schema = EntityShape & { nickname?: String<64> | null; password?: Text | null; refId?: ForeignKey<"user"> | null; + accountName?: String<32> | null; userState?: UserState | null; ref?: Schema | null; oper$operator?: Array; @@ -50,6 +52,7 @@ type AttrFilter = { password: Q_StringValue; refId: Q_StringValue; ref: Filter; + accountName: Q_StringValue; userState: Q_EnumValue; oper$operator: Oper.Filter & SubQueryPredicateMetadata; user$ref: Filter & SubQueryPredicateMetadata; @@ -71,6 +74,7 @@ export type Projection = { password?: number; refId?: number; ref?: Projection; + accountName?: number; userState?: number; oper$operator?: Oper.Selection & { $entity: "oper"; @@ -131,6 +135,8 @@ export type SortAttr = { refId: number; } | { ref: SortAttr; +} | { + accountName: number; } | { userState: number; } | { diff --git a/lib/base-app-domain/User/Storage.js b/lib/base-app-domain/User/Storage.js index 7fea613..1a46d69 100644 --- a/lib/base-app-domain/User/Storage.js +++ b/lib/base-app-domain/User/Storage.js @@ -23,11 +23,30 @@ exports.desc = { type: "ref", ref: "user" }, + accountName: { + type: "varchar", + params: { + length: 32 + } + }, userState: { type: "enum", enumeration: ["normal", "merged"] } }, actionType: "crud", - actions: Action_1.actions + actions: Action_1.actions, + indexes: [ + { + name: 'index_accountName', + attributes: [ + { + name: 'accountName', + }, + ], + config: { + unique: true, + }, + } + ] }; diff --git a/lib/base-app-domain/User/Style.js b/lib/base-app-domain/User/Style.js index 058d110..dfc5dfc 100644 --- a/lib/base-app-domain/User/Style.js +++ b/lib/base-app-domain/User/Style.js @@ -9,6 +9,6 @@ exports.style = { userState: { normal: '#112233', merged: '#223344', - } - } + }, + }, }; diff --git a/lib/entities/User.d.ts b/lib/entities/User.d.ts index 26542bb..82f1d11 100644 --- a/lib/entities/User.d.ts +++ b/lib/entities/User.d.ts @@ -7,6 +7,7 @@ export interface Schema extends EntityShape { nickname?: String<64>; password?: Text; ref?: Schema; + accountName?: String<32>; } type UserAction = 'mergeTo'; type UserState = 'normal' | 'merged'; diff --git a/lib/entities/User.js b/lib/entities/User.js index 5191653..bb983e4 100644 --- a/lib/entities/User.js +++ b/lib/entities/User.js @@ -8,6 +8,19 @@ exports.UserActionDef = { }, }; exports.entityDesc = { + indexes: [ + { + name: 'index_accountName', + attributes: [ + { + name: 'accountName', + }, + ], + config: { + unique: true, + }, + }, + ], locales: { zh_CN: { name: '用户', @@ -17,6 +30,7 @@ exports.entityDesc = { password: '密码', ref: '指向用户', userState: '状态', + accountName: '账号名', }, action: { mergeTo: '合并', @@ -26,7 +40,7 @@ exports.entityDesc = { normal: '正常', merged: '已被合并', }, - } + }, }, }, style: { @@ -37,7 +51,7 @@ exports.entityDesc = { userState: { normal: '#112233', merged: '#223344', - } - } - } + }, + }, + }, }; diff --git a/src/entities/User.ts b/src/entities/User.ts index c457470..e8db1db 100644 --- a/src/entities/User.ts +++ b/src/entities/User.ts @@ -1,4 +1,4 @@ -import { String, Int, Text, Image, Datetime } from '../types/DataType'; +import { String, Text } from '../types/DataType'; import { EntityShape } from '../types/Entity'; import { ActionDef } from '../types/Action'; import { EntityDesc } from '../types/EntityDesc'; @@ -8,6 +8,7 @@ export interface Schema extends EntityShape { nickname?: String<64>; password?: Text; ref?: Schema; + accountName?: String<32>; }; type UserAction = 'mergeTo'; @@ -22,9 +23,27 @@ export const UserActionDef: ActionDef = { }, }; -export const entityDesc: EntityDesc = { +export const entityDesc: EntityDesc< + Schema, + Action, + '', + { + userState: UserState; + } +> = { + indexes: [ + { + name: 'index_accountName', + attributes: [ + { + name: 'accountName', + }, + ], + config: { + unique: true, + }, + }, + ], locales: { zh_CN: { name: '用户', @@ -34,6 +53,7 @@ export const entityDesc: EntityDesc Date: Fri, 26 Apr 2024 11:33:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9B=9E=E9=80=80user=20accountName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/base-app-domain/User/Schema.d.ts | 6 ------ lib/base-app-domain/User/Storage.js | 21 +-------------------- lib/entities/User.d.ts | 1 - lib/entities/User.js | 14 -------------- src/entities/User.ts | 15 --------------- 5 files changed, 1 insertion(+), 56 deletions(-) diff --git a/lib/base-app-domain/User/Schema.d.ts b/lib/base-app-domain/User/Schema.d.ts index b5ce4e3..53708fd 100644 --- a/lib/base-app-domain/User/Schema.d.ts +++ b/lib/base-app-domain/User/Schema.d.ts @@ -15,7 +15,6 @@ export type OpSchema = EntityShape & { nickname?: String<64> | null; password?: Text | null; refId?: ForeignKey<"user"> | null; - accountName?: String<32> | null; userState?: UserState | null; }; export type OpAttr = keyof OpSchema; @@ -24,7 +23,6 @@ export type Schema = EntityShape & { nickname?: String<64> | null; password?: Text | null; refId?: ForeignKey<"user"> | null; - accountName?: String<32> | null; userState?: UserState | null; ref?: Schema | null; oper$operator?: Array; @@ -52,7 +50,6 @@ type AttrFilter = { password: Q_StringValue; refId: Q_StringValue; ref: Filter; - accountName: Q_StringValue; userState: Q_EnumValue; oper$operator: Oper.Filter & SubQueryPredicateMetadata; user$ref: Filter & SubQueryPredicateMetadata; @@ -74,7 +71,6 @@ export type Projection = { password?: number; refId?: number; ref?: Projection; - accountName?: number; userState?: number; oper$operator?: Oper.Selection & { $entity: "oper"; @@ -135,8 +131,6 @@ export type SortAttr = { refId: number; } | { ref: SortAttr; -} | { - accountName: number; } | { userState: number; } | { diff --git a/lib/base-app-domain/User/Storage.js b/lib/base-app-domain/User/Storage.js index 1a46d69..7fea613 100644 --- a/lib/base-app-domain/User/Storage.js +++ b/lib/base-app-domain/User/Storage.js @@ -23,30 +23,11 @@ exports.desc = { type: "ref", ref: "user" }, - accountName: { - type: "varchar", - params: { - length: 32 - } - }, userState: { type: "enum", enumeration: ["normal", "merged"] } }, actionType: "crud", - actions: Action_1.actions, - indexes: [ - { - name: 'index_accountName', - attributes: [ - { - name: 'accountName', - }, - ], - config: { - unique: true, - }, - } - ] + actions: Action_1.actions }; diff --git a/lib/entities/User.d.ts b/lib/entities/User.d.ts index 82f1d11..26542bb 100644 --- a/lib/entities/User.d.ts +++ b/lib/entities/User.d.ts @@ -7,7 +7,6 @@ export interface Schema extends EntityShape { nickname?: String<64>; password?: Text; ref?: Schema; - accountName?: String<32>; } type UserAction = 'mergeTo'; type UserState = 'normal' | 'merged'; diff --git a/lib/entities/User.js b/lib/entities/User.js index bb983e4..da758ce 100644 --- a/lib/entities/User.js +++ b/lib/entities/User.js @@ -8,19 +8,6 @@ exports.UserActionDef = { }, }; exports.entityDesc = { - indexes: [ - { - name: 'index_accountName', - attributes: [ - { - name: 'accountName', - }, - ], - config: { - unique: true, - }, - }, - ], locales: { zh_CN: { name: '用户', @@ -30,7 +17,6 @@ exports.entityDesc = { password: '密码', ref: '指向用户', userState: '状态', - accountName: '账号名', }, action: { mergeTo: '合并', diff --git a/src/entities/User.ts b/src/entities/User.ts index e8db1db..9a32b6c 100644 --- a/src/entities/User.ts +++ b/src/entities/User.ts @@ -8,7 +8,6 @@ export interface Schema extends EntityShape { nickname?: String<64>; password?: Text; ref?: Schema; - accountName?: String<32>; }; type UserAction = 'mergeTo'; @@ -31,19 +30,6 @@ export const entityDesc: EntityDesc< userState: UserState; } > = { - indexes: [ - { - name: 'index_accountName', - attributes: [ - { - name: 'accountName', - }, - ], - config: { - unique: true, - }, - }, - ], locales: { zh_CN: { name: '用户', @@ -53,7 +39,6 @@ export const entityDesc: EntityDesc< password: '密码', ref: '指向用户', userState: '状态', - accountName: '账号名', }, action: { mergeTo: '合并',