当生成accountOper时,修改account中的值,并向订阅者推送 trigger添加asRoot
This commit is contained in:
parent
f3d4abb911
commit
1be08c6d4f
|
|
@ -7,6 +7,7 @@ const triggers = [
|
||||||
entity: 'accountOper',
|
entity: 'accountOper',
|
||||||
action: 'create',
|
action: 'create',
|
||||||
when: 'before',
|
when: 'before',
|
||||||
|
asRoot: true,
|
||||||
fn: async ({ operation }, context, option) => {
|
fn: async ({ operation }, context, option) => {
|
||||||
const { id, data } = operation;
|
const { id, data } = operation;
|
||||||
assert(!(data instanceof Array));
|
assert(!(data instanceof Array));
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ const triggers = [
|
||||||
entity: 'accountOper',
|
entity: 'accountOper',
|
||||||
action: 'create',
|
action: 'create',
|
||||||
when: 'before',
|
when: 'before',
|
||||||
|
asRoot: true,
|
||||||
fn: async ({ operation }, context, option) => {
|
fn: async ({ operation }, context, option) => {
|
||||||
const { id, data } = operation;
|
const { id, data } = operation;
|
||||||
(0, assert_1.default)(!(data instanceof Array));
|
(0, assert_1.default)(!(data instanceof Array));
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ const triggers: Trigger<EntityDict, 'accountOper', BRC>[] = [
|
||||||
entity: 'accountOper',
|
entity: 'accountOper',
|
||||||
action: 'create',
|
action: 'create',
|
||||||
when: 'before',
|
when: 'before',
|
||||||
|
asRoot: true,
|
||||||
fn: async ({ operation }, context, option) => {
|
fn: async ({ operation }, context, option) => {
|
||||||
const { id, data } = operation;
|
const { id, data } = operation;
|
||||||
assert(!(data instanceof Array));
|
assert(!(data instanceof Array));
|
||||||
|
|
@ -57,7 +58,7 @@ const triggers: Trigger<EntityDict, 'accountOper', BRC>[] = [
|
||||||
context.saveOperationToEvent(id, `${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${accountId}`);
|
context.saveOperationToEvent(id, `${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${accountId}`);
|
||||||
return 1;
|
return 1;
|
||||||
},
|
},
|
||||||
} as CreateTriggerInTxn<EntityDict, 'accountOper', BRC>,
|
} as CreateTriggerInTxn<EntityDict, 'accountOper', BRC>,
|
||||||
];
|
];
|
||||||
|
|
||||||
export default triggers;
|
export default triggers;
|
||||||
Loading…
Reference in New Issue