当生成accountOper时,修改account中的值,并向订阅者推送 trigger添加asRoot

This commit is contained in:
lxy 2025-02-21 11:33:14 +08:00
parent f3d4abb911
commit 1be08c6d4f
3 changed files with 4 additions and 1 deletions

View File

@ -7,6 +7,7 @@ const triggers = [
entity: 'accountOper',
action: 'create',
when: 'before',
asRoot: true,
fn: async ({ operation }, context, option) => {
const { id, data } = operation;
assert(!(data instanceof Array));

View File

@ -10,6 +10,7 @@ const triggers = [
entity: 'accountOper',
action: 'create',
when: 'before',
asRoot: true,
fn: async ({ operation }, context, option) => {
const { id, data } = operation;
(0, assert_1.default)(!(data instanceof Array));

View File

@ -11,6 +11,7 @@ const triggers: Trigger<EntityDict, 'accountOper', BRC>[] = [
entity: 'accountOper',
action: 'create',
when: 'before',
asRoot: true,
fn: async ({ operation }, context, option) => {
const { id, data } = operation;
assert(!(data instanceof Array));
@ -57,7 +58,7 @@ const triggers: Trigger<EntityDict, 'accountOper', BRC>[] = [
context.saveOperationToEvent(id, `${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${accountId}`);
return 1;
},
} as CreateTriggerInTxn<EntityDict, 'accountOper', BRC>,
} as CreateTriggerInTxn<EntityDict, 'accountOper', BRC>,
];
export default triggers;