Skip to content
Snippets Groups Projects
Commit 544cd52b authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Remove under construction

parent 2e3dcc5d
No related branches found
No related tags found
No related merge requests found
!!! info ""
:construction: Section under Construction :construction:
Ecolyo is a [Cozy](https://docs.cozy.io/en/) application that allows users to connect their energy accounts such as **EGL**, **ENEDIS** and **GRDF**, using cozy [konnectors](https://docs.cozy.io/en/cozy-stack/konnectors/)
!!! info ""
:construction: Section under Construction :construction:
## Initialize
- Create a new projet in gitlab and take note of its url
### Protecting Master Branch
On the gitlab page of your project go to *Settings/Repository* in the *Protected Branches* section.
Select the **Master** branch and set **allow to merge** to ***Master*** and **allow to push** to **No one**
On the gitlab page of your project go to _Settings/Repository_ in the _Protected Branches_ section.
Select the **Master** branch and set **allow to merge** to **_Master_** and **allow to push** to **No one**
This will prevent anyone to push on the master branch, the only way to add code to the branch will be using merge requests.
### Setting Development Branch
- Retrieve the project on your computer, open a command line and execute.
```
git clone https://forge.grandlyon.com/web-et-numerique/llle.git
```
- Create the development branch
```
......@@ -31,34 +31,40 @@ git push origin dev
```
## Start Developing
For any other development you should create a branch from the development branch.
First make sure to be on the ***dev*** branch, type:
First make sure to be on the **_dev_** branch, type:
```
git branch
```
> to see your current branch
### Conventional Commits
The commit contains the following structural **types**:
- fix
- feature
In our team organisation we are using IceScrum to keep track of our User Stories (US). Each US is identified by a number. In order to easily identify the commit that refers to the US, a `feature` branch name should follow this structure:
- *features/<number of the User Story\>-<title_of_the_user_story\>*
- _features/<number of the User Story\>-<title_of_the_user_story\>_
You can create the branch by typing:
```
git checkout -b features/<number of the User Story>-<title_of_the_user_story>
```
> Note that the **feature** type is the only one with a dedicated folder (features/-US).
Each fix branch should be named as the following *fix-\<title_of_the_fix\>*.
Each fix branch should be named as the following _fix-\<title_of_the_fix\>_.
You can create the branch by typing:
```
git checkout -b fix-<title_of_the_fix>
```
......@@ -66,13 +72,14 @@ git checkout -b fix-<title_of_the_fix>
**Breaking Change**
Appends a `!` before the title of the commit to notify that a breaking change has happened. Give a solid description of the changes as well.
**Types** other than fix and feature are allowed, for example *build*, *chore*, *ci*, *docs*, *style*, *refactor*, *perf*, *test* and others.
**Types** other than fix and feature are allowed, for example _build_, _chore_, _ci_, _docs_, _style_, _refactor_, _perf_, _test_ and others.
**add tag**
```
git tag -a 1.0.0 -m "complementary message"
```
```
### Gitflow Scheme
![Gitflow](/img/gitflow.png)
\ No newline at end of file
![Gitflow](/img/gitflow.png)
!!! info ""
:construction: Section under Construction :construction:
This section explain all the functionnalities in the challenge part
## Quiz
......
!!! info ""
:construction: Section under Construction :construction:
This section explains how to handle data storage.
We handle data storage according to the following process :
......
!!! info ""
:construction: Section under Construction :construction:
This section will allow you to launch a proper local environment of the Ecolyo application
## Initialisation of the project
......@@ -74,14 +71,12 @@ If the application starts successfully you should obtain the following message:
> App successfully compiled!
> Dev assets:http://localhost:8888
Once the application is started, run the easy-cozy stack with docker.
Once the application is started, run the easy-cozy stack with docker.
!!! info "Fix webpack error on cozy script"
**Deprecated** Updated cozy-script lib
To fix it launch the following command in node_modules/cozy-script folder:
```
yarn add webpack
```
**Deprecated** Updated cozy-script lib
To fix it launch the following command in node_modules/cozy-script folder:
` yarn add webpack `
### Run easy-cozy dev stack
......@@ -110,6 +105,7 @@ yarn winstack
```
A Powershell window will open. Wait until the success message:
> Everything is setup. Go to http://ecolyo.cozy.tools:8080/
> To exit, press ^C
......@@ -125,6 +121,7 @@ yarn linuxstack
```
Wait until the success message:
> Everything is setup. Go to http://ecolyo.cozy.tools:8080/
> To exit, press ^C
......@@ -189,12 +186,14 @@ When using local environment, konnectors are not able to connect.
To simulate the connection you can use the script **createConnection.js** available in **scripts** folder.
First update the authorization and cookie information from the "config.js" file (if not create just create it from the "config.template.js" file):
```
const authorization =
'Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
const cookie =
'cozysessid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
```
To obtain your own Bearer and cozysessid you need to have the application launched and display the web console (F12) in your navigator and select the Network tab. Just select one request and retrieve information for Request Header:
![Bearer&cozysessid](/img/bearer_cozysessid.png)
......@@ -206,4 +205,4 @@ cd scripts
node createConnection.js
```
Your data is now loaded and you can refresh the application to see your konnector connected.
\ No newline at end of file
Your data is now loaded and you can refresh the application to see your konnector connected.
!!! info ""
:construction: Section under Construction :construction:
## EGL Konnector
This konnector fetches consumptions measures from EGL API.
......
!!! info ""
:construction: Section under Construction :construction:
This konnector fetches consumptions measures from Enedis API. This is an Oauth Konnector, meaning the authentification performed to access all data is made following an Oauth2 protocol.
You can clone the project [here](https://forge.grandlyon.com/web-et-numerique/llle_project/enedis-konnector).
......@@ -19,11 +16,11 @@ On its first launch, following the Oauth Client Connect authentification.
- The account has now an access_token and an id_token from the oauth call
!!! info ""
id token is only given when requesting the token endpoint in \_authorization_code grant_type.
This token holds several meta datas, including the usage_point_id (id of user's meter) that will be needed further to fetch user's datas.
id token is only given when requesting the token endpoint in \_authorization_code grant_type.
This token holds several meta datas, including the usage_point_id (id of user's meter) that will be needed further to fetch user's datas.
- Konnector starts, if no usage_point_id are found in database or fields then proceed as a first launch. Store the usage_point_id in oauth_callback_result in db (see [addData](https://docs.cozy.io/en/cozy-konnector-libs/api/#adddata_1)).
- Konnector finds usage_point_id when starting but token is expired. Proceed to refresh token and restart konnector with usage_point_id in fields params (see *Troubleshooting when asking for refresh token* section at the end of the page).
- Konnector finds usage_point_id when starting but token is expired. Proceed to refresh token and restart konnector with usage_point_id in fields params (see _Troubleshooting when asking for refresh token_ section at the end of the page).
## Enedis API
......@@ -82,16 +79,13 @@ For more information about Datahub-Enedis API, checkout the [Datahub documentati
When a token expires, the konnector will encounter an error when fetching user data, leading to a refresh token request.
Since refresh token requests restart the Konnector, it was decided to add the ```usage_point_id``` into the start fields when asking for a refresh token (see line 97).
Since refresh token requests restart the Konnector, it was decided to add the `usage_point_id` into the start fields when asking for a refresh token (see line 97).
!!! info "restart to refresh token"
Line 85: ```await cozyClient.fetchJSON(
'POST',
`/accounts/enedisgrandlyon/${accountId}/refresh`
)```
Line 85: `` await cozyClient.fetchJSON( 'POST', `/accounts/enedisgrandlyon/${accountId}/refresh` ) ``
Line 97: ```fields.usage_point_id = usage_point_id```
Line 98: ```return start(fields, cozyParameters, false)```
In fact the usage_point_id still remains in the account collection, but on restart, the konnector loses ```this._account``` context leading to an error when searching for usage_point_id in account.
\ No newline at end of file
In fact the usage_point_id still remains in the account collection, but on restart, the konnector loses `this._account` context leading to an error when searching for usage_point_id in account.
!!! info ""
:construction: Section under Construction :construction:
This konnector fetches consumptions measures from Grdf Adict API. This is an Oauth Konnector, meaning the authentification performed to access all data is made following an Oauth2 protocol.
You can clone the project [here](https://forge.grandlyon.com/web-et-numerique/llle_project/grdf-adict-konnector).
......@@ -51,7 +48,7 @@ This token holds several meta datas, including the pce_id (id of user's meter) t
```
!!! info "to do"
:construction: Add request PCE's frequency :construction:
:construction: Add request PCE's frequency :construction:
Grdf owns different type of meters, some are read twice a year (every six months therefore called 6M), others are 1M or 1D. Ecolyo could warn the user if its meter is not suited for the application use.
......
!!! info ""
:construction: Section under Construction :construction:
## Libraries
For this project, we use libraries below:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment