@volontariapp/domain-post 3.6.11 → 3.6.14-snap-d0fb360

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 +38 -0
  2. package/README.md +75 -0
  3. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.6.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @volontariapp/contracts@4.3.4
9
+ - @volontariapp/messaging@2.10.3
10
+ - @volontariapp/database@3.4.6
11
+ - @volontariapp/outbox@0.9.43
12
+
13
+ ## 3.6.13
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies []:
18
+ - @volontariapp/contracts@4.3.3
19
+ - @volontariapp/messaging@2.10.2
20
+ - @volontariapp/logger@0.2.7
21
+ - @volontariapp/database@3.4.5
22
+ - @volontariapp/outbox@0.9.42
23
+ - @volontariapp/errors@0.6.2
24
+ - @volontariapp/errors-nest@0.13.2
25
+
26
+ ## 3.6.12
27
+
28
+ ### Patch Changes
29
+
30
+ - README bump
31
+
32
+ - Updated dependencies []:
33
+ - @volontariapp/contracts@4.3.2
34
+ - @volontariapp/database@3.4.4
35
+ - @volontariapp/errors@0.6.1
36
+ - @volontariapp/errors-nest@0.13.1
37
+ - @volontariapp/logger@0.2.6
38
+ - @volontariapp/messaging@2.10.1
39
+ - @volontariapp/outbox@0.9.41
40
+
3
41
  ## 3.6.11
4
42
 
5
43
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @volontariapp/domain-post
2
+
3
+ ## Overview & Domain Driven Design (DDD)
4
+
5
+ Le package `domain-post` contient la **logique métier absolue** relative aux **Actualités (Posts)**.
6
+ Tout comme les autres packages de domaine, il est construit autour des principes de la **Clean Architecture**. Il garantit une isolation parfaite entre les règles de gestion d'un Post et la tuyauterie de l'infrastructure (serveur HTTP, bases de données, Kafka/Redis).
7
+
8
+ Ce package est partagé entre :
9
+ - `ms-post` (API)
10
+ - Les Workers asynchrones de traitement d'images/posts
11
+ - Les Post-Processors (Notifications, Flux)
12
+
13
+ ## Architecture du Domaine
14
+
15
+ ```mermaid
16
+ graph TD
17
+ subgraph "Domain Layer (Pure TypeScript)"
18
+ PS[PostService]
19
+ PE[PostEntity]
20
+ VO[ContentValueObject]
21
+ IR[IPostRepository]
22
+
23
+ PS -->|Manipule| PE
24
+ PE -->|Contient| VO
25
+ PS -->|Persiste via| IR
26
+ end
27
+
28
+ subgraph "Infrastructure Layer"
29
+ PGR[PostgresPostRepository]
30
+ API[NestJS PostController]
31
+
32
+ PGR -.->|Implémente| IR
33
+ API -->|Invoque| PS
34
+ end
35
+ ```
36
+
37
+ ## Structure des Dossiers
38
+
39
+ ```text
40
+ src/
41
+ ├── entities/ # PostEntity, CommentEntity, LikeEntity
42
+ ├── value-objects/ # PostContent (validation de longueur, profanité)
43
+ ├── services/ # FeedGenerationService, PostModerationService
44
+ ├── repositories/ # Interfaces (IPostRepository) et Implémentations SQL
45
+ └── test/ # Stubs et Factories
46
+ ```
47
+
48
+ ## Exemples d'Implémentation
49
+
50
+ ### L'Entité Post et l'encapsulation
51
+
52
+ ```typescript
53
+ // entities/post.entity.ts
54
+ export class PostEntity {
55
+ private constructor(
56
+ public readonly id: string,
57
+ public readonly authorId: string,
58
+ public content: PostContent, // Value Object
59
+ public isPublished: boolean
60
+ ) {}
61
+
62
+ // Constructeur statique pour forcer la validation à la création
63
+ public static create(authorId: string, contentText: string): PostEntity {
64
+ const content = new PostContent(contentText);
65
+ return new PostEntity(uuidv4(), authorId, content, false);
66
+ }
67
+
68
+ public publish(): void {
69
+ if (this.content.isEmpty()) {
70
+ throw new DomainError('POST_EMPTY', 'Cannot publish an empty post');
71
+ }
72
+ this.isPublished = true;
73
+ }
74
+ }
75
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volontariapp/domain-post",
3
- "version": "3.6.11",
3
+ "version": "3.6.14-snap-d0fb360",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -43,7 +43,7 @@
43
43
  "@nestjs/typeorm": "^11.0.1",
44
44
  "@types/jest": "^30.0.0",
45
45
  "@types/node": "^22.10.7",
46
- "@volontariapp/testing": "1.0.1",
46
+ "@volontariapp/testing": "1.0.3",
47
47
  "jest": "^30.3.0",
48
48
  "pg": "^8.20.0",
49
49
  "reflect-metadata": "^0.2.2",
@@ -54,13 +54,13 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@nestjs/common": "^11.0.1",
57
- "@volontariapp/contracts": "4.3.1",
58
- "@volontariapp/database": "3.4.3",
59
- "@volontariapp/errors": "0.6.0",
60
- "@volontariapp/errors-nest": "0.13.0",
61
- "@volontariapp/logger": "0.2.5",
62
- "@volontariapp/messaging": "2.10.0",
63
- "@volontariapp/outbox": "0.9.40",
57
+ "@volontariapp/contracts": "4.3.4-snap-d0fb360",
58
+ "@volontariapp/database": "3.4.6-snap-d0fb360",
59
+ "@volontariapp/errors": "0.6.2",
60
+ "@volontariapp/errors-nest": "0.13.2",
61
+ "@volontariapp/logger": "0.2.7",
62
+ "@volontariapp/messaging": "2.10.3-snap-d0fb360",
63
+ "@volontariapp/outbox": "0.9.43-snap-d0fb360",
64
64
  "class-transformer": "^0.5.1"
65
65
  }
66
66
  }