@volontariapp/domain-user 2.8.23-snap-8e4f7a0 → 2.8.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +72 -0
  3. package/package.json +11 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.8.24
4
+
5
+ ### Patch Changes
6
+
7
+ - README bump
8
+
9
+ - Updated dependencies []:
10
+ - @volontariapp/auth@3.3.8
11
+ - @volontariapp/contracts@4.3.2
12
+ - @volontariapp/crypto@0.3.9
13
+ - @volontariapp/database@3.4.4
14
+ - @volontariapp/errors@0.6.1
15
+ - @volontariapp/errors-nest@0.13.1
16
+ - @volontariapp/logger@0.2.6
17
+ - @volontariapp/messaging@2.10.1
18
+ - @volontariapp/shared@0.8.1
19
+
3
20
  ## 2.8.23
4
21
 
5
22
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # @volontariapp/domain-user
2
+
3
+ ## Overview & Domain Driven Design (DDD)
4
+
5
+ Le package `domain-user` représente le **Cœur du Métier** (Core Domain) pour l'identité, le profil et l'état des **Utilisateurs**.
6
+ Totalement découplé de l'infrastructure d'authentification (ex: Firebase, OAuth) ou de la base de données (PostgreSQL), il définit ce qu'est un Utilisateur valide au sein de Volontariapp.
7
+
8
+ Il est utilisé (DRY) par :
9
+ - `ms-user`
10
+ - Les Workers de modération ou de désactivation de comptes
11
+ - Les autres services nécessitant de valider des statuts utilisateurs
12
+
13
+ ## Architecture du Domaine
14
+
15
+ ```mermaid
16
+ graph TD
17
+ subgraph "Domain Layer (Core)"
18
+ US[UserDomainService]
19
+ UE[UserEntity]
20
+ EM[EmailValueObject]
21
+ PH[PhoneValueObject]
22
+
23
+ US -->|Valide via| UE
24
+ UE -->|Propriété structurée| EM
25
+ UE -->|Propriété structurée| PH
26
+ end
27
+
28
+ subgraph "Infrastructure Layer"
29
+ PG[PostgresUserRepository]
30
+ RPC[UserGrpcController]
31
+
32
+ RPC -->|Appelle| US
33
+ US -->|Persiste (Interface)| PG
34
+ end
35
+ ```
36
+
37
+ ## Structure des Dossiers
38
+
39
+ ```text
40
+ src/
41
+ ├── entities/ # UserEntity, UserProfileEntity
42
+ ├── value-objects/ # Email, PhoneNumber, Username (règles de regex/longueur)
43
+ ├── services/ # UserRegistrationService, AccountSuspensionService
44
+ ├── repositories/ # IUserProfileRepository
45
+ └── test/ # Factories de test (ex: buildUserEntity)
46
+ ```
47
+
48
+ ## Exemples d'Implémentation
49
+
50
+ ### Value Object d'Email strict
51
+
52
+ ```typescript
53
+ // value-objects/email.value-object.ts
54
+ export class Email {
55
+ private readonly address: string;
56
+
57
+ constructor(address: string) {
58
+ if (!this.isValidEmail(address)) {
59
+ throw new DomainError('INVALID_EMAIL', `The email ${address} is not valid.`);
60
+ }
61
+ this.address = address.toLowerCase();
62
+ }
63
+
64
+ public getValue(): string {
65
+ return this.address;
66
+ }
67
+
68
+ private isValidEmail(email: string): boolean {
69
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
70
+ }
71
+ }
72
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volontariapp/domain-user",
3
- "version": "2.8.23-snap-8e4f7a0",
3
+ "version": "2.8.24",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -39,19 +39,19 @@
39
39
  "migration:run": "TYPEORM_MIGRATION_RUN=true yarn typeorm migration:run -d src/test/data-source.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@volontariapp/auth": "3.3.7",
43
- "@volontariapp/contracts": "4.3.1",
44
- "@volontariapp/crypto": "0.3.8",
45
- "@volontariapp/database": "3.4.3-snap-8e4f7a0",
46
- "@volontariapp/errors": "0.6.0",
47
- "@volontariapp/errors-nest": "0.13.0",
48
- "@volontariapp/logger": "0.2.5",
49
- "@volontariapp/messaging": "2.10.0-snap-8e4f7a0",
50
- "@volontariapp/shared": "0.8.0"
42
+ "@volontariapp/auth": "3.3.8",
43
+ "@volontariapp/contracts": "4.3.2",
44
+ "@volontariapp/crypto": "0.3.9",
45
+ "@volontariapp/database": "3.4.4",
46
+ "@volontariapp/errors": "0.6.1",
47
+ "@volontariapp/errors-nest": "0.13.1",
48
+ "@volontariapp/logger": "0.2.6",
49
+ "@volontariapp/messaging": "2.10.1",
50
+ "@volontariapp/shared": "0.8.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@nestjs/typeorm": "^11.0.1",
54
- "@volontariapp/testing": "1.0.1",
54
+ "@volontariapp/testing": "1.0.2",
55
55
  "reflect-metadata": "^0.2.2",
56
56
  "ts-node": "^10.9.2",
57
57
  "typeorm": "^0.3.28",