oak-general-business/lib/triggers/session.js

21 lines
750 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const constants_1 = require("../config/constants");
const assert_1 = require("oak-domain/lib/utils/assert");
const triggers = [
{
name: '当创建session时通知订阅了sessionList变化的事件',
entity: 'session',
action: 'create',
when: 'before',
fn: async ({ operation }, context) => {
const { data, id } = operation;
(0, assert_1.assert)(!(data instanceof Array));
const { userId } = data;
(0, assert_1.assert)(userId);
context.saveOperationToEvent(id, `${constants_1.DATA_SUBSCRIBER_KEYS.sessionList}-u-${userId}`);
return 1;
}
}
];