@stevenkellner/team-conduct-api 2.0.18 → 2.0.19

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 (231) hide show
  1. package/lib/src/functions/fine/add.d.ts +3 -8
  2. package/lib/src/functions/fine/add.js +1 -2
  3. package/lib/src/functions/fine/delete.d.ts +1 -6
  4. package/lib/src/functions/fine/delete.js +2 -3
  5. package/lib/src/functions/fine/update.d.ts +2 -8
  6. package/lib/src/functions/fine/update.js +1 -3
  7. package/lib/src/functions/fineTemplate/add.d.ts +3 -3
  8. package/lib/src/functions/fineTemplate/update.d.ts +3 -3
  9. package/lib/src/functions/firebaseFunctionsContext.d.ts +34 -1
  10. package/lib/src/functions/firebaseFunctionsContext.js +33 -33
  11. package/lib/src/functions/index.d.ts +10 -8
  12. package/lib/src/functions/index.js +11 -8
  13. package/lib/src/functions/notification/markNotificationAsRead.d.ts +14 -0
  14. package/lib/src/functions/notification/{subscribe.js → markNotificationAsRead.js} +5 -7
  15. package/lib/src/functions/person/kickout.d.ts +6 -6
  16. package/lib/src/functions/person/kickout.js +4 -4
  17. package/lib/src/functions/person/roleEdit.d.ts +5 -5
  18. package/lib/src/functions/person/roleEdit.js +3 -3
  19. package/lib/src/functions/{paypalMe/edit.d.ts → team/delete.d.ts} +5 -7
  20. package/lib/src/functions/{paypalMe/edit.js → team/delete.js} +4 -5
  21. package/lib/src/functions/team/new.d.ts +18 -18
  22. package/lib/src/functions/team/new.js +8 -4
  23. package/lib/src/functions/team/update.d.ts +34 -0
  24. package/lib/src/functions/team/update.js +23 -0
  25. package/lib/src/functions/user/register.d.ts +4 -0
  26. package/lib/src/functions/user/register.js +3 -1
  27. package/lib/src/functions/user/update.d.ts +26 -0
  28. package/lib/src/functions/user/update.js +15 -0
  29. package/lib/src/index.d.ts +1 -1
  30. package/lib/src/index.js +1 -1
  31. package/lib/src/locales/de.d.ts +1 -1
  32. package/lib/src/locales/de.js +6 -2
  33. package/lib/src/locales/en.d.ts +6 -2
  34. package/lib/src/locales/en.js +6 -2
  35. package/lib/src/types/{MoneyAmount.d.ts → Money.d.ts} +23 -23
  36. package/lib/src/types/{MoneyAmount.js → Money.js} +25 -25
  37. package/lib/src/types/fine/Fine.d.ts +275 -0
  38. package/lib/src/types/fine/Fine.js +318 -0
  39. package/lib/src/types/fine/FineTemplate.d.ts +154 -0
  40. package/lib/src/types/fine/FineTemplate.js +170 -0
  41. package/lib/src/types/{PayedState.d.ts → fine/PayedState.d.ts} +1 -1
  42. package/lib/src/types/{PayedState.js → fine/PayedState.js} +1 -1
  43. package/lib/src/types/fine/index.d.ts +3 -0
  44. package/lib/src/{firebase → types/fine}/index.js +3 -6
  45. package/lib/src/types/index.d.ts +7 -18
  46. package/lib/src/types/index.js +7 -18
  47. package/lib/src/types/{Localization.d.ts → localization/Localization.d.ts} +15 -43
  48. package/lib/src/types/localization/Localization.js +54 -0
  49. package/lib/src/types/localization/PluralLocalization.d.ts +23 -0
  50. package/lib/src/types/localization/PluralLocalization.js +35 -0
  51. package/lib/src/types/{Pluralization.d.ts → localization/Pluralization.d.ts} +1 -0
  52. package/lib/src/types/{Pluralization.js → localization/Pluralization.js} +1 -0
  53. package/lib/src/types/localization/ValueLocalization.d.ts +22 -0
  54. package/lib/src/types/localization/ValueLocalization.js +41 -0
  55. package/lib/src/types/localization/index.d.ts +5 -0
  56. package/lib/src/types/localization/index.js +21 -0
  57. package/lib/src/types/notification/InAppNotification.d.ts +152 -0
  58. package/lib/src/types/notification/InAppNotification.js +136 -0
  59. package/lib/src/types/notification/index.d.ts +1 -0
  60. package/lib/src/types/notification/index.js +17 -0
  61. package/lib/src/types/{Person.d.ts → person/Person.d.ts} +3 -3
  62. package/lib/src/types/{Person.js → person/Person.js} +3 -3
  63. package/lib/src/types/{PersonProperties.d.ts → person/PersonProperties.d.ts} +8 -7
  64. package/lib/src/types/{PersonProperties.js → person/PersonProperties.js} +7 -6
  65. package/lib/src/types/{PersonSignInProperties.d.ts → person/PersonSignInProperties.d.ts} +9 -11
  66. package/lib/src/types/{PersonSignInProperties.js → person/PersonSignInProperties.js} +7 -10
  67. package/lib/src/types/person/index.d.ts +3 -0
  68. package/lib/src/types/person/index.js +19 -0
  69. package/lib/src/types/{Invitation.d.ts → team/Invitation.d.ts} +1 -1
  70. package/lib/src/types/{Invitation.js → team/Invitation.js} +1 -1
  71. package/lib/src/types/team/Team.d.ts +144 -0
  72. package/lib/src/types/team/Team.js +141 -0
  73. package/lib/src/types/team/TeamRole.d.ts +30 -0
  74. package/lib/src/types/{UserRole.js → team/TeamRole.js} +16 -15
  75. package/lib/src/types/team/index.d.ts +3 -0
  76. package/lib/src/types/team/index.js +19 -0
  77. package/lib/src/types/{NotificationProperties.d.ts → user/NotificationProperties.d.ts} +8 -3
  78. package/lib/src/types/{NotificationProperties.js → user/NotificationProperties.js} +4 -0
  79. package/lib/src/types/user/User.d.ts +328 -0
  80. package/lib/src/types/user/User.js +355 -0
  81. package/lib/src/types/user/index.d.ts +2 -0
  82. package/lib/src/types/user/index.js +18 -0
  83. package/lib/src/utils/StaticUnionTypeBuilder.d.ts +9 -0
  84. package/lib/src/utils/StaticUnionTypeBuilder.js +23 -0
  85. package/lib/src/utils/index.d.ts +1 -0
  86. package/lib/src/utils/index.js +17 -0
  87. package/lib/tsconfig.tsbuildinfo +1 -1
  88. package/package.json +4 -3
  89. package/src/functions/fine/add.ts +3 -5
  90. package/src/functions/fine/delete.ts +3 -5
  91. package/src/functions/fine/update.ts +2 -5
  92. package/src/functions/firebaseFunctionsContext.ts +40 -40
  93. package/src/functions/index.ts +11 -9
  94. package/src/functions/notification/markNotificationAsRead.ts +19 -0
  95. package/src/functions/person/add.ts +1 -1
  96. package/src/functions/person/kickout.ts +6 -6
  97. package/src/functions/person/roleEdit.ts +5 -5
  98. package/src/functions/{paypalMe/edit.ts → team/delete.ts} +5 -7
  99. package/src/functions/team/new.ts +19 -11
  100. package/src/functions/team/update.ts +40 -0
  101. package/src/functions/user/register.ts +7 -3
  102. package/src/functions/user/update.ts +29 -0
  103. package/src/index.ts +1 -1
  104. package/src/locales/de.ts +7 -3
  105. package/src/locales/en.ts +7 -3
  106. package/src/types/{MoneyAmount.ts → Money.ts} +29 -29
  107. package/src/types/fine/Fine.ts +399 -0
  108. package/src/types/fine/FineTemplate.ts +219 -0
  109. package/src/types/{PayedState.ts → fine/PayedState.ts} +2 -2
  110. package/src/types/fine/index.ts +3 -0
  111. package/src/types/index.ts +7 -18
  112. package/src/types/{Localization.ts → localization/Localization.ts} +7 -64
  113. package/src/types/localization/PluralLocalization.ts +32 -0
  114. package/src/types/{Pluralization.ts → localization/Pluralization.ts} +1 -0
  115. package/src/types/localization/ValueLocalization.ts +36 -0
  116. package/src/types/localization/index.ts +5 -0
  117. package/src/types/notification/InAppNotification.ts +184 -0
  118. package/src/types/notification/index.ts +1 -0
  119. package/src/types/{Person.ts → person/Person.ts} +3 -3
  120. package/src/types/{PersonProperties.ts → person/PersonProperties.ts} +8 -7
  121. package/src/types/{PersonSignInProperties.ts → person/PersonSignInProperties.ts} +13 -12
  122. package/src/types/person/index.ts +3 -0
  123. package/src/types/{Invitation.ts → team/Invitation.ts} +1 -1
  124. package/src/types/team/Team.ts +204 -0
  125. package/src/types/{UserRole.ts → team/TeamRole.ts} +19 -17
  126. package/src/types/team/index.ts +3 -0
  127. package/src/types/{NotificationProperties.ts → user/NotificationProperties.ts} +12 -3
  128. package/src/types/user/User.ts +451 -0
  129. package/src/types/user/index.ts +2 -0
  130. package/src/utils/StaticUnionTypeBuilder.ts +23 -0
  131. package/src/utils/index.ts +1 -0
  132. package/lib/src/firebase/FirebaseConfiguration.d.ts +0 -64
  133. package/lib/src/firebase/FirebaseConfiguration.js +0 -79
  134. package/lib/src/firebase/Firestore.d.ts +0 -201
  135. package/lib/src/firebase/Firestore.js +0 -244
  136. package/lib/src/firebase/FirestoreScheme.d.ts +0 -42
  137. package/lib/src/firebase/FirestoreScheme.js +0 -2
  138. package/lib/src/firebase/Messaging.d.ts +0 -90
  139. package/lib/src/firebase/Messaging.js +0 -2
  140. package/lib/src/firebase/checkAuthentication.d.ts +0 -38
  141. package/lib/src/firebase/checkAuthentication.js +0 -64
  142. package/lib/src/firebase/index.d.ts +0 -6
  143. package/lib/src/firebase/pushNotification.d.ts +0 -39
  144. package/lib/src/firebase/pushNotification.js +0 -88
  145. package/lib/src/functions/notification/subscribe.d.ts +0 -18
  146. package/lib/src/types/Configuration.d.ts +0 -46
  147. package/lib/src/types/Configuration.js +0 -51
  148. package/lib/src/types/Fine.d.ts +0 -71
  149. package/lib/src/types/Fine.js +0 -74
  150. package/lib/src/types/FineAmount.d.ts +0 -207
  151. package/lib/src/types/FineAmount.js +0 -238
  152. package/lib/src/types/FineTemplate.d.ts +0 -69
  153. package/lib/src/types/FineTemplate.js +0 -72
  154. package/lib/src/types/FineTemplateRepetition.d.ts +0 -87
  155. package/lib/src/types/FineTemplateRepetition.js +0 -103
  156. package/lib/src/types/Localization.js +0 -115
  157. package/lib/src/types/Team.d.ts +0 -62
  158. package/lib/src/types/Team.js +0 -64
  159. package/lib/src/types/User.d.ts +0 -221
  160. package/lib/src/types/User.js +0 -235
  161. package/lib/src/types/UserRole.d.ts +0 -29
  162. package/lib/test/firebase/FirebaseConfiguration.test.d.ts +0 -1
  163. package/lib/test/firebase/FirebaseConfiguration.test.js +0 -158
  164. package/lib/test/firebase/Firestore.test.d.ts +0 -1
  165. package/lib/test/firebase/Firestore.test.js +0 -46
  166. package/lib/test/firebase/checkAuthentication.test.d.ts +0 -1
  167. package/lib/test/firebase/checkAuthentication.test.js +0 -356
  168. package/lib/test/firebase/firebase-utils.d.ts +0 -32
  169. package/lib/test/firebase/firebase-utils.js +0 -134
  170. package/lib/test/firebase/pushNotification.test.d.ts +0 -1
  171. package/lib/test/firebase/pushNotification.test.js +0 -300
  172. package/lib/test/locales/localization.de.test.d.ts +0 -1
  173. package/lib/test/locales/localization.de.test.js +0 -144
  174. package/lib/test/locales/localization.en.test.d.ts +0 -1
  175. package/lib/test/locales/localization.en.test.js +0 -144
  176. package/lib/test/types/Configuration.test.d.ts +0 -1
  177. package/lib/test/types/Configuration.test.js +0 -84
  178. package/lib/test/types/Currency.test.d.ts +0 -1
  179. package/lib/test/types/Currency.test.js +0 -41
  180. package/lib/test/types/Fine.test.d.ts +0 -1
  181. package/lib/test/types/Fine.test.js +0 -265
  182. package/lib/test/types/FineAmount.test.d.ts +0 -1
  183. package/lib/test/types/FineAmount.test.js +0 -445
  184. package/lib/test/types/FineTemplate.test.d.ts +0 -1
  185. package/lib/test/types/FineTemplate.test.js +0 -271
  186. package/lib/test/types/FineTemplateRepetition.test.d.ts +0 -1
  187. package/lib/test/types/FineTemplateRepetition.test.js +0 -361
  188. package/lib/test/types/Invitation.test.d.ts +0 -1
  189. package/lib/test/types/Invitation.test.js +0 -269
  190. package/lib/test/types/Locale.test.d.ts +0 -1
  191. package/lib/test/types/Locale.test.js +0 -46
  192. package/lib/test/types/Localization.test.d.ts +0 -1
  193. package/lib/test/types/Localization.test.js +0 -241
  194. package/lib/test/types/MoneyAmount.test.d.ts +0 -1
  195. package/lib/test/types/MoneyAmount.test.js +0 -276
  196. package/lib/test/types/NotificationProperties.test.d.ts +0 -1
  197. package/lib/test/types/NotificationProperties.test.js +0 -258
  198. package/lib/test/types/PayedState.test.d.ts +0 -1
  199. package/lib/test/types/PayedState.test.js +0 -136
  200. package/lib/test/types/Person.test.d.ts +0 -1
  201. package/lib/test/types/Person.test.js +0 -266
  202. package/lib/test/types/PersonProperties.test.d.ts +0 -1
  203. package/lib/test/types/PersonProperties.test.js +0 -155
  204. package/lib/test/types/PersonSignInProperties.test.d.ts +0 -1
  205. package/lib/test/types/PersonSignInProperties.test.js +0 -208
  206. package/lib/test/types/Pluralization.test.d.ts +0 -1
  207. package/lib/test/types/Pluralization.test.js +0 -206
  208. package/lib/test/types/Team.test.d.ts +0 -1
  209. package/lib/test/types/Team.test.js +0 -145
  210. package/lib/test/types/User.test.d.ts +0 -1
  211. package/lib/test/types/User.test.js +0 -450
  212. package/lib/test/types/UserRole.test.d.ts +0 -1
  213. package/lib/test/types/UserRole.test.js +0 -140
  214. package/src/firebase/FirebaseConfiguration.ts +0 -99
  215. package/src/firebase/Firestore.ts +0 -258
  216. package/src/firebase/FirestoreScheme.ts +0 -41
  217. package/src/firebase/Messaging.ts +0 -93
  218. package/src/firebase/checkAuthentication.ts +0 -91
  219. package/src/firebase/index.ts +0 -7
  220. package/src/firebase/pushNotification.ts +0 -90
  221. package/src/functions/notification/subscribe.ts +0 -23
  222. package/src/types/Configuration.ts +0 -65
  223. package/src/types/Fine.ts +0 -100
  224. package/src/types/FineAmount.ts +0 -303
  225. package/src/types/FineTemplate.ts +0 -96
  226. package/src/types/FineTemplateRepetition.ts +0 -125
  227. package/src/types/Team.ts +0 -87
  228. package/src/types/User.ts +0 -302
  229. /package/lib/src/types/{Locale.d.ts → localization/Locale.d.ts} +0 -0
  230. /package/lib/src/types/{Locale.js → localization/Locale.js} +0 -0
  231. /package/src/types/{Locale.ts → localization/Locale.ts} +0 -0
@@ -1,21 +1,21 @@
1
1
  import { Flattable, ITypeBuilder } from '@stevenkellner/typescript-common-functionality';
2
2
 
3
3
  /**
4
- * Represents the private properties of a person.
4
+ * Represents the personal properties of a person within a team.
5
5
  *
6
- * Contains personal information that is private to the person,
7
- * such as their name. The last name is optional.
6
+ * Contains identification information such as first and last name.
8
7
  */
9
8
  export class PersonProperties implements Flattable<PersonProperties.Flatten> {
10
9
 
11
10
  /**
12
- * Creates new person private properties.
11
+ * Creates new person properties.
12
+ *
13
13
  * @param firstName - The first name of the person
14
14
  * @param lastName - The last name of the person (null if not provided)
15
15
  */
16
16
  constructor(
17
17
  public firstName: string,
18
- public lastName: string | null
18
+ public lastName: string | null = null
19
19
  ) {}
20
20
 
21
21
  /**
@@ -32,7 +32,7 @@ export class PersonProperties implements Flattable<PersonProperties.Flatten> {
32
32
  export namespace PersonProperties {
33
33
 
34
34
  /**
35
- * Flattened representation of person private properties for serialization.
35
+ * Flattened representation of person properties for serialization.
36
36
  */
37
37
  export type Flatten = {
38
38
  firstName: string;
@@ -46,7 +46,8 @@ export namespace PersonProperties {
46
46
 
47
47
  /**
48
48
  * Builds a PersonProperties instance from flattened data.
49
- * @param value - The flattened person private properties data
49
+ *
50
+ * @param value - The flattened person properties data
50
51
  * @returns A new PersonProperties instance
51
52
  */
52
53
  public build(value: Flatten): PersonProperties {
@@ -1,28 +1,26 @@
1
1
  import { Flattable, ITypeBuilder, UtcDate } from '@stevenkellner/typescript-common-functionality';
2
- import { NotificationProperties } from './NotificationProperties';
3
- import { User } from './User';
4
- import { UserRole } from './UserRole';
2
+ import { User } from '../user/User';
3
+ import { TeamRole } from '../team/TeamRole';
5
4
 
6
5
  /**
7
6
  * Represents the sign-in properties for a person in the system.
8
7
  *
9
8
  * Contains authentication-related information including user ID, sign-in timestamp,
10
- * notification preferences, and assigned user roles for access control.
9
+ * and assigned team roles for access control.
11
10
  */
12
11
  export class PersonSignInProperties implements Flattable<PersonSignInProperties.Flatten> {
13
12
 
14
13
  /**
15
14
  * Creates new person sign-in properties.
15
+ *
16
16
  * @param userId - The unique identifier of the user associated with this person
17
17
  * @param joinDate - The timestamp when the person joined the team
18
- * @param notificationProperties - Optional notification preferences (defaults to new NotificationProperties)
19
- * @param roles - Optional array of user roles for access control (defaults to empty array)
18
+ * @param roles - Optional array of team roles for access control (defaults to empty array)
20
19
  */
21
20
  public constructor(
22
21
  public userId: User.Id,
23
22
  public joinDate: UtcDate,
24
- public notificationProperties: NotificationProperties = new NotificationProperties(),
25
- public roles: UserRole[] = []
23
+ public roles: TeamRole[] = []
26
24
  ) {}
27
25
 
28
26
  /**
@@ -32,7 +30,6 @@ export class PersonSignInProperties implements Flattable<PersonSignInProperties.
32
30
  return {
33
31
  userId: this.userId.flatten,
34
32
  joinDate: this.joinDate.flatten,
35
- notificationProperties: this.notificationProperties.flatten,
36
33
  roles: this.roles
37
34
  };
38
35
  }
@@ -46,8 +43,7 @@ export namespace PersonSignInProperties {
46
43
  export type Flatten = {
47
44
  userId: User.Id.Flatten
48
45
  joinDate: UtcDate.Flatten,
49
- notificationProperties: NotificationProperties.Flatten,
50
- roles: UserRole[]
46
+ roles: TeamRole[]
51
47
  }
52
48
 
53
49
  /**
@@ -57,11 +53,16 @@ export namespace PersonSignInProperties {
57
53
 
58
54
  /**
59
55
  * Builds a PersonSignInProperties instance from flattened data.
56
+ *
60
57
  * @param value - The flattened sign-in properties data
61
58
  * @returns A new PersonSignInProperties instance
62
59
  */
63
60
  public build(value: Flatten): PersonSignInProperties {
64
- return new PersonSignInProperties(User.Id.builder.build(value.userId), UtcDate.builder.build(value.joinDate), NotificationProperties.builder.build(value.notificationProperties), value.roles);
61
+ return new PersonSignInProperties(
62
+ User.Id.builder.build(value.userId),
63
+ UtcDate.builder.build(value.joinDate),
64
+ value.roles
65
+ );
65
66
  }
66
67
  }
67
68
 
@@ -0,0 +1,3 @@
1
+ export * from './Person';
2
+ export * from './PersonProperties';
3
+ export * from './PersonSignInProperties';
@@ -1,6 +1,6 @@
1
1
  import { BytesCoder, Flattable, ITypeBuilder, OptionalTypeBuilder, Sha512, Tagged, ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
2
2
  import { Team } from './Team';
3
- import { Person } from './Person';
3
+ import { Person } from '../person/Person';
4
4
 
5
5
  /**
6
6
  * Represents an invitation to join a team.
@@ -0,0 +1,204 @@
1
+ import { Flattable, Guid, ITypeBuilder, Tagged } from '@stevenkellner/typescript-common-functionality';
2
+ import { Locale } from '../localization/Locale';
3
+ import { Currency } from '../Currency';
4
+
5
+ /**
6
+ * Represents a team in the system with its basic information.
7
+ *
8
+ * A team is a group of people who can track fines and payments together.
9
+ */
10
+ export class Team implements Flattable<Team.Flatten> {
11
+
12
+ /**
13
+ * Creates a new Team instance.
14
+ *
15
+ * @param id - The unique identifier for this team
16
+ * @param name - The display name of the team
17
+ * @param logoUrl - Optional URL for the team's logo (null if not set)
18
+ * @param sportCategory - Optional sport category label (null if not set)
19
+ * @param description - Optional description of the team (null if not set)
20
+ * @param settings - Team configuration settings
21
+ */
22
+ public constructor(
23
+ public id: Team.Id,
24
+ public name: string,
25
+ public logoUrl: string | null,
26
+ public sportCategory: string | null,
27
+ public description: string | null,
28
+ public settings: Team.Settings
29
+ ) {}
30
+
31
+ /**
32
+ * Gets the flattened representation of this team for serialization.
33
+ */
34
+ public get flatten(): Team.Flatten {
35
+ return {
36
+ id: this.id.flatten,
37
+ name: this.name,
38
+ logoUrl: this.logoUrl,
39
+ sportCategory: this.sportCategory,
40
+ description: this.description,
41
+ settings: this.settings.flatten
42
+ };
43
+ }
44
+ }
45
+
46
+ export namespace Team {
47
+
48
+ /**
49
+ * Tagged type for team identifiers to prevent mixing with other GUID types.
50
+ */
51
+ export type Id = Tagged<Guid, 'team'>;
52
+
53
+ export namespace Id {
54
+
55
+ /**
56
+ * Flattened representation of a team ID (plain GUID string).
57
+ */
58
+ export type Flatten = string;
59
+
60
+ /**
61
+ * Builder for constructing Team.Id instances from GUID strings.
62
+ */
63
+ export const builder = Tagged.builder('team' as const, Guid.builder);
64
+ }
65
+
66
+ /**
67
+ * Configurable settings for a team.
68
+ */
69
+ export class Settings implements Flattable<Settings.Flatten> {
70
+
71
+ /**
72
+ * Creates new team settings.
73
+ *
74
+ * @param paypalMeLink - Optional PayPal.Me link for payment collection (null if not set)
75
+ * @param allowMembersToAddFines - Whether regular members can add fines
76
+ * @param fineVisibility - Controls which fines are visible to members
77
+ * @param joinRequestType - Controls how new members can join the team
78
+ * @param currency - The currency used for monetary fines
79
+ * @param locale - The locale for localized output
80
+ */
81
+ public constructor(
82
+ public paypalMeLink: string | null,
83
+ public allowMembersToAddFines: boolean,
84
+ public fineVisibility: Settings.FineVisibility,
85
+ public joinRequestType: Settings.JoinRequestType,
86
+ public currency: Currency,
87
+ public locale: Locale
88
+ ) {}
89
+
90
+ /**
91
+ * Gets the flattened representation of these settings for serialization.
92
+ */
93
+ public get flatten(): Settings.Flatten {
94
+ return {
95
+ paypalMeLink: this.paypalMeLink,
96
+ allowMembersToAddFines: this.allowMembersToAddFines,
97
+ fineVisibility: this.fineVisibility,
98
+ joinRequestType: this.joinRequestType,
99
+ currency: this.currency,
100
+ locale: this.locale
101
+ };
102
+ }
103
+ }
104
+
105
+ export namespace Settings {
106
+
107
+ /**
108
+ * Controls which fines are visible to team members.
109
+ *
110
+ * - 'only-own-fines': Members can only see their own fines
111
+ * - 'all-fines': Members can see all fines in the team
112
+ */
113
+ export type FineVisibility = 'only-own-fines' | 'all-fines';
114
+
115
+ /**
116
+ * Controls how new members can join the team.
117
+ *
118
+ * - 'public-link-without-approval': Anyone with the link can join directly
119
+ * - 'public-link-with-approval': Anyone with the link can request to join (requires approval)
120
+ * - 'invite-only': Only invited people can join
121
+ */
122
+ export type JoinRequestType = 'public-link-without-approval' | 'public-link-with-approval' | 'invite-only';
123
+
124
+ /**
125
+ * Flattened representation of team settings for serialization.
126
+ */
127
+ export type Flatten = {
128
+ paypalMeLink: string | null,
129
+ allowMembersToAddFines: boolean,
130
+ fineVisibility: FineVisibility,
131
+ joinRequestType: JoinRequestType,
132
+ currency: Currency,
133
+ locale: Locale
134
+ }
135
+
136
+ /**
137
+ * Builder for constructing Settings instances from flattened data.
138
+ */
139
+ export class TypeBuilder implements ITypeBuilder<Flatten, Settings> {
140
+
141
+ /**
142
+ * Builds a Settings instance from flattened data.
143
+ *
144
+ * @param value - The flattened team settings data
145
+ * @returns A new Settings instance
146
+ */
147
+ public build(value: Flatten): Settings {
148
+ return new Settings(
149
+ value.paypalMeLink,
150
+ value.allowMembersToAddFines,
151
+ value.fineVisibility,
152
+ value.joinRequestType,
153
+ value.currency,
154
+ value.locale
155
+ );
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Singleton builder instance for Settings.
161
+ */
162
+ export const builder = new TypeBuilder();
163
+ }
164
+
165
+ /**
166
+ * Flattened representation of a Team for serialization.
167
+ */
168
+ export type Flatten = {
169
+ id: Id.Flatten,
170
+ name: string,
171
+ logoUrl: string | null,
172
+ sportCategory: string | null,
173
+ description: string | null,
174
+ settings: Settings.Flatten
175
+ }
176
+
177
+ /**
178
+ * Builder for constructing Team instances from flattened data.
179
+ */
180
+ export class TypeBuilder implements ITypeBuilder<Flatten, Team> {
181
+
182
+ /**
183
+ * Builds a Team instance from flattened data.
184
+ *
185
+ * @param value - The flattened team data
186
+ * @returns A new Team instance
187
+ */
188
+ public build(value: Flatten): Team {
189
+ return new Team(
190
+ Id.builder.build(value.id),
191
+ value.name,
192
+ value.logoUrl,
193
+ value.sportCategory,
194
+ value.description,
195
+ Settings.builder.build(value.settings)
196
+ );
197
+ }
198
+ }
199
+
200
+ /**
201
+ * Singleton builder instance for Team.
202
+ */
203
+ export const builder = new TypeBuilder();
204
+ }
@@ -1,11 +1,11 @@
1
1
  import { ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
2
- import { Localization, localizations } from './Localization';
3
- import { Locale } from './Locale';
2
+ import { Localization, localizations } from '../localization/Localization';
3
+ import { Locale } from '../localization/Locale';
4
4
 
5
5
  /**
6
- * Array of all available user roles.
6
+ * Array of all available team roles.
7
7
  */
8
- const userRoles = [
8
+ const teamRoles = [
9
9
  'person-manager', // Can manage persons, i.e. add/edit/remove persons of the team
10
10
  'fineTemplate-manager', // Can manage fine templates, i.e. add/edit/remove fine templates
11
11
  'fine-manager', // Can manage fines, i.e. add/edit/remove fines
@@ -14,36 +14,38 @@ const userRoles = [
14
14
  ] as const;
15
15
 
16
16
  /**
17
- * Represents user roles in the application.
17
+ * Represents team roles in the application.
18
18
  * Defines different levels of permissions for team members.
19
19
  */
20
- export type UserRole = typeof userRoles[number];
20
+ export type TeamRole = typeof teamRoles[number];
21
+
22
+ export namespace TeamRole {
21
23
 
22
- export namespace UserRole {
23
24
  /**
24
- * Array of all available user roles.
25
+ * Array of all available team roles.
25
26
  */
26
- export const all: readonly UserRole[] = userRoles;
27
+ export const all: readonly TeamRole[] = teamRoles;
27
28
 
28
29
  /**
29
- * Returns the localized, human-readable name for a user role.
30
- * @param role - The user role to format
30
+ * Returns the localized, human-readable name for a team role.
31
+ *
32
+ * @param role - The team role to format
31
33
  * @param locale - The locale to use for localization
32
34
  * @returns The localized role name
33
35
  */
34
- export function formatted(role: UserRole, locale: Locale): string {
35
- const localizationKeyMap: Record<UserRole, keyof (typeof localizations)[keyof typeof localizations]['userRole']> = {
36
+ export function formatted(role: TeamRole, locale: Locale): string {
37
+ const localizationKeyMap: Record<TeamRole, keyof (typeof localizations)[keyof typeof localizations]['teamRole']> = {
36
38
  'person-manager': 'personManager',
37
39
  'fineTemplate-manager': 'fineTemplateManager',
38
40
  'fine-manager': 'fineManager',
39
41
  'fine-can-add': 'fineCanAdd',
40
42
  'team-manager': 'teamManager'
41
- }
42
- return Localization.shared(locale).userRole[localizationKeyMap[role]].value();
43
+ };
44
+ return Localization.shared(locale).teamRole[localizationKeyMap[role]].value();
43
45
  }
44
46
 
45
47
  /**
46
- * Builder for constructing UserRole values.
48
+ * Builder for constructing TeamRole values.
47
49
  */
48
- export const builder = new ValueTypeBuilder<UserRole>();
50
+ export const builder = new ValueTypeBuilder<TeamRole>();
49
51
  }
@@ -0,0 +1,3 @@
1
+ export * from './Invitation';
2
+ export * from './Team';
3
+ export * from './TeamRole';
@@ -10,6 +10,7 @@ export class NotificationProperties implements Flattable<NotificationProperties.
10
10
 
11
11
  /**
12
12
  * Creates new notification properties.
13
+ *
13
14
  * @param tokens - Dictionary mapping token IDs to device tokens for push notifications (defaults to empty)
14
15
  * @param subscriptions - Array of notification types the user is subscribed to (defaults to empty)
15
16
  */
@@ -42,6 +43,7 @@ export namespace NotificationProperties {
42
43
  /**
43
44
  * Creates a token ID from a device token by hashing it with SHA-512.
44
45
  * Only the first 16 characters of the hash are used as the identifier.
46
+ *
45
47
  * @param token - The device push notification token
46
48
  * @returns A hashed token ID for secure storage and lookup
47
49
  */
@@ -70,15 +72,18 @@ export namespace NotificationProperties {
70
72
  */
71
73
  const subscriptions = [
72
74
  'new-fine',
75
+ 'fine-changed',
73
76
  'fine-reminder',
74
77
  'fine-state-change'
75
78
  ] as const;
76
79
 
77
80
  /**
78
81
  * Type representing the available notification subscription options.
82
+ *
79
83
  * - new-fine: Notifications when a new fine is created
84
+ * - fine-changed: Notifications when a fine is updated (non-payed-state change)
80
85
  * - fine-reminder: Reminder notifications for unpaid fines
81
- * - fine-state-change: Notifications when a fine's status changes
86
+ * - fine-state-change: Notifications when a fine's payed status changes or is deleted
82
87
  */
83
88
  export type Subscription = typeof subscriptions[number];
84
89
 
@@ -87,7 +92,7 @@ export namespace NotificationProperties {
87
92
  /**
88
93
  * Readonly array of all available subscription types.
89
94
  */
90
- export const all: readonly Subscription[] = subscriptions
95
+ export const all: readonly Subscription[] = subscriptions;
91
96
 
92
97
  /**
93
98
  * Builder for constructing Subscription values from strings.
@@ -110,11 +115,15 @@ export namespace NotificationProperties {
110
115
 
111
116
  /**
112
117
  * Builds a NotificationProperties instance from flattened data.
118
+ *
113
119
  * @param value - The flattened notification properties data
114
120
  * @returns A new NotificationProperties instance
115
121
  */
116
122
  public build(value: Flatten): NotificationProperties {
117
- return new NotificationProperties(Dictionary.builder(TokenId.builder, new ValueTypeBuilder<string>()).build(value.tokens), value.subscriptions);
123
+ return new NotificationProperties(
124
+ Dictionary.builder(TokenId.builder, new ValueTypeBuilder<string>()).build(value.tokens),
125
+ value.subscriptions
126
+ );
118
127
  }
119
128
  }
120
129