Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit 81e71bb

Browse files
authored
Refacto news service (#21)
* WIP: Refacto news service * Done news service * Done bans service * Done comments service * clean code * 0.3.0 - Refacto news
1 parent 0a32d35 commit 81e71bb

File tree

14 files changed

+527
-56
lines changed

14 files changed

+527
-56
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@funixproductions/angular-core",
3-
"version": "0.2.12",
3+
"version": "0.3.0",
44
"description": "Package used in all FunixProductions Angular projects",
55
"scripts": {
66
"ng": "ng",

projects/funixproductions-requests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@funixproductions/funixproductions-requests",
3-
"version": "0.2.12",
3+
"version": "0.3.0",
44
"description": "Package used in all FunixProductions Angular projects",
55
"peerDependencies": {
66
"@angular/common": "^18.2.4",

projects/funixproductions-requests/src/lib/services/pacifista-api/web/news/dtos/PacifistaNewsDTO.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import {ApiDTO} from "../../../../core/dtos/api-dto";
2+
import {PacifistaNewsDTO} from "./news/PacifistaNewsDTO";
3+
4+
export abstract class PacifistaNewsUserDataDTO extends ApiDTO {
5+
6+
/**
7+
* La news à laquelle ce commentaire répond
8+
*/
9+
news: PacifistaNewsDTO
10+
11+
/**
12+
* Nom d'utilisateur Minecraft du joueur
13+
*/
14+
minecraftUsername: string
15+
16+
/**
17+
* UUID du compte ID sur la funixproductions api
18+
*/
19+
funixProdUserId: string
20+
21+
protected constructor(news: PacifistaNewsDTO) {
22+
super();
23+
this.news = news;
24+
this.minecraftUsername = "";
25+
this.funixProdUserId = "";
26+
}
27+
28+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import {ApiDTO} from "../../../../../core/dtos/api-dto";
2+
3+
export class PacifistaNewsBanDTO extends ApiDTO {
4+
5+
/**
6+
* La raison du ban
7+
*/
8+
reason?: string
9+
10+
/**
11+
* Nom d'utilisateur Minecraft du joueur banni
12+
*/
13+
minecraftUserNameBanned: string
14+
15+
/**
16+
* Le UUID du compte
17+
*/
18+
funixProdUserIdBanned: string
19+
20+
/**
21+
* Pseudo Minecraft de la personne qui sanctionne le joueur
22+
*/
23+
staffMinecraftUserName: string
24+
25+
/**
26+
* UUID funix prod account
27+
*/
28+
staffFunixProdUserId: string
29+
30+
constructor(funixProdUserIdBanned: string, minecraftUserNameBanned: string, reason?: string) {
31+
super();
32+
this.minecraftUserNameBanned = minecraftUserNameBanned;
33+
this.funixProdUserIdBanned = funixProdUserIdBanned;
34+
this.reason = reason;
35+
36+
this.staffFunixProdUserId = '';
37+
this.staffMinecraftUserName = '';
38+
}
39+
40+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import {PacifistaNewsUserDataDTO} from "../PacifistaNewsUserDataDTO";
2+
import {PacifistaNewsDTO} from "../news/PacifistaNewsDTO";
3+
4+
export class PacifistaNewsCommentDTO extends PacifistaNewsUserDataDTO {
5+
6+
/**
7+
* Commentaire parent
8+
*/
9+
parent?: PacifistaNewsCommentDTO
10+
11+
/**
12+
* Contenu du commentaire en texte plein, pas de HTML
13+
*/
14+
content: string
15+
16+
/**
17+
* Nombre de likes sur ce commentaire
18+
*/
19+
likes: number
20+
21+
constructor(news: PacifistaNewsDTO, content: string, parent?: PacifistaNewsCommentDTO) {
22+
super(news);
23+
this.content = content;
24+
this.parent = parent;
25+
26+
this.likes = 0;
27+
}
28+
29+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {PacifistaNewsUserDataDTO} from "../PacifistaNewsUserDataDTO";
2+
import {PacifistaNewsDTO} from "../news/PacifistaNewsDTO";
3+
import {PacifistaNewsCommentDTO} from "./PacifistaNewsCommentDTO";
4+
5+
export class PacifistaNewsCommentLikeDTO extends PacifistaNewsUserDataDTO {
6+
7+
/**
8+
* Le commentaire de la news qui a été liké
9+
*/
10+
comment: PacifistaNewsCommentDTO
11+
12+
constructor(news: PacifistaNewsDTO, comment: PacifistaNewsCommentDTO) {
13+
super(news);
14+
this.comment = comment;
15+
}
16+
17+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import {ApiDTO} from "../../../../../core/dtos/api-dto";
2+
3+
export class PacifistaNewsDTO extends ApiDTO {
4+
5+
/**
6+
* Nom d'utilisateur Minecraft du rédacteur d'origine
7+
*/
8+
originalWriter: string
9+
10+
/**
11+
* Nom d'utilisateur Minecraft de la personne qui l'a modifié
12+
*/
13+
updateWriter: string
14+
15+
/**
16+
* Nom de l'article présent dans l'url
17+
*/
18+
name: string
19+
20+
/**
21+
* Nom de l'article sur la page
22+
*/
23+
title: string
24+
25+
/**
26+
* Sous titre de l'article
27+
*/
28+
subtitle: string
29+
30+
/**
31+
* Image id pour l'image en taille réelle
32+
*/
33+
articleImageId: string
34+
35+
/**
36+
* Image id pour l'image en taille résuite pour l'affichage par liste
37+
*/
38+
articleImageIdLowRes: string
39+
40+
/**
41+
* Le contenu HTML de l'article
42+
*/
43+
bodyHtml: string
44+
45+
/**
46+
* Le contenu MarkDown de l'article pour la modification
47+
*/
48+
bodyMarkdown: string
49+
50+
/**
51+
* Si la news est publiée ou pas
52+
*/
53+
draft: boolean
54+
55+
/**
56+
* Nombre de likes
57+
*/
58+
likes: number
59+
60+
/**
61+
* Nombre de commentaires
62+
*/
63+
comments: number
64+
65+
/**
66+
* Nombre de vues
67+
*/
68+
views: number
69+
70+
constructor(name: string, title: string, subtitle: string, bodyHtml: string, bodyMarkdown: string, draft: boolean) {
71+
super();
72+
this.name = name;
73+
this.title = title;
74+
this.subtitle = subtitle;
75+
this.bodyHtml = bodyHtml;
76+
this.bodyMarkdown = bodyMarkdown;
77+
this.draft = draft;
78+
79+
this.originalWriter = '';
80+
this.updateWriter = '';
81+
this.articleImageId = '';
82+
this.articleImageIdLowRes = '';
83+
this.likes = 0;
84+
this.comments = 0;
85+
this.views = 0;
86+
}
87+
88+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import {ApiDTO} from "../../../../../core/dtos/api-dto";
2+
3+
export class PacifistaNewsImageDTO extends ApiDTO {
4+
5+
/**
6+
* Image rattachée à la news
7+
*/
8+
newsUuid: string
9+
10+
/**
11+
* Image en basse résolution pour l'affichage par liste
12+
*/
13+
isLowResolution: boolean
14+
15+
constructor(newsUuid: string, isLowResolution: boolean) {
16+
super();
17+
this.newsUuid = newsUuid;
18+
this.isLowResolution = isLowResolution;
19+
}
20+
21+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {PacifistaNewsUserDataDTO} from "../PacifistaNewsUserDataDTO";
2+
import {PacifistaNewsDTO} from "./PacifistaNewsDTO";
3+
4+
export class PacifistaNewsLikeDTO extends PacifistaNewsUserDataDTO {
5+
constructor(news: PacifistaNewsDTO) {
6+
super(news);
7+
}
8+
}

0 commit comments

Comments
 (0)