@stevenkellner/team-conduct-api 1.0.21 → 1.0.23
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.
- package/lib/src/functions/fine/add.js +7 -3
- package/lib/src/functions/fine/delete.js +5 -3
- package/lib/src/functions/fine/update.js +9 -6
- package/lib/src/locales/de.d.ts +66 -0
- package/lib/src/locales/de.js +99 -0
- package/lib/src/locales/en.d.ts +66 -0
- package/lib/src/locales/en.js +99 -0
- package/lib/src/types/Configuration.d.ts +3 -2
- package/lib/src/types/Configuration.js +2 -1
- package/lib/src/types/FineAmount.js +3 -3
- package/lib/src/types/FineTemplateRepetition.js +3 -3
- package/lib/src/types/Localization.d.ts +205 -60
- package/lib/src/types/Localization.js +65 -117
- package/lib/src/types/PayedState.js +1 -1
- package/lib/src/types/Pluralization.d.ts +17 -0
- package/lib/src/types/Pluralization.js +33 -0
- package/lib/src/types/UserRole.js +1 -1
- package/lib/src/types/index.d.ts +1 -0
- package/lib/src/types/index.js +1 -0
- package/lib/test/localization-utils.d.ts +0 -11
- package/lib/test/localization-utils.js +5 -49
- package/lib/test/localization.de.test.js +43 -80
- package/lib/test/localization.en.test.js +46 -85
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -5
- package/src/functions/fine/add.ts +7 -3
- package/src/functions/fine/delete.ts +5 -3
- package/src/functions/fine/update.ts +10 -7
- package/src/locales/de.ts +97 -0
- package/src/locales/en.ts +97 -0
- package/src/types/Configuration.ts +4 -3
- package/src/types/FineAmount.ts +3 -3
- package/src/types/FineTemplateRepetition.ts +3 -3
- package/src/types/Localization.ts +67 -83
- package/src/types/PayedState.ts +1 -1
- package/src/types/Pluralization.ts +44 -0
- package/src/types/UserRole.ts +3 -3
- package/src/types/index.ts +1 -0
- package/lib/src/locales/de.json +0 -85
- package/lib/src/locales/en.json +0 -85
- package/src/locales/de.json +0 -85
- package/src/locales/en.json +0 -85
|
@@ -1,77 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
const core_1 = require("@assertive-ts/core");
|
|
37
|
-
const
|
|
38
|
-
const
|
|
4
|
+
const en_1 = require("../src/locales/en");
|
|
5
|
+
const de_1 = require("../src/locales/de");
|
|
39
6
|
const types_1 = require("../src/types");
|
|
40
7
|
const localization_utils_1 = require("./localization-utils");
|
|
41
8
|
describe('Localization for de', () => {
|
|
42
|
-
const testedKeys = new localization_utils_1.TestedKeys((0, localization_utils_1.localizationWithoutDefault)(localizationDE));
|
|
43
9
|
before(() => {
|
|
44
|
-
types_1.Localization.
|
|
45
|
-
});
|
|
46
|
-
after('all values should be tested', () => {
|
|
47
|
-
testedKeys.checkAllTested();
|
|
10
|
+
types_1.Localization.locale = 'de';
|
|
48
11
|
});
|
|
49
12
|
it('should have the same keys as en', () => {
|
|
50
|
-
(0, localization_utils_1.hasSameKeys)(
|
|
13
|
+
(0, localization_utils_1.hasSameKeys)(de_1.localizationDE, en_1.localizationEN);
|
|
51
14
|
});
|
|
52
15
|
describe('notification.fine should be tested', () => {
|
|
53
16
|
it('notification.fine.new should be tested', () => {
|
|
54
|
-
|
|
55
|
-
|
|
17
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.new.title.value({ reason: 'fine-reason' })).toBeEqual('fine-reason');
|
|
18
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.new.body.value({ amount: '10,50 €' })).toBeEqual('Du hast eine neue Strafe von 10,50 €. Bitte so schnell wie möglich zahlen.');
|
|
56
19
|
});
|
|
57
20
|
it('notification.fine.reminder should be tested', () => {
|
|
58
|
-
|
|
59
|
-
|
|
21
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.reminder.title.value()).toBeEqual('Du hast noch offene Strafen');
|
|
22
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.reminder.body.value({ amount: '10,50 €' })).toBeEqual('Bei dir sind noch 10,50 € offen. Bitte so schnell wie möglich zahlen.');
|
|
60
23
|
});
|
|
61
24
|
it('notification.fine.stateChange should be tested', () => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
25
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.stateChange.title.value()).toBeEqual('Eine deiner Strafen hat sich geändert');
|
|
26
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.stateChange.bodyPayed.value({ amount: '10,50 €', reason: 'fine-reason' })).toBeEqual('Du hast eine Strafe von 10,50 € bezahlt (fine-reason).');
|
|
27
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.stateChange.bodyUnpayed.value({ amount: '10,50 €', reason: 'fine-reason' })).toBeEqual('fine-reason, 10,50 € ist noch offen.');
|
|
28
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.stateChange.bodyDeleted.value({ amount: '10,50 €', reason: 'fine-reason' })).toBeEqual('fine-reason, 10,50 € wurde gelöscht.');
|
|
66
29
|
});
|
|
67
30
|
});
|
|
68
31
|
describe('fineAmount should be tested', () => {
|
|
69
32
|
it('fineAmount.item.type.crateOfBeer should be tested', () => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
33
|
+
(0, core_1.expect)(types_1.Localization.shared.fineAmount.item.type.crateOfBeer.name.value()).toBeEqual('Kasten Bier');
|
|
34
|
+
(0, core_1.expect)(types_1.Localization.shared.fineAmount.item.type.crateOfBeer.withCount.value(1)).toBeEqual('Ein Kasten Bier');
|
|
35
|
+
(0, core_1.expect)(types_1.Localization.shared.fineAmount.item.type.crateOfBeer.withCount.value(4)).toBeEqual('4 Kästen Bier');
|
|
36
|
+
(0, core_1.expect)(types_1.Localization.shared.fineAmount.item.type.crateOfBeer.withoutCount.value(1)).toBeEqual('Kasten Bier');
|
|
37
|
+
(0, core_1.expect)(types_1.Localization.shared.fineAmount.item.type.crateOfBeer.withoutCount.value(4)).toBeEqual('Kästen Bier');
|
|
75
38
|
});
|
|
76
39
|
it('fineAmount.item.type.crateOfBeer should be formatted correctly', () => {
|
|
77
40
|
(0, core_1.expect)(types_1.FineAmount.Item.Type.formatted('crateOfBeer')).toBeEqual('Kasten Bier');
|
|
@@ -83,11 +46,11 @@ describe('Localization for de', () => {
|
|
|
83
46
|
});
|
|
84
47
|
describe('fineTemplateRepetition should be tested', () => {
|
|
85
48
|
it('fineTemplateRepetition.item.minute should be tested', () => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
49
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.minute.name.value()).toBeEqual('Minute');
|
|
50
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.minute.withCount.value(1)).toBeEqual('1 Minute');
|
|
51
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.minute.withCount.value(4)).toBeEqual('4 Minuten');
|
|
52
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.minute.withoutCount.value(1)).toBeEqual('Minute');
|
|
53
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.minute.withoutCount.value(4)).toBeEqual('Minuten');
|
|
91
54
|
});
|
|
92
55
|
it('fineTemplateRepetition.item.minute should be formatted correctly', () => {
|
|
93
56
|
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('minute')).toBeEqual('Minute');
|
|
@@ -97,11 +60,11 @@ describe('Localization for de', () => {
|
|
|
97
60
|
(0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formattedWithoutCount(4)).toBeEqual('Minuten');
|
|
98
61
|
});
|
|
99
62
|
it('fineTemplateRepetition.item.day should be tested', () => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
63
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.day.name.value()).toBeEqual('Tag');
|
|
64
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.day.withCount.value(1)).toBeEqual('1 Tag');
|
|
65
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.day.withCount.value(4)).toBeEqual('4 Tage');
|
|
66
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.day.withoutCount.value(1)).toBeEqual('Tag');
|
|
67
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.day.withoutCount.value(4)).toBeEqual('Tage');
|
|
105
68
|
});
|
|
106
69
|
it('fineTemplateRepetition.item.day should be formatted correctly', () => {
|
|
107
70
|
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('day')).toBeEqual('Tag');
|
|
@@ -111,11 +74,11 @@ describe('Localization for de', () => {
|
|
|
111
74
|
(0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formattedWithoutCount(4)).toBeEqual('Tage');
|
|
112
75
|
});
|
|
113
76
|
it('fineTemplateRepetition.item.item should be tested', () => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
77
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.item.name.value()).toBeEqual('Teil');
|
|
78
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.item.withCount.value(1)).toBeEqual('1 Teil');
|
|
79
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.item.withCount.value(4)).toBeEqual('4 Teile');
|
|
80
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.item.withoutCount.value(1)).toBeEqual('Teil');
|
|
81
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.item.withoutCount.value(4)).toBeEqual('Teile');
|
|
119
82
|
});
|
|
120
83
|
it('fineTemplateRepetition.item.item should be formatted correctly', () => {
|
|
121
84
|
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('item')).toBeEqual('Teil');
|
|
@@ -125,11 +88,11 @@ describe('Localization for de', () => {
|
|
|
125
88
|
(0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formattedWithoutCount(4)).toBeEqual('Teile');
|
|
126
89
|
});
|
|
127
90
|
it('fineTemplateRepetition.item.count should be tested', () => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
91
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.count.name.value()).toBeEqual('Anzahl');
|
|
92
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.count.withCount.value(1)).toBeEqual('1 mal');
|
|
93
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.count.withCount.value(4)).toBeEqual('4 mal');
|
|
94
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.count.withoutCount.value(1)).toBeEqual('mal');
|
|
95
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.count.withoutCount.value(4)).toBeEqual('mal');
|
|
133
96
|
});
|
|
134
97
|
it('fineTemplateRepetition.item.count should be formatted correctly', () => {
|
|
135
98
|
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('count')).toBeEqual('Anzahl');
|
|
@@ -141,13 +104,13 @@ describe('Localization for de', () => {
|
|
|
141
104
|
});
|
|
142
105
|
describe('payedState should be tested', () => {
|
|
143
106
|
it('payedState.payed should be tested', () => {
|
|
144
|
-
|
|
107
|
+
(0, core_1.expect)(types_1.Localization.shared.payedState.payed.value()).toBeEqual('Bezahlt');
|
|
145
108
|
});
|
|
146
109
|
it('payedState.payed should be formatted correctly', () => {
|
|
147
110
|
(0, core_1.expect)(types_1.PayedState.formatted('payed')).toBeEqual('Bezahlt');
|
|
148
111
|
});
|
|
149
112
|
it('payedState.notPayed should be tested', () => {
|
|
150
|
-
|
|
113
|
+
(0, core_1.expect)(types_1.Localization.shared.payedState.notPayed.value()).toBeEqual('Offen');
|
|
151
114
|
});
|
|
152
115
|
it('payedState.notPayed should be formatted correctly', () => {
|
|
153
116
|
(0, core_1.expect)(types_1.PayedState.formatted('notPayed')).toBeEqual('Offen');
|
|
@@ -155,25 +118,25 @@ describe('Localization for de', () => {
|
|
|
155
118
|
});
|
|
156
119
|
describe('userRole should be tested', () => {
|
|
157
120
|
it('userRole.personManager should be tested', () => {
|
|
158
|
-
|
|
121
|
+
(0, core_1.expect)(types_1.Localization.shared.userRole.personManager.value()).toBeEqual('Personenmanager');
|
|
159
122
|
});
|
|
160
123
|
it('userRole.personManager should be formatted correctly', () => {
|
|
161
124
|
(0, core_1.expect)(types_1.UserRole.formatted('person-manager')).toBeEqual('Personenmanager');
|
|
162
125
|
});
|
|
163
126
|
it('userRole.fineTemplateManager should be tested', () => {
|
|
164
|
-
|
|
127
|
+
(0, core_1.expect)(types_1.Localization.shared.userRole.fineTemplateManager.value()).toBeEqual('Strafvorlagenmanager');
|
|
165
128
|
});
|
|
166
129
|
it('userRole.fineTemplateManager should be formatted correctly', () => {
|
|
167
130
|
(0, core_1.expect)(types_1.UserRole.formatted('fineTemplate-manager')).toBeEqual('Strafvorlagenmanager');
|
|
168
131
|
});
|
|
169
132
|
it('userRole.fineManager should be tested', () => {
|
|
170
|
-
|
|
133
|
+
(0, core_1.expect)(types_1.Localization.shared.userRole.fineManager.value()).toBeEqual('Strafenmanager');
|
|
171
134
|
});
|
|
172
135
|
it('userRole.fineManager should be formatted correctly', () => {
|
|
173
136
|
(0, core_1.expect)(types_1.UserRole.formatted('fine-manager')).toBeEqual('Strafenmanager');
|
|
174
137
|
});
|
|
175
138
|
it('userRole.teamManager should be tested', () => {
|
|
176
|
-
|
|
139
|
+
(0, core_1.expect)(types_1.Localization.shared.userRole.teamManager.value()).toBeEqual('Teammanager');
|
|
177
140
|
});
|
|
178
141
|
it('userRole.teamManager should be formatted correctly', () => {
|
|
179
142
|
(0, core_1.expect)(types_1.UserRole.formatted('team-manager')).toBeEqual('Teammanager');
|
|
@@ -1,73 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
const core_1 = require("@assertive-ts/core");
|
|
37
|
-
const localizationEN = __importStar(require("../src/locales/en.json"));
|
|
38
4
|
const types_1 = require("../src/types");
|
|
39
|
-
const localization_utils_1 = require("./localization-utils");
|
|
40
5
|
describe('Localization for en', () => {
|
|
41
|
-
const testedKeys = new localization_utils_1.TestedKeys((0, localization_utils_1.localizationWithoutDefault)(localizationEN));
|
|
42
6
|
before(() => {
|
|
43
|
-
types_1.Localization.
|
|
44
|
-
});
|
|
45
|
-
after('all values should be tested', () => {
|
|
46
|
-
testedKeys.checkAllTested();
|
|
7
|
+
types_1.Localization.locale = 'en';
|
|
47
8
|
});
|
|
48
9
|
describe('notification.fine should be tested', () => {
|
|
49
10
|
it('notification.fine.new should be tested', () => {
|
|
50
|
-
|
|
51
|
-
|
|
11
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.new.title.value({ reason: 'fine-reason' })).toBeEqual('fine-reason');
|
|
12
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.new.body.value({ amount: '10.50 €' })).toBeEqual('You have a new fine of 10.50 €. Please pay it as soon as possible.');
|
|
52
13
|
});
|
|
53
14
|
it('notification.fine.reminder should be tested', () => {
|
|
54
|
-
|
|
55
|
-
|
|
15
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.reminder.title.value()).toBeEqual('You still have outstanding fines');
|
|
16
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.reminder.body.value({ amount: '10.50 €' })).toBeEqual('You still have 10.50 € outstanding. Please pay as soon as possible.');
|
|
56
17
|
});
|
|
57
18
|
it('notification.fine.stateChange should be tested', () => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
19
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.stateChange.title.value()).toBeEqual('One of your fines has changed');
|
|
20
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.stateChange.bodyPayed.value({ amount: '10.50 €', reason: 'fine-reason' })).toBeEqual('You have paid a fine of 10.50 € (fine-reason).');
|
|
21
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.stateChange.bodyUnpayed.value({ amount: '10.50 €', reason: 'fine-reason' })).toBeEqual('fine-reason, 10.50 € is still outstanding.');
|
|
22
|
+
(0, core_1.expect)(types_1.Localization.shared.notification.fine.stateChange.bodyDeleted.value({ amount: '10.50 €', reason: 'fine-reason' })).toBeEqual('fine-reason, 10.50 € has been deleted.');
|
|
62
23
|
});
|
|
63
24
|
});
|
|
64
25
|
describe('fineAmount should be tested', () => {
|
|
65
26
|
it('fineAmount.item.type.crateOfBeer should be tested', () => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
27
|
+
(0, core_1.expect)(types_1.Localization.shared.fineAmount.item.type.crateOfBeer.name.value()).toBeEqual('Crate of Beer');
|
|
28
|
+
(0, core_1.expect)(types_1.Localization.shared.fineAmount.item.type.crateOfBeer.withCount.value(1)).toBeEqual('a crate of beer');
|
|
29
|
+
(0, core_1.expect)(types_1.Localization.shared.fineAmount.item.type.crateOfBeer.withCount.value(4)).toBeEqual('4 crates of beer');
|
|
30
|
+
(0, core_1.expect)(types_1.Localization.shared.fineAmount.item.type.crateOfBeer.withoutCount.value(1)).toBeEqual('Crate of Beer');
|
|
31
|
+
(0, core_1.expect)(types_1.Localization.shared.fineAmount.item.type.crateOfBeer.withoutCount.value(4)).toBeEqual('Crates of Beer');
|
|
71
32
|
});
|
|
72
33
|
it('fineAmount.item.type.crateOfBeer should be formatted correctly', () => {
|
|
73
34
|
(0, core_1.expect)(types_1.FineAmount.Item.Type.formatted('crateOfBeer')).toBeEqual('Crate of Beer');
|
|
@@ -79,53 +40,53 @@ describe('Localization for en', () => {
|
|
|
79
40
|
});
|
|
80
41
|
describe('fineTemplateRepetition should be tested', () => {
|
|
81
42
|
it('fineTemplateRepetition.item.minute should be tested', () => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
43
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.minute.name.value()).toBeEqual('Minute');
|
|
44
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.minute.withCount.value(1)).toBeEqual('1 minute');
|
|
45
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.minute.withCount.value(4)).toBeEqual('4 minutes');
|
|
46
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.minute.withoutCount.value(1)).toBeEqual('minute');
|
|
47
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.minute.withoutCount.value(4)).toBeEqual('minutes');
|
|
87
48
|
});
|
|
88
49
|
it('fineTemplateRepetition.item.minute should be formatted correctly', () => {
|
|
89
50
|
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('minute')).toBeEqual('Minute');
|
|
90
51
|
(0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formatted(1)).toBeEqual('1 minute');
|
|
91
52
|
(0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formatted(4)).toBeEqual('4 minutes');
|
|
92
|
-
(0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formattedWithoutCount(1)).toBeEqual('
|
|
93
|
-
(0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formattedWithoutCount(4)).toBeEqual('
|
|
53
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formattedWithoutCount(1)).toBeEqual('minute');
|
|
54
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formattedWithoutCount(4)).toBeEqual('minutes');
|
|
94
55
|
});
|
|
95
56
|
it('fineTemplateRepetition.item.day should be tested', () => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
57
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.day.name.value()).toBeEqual('Day');
|
|
58
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.day.withCount.value(1)).toBeEqual('1 day');
|
|
59
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.day.withCount.value(4)).toBeEqual('4 days');
|
|
60
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.day.withoutCount.value(1)).toBeEqual('day');
|
|
61
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.day.withoutCount.value(4)).toBeEqual('days');
|
|
101
62
|
});
|
|
102
63
|
it('fineTemplateRepetition.item.day should be formatted correctly', () => {
|
|
103
64
|
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('day')).toBeEqual('Day');
|
|
104
65
|
(0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formatted(1)).toBeEqual('1 day');
|
|
105
66
|
(0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formatted(4)).toBeEqual('4 days');
|
|
106
|
-
(0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formattedWithoutCount(1)).toBeEqual('
|
|
107
|
-
(0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formattedWithoutCount(4)).toBeEqual('
|
|
67
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formattedWithoutCount(1)).toBeEqual('day');
|
|
68
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formattedWithoutCount(4)).toBeEqual('days');
|
|
108
69
|
});
|
|
109
70
|
it('fineTemplateRepetition.item.item should be tested', () => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
71
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.item.name.value()).toBeEqual('Item');
|
|
72
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.item.withCount.value(1)).toBeEqual('1 item');
|
|
73
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.item.withCount.value(4)).toBeEqual('4 items');
|
|
74
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.item.withoutCount.value(1)).toBeEqual('item');
|
|
75
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.item.withoutCount.value(4)).toBeEqual('items');
|
|
115
76
|
});
|
|
116
77
|
it('fineTemplateRepetition.item.item should be formatted correctly', () => {
|
|
117
78
|
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('item')).toBeEqual('Item');
|
|
118
79
|
(0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formatted(1)).toBeEqual('1 item');
|
|
119
80
|
(0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formatted(4)).toBeEqual('4 items');
|
|
120
|
-
(0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formattedWithoutCount(1)).toBeEqual('
|
|
121
|
-
(0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formattedWithoutCount(4)).toBeEqual('
|
|
81
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formattedWithoutCount(1)).toBeEqual('item');
|
|
82
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formattedWithoutCount(4)).toBeEqual('items');
|
|
122
83
|
});
|
|
123
84
|
it('fineTemplateRepetition.item.count should be tested', () => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
85
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.count.name.value()).toBeEqual('Count');
|
|
86
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.count.withCount.value(1)).toBeEqual('1 time');
|
|
87
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.count.withCount.value(4)).toBeEqual('4 times');
|
|
88
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.count.withoutCount.value(1)).toBeEqual('time');
|
|
89
|
+
(0, core_1.expect)(types_1.Localization.shared.fineTemplateRepetition.item.count.withoutCount.value(4)).toBeEqual('times');
|
|
129
90
|
});
|
|
130
91
|
it('fineTemplateRepetition.item.count should be formatted correctly', () => {
|
|
131
92
|
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('count')).toBeEqual('Count');
|
|
@@ -137,13 +98,13 @@ describe('Localization for en', () => {
|
|
|
137
98
|
});
|
|
138
99
|
describe('payedState should be tested', () => {
|
|
139
100
|
it('payedState.payed should be tested', () => {
|
|
140
|
-
|
|
101
|
+
(0, core_1.expect)(types_1.Localization.shared.payedState.payed.value()).toBeEqual('Paid');
|
|
141
102
|
});
|
|
142
103
|
it('payedState.payed should be formatted correctly', () => {
|
|
143
104
|
(0, core_1.expect)(types_1.PayedState.formatted('payed')).toBeEqual('Paid');
|
|
144
105
|
});
|
|
145
106
|
it('payedState.notPayed should be tested', () => {
|
|
146
|
-
|
|
107
|
+
(0, core_1.expect)(types_1.Localization.shared.payedState.notPayed.value()).toBeEqual('Outstanding');
|
|
147
108
|
});
|
|
148
109
|
it('payedState.notPayed should be formatted correctly', () => {
|
|
149
110
|
(0, core_1.expect)(types_1.PayedState.formatted('notPayed')).toBeEqual('Outstanding');
|
|
@@ -151,25 +112,25 @@ describe('Localization for en', () => {
|
|
|
151
112
|
});
|
|
152
113
|
describe('userRole should be tested', () => {
|
|
153
114
|
it('userRole.personManager should be tested', () => {
|
|
154
|
-
|
|
115
|
+
(0, core_1.expect)(types_1.Localization.shared.userRole.personManager.value()).toBeEqual('Person Manager');
|
|
155
116
|
});
|
|
156
117
|
it('userRole.personManager should be formatted correctly', () => {
|
|
157
118
|
(0, core_1.expect)(types_1.UserRole.formatted('person-manager')).toBeEqual('Person Manager');
|
|
158
119
|
});
|
|
159
120
|
it('userRole.fineTemplateManager should be tested', () => {
|
|
160
|
-
|
|
121
|
+
(0, core_1.expect)(types_1.Localization.shared.userRole.fineTemplateManager.value()).toBeEqual('Fine Template Manager');
|
|
161
122
|
});
|
|
162
123
|
it('userRole.fineTemplateManager should be formatted correctly', () => {
|
|
163
124
|
(0, core_1.expect)(types_1.UserRole.formatted('fineTemplate-manager')).toBeEqual('Fine Template Manager');
|
|
164
125
|
});
|
|
165
126
|
it('userRole.fineManager should be tested', () => {
|
|
166
|
-
|
|
127
|
+
(0, core_1.expect)(types_1.Localization.shared.userRole.fineManager.value()).toBeEqual('Fine Manager');
|
|
167
128
|
});
|
|
168
129
|
it('userRole.fineManager should be formatted correctly', () => {
|
|
169
130
|
(0, core_1.expect)(types_1.UserRole.formatted('fine-manager')).toBeEqual('Fine Manager');
|
|
170
131
|
});
|
|
171
132
|
it('userRole.teamManager should be tested', () => {
|
|
172
|
-
|
|
133
|
+
(0, core_1.expect)(types_1.Localization.shared.userRole.teamManager.value()).toBeEqual('Team Manager');
|
|
173
134
|
});
|
|
174
135
|
it('userRole.teamManager should be formatted correctly', () => {
|
|
175
136
|
(0, core_1.expect)(types_1.UserRole.formatted('team-manager')).toBeEqual('Team Manager');
|
package/lib/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../index.ts","../src/Firestore.ts","../src/FirestoreScheme.ts","../src/checkAuthentication.ts","../src/firebaseFunctionsContext.ts","../src/index.ts","../src/pushNotification.ts","../src/firebase/FirebaseConfiguration.ts","../src/firebase/Messaging.ts","../src/firebase/index.ts","../src/functions/index.ts","../src/functions/fine/add.ts","../src/functions/fine/delete.ts","../src/functions/fine/update.ts","../src/functions/fineTemplate/add.ts","../src/functions/fineTemplate/delete.ts","../src/functions/fineTemplate/update.ts","../src/functions/invitation/invite.ts","../src/functions/invitation/register.ts","../src/functions/invitation/withdraw.ts","../src/functions/notification/register.ts","../src/functions/notification/subscribe.ts","../src/functions/paypalMe/edit.ts","../src/functions/person/add.ts","../src/functions/person/delete.ts","../src/functions/person/update.ts","../src/functions/team/new.ts","../src/functions/user/login.ts","../src/functions/user/roleEdit.ts","../src/types/Configuration.ts","../src/types/Fine.ts","../src/types/FineAmount.ts","../src/types/FineTemplate.ts","../src/types/FineTemplateRepetition.ts","../src/types/Invitation.ts","../src/types/Localization.ts","../src/types/MoneyAmount.ts","../src/types/NotificationProperties.ts","../src/types/PayedState.ts","../src/types/Person.ts","../src/types/PersonPrivateProperties.ts","../src/types/PersonSignInProperties.ts","../src/types/Team.ts","../src/types/User.ts","../src/types/UserRole.ts","../src/types/index.ts","../test/localization-utils.ts","../test/localization.de.test.ts","../test/localization.en.test.ts"],"version":"5.8.3"}
|
|
1
|
+
{"root":["../index.ts","../src/Firestore.ts","../src/FirestoreScheme.ts","../src/checkAuthentication.ts","../src/firebaseFunctionsContext.ts","../src/index.ts","../src/pushNotification.ts","../src/firebase/FirebaseConfiguration.ts","../src/firebase/Messaging.ts","../src/firebase/index.ts","../src/functions/index.ts","../src/functions/fine/add.ts","../src/functions/fine/delete.ts","../src/functions/fine/update.ts","../src/functions/fineTemplate/add.ts","../src/functions/fineTemplate/delete.ts","../src/functions/fineTemplate/update.ts","../src/functions/invitation/invite.ts","../src/functions/invitation/register.ts","../src/functions/invitation/withdraw.ts","../src/functions/notification/register.ts","../src/functions/notification/subscribe.ts","../src/functions/paypalMe/edit.ts","../src/functions/person/add.ts","../src/functions/person/delete.ts","../src/functions/person/update.ts","../src/functions/team/new.ts","../src/functions/user/login.ts","../src/functions/user/roleEdit.ts","../src/locales/de.ts","../src/locales/en.ts","../src/types/Configuration.ts","../src/types/Fine.ts","../src/types/FineAmount.ts","../src/types/FineTemplate.ts","../src/types/FineTemplateRepetition.ts","../src/types/Invitation.ts","../src/types/Localization.ts","../src/types/MoneyAmount.ts","../src/types/NotificationProperties.ts","../src/types/PayedState.ts","../src/types/Person.ts","../src/types/PersonPrivateProperties.ts","../src/types/PersonSignInProperties.ts","../src/types/Pluralization.ts","../src/types/Team.ts","../src/types/User.ts","../src/types/UserRole.ts","../src/types/index.ts","../test/localization-utils.ts","../test/localization.de.test.ts","../test/localization.en.test.ts"],"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stevenkellner/team-conduct-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "Firebase API for Team Conduct",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Steven Kellner",
|
|
@@ -22,16 +22,14 @@
|
|
|
22
22
|
"release": "npm run rebuild && npm run lint && npm version patch && git push --follow-tags"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@stevenkellner/firebase-function": "^1.4.
|
|
26
|
-
"@stevenkellner/typescript-common-functionality": "^1.0.49"
|
|
27
|
-
"i18n": "^0.15.1"
|
|
25
|
+
"@stevenkellner/firebase-function": "^1.4.137",
|
|
26
|
+
"@stevenkellner/typescript-common-functionality": "^1.0.49"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@assertive-ts/core": "^2.1.0",
|
|
31
30
|
"@eslint/compat": "^1.2.9",
|
|
32
31
|
"@eslint/eslintrc": "^3.3.1",
|
|
33
32
|
"@eslint/js": "^9.26.0",
|
|
34
|
-
"@types/i18n": "^0.13.12",
|
|
35
33
|
"@types/mocha": "^10.0.10",
|
|
36
34
|
"@typescript-eslint/eslint-plugin": "^8.32.0",
|
|
37
35
|
"@typescript-eslint/parser": "^8.32.0",
|
|
@@ -45,10 +45,14 @@ export class FineAddFunction extends FirebaseFunction<FineAddFunction.Parameters
|
|
|
45
45
|
person.fineIds.push(parameters.fine.id);
|
|
46
46
|
await Firestore.shared.person(parameters.teamId, parameters.personId).set(person);
|
|
47
47
|
|
|
48
|
-
Localization.
|
|
48
|
+
Localization.locale = parameters.configuration.locale;
|
|
49
49
|
await pushNotification(parameters.teamId, parameters.personId, 'new-fine', {
|
|
50
|
-
title: Localization.shared.
|
|
51
|
-
|
|
50
|
+
title: Localization.shared.notification.fine.new.title.value({
|
|
51
|
+
reason: parameters.fine.reason
|
|
52
|
+
}),
|
|
53
|
+
body: Localization.shared.notification.fine.new.body.value({
|
|
54
|
+
amount: parameters.fine.amount.formatted(parameters.configuration)
|
|
55
|
+
})
|
|
52
56
|
});
|
|
53
57
|
}
|
|
54
58
|
}
|
|
@@ -44,10 +44,12 @@ export class FineDeleteFunction extends FirebaseFunction<FineDeleteFunction.Para
|
|
|
44
44
|
person.fineIds = person.fineIds.filter(id => id.guidString !== parameters.id.guidString);
|
|
45
45
|
await Firestore.shared.person(parameters.teamId, parameters.personId).set(person);
|
|
46
46
|
|
|
47
|
-
Localization.
|
|
47
|
+
Localization.locale = parameters.configuration.locale;
|
|
48
48
|
await pushNotification(parameters.teamId, parameters.personId, 'fine-state-change', {
|
|
49
|
-
title: Localization.shared.
|
|
50
|
-
body: Localization.shared.
|
|
49
|
+
title: Localization.shared.notification.fine.stateChange.title.value(),
|
|
50
|
+
body: Localization.shared.notification.fine.stateChange.bodyDeleted.value({
|
|
51
|
+
amount: FineAmount.builder.build(fineSnapshot.data.amount).formatted(parameters.configuration)
|
|
52
|
+
})
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Configuration } from '../../types/Configuration';
|
|
2
2
|
import { FirebaseFunction, FunctionsError } from '@stevenkellner/firebase-function';
|
|
3
3
|
import { pushNotification } from '../../pushNotification';
|
|
4
|
-
import { Fine, Localization, Person, Team } from '../../types';
|
|
4
|
+
import { Fine, Localization, Person, Team, ValueLocalization } from '../../types';
|
|
5
5
|
import { Flattable, ObjectTypeBuilder, ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality';
|
|
6
6
|
import { checkAuthentication } from '../../checkAuthentication';
|
|
7
7
|
import { Firestore } from '../../Firestore';
|
|
@@ -37,16 +37,19 @@ export class FineUpdateFunction extends FirebaseFunction<FineUpdateFunction.Para
|
|
|
37
37
|
|
|
38
38
|
await Firestore.shared.fine(parameters.teamId, parameters.fine.id).set(parameters.fine);
|
|
39
39
|
|
|
40
|
-
Localization.
|
|
40
|
+
Localization.locale = parameters.configuration.locale;
|
|
41
41
|
if (parameters.fine.payedState !== fineSnapshot.data.payedState) {
|
|
42
|
-
let
|
|
42
|
+
let bodyLocalization: ValueLocalization;
|
|
43
43
|
if (parameters.fine.payedState === 'payed')
|
|
44
|
-
|
|
44
|
+
bodyLocalization = Localization.shared.notification.fine.stateChange.bodyPayed;
|
|
45
45
|
else
|
|
46
|
-
|
|
46
|
+
bodyLocalization = Localization.shared.notification.fine.stateChange.bodyUnpayed;
|
|
47
47
|
await pushNotification(parameters.teamId, parameters.personId, 'fine-state-change', {
|
|
48
|
-
title: Localization.shared.
|
|
49
|
-
body:
|
|
48
|
+
title: Localization.shared.notification.fine.stateChange.title.value(),
|
|
49
|
+
body: bodyLocalization.value({
|
|
50
|
+
reason: parameters.fine.reason,
|
|
51
|
+
amount: parameters.fine.amount.formatted(parameters.configuration)
|
|
52
|
+
})
|
|
50
53
|
});
|
|
51
54
|
|
|
52
55
|
}
|