ballrush-core 0.6.5 → 0.6.6

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.
@@ -15,6 +15,7 @@ export declare class Achievement {
15
15
  private description;
16
16
  private translations;
17
17
  private icon;
18
+ private iconUrl;
18
19
  private algorithm;
19
20
  private isActive;
20
21
  private createdAt;
@@ -28,6 +29,7 @@ export declare class Achievement {
28
29
  description: string;
29
30
  translations?: AchievementTranslations;
30
31
  icon: string;
32
+ iconUrl?: string;
31
33
  algorithm: string;
32
34
  isActive?: boolean;
33
35
  createdAt?: Date;
@@ -41,6 +43,7 @@ export declare class Achievement {
41
43
  getTranslations(): AchievementTranslations;
42
44
  getTranslation(language: string): AchievementTranslation | undefined;
43
45
  getIcon(): string;
46
+ getIconUrl(): string | undefined;
44
47
  getAlgorithm(): string;
45
48
  getIsActive(): boolean;
46
49
  getCreatedAt(): Date;
@@ -51,6 +54,7 @@ export declare class Achievement {
51
54
  addTranslation(language: string, translation: AchievementTranslation): void;
52
55
  removeTranslation(language: string): void;
53
56
  setIcon(icon: string): void;
57
+ setIconUrl(url: string | undefined): void;
54
58
  setAlgorithm(algorithm: string): void;
55
59
  setIsActive(isActive: boolean): void;
56
60
  /**
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Achievement = void 0;
4
4
  class Achievement {
5
- constructor(achievementId, type, scope, title, description, translations, icon, algorithm, isActive, createdAt, updatedAt) {
5
+ constructor(achievementId, type, scope, title, description, translations, icon, iconUrl, algorithm, isActive, createdAt, updatedAt) {
6
6
  this.achievementId = achievementId;
7
7
  this.type = type;
8
8
  this.scope = scope;
@@ -10,6 +10,7 @@ class Achievement {
10
10
  this.description = description;
11
11
  this.translations = translations;
12
12
  this.icon = icon;
13
+ this.iconUrl = iconUrl;
13
14
  this.algorithm = algorithm;
14
15
  this.isActive = isActive;
15
16
  this.createdAt = createdAt;
@@ -38,7 +39,7 @@ class Achievement {
38
39
  throw new Error("Achievement creation failed: algorithm is required");
39
40
  }
40
41
  const now = new Date();
41
- return new Achievement(params.achievementId, params.type, params.scope, params.title, params.description, params.translations ?? {}, params.icon, params.algorithm, params.isActive ?? true, params.createdAt ?? now, params.updatedAt ?? now);
42
+ return new Achievement(params.achievementId, params.type, params.scope, params.title, params.description, params.translations ?? {}, params.icon, params.iconUrl, params.algorithm, params.isActive ?? true, params.createdAt ?? now, params.updatedAt ?? now);
42
43
  }
43
44
  // ---- GETTERS
44
45
  getAchievementId() {
@@ -65,6 +66,9 @@ class Achievement {
65
66
  getIcon() {
66
67
  return this.icon;
67
68
  }
69
+ getIconUrl() {
70
+ return this.iconUrl;
71
+ }
68
72
  getAlgorithm() {
69
73
  return this.algorithm;
70
74
  }
@@ -117,6 +121,10 @@ class Achievement {
117
121
  this.icon = icon;
118
122
  this.updatedAt = new Date();
119
123
  }
124
+ setIconUrl(url) {
125
+ this.iconUrl = url;
126
+ this.updatedAt = new Date();
127
+ }
120
128
  setAlgorithm(algorithm) {
121
129
  if (!algorithm) {
122
130
  throw new Error("algorithm cannot be empty");
@@ -9,6 +9,7 @@ export interface AchievementDoc {
9
9
  description: string;
10
10
  translations: AchievementTranslations;
11
11
  icon: string;
12
+ iconUrl?: string;
12
13
  algorithm: string;
13
14
  isActive: boolean;
14
15
  createdAt: Date;
@@ -37,6 +37,10 @@ function createAchievementSchema() {
37
37
  type: String,
38
38
  required: true,
39
39
  },
40
+ iconUrl: {
41
+ type: String,
42
+ required: false,
43
+ },
40
44
  algorithm: {
41
45
  type: String,
42
46
  required: true,
@@ -12,6 +12,7 @@ function toDomain(doc) {
12
12
  description: doc.description,
13
13
  translations: doc.translations,
14
14
  icon: doc.icon,
15
+ iconUrl: doc.iconUrl,
15
16
  algorithm: doc.algorithm,
16
17
  isActive: doc.isActive,
17
18
  createdAt: doc.createdAt,
@@ -27,6 +28,7 @@ function toDoc(achievement) {
27
28
  description: achievement.getDescription(),
28
29
  translations: achievement.getTranslations(),
29
30
  icon: achievement.getIcon(),
31
+ iconUrl: achievement.getIconUrl(),
30
32
  algorithm: achievement.getAlgorithm(),
31
33
  isActive: achievement.getIsActive(),
32
34
  createdAt: achievement.getCreatedAt(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ballrush-core",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",