Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-domain into dev

This commit is contained in:
Xu Chang 2024-02-06 19:45:09 +08:00
commit c722412c62
4 changed files with 8 additions and 4 deletions

View File

@ -48,6 +48,7 @@ export declare abstract class AsyncContext<ED extends EntityDict> implements Con
getMessage(): string | undefined; getMessage(): string | undefined;
abstract isRoot(): boolean; abstract isRoot(): boolean;
abstract getCurrentUserId(allowUnloggedIn?: boolean): string | undefined; abstract getCurrentUserId(allowUnloggedIn?: boolean): string | undefined;
abstract setCurrentUserId(userId: string | undefined): void;
abstract toString(): Promise<string>; abstract toString(): Promise<string>;
abstract initialize(data: any): Promise<void>; abstract initialize(data: any): Promise<void>;
abstract allowUserUpdate(): boolean; abstract allowUserUpdate(): boolean;

View File

@ -146,7 +146,7 @@ function makeIntrinsicCTWs(schema, actionDefDict) {
action: 'create', action: 'create',
type: 'data', type: 'data',
entity, entity,
priority: 10, priority: 10, // 优先级要高先于真正的data检查进行
checker: (data) => { checker: (data) => {
if (data instanceof Array) { if (data instanceof Array) {
data.forEach(ele => { data.forEach(ele => {
@ -181,7 +181,7 @@ function makeIntrinsicCTWs(schema, actionDefDict) {
entity, entity,
action: 'create', action: 'create',
type: 'logicalData', type: 'logicalData',
priority: types_1.CHECKER_MAX_PRIORITY, priority: types_1.CHECKER_MAX_PRIORITY, // 优先级要放在最低所有前置的checker/trigger将数据完整之后再在这里检测
checker: (operation, context) => { checker: (operation, context) => {
const { data } = operation; const { data } = operation;
if (data instanceof Array) { if (data instanceof Array) {
@ -197,9 +197,9 @@ function makeIntrinsicCTWs(schema, actionDefDict) {
} }
}, { }, {
entity, entity,
action: 'update', action: 'update', // 只检查update其它状态转换的action应该不会涉及unique约束的属性
type: 'logicalData', type: 'logicalData',
priority: types_1.CHECKER_MAX_PRIORITY, priority: types_1.CHECKER_MAX_PRIORITY, // 优先级要放在最低所有前置的checker/trigger将数据完整之后再在这里检测
checker: (operation, context) => { checker: (operation, context) => {
const { data, filter: operationFilter } = operation; const { data, filter: operationFilter } = operation;
if (data) { if (data) {

View File

@ -1,3 +1,4 @@
/// <reference types="node" />
/** /**
* assert打包体积过大 * assert打包体积过大
*/ */

View File

@ -219,6 +219,8 @@ export abstract class AsyncContext<ED extends EntityDict> implements Context {
abstract getCurrentUserId(allowUnloggedIn?: boolean): string | undefined; abstract getCurrentUserId(allowUnloggedIn?: boolean): string | undefined;
abstract setCurrentUserId(userId: string | undefined): void; // 设置上下文userId必须在root模式下才能调用
// 此接口将上下文变成可以serialized的字符串 // 此接口将上下文变成可以serialized的字符串
abstract toString(): Promise<string>; abstract toString(): Promise<string>;