---
title: GDPR
slug: oip-next/howtqhuzso3xvpivo8qz
icon: {"lucideIcon":"📘"}
createdAt: 2024-04-08T10:17:29.000Z
---

# GDPR

## Description

L'entité GDPR regroupe les informations relatives au consentement RGPD d'une personne.

## Relations

### Ascendantes

| Entité   | Propriété |
| -------- | --------- |
| Company  | GDPRs     |
| Contact  | GDPRs     |
| Customer | GDPRs     |
| Employee | GDPRs     |
| Grantee  | GDPRs     |
| Tns      | GDPRs     |
| User     | GDPRs     |

### Descendantes

| Entité  | Propriété |
| ------- | --------- |
| History | history   |

## Propriétés

| Nom          | Type           | Description                                                                    | Validateur | Lecture seule ? | Dépréciée ? | Dernière version modifiée |
| ------------ | -------------- | ------------------------------------------------------------------------------ | ---------- | --------------- | ----------- | ------------------------- |
| date         | `Date`         | Date du consentement de l'utilisateur                                          |            |                 |             |                           |
| isConsent    | `Boolean`      | Indique si l'utilisateur donne son consentement RGPD                           |            |                 |             |                           |
| type         | `GDPRTypeEnum` | Cas d’usage de l'entrée GDPR                                                   |            |                 |             | 3.16.0                    |
| id           | `String`       | Identifiant de l'entité `GDPR`                                                 |            | X               |             |                           |
| code         | `String`       | Codification fonctionnelle de l'entité `GDPR`                                  |            |                 |             |                           |
| externalId   | `String`       | Identifiant de l'entité `GDPR` dans le système client                          |            |                 |             |                           |
| externalCode | `String`       | Codification fonctionnelle de l'entité `GDPR` dans le système client           |            |                 |             |                           |
| gDPRId       | `String`       | Identifiant public de l'entité `GDPR` dans l'OIP                               |            |                 |             |                           |
| label        | `String`       | Information relative au nom de l'entité `GDPR` dans son contexte d'utilisation |            |                 |             |                           |
| createdAt    | `Date`         | Date de création de l'entité `GDPR`                                            |            | X               |             |                           |
| updatedAt    | `Date`         | Date de modification de l'entité `GDPR`                                        |            | X               |             |                           |

## Enumérations

### GDPRTypeEnum

- `LEGAL_OBLIGATION`
- `LEGAL_PUBLIC_IINTEREST`
- `LEGAL_VITAL_INTERESTS`
- `COMMERCIAL_MARKETING_PROSPECTING`
- `COMMERCIAL_CUSTOMER_DATABASE_MANAGEMENT`
- `COMMERCIAL_DATA_RESALE`
- `COOKIES_FIRST`
- `COOKIES_MARKETING`
- `COOKIES_ANALYTICS`
- `SENSITIVE_HEALTH`
- `SENSITIVE_BIOMETRIC`
- `SENSITIVE_OPINIONS`
- `INTERNATIONAL_DATA_TRANSFERT`
- `RESERCH_ANONYMIZATION`
- `RESEARCH_ARCHIVING`

## Enumérations génériques

Aucune enumération générique.

## Exemple

```javascript
import { Entities } from '@fasstech/oip-core';
import { getCompanyId } from '@fasstech/oip-core/entities/Company';
import { getGDPRCode, getGDPRDate, getGDPRExternalCode, getGDPRExternalId, getGDPRGDPRId, getGDPRId, getGDPRIsConsent, getGDPRLabel, getGDPRType, setGDPRCode, setGDPRDate, setGDPRExternalCode, setGDPRExternalId, setGDPRGDPRId, setGDPRIsConsent, setGDPRLabel, setGDPRType } from '@fasstech/oip-core/entities/GDPR';
import { GDPRTypeEnum } from '@fasstech/oip-core/entities/GDPR/enums';
import { getProjectId } from '@fasstech/oip-core/entities/Project';

(async () => {
  let project = await Entities('Project').create();
  let company = await Entities('Company').create();
  const gDPR = await Entities('GDPR').create();
  
  setGDPRDate(new Date('2017-01-01'), gDPR);
  setGDPRIsConsent(false, gDPR);
  setGDPRType(GDPRTypeEnum.RESERCH_ANONYMIZATION, gDPR);
  setGDPRCode('code', gDPR);
  setGDPRExternalId('externalId', gDPR);
  setGDPRExternalCode('externalCode', gDPR);
  setGDPRGDPRId('gDPRId', gDPR);
  setGDPRLabel('label', gDPR);
  
  company = await Entities('GDPR').save(company, gDPR);
  project = await Entities('Company').save(project, company);
  await Entities('Project').save(project);
  
  const projectToTest = await Entities('Project').get({ id: getProjectId(project) });
  const companyToTest = await Entities('Company').get(projectToTest, { filter: ({ id }) => id === getCompanyId(company) });
  const gDPRToTest = await Entities('GDPR').get(companyToTest, { filter: ({ id }) => id === getGDPRId(gDPR) });
  
  getGDPRDate(gDPRToTest); // new Date('2017-01-01')
  getGDPRIsConsent(gDPRToTest); // false
  getGDPRType(gDPRToTest); // GDPRTypeEnum.RESERCH_ANONYMIZATION
  getGDPRCode(gDPRToTest); // 'code'
  getGDPRExternalId(gDPRToTest); // 'externalId'
  getGDPRExternalCode(gDPRToTest); // 'externalCode'
  getGDPRGDPRId(gDPRToTest); // 'gDPRId'
  getGDPRLabel(gDPRToTest); // 'label'
})();
```
