---
title: Contact
slug: oip-next/94orduivlzhjx7e0hnwu
icon: {"lucideIcon":"📘"}
createdAt: 2024-04-08T10:17:29.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        | addresses        |
| Aml            | amls             |
| BankAccount    | bankAccounts     |
| Email          | emails           |
| History        | history          |
| Phone          | phones           |
| SocialSecurity | socialSecurities |

## Propriétés

| Nom          | Type              | Description                                                                       | Validateur | Lecture seule ? | Dépréciée ? | Dernière version modifiée |
| ------------ | ----------------- | --------------------------------------------------------------------------------- | ---------- | --------------- | ----------- | ------------------------- |
| birthDate    | `Date`            | Date de naissance du contact.                                                     |            |                 |             | 3.9.0                     |
| civility     | `CivilityEnum`    | Civilité                                                                          |            |                 |             | 2.1.0                     |
| companyName  | `String`          | Nom de la société du contact                                                      |            |                 |             | 2.6.0                     |
| firstName    | `String`          | Prénom du contact                                                                 |            |                 |             | 2.1.0                     |
| isRecipient  | `Boolean`         | Permet de savoir si le contact est destinataire du mail                           |            |                 |             | 2.1.0                     |
| isSignatory  | `Boolean`         | Permet de savoir si le contact est signataire                                     |            |                 |             | 2.1.0                     |
| lastName     | `String`          | Nom de famille du contact                                                         |            |                 |             | 2.1.0                     |
| role         | `ContactRoleEnum` | Rôle du contact                                                                   |            |                 |             | 2.1.0                     |
| id           | `String`          | Identifiant de l'entité `Contact`                                                 |            | X               |             |                           |
| code         | `String`          | Codification fonctionnelle de l'entité `Contact`                                  |            |                 |             |                           |
| externalId   | `String`          | Identifiant de l'entité `Contact` dans le système client                          |            |                 |             |                           |
| externalCode | `String`          | Codification fonctionnelle de l'entité `Contact` dans le système client           |            |                 |             |                           |
| contactId    | `String`          | Identifiant public de l'entité `Contact` dans l'OIP                               |            |                 |             |                           |
| label        | `String`          | Information relative au nom de l'entité `Contact` dans son contexte d'utilisation |            |                 |             |                           |
| createdAt    | `Date`            | Date de création de l'entité `Contact`                                            |            | X               |             |                           |
| updatedAt    | `Date`            | Date de modification de l'entité `Contact`                                        |            | X               |             |                           |

## Enumérations

### ContactRoleEnum

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

## Enumérations génériques

- CivilityEnum

## Exemple

```javascript
import { Entities } from '@fasstech/oip-core';
import { getContactBirthDate, getContactCivility, getContactCode, getContactCompanyName, getContactContactId, getContactExternalCode, getContactExternalId, getContactFirstName, getContactId, getContactIsRecipient, getContactIsSignatory, getContactLabel, getContactLastName, getContactRole, setContactBirthDate, setContactCivility, setContactCode, setContactCompanyName, setContactContactId, setContactExternalCode, setContactExternalId, setContactFirstName, setContactIsRecipient, setContactIsSignatory, setContactLabel, setContactLastName, setContactRole } from '@fasstech/oip-core/entities/Contact';
import { ContactRoleEnum } from '@fasstech/oip-core/entities/Contact/enums';
import { getProjectId } from '@fasstech/oip-core/entities/Project';
import { CivilityEnum } from '@fasstech/oip-core/entities/enums';

(async () => {
  let project = await Entities('Project').create();
  const contact = await Entities('Contact').create();
  
  setContactBirthDate(new Date('2017-01-01'), contact);
  setContactCivility(CivilityEnum.MISTER, contact);
  setContactCompanyName('companyName', contact);
  setContactFirstName('firstName', contact);
  setContactIsRecipient(false, contact);
  setContactIsSignatory(false, contact);
  setContactLastName('lastName', contact);
  setContactRole(ContactRoleEnum.FINANCIAL_OFFICER, contact);
  setContactCode('code', contact);
  setContactExternalId('externalId', contact);
  setContactExternalCode('externalCode', contact);
  setContactContactId('contactId', contact);
  setContactLabel('label', contact);
  
  project = await Entities('Contact').save(project, contact);
  await Entities('Project').save(project);
  
  const projectToTest = await Entities('Project').get({ id: getProjectId(project) });
  const contactToTest = await Entities('Contact').get(projectToTest, { filter: ({ id }) => id === getContactId(contact) });
  
  getContactBirthDate(contactToTest); // new Date('2017-01-01')
  getContactCivility(contactToTest); // CivilityEnum.MISTER
  getContactCompanyName(contactToTest); // 'companyName'
  getContactFirstName(contactToTest); // 'firstName'
  getContactIsRecipient(contactToTest); // false
  getContactIsSignatory(contactToTest); // false
  getContactLastName(contactToTest); // 'lastName'
  getContactRole(contactToTest); // ContactRoleEnum.FINANCIAL_OFFICER
  getContactCode(contactToTest); // 'code'
  getContactExternalId(contactToTest); // 'externalId'
  getContactExternalCode(contactToTest); // 'externalCode'
  getContactContactId(contactToTest); // 'contactId'
  getContactLabel(contactToTest); // 'label'
})();
```
