Skip to content
Snippets Groups Projects
Commit 1e7912a6 authored by Yoan VALLET's avatar Yoan VALLET
Browse files

update service section

parent 3262b87c
Branches
No related tags found
No related merge requests found
!!! warning ""
:construction: Section under Construction :construction:
## Cron Services ## 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. 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. ...@@ -15,12 +12,28 @@ File location is determined after the build, see [here](https://forge.grandlyon.
!!! note "Cron" !!! note "Cron"
See the cron definition at [cozy-stack](https://docs.cozy.io/en/cozy-stack/jobs/#cron-syntax). 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** 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.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment