diff --git a/docs/ecolyo/application/services.md b/docs/ecolyo/application/services.md index 9dd6dde8a4df76df7fb002c525992b57a490780d..c93b293fe2151b4ed31698a6c3b618caeff5344c 100644 --- a/docs/ecolyo/application/services.md +++ b/docs/ecolyo/application/services.md @@ -1,6 +1,3 @@ -!!! warning "" - :construction: Section under Construction :construction: - ## Cron Services In order to build an automated task within our cozy-stack, we can create *services* which are javascript files called from a trigger job. @@ -15,12 +12,28 @@ File location is determined after the build, see [here](https://forge.grandlyon. !!! note "Cron" See the cron definition at [cozy-stack](https://docs.cozy.io/en/cozy-stack/jobs/#cron-syntax). -### Services +## Ecolyo services Located under **src\targets\services** -#### Monthly report notification +### Monthly report notification + +#### Definition of the service +The service will run the 3rd of each month at 10.00 am, as defined in the manifest: + +``` +"monthlyReportNotification": { + "type": "node", + "file": "services/monthlyReportNotification/ecolyo.js", + "trigger": "@cron 0 0 10 3 * *" + } +``` +#### Main responsabilities of the service -Fetches metadata to customize the mail (Public name, instance url). +The service is reponsible of sending a mail to user to warn him about the availability of a new information in the Analyse. -Send mail containing a link to the user instance so that he can be warned about the update of its monthly report and visualize it. +Main steps are the following: + - Check the "sendReportNotification" attribute in the com.grandlyon.ecolyo.profile doctype. If true, service will continue, else it will stop. + - Fetches metadata to customize the mail (Public name, instance url). + - Build the mail. + - Send the mail.