Skip to content

Commit 315623a

Browse files
chore(merge): merge develop into main
2 parents 87548ab + ef263a6 commit 315623a

File tree

3 files changed

+66
-31
lines changed

3 files changed

+66
-31
lines changed

libs/backend/competition/assembly/src/services/validate/assembly.service.spec.ts

+59-29
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ describe('AssemblyValidationService', () => {
199199
.WithName('club 1')
200200
.WithTeam(
201201
teamB
202-
.WithTeamNumber(2)
203202
.WithPlayer(player777B, TeamMembershipType.REGULAR)
204203
.WithPlayer(player888B, TeamMembershipType.REGULAR)
205204
.WithPlayer(player999B, TeamMembershipType.REGULAR)
@@ -760,7 +759,8 @@ describe('AssemblyValidationService', () => {
760759
let player888: Player;
761760
let player999: Player;
762761

763-
let team: Team;
762+
let team1: Team;
763+
let team2: Team;
764764

765765
beforeEach(async () => {
766766
const player555B = PlayerBuilder.Create()
@@ -823,30 +823,41 @@ describe('AssemblyValidationService', () => {
823823
.WithDate(new Date('2020-05-09')),
824824
);
825825

826-
const teamB = TeamBuilder.Create(SubEventTypeEnum.MX)
826+
const team1B = TeamBuilder.Create(SubEventTypeEnum.MX)
827827
.WithTeamNumber(1)
828828
.WithSeason(event.season)
829829
.WithName('team 1');
830+
const team2B = TeamBuilder.Create(SubEventTypeEnum.MX)
831+
.WithTeamNumber(2)
832+
.WithSeason(event.season)
833+
.WithName('team 2');
834+
835+
const entry = EventCompetitionEntryBuilder.Create('competition')
836+
.WithDrawId(draw.id)
837+
.WithSubEventId(subEvent.id)
838+
.WithBasePlayer(player666B, 6, 6, 6)
839+
.WithBasePlayer(player777B, 7, 7, 7)
840+
.WithBasePlayer(player888B, 8, 8, 8)
841+
.WithBasePlayer(player999B, 9, 9, 9)
842+
.WithBaseIndex(60);
830843

831844
await ClubBuilder.Create()
832845
.WithName('club 1')
833846
.WithTeam(
834-
teamB
835-
.WithTeamNumber(2)
847+
team1B
836848
.WithPlayer(player777B, TeamMembershipType.REGULAR)
837849
.WithPlayer(player888B, TeamMembershipType.REGULAR)
838850
.WithPlayer(player999B, TeamMembershipType.REGULAR)
839851
.WithPlayer(player666B, TeamMembershipType.REGULAR)
840-
.WithEntry(
841-
EventCompetitionEntryBuilder.Create('competition')
842-
.WithDrawId(draw.id)
843-
.WithSubEventId(subEvent.id)
844-
.WithBasePlayer(player666B, 6, 6, 6)
845-
.WithBasePlayer(player777B, 7, 7, 7)
846-
.WithBasePlayer(player888B, 8, 8, 8)
847-
.WithBasePlayer(player999B, 9, 9, 9)
848-
.WithBaseIndex(60),
849-
),
852+
.WithEntry(entry),
853+
)
854+
.WithTeam(
855+
team2B
856+
.WithPlayer(player777B, TeamMembershipType.REGULAR)
857+
.WithPlayer(player888B, TeamMembershipType.REGULAR)
858+
.WithPlayer(player999B, TeamMembershipType.REGULAR)
859+
.WithPlayer(player666B, TeamMembershipType.REGULAR)
860+
.WithEntry(entry),
850861
)
851862
.Build();
852863

@@ -856,7 +867,8 @@ describe('AssemblyValidationService', () => {
856867
player888 = await player888B.Build();
857868
player999 = await player999B.Build();
858869

859-
team = await teamB.Build();
870+
team1 = await team1B.Build();
871+
team2 = await team2B.Build();
860872
});
861873
describe('Rule [PlayerOrderRule]', () => {
862874
beforeEach(async () => {
@@ -870,7 +882,7 @@ describe('AssemblyValidationService', () => {
870882
it('Double 3 is better then Double 4', async () => {
871883
const validation = await service.validate({
872884
systemId: system.id,
873-
teamId: team?.id,
885+
teamId: team1?.id,
874886
encounterId: encounter.id,
875887
double3: [player666.id, player999.id],
876888
double4: [player777.id, player888.id],
@@ -895,7 +907,7 @@ describe('AssemblyValidationService', () => {
895907
test.each(invalid)('Single %p is not better then Single %p', async (p1, p2) => {
896908
const validation = await service.validate({
897909
systemId: system.id,
898-
teamId: team?.id,
910+
teamId: team1?.id,
899911
encounterId: encounter.id,
900912
[`single${p1}`]: player888.id,
901913
[`single${p2}`]: player777.id,
@@ -920,7 +932,7 @@ describe('AssemblyValidationService', () => {
920932
it('Mixed double is better then other', async () => {
921933
const validation = await service.validate({
922934
systemId: system.id,
923-
teamId: team?.id,
935+
teamId: team1?.id,
924936
encounterId: encounter.id,
925937
double3: [player777.id, player888.id],
926938
double4: [player666.id, player888.id],
@@ -951,7 +963,7 @@ describe('AssemblyValidationService', () => {
951963
it('Mixed double is better then other by level', async () => {
952964
const validation = await service.validate({
953965
systemId: system.id,
954-
teamId: team?.id,
966+
teamId: team1?.id,
955967
encounterId: encounter.id,
956968
double3: [player777.id, player888.id],
957969
double4: [player666.id, player999.id],
@@ -993,7 +1005,7 @@ describe('AssemblyValidationService', () => {
9931005
it('should be valid doubles', async () => {
9941006
const validation = await service.validate({
9951007
systemId: system.id,
996-
teamId: team?.id,
1008+
teamId: team1?.id,
9971009
encounterId: encounter.id,
9981010
double1: [player666.id, player888.id],
9991011
double2: [player777.id, player999.id],
@@ -1015,7 +1027,7 @@ describe('AssemblyValidationService', () => {
10151027
it('should be invalid if the player has more then 1 mixed', async () => {
10161028
const validation = await service.validate({
10171029
systemId: system.id,
1018-
teamId: team?.id,
1030+
teamId: team1?.id,
10191031
encounterId: encounter.id,
10201032
double3: [player666.id, player999.id],
10211033
double4: [player888.id, player999.id],
@@ -1046,7 +1058,7 @@ describe('AssemblyValidationService', () => {
10461058
it('should be valid doubles', async () => {
10471059
const validation = await service.validate({
10481060
systemId: system.id,
1049-
teamId: team?.id,
1061+
teamId: team1?.id,
10501062
encounterId: encounter.id,
10511063
double1: [player666.id, player777.id],
10521064
double2: [player888.id, player999.id],
@@ -1070,7 +1082,7 @@ describe('AssemblyValidationService', () => {
10701082
it('should be invalid if a mixed 3 has 2 of the same gender', async () => {
10711083
const validation = await service.validate({
10721084
systemId: system.id,
1073-
teamId: team?.id,
1085+
teamId: team1?.id,
10741086
encounterId: encounter.id,
10751087
double3: [player666.id, player777.id],
10761088
double4: [player888.id, player777.id],
@@ -1091,7 +1103,7 @@ describe('AssemblyValidationService', () => {
10911103
it('should be invalid if a mixed 4 has 2 of the same gender', async () => {
10921104
const validation = await service.validate({
10931105
systemId: system.id,
1094-
teamId: team?.id,
1106+
teamId: team1?.id,
10951107
encounterId: encounter.id,
10961108
double3: [player666.id, player999.id],
10971109
double4: [player888.id, player999.id],
@@ -1123,7 +1135,7 @@ describe('AssemblyValidationService', () => {
11231135
it('should be valid', async () => {
11241136
const validation = await service.validate({
11251137
systemId: system.id,
1126-
teamId: team?.id,
1138+
teamId: team2?.id,
11271139
encounterId: encounter.id,
11281140
single1: player666.id,
11291141
single2: player777.id,
@@ -1138,13 +1150,32 @@ describe('AssemblyValidationService', () => {
11381150
);
11391151
expect(error).toBeUndefined();
11401152
});
1153+
1154+
it('first team should always be valid', async () => {
1155+
const validation = await service.validate({
1156+
systemId: system.id,
1157+
teamId: team1?.id,
1158+
encounterId: encounter.id,
1159+
single1: player555.id,
1160+
single2: player777.id,
1161+
single3: player888.id,
1162+
single4: player999.id,
1163+
});
1164+
1165+
expect(validation).toBeDefined();
1166+
1167+
const error = validation.errors?.find(
1168+
(e) => e.message === 'all.competition.team-assembly.errors.player-min-level',
1169+
);
1170+
expect(error).toBeUndefined();
1171+
});
11411172
});
11421173

11431174
describe('invalid', () => {
1144-
it("should be invalid if the player doesn't have competition status on true ", async () => {
1175+
it('should be invalid if the player has a lower ranking then the subevent ', async () => {
11451176
const validation = await service.validate({
11461177
systemId: system.id,
1147-
teamId: team?.id,
1178+
teamId: team2?.id,
11481179
encounterId: encounter.id,
11491180
single1: player555.id,
11501181
single2: player777.id,
@@ -1604,7 +1635,6 @@ describe('AssemblyValidationService', () => {
16041635
.WithName('club 1')
16051636
.WithTeam(
16061637
teamB
1607-
.WithTeamNumber(2)
16081638
.WithPlayer(player777B, TeamMembershipType.REGULAR)
16091639
.WithPlayer(player888B, TeamMembershipType.REGULAR)
16101640
.WithPlayer(player999B, TeamMembershipType.REGULAR)

libs/backend/database/src/types/pushSubscription.type.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class PushSubscriptionKeysInputType extends PartialType(
3636

3737
export interface PushSubscription {
3838
endpoint: string;
39-
expirationTime: string;
39+
expirationTime: number;
4040
keys: PushSubscriptionKeys;
4141
}
4242

libs/backend/twizzit/package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
"fastify": "^4.27.0",
88
"moment-timezone": "^0.5.45",
99
"sequelize": "^6.37.3",
10-
"@swc/helpers": "^0.5.11"
10+
"@swc/helpers": "^0.5.11",
11+
"@badman/utils": "6.173.5",
12+
"@nestjs/config": "^3.2.3",
13+
"axios": "^1.7.7",
14+
"axios-rate-limit": "^1.4.0",
15+
"axios-retry": "^4.5.0"
1116
},
1217
"type": "commonjs",
1318
"main": "./src/index.js",

0 commit comments

Comments
 (0)