mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
add pseudocode
This commit is contained in:
@@ -56,6 +56,15 @@ export class NotificationService {
|
|||||||
return this._lastRefreshedTimeMs && Date.now() - this._lastRefreshedTimeMs < thirtyMinutesMs;
|
return this._lastRefreshedTimeMs && Date.now() - this._lastRefreshedTimeMs < thirtyMinutesMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sendEtaNotificationImmediately({ deviceId, shuttleId, stopId }: ScheduledNotificationData) {
|
||||||
|
// Construct the fetch request
|
||||||
|
|
||||||
|
// Send the fetch request
|
||||||
|
|
||||||
|
// Check whether it was successful
|
||||||
|
// Return the result
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queue a notification to be sent.
|
* Queue a notification to be sent.
|
||||||
* @param deviceId The device ID to send the notification to.
|
* @param deviceId The device ID to send the notification to.
|
||||||
@@ -63,7 +72,13 @@ export class NotificationService {
|
|||||||
* @param stopId Stop ID of ETA object to check.
|
* @param stopId Stop ID of ETA object to check.
|
||||||
*/
|
*/
|
||||||
public async scheduleNotification({ deviceId, shuttleId, stopId }: ScheduledNotificationData) {
|
public async scheduleNotification({ deviceId, shuttleId, stopId }: ScheduledNotificationData) {
|
||||||
|
// Associate TupleKey(shuttleId, stopId) with array of device IDs
|
||||||
|
// Refresh the subscriber with the updated array if needed
|
||||||
|
|
||||||
|
// In the subscriber callback:
|
||||||
|
// If the ETA matches, call sendNotification with the necessary parameters
|
||||||
|
// If it was successful, unsubscribe the callback
|
||||||
|
// If it wasn't, leave it until the next ETA update
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user