diff --git a/docs/ecolyo/application/release.md b/docs/ecolyo/application/release.md new file mode 100644 index 0000000000000000000000000000000000000000..90bc6d151cc47dc8808d4404b29a142c167f47f8 --- /dev/null +++ b/docs/ecolyo/application/release.md @@ -0,0 +1,40 @@ +# Release + +This section will show you how to properly create a release for the app. + +## Conventionnal commit + +The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages. + +The commit message should be structured as follows: + +``` +<type>[optional scope]: <description> + +[optional body] + +[optional footer(s)] +``` + +The commit contains the following structural elements, to communicate intent to the consumers of your library: + +* fix: a commit of the type fix patches a bug in your codebase (this correlates with PATCH in Semantic Versioning). +* feat: a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in Semantic Versioning). +* BREAKING CHANGE: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type. +* types other than fix: and feat: are allowed, for example @commitlint/config-conventional (based on the the Angular convention) recommends build:, chore:, ci:, docs:, style:, refactor:, perf:, test:, and others. +* footers other than BREAKING CHANGE: <description> may be provided and follow a convention similar to git trailer format. + +## standard-version + +Standard-version is librairie javascript that allow to handle easly tags and changelog file. + +Just run the following command in order to create a release tag, bump package.json version and upadte changelog file. + +```bash +yarn run release -- --release-as X.X.X # replace with version number (ex: 1.2.0) +``` + +## Usefull links +[Conventional commit doc](https://www.conventionalcommits.org/en/v1.0.0/) + +[Lib link](https://github.com/conventional-changelog/standard-version) \ No newline at end of file diff --git a/docs/ecolyo/functionalities/feedback.md b/docs/ecolyo/functionalities/feedback.md new file mode 100644 index 0000000000000000000000000000000000000000..4a3b5ea77f5322e40f208d4cb266076b347b6100 --- /dev/null +++ b/docs/ecolyo/functionalities/feedback.md @@ -0,0 +1,32 @@ +# Feedback + +Users can send a feedback in the application, the feedback's receiver is defined in the _FeedbackModal component_ + +## Add mail attachments + +The user has the possibility to add an image to a feedback. + +The email informations are created in the _sendEmail_ function and the mailData respects this scheme : + +```js +const mailData = { + mode: "from", + to: [{ name: "Support", email: "receiver-email" }], + subject: "Your subject", + parts: [{ type: "text/plain", body: mailContent }], + attachments: [{ filename: "test.png", content: "base64file" }], +}; +``` + +It is important that your file is sent base64 encoded to the sendmail job and with the _data...base64_ headers removed, otherwise it will be unreadable. +In order to do this, we use a reader to read the file as Data URL + +```js +reader.readAsDataURL(file); +``` + +and then apply to the result so we send only the encoded part without its headers. + +```js +split(",")[1]; +``` diff --git a/docs/ecolyo/functionalities/profile_type.md b/docs/ecolyo/functionalities/profile_type.md index 065bb70fa3749f45e583ba0e909f4e44908167a8..4003506d65d32422ed54b980d98383076f00956a 100644 --- a/docs/ecolyo/functionalities/profile_type.md +++ b/docs/ecolyo/functionalities/profile_type.md @@ -110,3 +110,18 @@ Also, we consider that if the heating or the hotwater are collective, we don't c The method **fetchDJU(month:number)** tries to fetch the daily dju from the datagrandlyon API trough a remote doctype named _org.ecolyo.dju_. The data returned by this API are gathered by the lyon-bron-sta The API returns dju by day for a given month, so we add them to return a monthly dju. If remote doctype fails or return a null value, we returns instead the default dju stored in _heating.json_ + +Usefull tips while working with this API : + +- Do not pass a Content-Type while requesting, it will returns error +- While requesting from a cozy instance, if you get errors, you will get errors from the cozy stack and not directly from the API, which leads to weird cases : + - If there is an authentication error, the api will returns an error in _html_ format to cozy, so you'll get from cozy an error 502 as following, beacause cozy expects a json response : + ```json + { + "status": "502", + "title": "Bad Gateway", + "detail": "the content-type for the response is not authorized", + "source": {} + } + ``` + - In case of bad request (wrong paramaters for example), the API will return an error in _xml_ format so you'll get exaclty the same error as above in your cozy instance. diff --git a/docs/ecolyo/project_architecture/remote_doctypes.md b/docs/ecolyo/project_architecture/remote_doctypes.md index afb30112e81a2b78c277f0f14929665f8e63d38d..852782caf276c1be1c71e47729d597738b72cf8c 100644 --- a/docs/ecolyo/project_architecture/remote_doctypes.md +++ b/docs/ecolyo/project_architecture/remote_doctypes.md @@ -129,3 +129,16 @@ const result = await client ``` If you wanna know more about remote doctypes and how to store and use secret tokens, please refer to the official cozy documentation. + +## Add secrets to a remote + +As above, you can pass a _{{secret_token}}_ to your remote doctype. In local, you can directly pass it as a request param in _io.cozy.doctypes/org.ecolyo.usage_. +Otherwise, you will have to add it in the shell script _easy-cozy/db-init.sh_ on the server. You can add the following line to the file in order to add the secret in the database : + +``` +docker-compose exec db curl -X PUT -d "{\"_id\":\"org.ecolyo.dju\",\"token\":\"${API_DATAGRANDLYON_TOKEN}\"}" http://127.0.0.1:5984/secrets%2Fio-cozy-remote-secrets/org.ecolyo.dju +``` + +Make sure you have the right remote doctype name as \_id. + +Then, in the .env file, just add your token variable. diff --git a/mkdocs.yml b/mkdocs.yml index 049da3a130ee556a54f474bb6bfda363eb0eb0d8..fd7524a89cdcdf289f0075c356ee544b75999362 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -43,13 +43,15 @@ nav: - DocTypes: ecolyo/project_architecture/doctypes.md - Remote DocTypes: ecolyo/project_architecture/remote_doctypes.md - Application: + - Deploy: ecolyo/application/deploy.md - Description: ecolyo/application/description.md + - Gitflow: ecolyo/application/gitflow.md - Redux: ecolyo/application/redux.md + - Release: ecolyo/application/release.md - Scaffolding: ecolyo/application/scaffolding.md - - Services: ecolyo/application/services.md - Gitflow: ecolyo/application/gitflow.md - Deploy: ecolyo/application/deploy.md - - Services: + - Services: - Description: ecolyo/services/index.md - Monthly report notification: ecolyo/services/monthly_report_notification.md - Aggregator usage events: ecolyo/services/aggregator_usage_events.md @@ -62,6 +64,7 @@ nav: - Profile Type: ecolyo/functionalities/profile_type.md - Analysis: ecolyo/functionalities/analysis.md - Usage events tracking: ecolyo/functionalities/usage_events_tracking.md + - Feedback: ecolyo/functionalities/feedback.md - Pilote: - Pilote - TS - Back: - Index: pilote/Pilote - TS - Back/index.md