-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Features for 1.0.0 of package #60
base: main
Are you sure you want to change the base?
Conversation
Still I would find a more a definition more close to the CDS language a good choice as well. |
const { createLogger } = require("@sap-cloud-sdk/util"); | ||
const LOG = createLogger('notifications'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the advantage of using @sap-cloud-sdk/util
over cds.log
. IMO cds.log
should cover all the required features and if not those should be requested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention was that the deployer module runs with the bare minimum required dependencies and utils is anyways needed for executeHttpRequest thus @sao/cds as a dependency for the deployer can be avoided.
Recipients: recipients?.map(id => { | ||
if (cds.env.features.use_global_user_uuid) | ||
return { GlobalUserId: id } | ||
return { RecipientId: id } | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be more dynamic. As not necessarily all users have a global user id. So I think this can't be solved on a static feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share more details (on teams)? With my naive assumption every solution using IAS+AMS should only have users with a global uuid shouldn't they?
if (req.event === 'deleteNotifications') return next() | ||
LOG._debug && LOG.debug('Handling notification event:', req.event); | ||
let notificationsToCreate = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case of alert.emit('deleteNotifications', {})
. I'm not aware of any reason why we should archiving notifications can you elaborate on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saving notifications is done so a 'MinTimeBetweenNotifications' can be specified avoiding to many notifications. But to do these checks notifications have to be saved. I did not yet find a clean way for scheduling a job to trigger deletion automatically, that is why the event exists so apps can trigger it themselves via a scheduler. I thought about adding a HANA Cloud Task Scheduler, but that would't not work for pg/sqlite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one use case where I send an action to multiple people.
If one person actions it, then I can delete the notification for the rest of the recipients.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @TheoExall, I think the event does not yet allow to delete specific notifications. However please also consider that Notification actions is something that ideally should be avoided. That is also why there likely won't be any support coming for NotificationType actions. The preferred way is to use SAP Task Center and create a task assigned to multiple people, with them receiving the notification for the task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For task scheduling you can use the event-queue package. This is exactly the purpose of the package.
But however, I still would not add such functionality in a reuse package. For me this seems more application-specific. Because we handle such things in our business coding and would not want additional tables for such things...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schiwekM
Correct. I have a really small app that is used by IT staff. In my use case there is around 80 notifications per month with around 40 recipients. In this case it's more about cleaning up older notifications, for managing the tasks I agree that Task Center is the best solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For task scheduling you can use the event-queue package. This is exactly the purpose of the package. But however, I still would not add such functionality in a reuse package. For me this seems more application-specific. Because we handle such things in our business coding and would not want additional tables for such things...
Thanks for mentioning the package - I am just unsure if it is fine to add it as an optional dependency. The tables / functionality is optional. If you do not import the index.cds no table will be added & notifications will be saved.
Similar to CDS data allow json & csv data? / for localisation just the localised attribute? In our app we have it currently and I have to say it is very clumsy for >50 notifications. Deployer is not yet multi tenant, e.g. no create/update handler yet registered to push the types, because there are ongoing discussions if onboarding notification types can be simplified for tenants. |
Hi colleagues,
Inline with cap/dev#1038 this PR includes many desired features for a productive usage of the package.
cds.env.requires.notifications.build.after
orcds.env.requires.notifications.build.after
a path to a file modifying the build results. The use case for example is to modify the EmailTemplate property for all notification typesrecipient
property being an object inalert.notify('Type', {recipient: '', data: {}})
alert.notify('Type', [{recipient: '', data: {}}, {recipients: [], data: {}}])
cds.env.requires.notifications.notifications_deletion_timeout
MinTimeBetweenNotifications
on notification types to specify values like7d
expressing that at least 7 days have to pass for another notification of that type with the same target parameterTargetParameters
attribute. Array of strings. ID is used as a TargetParameter if none are specified.cds.env.features.use_global_user_uuid
will set the recipient value to the 'GlobalUserId' property rather than the 'RecipeintId' property.Open points
BR,
Marten