Skip to content

Commit

Permalink
chore(merge): merge develop into main
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Aug 18, 2024
2 parents c252cb9 + 9c5723a commit 3a4c0bf
Show file tree
Hide file tree
Showing 177 changed files with 4,704 additions and 1,945 deletions.
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"github-actions.workflows.pinned.workflows": [
".github/workflows/main.yml"
],
"exportall.config.folderListener": []
"exportall.config.folderListener": [],
"sonarlint.connectedMode.project": {
"connectionId": "badman",
"projectKey": "Badminton-Apps_badman"
}
}
3 changes: 2 additions & 1 deletion apps/api/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';
import versionPackage from '../version.json';
import { CleanEnvironmentModule } from './clean-environment.module';
import { CalendarController } from './controllers/ical.controller';

const productionModules = [];
if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test') {
Expand Down Expand Up @@ -70,7 +71,7 @@ console.log('envFilePath', envFilePath, process.env.NODE_ENV);
SocketModule,
TransferLoanModule,
],
controllers: [AppController, ImageController],
controllers: [AppController, ImageController, CalendarController],
providers: [Logger],
})
export class AppModule {
Expand Down
83 changes: 83 additions & 0 deletions apps/api/src/app/controllers/ical.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { Team, Location, EncounterCompetition } from '@badman/backend-database';
import { Controller, Get, Query, Res } from '@nestjs/common';
import { Response } from 'express';
import { ICalCalendar } from 'ical-generator';
import moment from 'moment';
import { Includeable, Op } from 'sequelize';

@Controller('calendar')
export class CalendarController {
@Get('team')
async generateCalendarLink(
@Query() query: { teamId: string; linkId: string },
@Res() res: Response,
) {
if (!query.teamId && !query.linkId) {
return res.status(400).send('Invalid team or link id');
}

const team = query.teamId
? await Team.findByPk(query.teamId)
: await Team.findOne({ where: { link: query.linkId } });

if (!team) {
return res.status(404).send('Team not found');
}

const enconuters = await EncounterCompetition.findAll({
where: {
[Op.or]: [{ homeTeamId: team.id }, { awayTeamId: team.id }],
},
include: [
{
model: Location,
as: 'location',
},
{
model: Team,
as: 'home',
},
{
model: Team,
as: 'away',
},
],
});

console.log(`found ${enconuters.length} away encounters`);

const events = enconuters.map((enc) => ({
title: `${enc.home.name} vs ${enc.away.name}`,
startTime: enc.date,
endTime: moment(enc.date).add(3, 'hours').toDate(),
description: `${enc.home.name} vs ${enc.away.name}`,
location: enc.location,
}));

const calendar = new ICalCalendar({
name: team.name,
});

events.forEach((event) => {
calendar.createEvent({
start: event.startTime,
end: event.endTime,
summary: event.title,
description: event.description,
location: {
title: event.location.name,
address: event.location.address,
// geo: {
// lat: event.location.coordinates.
// }
},
});
});

res.header('Content-Type', 'text/calendar');
res.header('Content-Disposition', `attachment; filename="calendar-${team.name}.ics"`);

// Send the calendar data as an .ics file
res.send(calendar.toString());
}
}
2 changes: 1 addition & 1 deletion apps/api/src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "6.166.3"
"version": "6.168.3"
}
1 change: 1 addition & 0 deletions apps/api/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
compiler: 'tsc',
main: './src/main.ts',
tsConfig: './tsconfig.app.json',

assets: [
'./src/assets',
{
Expand Down
71 changes: 71 additions & 0 deletions apps/badman/src/assets/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
## 6.168.3 (2024-08-15)


### 🩹 Fixes

- switching ([3ea25fc68](https://github.com/Badminton-Apps/badman/commit/3ea25fc68))

### ❤️ Thank You

- cskiwi @cskiwi

## 6.168.2 (2024-08-15)


### 🩹 Fixes

- now directly copy to clipboard ([e5de0f9c2](https://github.com/Badminton-Apps/badman/commit/e5de0f9c2))
- show tooltip that it was copied ([6396f6b24](https://github.com/Badminton-Apps/badman/commit/6396f6b24))

### ❤️ Thank You

- cskiwi @cskiwi

## 6.168.1 (2024-08-15)


### 🩹 Fixes

- calendar wasn't showing th right events ([7b788bcda](https://github.com/Badminton-Apps/badman/commit/7b788bcda))

### ❤️ Thank You

- cskiwi @cskiwi

## 6.168.0 (2024-08-15)


### 🚀 Features

- add you calendars to your agenda ([c0f60fb83](https://github.com/Badminton-Apps/badman/commit/c0f60fb83))

### 🩹 Fixes

- location check now also loads the changed location. ([a8a26720e](https://github.com/Badminton-Apps/badman/commit/a8a26720e))

### ❤️ Thank You

- cskiwi @cskiwi

## 6.167.0 (2024-08-15)


### 🚀 Features

- export ranking breakdown ([29ade2ce0](https://github.com/Badminton-Apps/badman/commit/29ade2ce0))
- new ranking breakdown + export to excel ([e0dbfa26b](https://github.com/Badminton-Apps/badman/commit/e0dbfa26b))
- option to trigger a re-calculate of the points ([b8c3f64d6](https://github.com/Badminton-Apps/badman/commit/b8c3f64d6))

### 🩹 Fixes

- more sonar cloud implementations and stricter models ([1210cff44](https://github.com/Badminton-Apps/badman/commit/1210cff44))
- allow faster mailing ([8c9273e1d](https://github.com/Badminton-Apps/badman/commit/8c9273e1d))
- support for adding new games ([f0428a0bd](https://github.com/Badminton-Apps/badman/commit/f0428a0bd))
- top level translations weren't loaded ([64cd3b36b](https://github.com/Badminton-Apps/badman/commit/64cd3b36b))
- they should use the in-app translations ([4cfe9f4a7](https://github.com/Badminton-Apps/badman/commit/4cfe9f4a7))

### ❤️ Thank You

- cskiwi @cskiwi
- Glenn Latomme

## 6.166.3 (2024-08-12)


Expand Down
3 changes: 2 additions & 1 deletion apps/badman/src/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!doctype html>
<html lang="en">
<html class="notranslate" translate="no" lang="en">
<head>
<meta charset="utf-8" />
<title>Badman</title>
<base href="/" />
<meta name="google" content="notranslate" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="manifest" href="manifest.json" />
<meta name="theme-color" content="#212121" />
Expand Down
2 changes: 1 addition & 1 deletion apps/badman/src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "6.166.3"
"version": "6.168.3"
}
6 changes: 3 additions & 3 deletions apps/scripts/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { DatabaseModule } from '@badman/backend-database';
import { configSchema, load } from '@badman/utils';
import { Logger, Module, OnModuleInit } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { AssignClubToPlayers } from './scripts/assign-clubs-to-players-group-role/service';
import { PlayersWrongRankingRunner } from './scripts/players-with-wrong-ranking/players-with-wrong-ranking';

@Module({
providers: [AssignClubToPlayers],
providers: [PlayersWrongRankingRunner],
imports: [
ConfigModule.forRoot({
cache: true,
Expand All @@ -18,7 +18,7 @@ import { AssignClubToPlayers } from './scripts/assign-clubs-to-players-group-rol
export class ScriptModule implements OnModuleInit {
private readonly logger = new Logger(ScriptModule.name);

constructor(private fixer: AssignClubToPlayers) {}
constructor(private fixer: PlayersWrongRankingRunner) {}

async onModuleInit() {
this.logger.log('Running script');
Expand Down
Loading

0 comments on commit 3a4c0bf

Please sign in to comment.