mirror of https://github.com/boxyhq/jackson.git
Add target and tenant fields
This commit is contained in:
parent
303dc81727
commit
e08671161d
|
@ -59,11 +59,16 @@ const reportEvent = async ({ action, crud, group, actor, description, productId
|
|||
// Find team info for the product
|
||||
if (productId && !group) {
|
||||
try {
|
||||
const productInfo = await productController.get(productId);
|
||||
const product = await productController.get(productId);
|
||||
|
||||
retracedEvent.group = {
|
||||
id: productInfo.teamId,
|
||||
name: productInfo.teamName,
|
||||
id: product.teamId,
|
||||
name: product.teamName,
|
||||
};
|
||||
|
||||
retracedEvent.target = {
|
||||
id: product.id,
|
||||
name: product.name,
|
||||
};
|
||||
} catch (err: any) {
|
||||
console.error('Error getting product info. Event not reported to Retraced.', err);
|
||||
|
|
|
@ -34,6 +34,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
actor: {
|
||||
id: profile.email,
|
||||
name: `${profile.firstName} ${profile.lastName}`,
|
||||
fields: {
|
||||
tenant: profile.requested.tenant,
|
||||
},
|
||||
},
|
||||
productId: profile.requested.product,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue