oak-general-business/es/triggers/oauthProvider.js

18 lines
562 B
JavaScript
Raw 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.

import assert from 'assert';
const triggers = [
{
name: "创建provider时填充数据",
action: "create",
when: "before",
entity: "oauthProvider",
fn: async ({ operation }, context) => {
assert(operation.data && !Array.isArray(operation.data), "oauthProvider create data 必须存在且为单条记录");
const { data } = operation;
const systemId = context.getSystemId();
data.systemId = systemId;
return 0;
}
},
];
export default triggers;