Skip to content
Snippets Groups Projects
Commit adaf185f authored by PEDROLI Benjamin's avatar PEDROLI Benjamin
Browse files

add doc from Reda

parent 65c606ce
No related branches found
No related tags found
No related merge requests found
Pipeline #9805 passed
:construction: Section under Construction :construction:
# Doctypes
Doctypes represent different types of data. Their primary use is for permissions: an app or konnector will request permissions for one or several doctypes and will not be able to access other doctypes. See [Doctypes documentation](https://docs.cozy.io/en/cozy-doctypes/docs/) for more information.
The following is a full description of the doctypes we use and their fields. Cozy doctypes won't be fully described. Instead, for every used one, we'll include a link to its official documentation.
## Used Cozy doctypes
- [`io.cozy.accounts`](https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.accounts): Konnector accounts
- [`io.cozy.contacts`](https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.contacts): Contacts
- [`io.cozy.contacts.groups`](https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.contacts.groups): Contacts groups
- [`io.cozy.files`](https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.files): Files
- [`io.cozy.konnectors`](https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.konnectors): Connectors installed in the cozy
- [`io.cozy.permissions`](https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.permissions): Permissions of the instance
- [`io.cozy.todos.item`](https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.todos.item): Todos item
- [`io.cozy.todos.list`](https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.todos.list): Todos list
- [`io.cozy.triggers`](https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.triggers): Job triggers
## Custom doctypes
- `com.grandlyon.mps.notes`
Represents ...
`com.grandlyon.mps.notes` attributes are:
- `title`: {string} The title of the note.
- `content`: {string} The content of the note.
#### Example
```json
{
title: '...',
content: '...',
}
```
- `com.grandlyon.mps.profile`
Represents the tutorial and notifications state.
`com.grandlyon.mps.profile` attributes are:
- `tutorial`: {object} contains `home`, `contacts`, `documents`, `actions`, and `notes` which are all of type `boolean`. Each one represents the state of its tutorial. For example, `home: true` means the home tutorial hasn't been seen yet and will be visible to the user the next time he visits the Home component.
- `notification`: {} ...
#### Example
```json
{
tutorial: {
home: true,
contacts: false,
documents: true,
actions: false,
notes: true
},
notification: ...
}
}
```
- `com.grandlyon.mps.appointments`
...
- `com.grandlyon.mps.docrules`
Represents ...
`com.grandlyon.mps.docrules` attributes are:
- `description`: {string} Description of the docrule.
- `doctype`: {string} ...
- `rule`: {object} Contains `limit` of type `number`and `selector` which is an `object` with the following attributes:
- `'cozyMetadata.classification'`: {string} Classification ...
- `'cozyMetadata.createdAt'`: {object} Creation date.
#### Example
```json
{
description: '...',
doctype: 'io.cozy.files',
rule: {
limit: 10,
selector: {
'cozyMetadata.classification': '...',
'cozyMetadata.createdAt': 'December 23, 2020 03:24:00',
}
}
}
```
!!! info ""
:construction: Section under Construction :construction:
## Initialize
- Create a new project 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**
This will prevent anyone to push on the master branch, the only way to add code to the branch will be 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
git clone https://forge.grandlyon.com/solidarite/monparcourssocial/mps-usager.git
```
- Create the development branch
```
git checkout -b dev
```
- Init your project and then type any time you want to commit changes:
```
git add .
git commit -m "Commit changes"
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:
```
git branch
```
> to see your current branch
### Conventional Commits
A `feature` branch name should follow this structure:
- *feat/<title_of_the_user_story\>*
You can create the branch by typing:
```
git checkout -b feat/<title_of_the_user_story>
```
Each fix branch should be named as the following *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.
**add tag**
```
git tag -a 1.0.0 -m "complementary message"
```
### Gitflow Scheme
![Gitflow](/img/gitflow.png)
\ No newline at end of file
:construction: Section under Construction :construction:
In this section, you will find information about the project file structure and the purpose of the main folders.
##Source Files
| Folder/File | Purpose |
| ------------------ | ------------------------------------------------------------ |
| assets | The application's assets, contains fonts, svg and png files. |
| docrules | |
| doctypes | Contains the **cozy** doctypes, you can see more on [Cozy Documentation](https://github.com/cozy/cozy-doctypes). |
| helpers | Contains helper functions that are used by services. It contains also a test file for each helper file. |
| locales | Contains JSON data used by the translation system i18n provided by [Cozy-ui](https://github.com/cozy/cozy-ui). |
| models | Contains all our models' Interfaces |
| services | Here you'll find all the services. It contains also a test file for each service file. |
| store | Redux store. Contains actions, reducers, and store types. |
| styles | Styles folder. The **base** folder under it contains our variables, fonts, breakpoints, animations, and mixins. Whenever you add a style file elsewhere, don't forget to import it in **index.scss**. |
| targets | Contains mobile and browser targets. It also contains a **Public** target for *social workers*. |
| types | |
| utils | In this folder you'll find utilities methods. |
| tests | |
| components/App.tsx | The root component. |
##Configuration Files
| Folder/File | Purpose |
| --------------- | ------------------------------------------------------------ |
| .eslintrc.js | Config file for ESLint. |
| gitlab-ci.yml | Config file used for Gitlab continuous integration. |
| .prettierrc | Config file for Prettier extension. |
| | |
| jest.config.js | Config file used by Jest for testing the application. |
| manifest.webapp | Manifest of the application, used by cozy for permissions' management, you can add permissions for doctypes here. |
| tsconfig.json | Config file for TypeScript. |
| ... | |
\ No newline at end of file
:construction: Section under Construction :construction:
## Profile Service
### Functions
- `getProfile`: Tries fetching the profile if it exists. If not, it creates a new one and returns it.
- `updateProfile`: Updates the profile.
## Note Service
### Functions
- `findNoteCurrentAppointement`: Returns a note from an appointment id.
- `findNoteById`: Returns a note by its id.
- `getAllNotes`: Returns all notes.
- `findLastNote`: Returns the last note by date.
- `createNote`: Creates a new note and returns it.
- `updateNote`: Updates a note.
- `deleteNoteById`: Deletes a note by its id.
## DocRule Service
### Functions
- `createDocRule`: Creates a new docRule.
- `getDocRuleById`: Returns a docRule by its id.
- `getDocRulesByIds`: Returns a list of docRules by their ids.
- `getAllDocRules`: Returns all docRules.
- `createAllDocRules`: Fetches all docRules and creates the missing ones.
## Document Service
### Functions
- `getAllDocuments`: Returns the list of all documents.
- `getDocumentsByQualification`: Returns a document by the `'metadata.qualification.label'`.
- `getDocumentsByQualifications`: Uses `getDocumentsByQualification` to return a list of documents by the `'metadata.qualification.label'`.
- `getDocumentByID`: Returns a document by its id.
- `saveDocument`: Creates a new file.
- `editDocumentName`: Edits a document's name by its id.
- `deleteDocumentById`: Deletes the document by its id.
- `downloadDocument`: Downloads a file from its id.
- `viewDocument`: Takes a document's id, opens its download link and returns it.
## Contact Service
### Functions
- `getCurrentUser`: Returns the contact with an existing `me` field, which represents the current user.
- `getAllContacts`: Returns a list of all contacts.
- `findContactById`: Returns a contact by its id.
- `createContact`: Creates a new contact.
- `updateContact`: Updates an existing contact.
- `deleteContactById`: Deletes a contact by its id.
## Group Service
## Function
- `createMetroGroup`: Creates a new group and returns it.
- `getMetroGroup`: Returns the group if it exists or creates it if it doesn't.
## ...
\ No newline at end of file
# Redux
We are using **Redux** for our application state management. it maintains the state of the entire application in a single immutable state tree (object), which can't be changed directly. When something changes, a new object is created (using actions and reducers). For more information about Redux, visit The [official documentation][https://redux.js.org/].
## Store
The following are the existing store entities used by our application:
- `Global`: Preserves the global state, which includes `isPublic` and `screenType` (Mobile/Tablet/Desktop).
- `UploadDocument`: Manages the state of uploaded documents.
- `Profile`: Preserves the state of tutorials and notifications.
For each reducer file, a test file is associated testing the reducer.
All the actions are tested in a separate file with the same actions file name.
## Used packages
- **react-redux**: Official React bindings for [Redux](https://github.com/reduxjs/redux).
- **redux-devtools-extension**: For debugging application's state changes.
- **@types/react-redux**: This package contains type definitions for react-redux.
\ No newline at end of file
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