@realtimex/email-automator 2.6.2 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/src/routes/rules.ts +7 -2
- package/dist/api/src/routes/rules.js +6 -2
- package/dist/assets/index-BSHZ3lFn.js +97 -0
- package/dist/assets/index-CRQKk5IW.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/index-BaETRzrd.js +0 -97
- package/dist/assets/index-Bi5YqX3d.css +0 -1
package/api/src/routes/rules.ts
CHANGED
|
@@ -68,7 +68,12 @@ router.patch('/:ruleId',
|
|
|
68
68
|
validateBody(schemas.updateRule),
|
|
69
69
|
asyncHandler(async (req, res) => {
|
|
70
70
|
const { ruleId } = req.params;
|
|
71
|
-
const updates = req.body;
|
|
71
|
+
const updates = { ...req.body };
|
|
72
|
+
|
|
73
|
+
// Ensure legacy action is in sync if actions array is provided
|
|
74
|
+
if (updates.actions && Array.isArray(updates.actions) && updates.actions.length > 0) {
|
|
75
|
+
updates.action = updates.actions[0];
|
|
76
|
+
}
|
|
72
77
|
|
|
73
78
|
const { data, error } = await req.supabase!
|
|
74
79
|
.from('rules')
|
|
@@ -81,7 +86,7 @@ router.patch('/:ruleId',
|
|
|
81
86
|
if (error) throw error;
|
|
82
87
|
if (!data) throw new NotFoundError('Rule');
|
|
83
88
|
|
|
84
|
-
logger.info('Rule updated', { ruleId, userId: req.user!.id });
|
|
89
|
+
logger.info('Rule updated', { ruleId, actions: data.actions, userId: req.user!.id });
|
|
85
90
|
|
|
86
91
|
res.json({ rule: data });
|
|
87
92
|
})
|
|
@@ -46,7 +46,11 @@ router.post('/', apiRateLimit, authMiddleware, validateBody(schemas.createRule),
|
|
|
46
46
|
// Update rule
|
|
47
47
|
router.patch('/:ruleId', apiRateLimit, authMiddleware, validateParams(z.object({ ruleId: schemas.uuid })), validateBody(schemas.updateRule), asyncHandler(async (req, res) => {
|
|
48
48
|
const { ruleId } = req.params;
|
|
49
|
-
const updates = req.body;
|
|
49
|
+
const updates = { ...req.body };
|
|
50
|
+
// Ensure legacy action is in sync if actions array is provided
|
|
51
|
+
if (updates.actions && Array.isArray(updates.actions) && updates.actions.length > 0) {
|
|
52
|
+
updates.action = updates.actions[0];
|
|
53
|
+
}
|
|
50
54
|
const { data, error } = await req.supabase
|
|
51
55
|
.from('rules')
|
|
52
56
|
.update(updates)
|
|
@@ -58,7 +62,7 @@ router.patch('/:ruleId', apiRateLimit, authMiddleware, validateParams(z.object({
|
|
|
58
62
|
throw error;
|
|
59
63
|
if (!data)
|
|
60
64
|
throw new NotFoundError('Rule');
|
|
61
|
-
logger.info('Rule updated', { ruleId, userId: req.user.id });
|
|
65
|
+
logger.info('Rule updated', { ruleId, actions: data.actions, userId: req.user.id });
|
|
62
66
|
res.json({ rule: data });
|
|
63
67
|
}));
|
|
64
68
|
// Delete rule
|