---
title: Contact
slug: oip-next/t6ve5pppibg7ipxeuwfqm
createdAt: 2024-02-21T13:40:10.000Z
---

# Contact

## Description

L'entité Contact permet la gestion des différents contacts liés au projet \:destinataire de mail, signataire, représentant légal, etc.

## Relations

### Ascendantes

| Entité  | Propriété |
| ------- | --------- |
| Project | contacts  |

### Descendantes

| Entité         | Propriété      |
| -------------- | -------------- |
| GDPR           | GDPRs          |
| Address        | address        |
| Address        | addresses      |
| Aml            | aml            |
| BankAccount    | bankAccounts   |
| Email          | emails         |
| History        | history        |
| Phone          | phones         |
| SocialSecurity | socialSecurity |

## Liste des propriétés

| Nom                   | Type           | Dernière version modifiée | Description                                                      | Getter                          | Setter                          | Deprecated               |
| --------------------- | -------------- | ------------------------- | ---------------------------------------------------------------- | ------------------------------- | ------------------------------- | ------------------------ |
| civility              | `CivilityEnum` | 2.1.0                     | Civilité                                                         | getContactCivility              | setContactCivility              | -                        |
| companyName           | `String`       | 2.6.0                     | Nom de la société du contact                                     | getContactCompanyName           | setContactCompanyName           | -                        |
| createdAt             | `Date`         |                           | Date de création de l'entité `Contact`                           | getContactCreatedAt             | Lecture seule                   | -                        |
| createdBy             | `String`       |                           | Utilisateur à l'origine de la création de l'entité `Contact`     | getContactCreatedBy             | Lecture seule                   | -                        |
| email                 | `String`       | 2.1.0                     | Email du contact                                                 | getContactEmail                 | setContactEmail                 | Utiliser l'entité emails |
| externalId            | `String`       | 2.4.0                     | Identifiant externe du contact                                   | getContactExternalId            | setContactExternalId            | -                        |
| firstName             | `String`       | 2.1.0                     | Prénom du contact                                                | getContactFirstName             | setContactFirstName             | -                        |
| id                    | `String`       |                           | Identifiant unique de l'entité `Contact`                         | getContactId                    | Lecture seule                   | -                        |
| isPEP                 | `Boolean`      | 2.1.0                     | Personne Politiquement Exposée                                   | getContactIsPEP                 | setContactIsPEP                 | -                        |
| isRecipient           | `Boolean`      | 2.1.0                     | Permet de savoir si le contact est destinataire du mail          | getContactIsRecipient           | setContactIsRecipient           | -                        |
| isSignatory           | `Boolean`      | 2.1.0                     | Permet de savoir si le contact est signataire                    | getContactIsSignatory           | setContactIsSignatory           | -                        |
| lastName              | `String`       | 2.1.0                     | Nom de famille du contact                                        | getContactLastName              | setContactLastName              | -                        |
| mobilePhoneIndicative | `String`       | 2.1.0                     | Indicatif téléphonique mobile                                    | getContactMobilePhoneIndicative | setContactMobilePhoneIndicative | Utiliser l'entité phones |
| mobilePhoneNumber     | `String`       | 2.1.0                     | Numéro de téléphone mobile                                       | getContactMobilePhoneNumber     | setContactMobilePhoneNumber     | Utiliser l'entité phones |
| phoneIndicative       | `String`       | 2.1.0                     | Indicatif téléphonique                                           | getContactPhoneIndicative       | setContactPhoneIndicative       | Utiliser l'entité phones |
| phoneNumber           | `String`       | 2.1.0                     | Numéro de téléphone                                              | getContactPhoneNumber           | setContactPhoneNumber           | Utiliser l'entité phones |
| role                  | `RoleEnum`     | 2.1.0                     | Rôle du contact                                                  | getContactRole                  | setContactRole                  | -                        |
| updatedAt             | `Date`         |                           | Date de modification de l'entité `Contact`                       | getContactUpdatedAt             | Lecture seule                   | -                        |
| updatedBy             | `String`       |                           | Utilisateur à l'origine de la modification de l'entité `Contact` | getContactUpdatedBy             | Lecture seule                   | -                        |

## Enums

### CivilityEnum

- `CivilityEnum.MISS`
- `CivilityEnum.MISTER`

### RoleEnum

- `RoleEnum.ACCOUNTANT`
- `RoleEnum.ADMINISTRATIVE_MANAGER`
- `RoleEnum.BROKER`
- `RoleEnum.COMMERCIAL`
- `RoleEnum.FINANCIAL_OFFICER`
- `RoleEnum.HEAD_MANAGER`
- `RoleEnum.HR_MANAGER`
- `RoleEnum.LEGAL_REPRESENTATIVE`
- `RoleEnum.MANAGER`
- `RoleEnum.OTHER`

## Exemple

```javascript
import { Entities } from '@fasstech/oip-core';
import { getContactCivility, getContactCompanyName, getContactEmail, getContactExternalId, getContactFirstName, getContactIsPEP, getContactIsRecipient, getContactIsSignatory, getContactLastName, getContactMobilePhoneIndicative, getContactMobilePhoneNumber, getContactPhoneIndicative, getContactPhoneNumber, getContactRole, getcontactId, setContactCivility, setContactCompanyName, setContactEmail, setContactExternalId, setContactFirstName, setContactIsPEP, setContactIsRecipient, setContactIsSignatory, setContactLastName, setContactMobilePhoneIndicative, setContactMobilePhoneNumber, setContactPhoneIndicative, setContactPhoneNumber, setContactRole } from '@fasstech/oip-core/entities/contact';
import { CivilityEnum, RoleEnum } from '@fasstech/oip-core/entities/contact/enums';
import { getProjectId } from '@fasstech/oip-core/entities/project';

(async () => {
  let ProjectEntity = await Entities('Project').get({ id: projectId });
  const ContactEntity = await Entities('Contact').create();
  
  setContactCivility(CivilityEnum.MISTER, ContactEntity);
  setContactCompanyName('companyName', ContactEntity);
  setContactEmail('email', ContactEntity);
  setContactExternalId('externalId', ContactEntity);
  setContactFirstName('firstName', ContactEntity);
  setContactIsPEP(false, ContactEntity);
  setContactIsRecipient(false, ContactEntity);
  setContactIsSignatory(false, ContactEntity);
  setContactLastName('lastName', ContactEntity);
  setContactMobilePhoneIndicative('mobilePhoneIndicative', ContactEntity);
  setContactMobilePhoneNumber('mobilePhoneNumber', ContactEntity);
  setContactPhoneIndicative('phoneIndicative', ContactEntity);
  setContactPhoneNumber('phoneNumber', ContactEntity);
  setContactRole(RoleEnum.FINANCIAL_OFFICER, ContactEntity);
  
  ProjectEntity = await Entities('Contact').save(ProjectEntity, ContactEntity);
  await Entities('Project').save(ProjectEntity);
  
  const ProjectEntityToTest = await Entities('Project').get({ id: getProjectId(ProjectEntity) });
  const ContactEntityToTest = await Entities('Contact').get(ProjectEntityToTest, getContactId(ContactEntity));
  
  getContactCivility(ContactEntityToTest); // CivilityEnum.MISTER
  getContactCompanyName(ContactEntityToTest); // 'companyName'
  getContactEmail(ContactEntityToTest); // 'email'
  getContactExternalId(ContactEntityToTest); // 'externalId'
  getContactFirstName(ContactEntityToTest); // 'firstName'
  getContactIsPEP(ContactEntityToTest); // false
  getContactIsRecipient(ContactEntityToTest); // false
  getContactIsSignatory(ContactEntityToTest); // false
  getContactLastName(ContactEntityToTest); // 'lastName'
  getContactMobilePhoneIndicative(ContactEntityToTest); // 'mobilePhoneIndicative'
  getContactMobilePhoneNumber(ContactEntityToTest); // 'mobilePhoneNumber'
  getContactPhoneIndicative(ContactEntityToTest); // 'phoneIndicative'
  getContactPhoneNumber(ContactEntityToTest); // 'phoneNumber'
  getContactRole(ContactEntityToTest); // RoleEnum.FINANCIAL_OFFICER
})();
```
