@stevenkellner/team-conduct-api 2.0.2 → 2.0.4

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 (72) hide show
  1. package/lib/src/functions/fine/add.d.ts +10 -8
  2. package/lib/src/functions/fine/add.js +3 -4
  3. package/lib/src/functions/fine/delete.d.ts +10 -8
  4. package/lib/src/functions/fine/delete.js +3 -4
  5. package/lib/src/functions/fine/update.d.ts +10 -8
  6. package/lib/src/functions/fine/update.js +3 -4
  7. package/lib/src/functions/fineTemplate/add.d.ts +8 -6
  8. package/lib/src/functions/fineTemplate/add.js +3 -4
  9. package/lib/src/functions/fineTemplate/delete.d.ts +8 -6
  10. package/lib/src/functions/fineTemplate/delete.js +3 -4
  11. package/lib/src/functions/fineTemplate/update.d.ts +8 -6
  12. package/lib/src/functions/fineTemplate/update.js +3 -4
  13. package/lib/src/functions/firebaseFunctionsContext.d.ts +39 -0
  14. package/lib/src/functions/firebaseFunctionsContext.js +43 -0
  15. package/lib/src/functions/index.d.ts +1 -0
  16. package/lib/src/functions/index.js +1 -0
  17. package/lib/src/functions/invitation/getInvitation.d.ts +42 -40
  18. package/lib/src/functions/invitation/getInvitation.js +59 -58
  19. package/lib/src/functions/invitation/invite.d.ts +1 -1
  20. package/lib/src/functions/invitation/invite.js +3 -4
  21. package/lib/src/functions/invitation/register.d.ts +8 -6
  22. package/lib/src/functions/invitation/register.js +3 -4
  23. package/lib/src/functions/invitation/withdraw.d.ts +1 -1
  24. package/lib/src/functions/invitation/withdraw.js +3 -4
  25. package/lib/src/functions/notification/register.d.ts +9 -7
  26. package/lib/src/functions/notification/register.js +3 -4
  27. package/lib/src/functions/notification/subscribe.d.ts +9 -7
  28. package/lib/src/functions/notification/subscribe.js +3 -4
  29. package/lib/src/functions/paypalMe/edit.d.ts +8 -6
  30. package/lib/src/functions/paypalMe/edit.js +3 -4
  31. package/lib/src/functions/person/add.d.ts +9 -7
  32. package/lib/src/functions/person/add.js +3 -4
  33. package/lib/src/functions/person/delete.d.ts +8 -6
  34. package/lib/src/functions/person/delete.js +3 -4
  35. package/lib/src/functions/person/update.d.ts +9 -7
  36. package/lib/src/functions/person/update.js +3 -4
  37. package/lib/src/functions/team/new.d.ts +11 -9
  38. package/lib/src/functions/team/new.js +3 -4
  39. package/lib/src/functions/user/kickout.d.ts +8 -6
  40. package/lib/src/functions/user/kickout.js +3 -4
  41. package/lib/src/functions/user/login.d.ts +1 -1
  42. package/lib/src/functions/user/login.js +3 -4
  43. package/lib/src/functions/user/roleEdit.d.ts +9 -7
  44. package/lib/src/functions/user/roleEdit.js +3 -4
  45. package/lib/src/types/PayedState.d.ts +7 -0
  46. package/lib/src/types/PayedState.js +15 -0
  47. package/lib/test/types/PayedState.test.js +31 -0
  48. package/lib/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +2 -2
  50. package/src/functions/fine/add.ts +10 -8
  51. package/src/functions/fine/delete.ts +10 -7
  52. package/src/functions/fine/update.ts +11 -8
  53. package/src/functions/fineTemplate/add.ts +9 -6
  54. package/src/functions/fineTemplate/delete.ts +9 -6
  55. package/src/functions/fineTemplate/update.ts +9 -5
  56. package/src/functions/firebaseFunctionsContext.ts +48 -0
  57. package/src/functions/index.ts +1 -0
  58. package/src/functions/invitation/getInvitation.ts +82 -79
  59. package/src/functions/invitation/invite.ts +1 -1
  60. package/src/functions/invitation/register.ts +9 -6
  61. package/src/functions/invitation/withdraw.ts +1 -1
  62. package/src/functions/notification/register.ts +9 -6
  63. package/src/functions/notification/subscribe.ts +10 -7
  64. package/src/functions/paypalMe/edit.ts +9 -6
  65. package/src/functions/person/add.ts +10 -7
  66. package/src/functions/person/delete.ts +8 -5
  67. package/src/functions/person/update.ts +10 -7
  68. package/src/functions/team/new.ts +12 -9
  69. package/src/functions/user/kickout.ts +8 -6
  70. package/src/functions/user/login.ts +1 -1
  71. package/src/functions/user/roleEdit.ts +10 -7
  72. package/src/types/PayedState.ts +15 -0
@@ -2,17 +2,20 @@ import { Flattable, ObjectTypeBuilder, ValueTypeBuilder } from '@stevenkellner/t
2
2
  import { FirebaseFunction } from '@stevenkellner/firebase-function';
3
3
  import { Person, PersonPrivateProperties, User, Team } from '../../types';
4
4
 
5
- export type TeamNewFunctionParameters = {
6
- id: Team.Id
7
- name: string
8
- paypalMeLink: string | null
9
- personId: Person.Id
10
- personProperties: PersonPrivateProperties
11
- };
5
+ export namespace TeamNewFunction {
12
6
 
13
- export abstract class TeamNewFunctionBase extends FirebaseFunction<TeamNewFunctionParameters, User> {
7
+ export type Parameters = {
8
+ id: Team.Id
9
+ name: string
10
+ paypalMeLink: string | null
11
+ personId: Person.Id
12
+ personProperties: PersonPrivateProperties
13
+ };
14
+ }
15
+
16
+ export class TeamNewFunction implements FirebaseFunction<TeamNewFunction.Parameters, User> {
14
17
 
15
- public parametersBuilder = new ObjectTypeBuilder<Flattable.Flatten<TeamNewFunctionParameters>, TeamNewFunctionParameters>({
18
+ public parametersBuilder = new ObjectTypeBuilder<Flattable.Flatten<TeamNewFunction.Parameters>, TeamNewFunction.Parameters>({
16
19
  id: Team.Id.builder,
17
20
  name: new ValueTypeBuilder(),
18
21
  paypalMeLink: new ValueTypeBuilder(),
@@ -2,14 +2,16 @@ import { FirebaseFunction } from '@stevenkellner/firebase-function';
2
2
  import { Team, User } from '../../types';
3
3
  import { Flattable, ObjectTypeBuilder, ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
4
4
 
5
- export type UserKickoutFunctionParameters = {
6
- teamId: Team.Id
7
- userId: User.Id
8
- };
5
+ export namespace UserKickoutFunction {
9
6
 
10
- export abstract class UserKickoutFunctionBase extends FirebaseFunction<UserKickoutFunctionParameters, void> {
7
+ export type Parameters = {
8
+ teamId: Team.Id
9
+ userId: User.Id
10
+ };
11
+ }
12
+ export class UserKickoutFunction implements FirebaseFunction<UserKickoutFunction.Parameters, void> {
11
13
 
12
- public parametersBuilder = new ObjectTypeBuilder<Flattable.Flatten<UserKickoutFunctionParameters>, UserKickoutFunctionParameters>({
14
+ public parametersBuilder = new ObjectTypeBuilder<Flattable.Flatten<UserKickoutFunction.Parameters>, UserKickoutFunction.Parameters>({
13
15
  teamId: Team.Id.builder,
14
16
  userId: User.Id.builder
15
17
  });
@@ -2,7 +2,7 @@ import { FirebaseFunction } from '@stevenkellner/firebase-function';
2
2
  import { User } from '../../types';
3
3
  import { ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
4
4
 
5
- export abstract class UserLoginFunctionBase extends FirebaseFunction<null, User> {
5
+ export class UserLoginFunction implements FirebaseFunction<null, User> {
6
6
 
7
7
  public parametersBuilder = new ValueTypeBuilder<null>();
8
8
 
@@ -2,15 +2,18 @@ import { FirebaseFunction } from '@stevenkellner/firebase-function';
2
2
  import { Person, Team, UserRole } from '../../types';
3
3
  import { ArrayTypeBuilder, Flattable, ObjectTypeBuilder, ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
4
4
 
5
- export type UserRoleEditFunctionParameters = {
6
- teamId: Team.Id
7
- personId: Person.Id
8
- roles: UserRole[]
9
- };
5
+ export namespace UserRoleEditFunction {
10
6
 
11
- export abstract class UserRoleEditFunctionBase extends FirebaseFunction<UserRoleEditFunctionParameters, void> {
7
+ export type Parameters = {
8
+ teamId: Team.Id
9
+ personId: Person.Id
10
+ roles: UserRole[]
11
+ };
12
+ }
13
+
14
+ export class UserRoleEditFunction implements FirebaseFunction<UserRoleEditFunction.Parameters, void> {
12
15
 
13
- public parametersBuilder = new ObjectTypeBuilder<Flattable.Flatten<UserRoleEditFunctionParameters>, UserRoleEditFunctionParameters>({
16
+ public parametersBuilder = new ObjectTypeBuilder<Flattable.Flatten<UserRoleEditFunction.Parameters>, UserRoleEditFunction.Parameters>({
14
17
  teamId: Team.Id.builder,
15
18
  personId: Person.Id.builder,
16
19
  roles: new ArrayTypeBuilder(new ValueTypeBuilder())
@@ -29,6 +29,21 @@ export namespace PayedState {
29
29
  return Localization.shared(locale).payedState[state].value();
30
30
  }
31
31
 
32
+ /**
33
+ * Toggles the payment state between 'payed' and 'notPayed'.
34
+ *
35
+ * @param state - The current payment state
36
+ * @returns The toggled payment state
37
+ */
38
+ export function toggled(state: PayedState): PayedState {
39
+ switch (state) {
40
+ case 'payed':
41
+ return 'notPayed';
42
+ case 'notPayed':
43
+ return 'payed';
44
+ }
45
+ }
46
+
32
47
  /**
33
48
  * Type builder for PayedState serialization/deserialization.
34
49
  */