feat: add support for multiple route numbers in alert notifications
- Updated FCM alert notifications documentation to include handling of multiple route numbers. - Enhanced Telegram cancellation import logic to support multiple route numbers, ensuring correct notifications are sent for all directions. - Modified frontend components to allow selection of multiple route numbers for alerts, improving user experience. - Implemented backend migration to add `route_numbers` column to alerts and adjusted related database constraints. - Introduced new utility functions for normalizing and validating route numbers in alert processing.
This commit is contained in:
@@ -257,3 +257,12 @@ test('reads disabled-by-default Firebase configuration and environment overrides
|
||||
projectId: 'ridebus-test'
|
||||
});
|
||||
});
|
||||
|
||||
test('multi-route alert sends one data message with all direction IDs and number strings', () => {
|
||||
const message = buildAlertCreatedMessage({ id: 17, route_id: null, route_numbers: ['2', '27'], route_ids: [1, 2, 4, 5], title: 'Переезд закрыт', message: 'Объезд' });
|
||||
assert.equal(message.data.routeId, '');
|
||||
assert.equal(message.data.routeNumber, '');
|
||||
assert.deepEqual(JSON.parse(message.data.routeNumbers), ['2', '27']);
|
||||
assert.deepEqual(JSON.parse(message.data.routeIds), [1, 2, 4, 5]);
|
||||
assert.ok(Object.values(message.data).every(value => typeof value === 'string'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user