Skip to content

Commit af8e7fd

Browse files
committed
Merge branch 'main' into update-backend-controllers-with-timescale
2 parents 541476a + 3d802fa commit af8e7fd

4 files changed

Lines changed: 12 additions & 0 deletions

File tree

packages/db/src/services/DatabaseService.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ export class DatabaseService {
210210
}
211211

212212
async close(): Promise<void> {
213+
if (this.isConnected) {
214+
await AppDataSource.destroy();
213215
if (this.isConnected) {
214216
await AppDataSource.destroy();
215217
console.log("Database connection closed");

packages/server/.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ GPS_TABLE_NAME="your-dynamodb-gps-table-name"
1717
MQTT_USERNAME="primaryuser"
1818
MQTT_PASSWORD="changeme"
1919

20+
########################
21+
# Database #
22+
########################
23+
DATABASE_USERNAME=""
24+
DATABASE_PASSWORD=""
25+
DATABASE_HOST=""
26+
DATABASE_PORT=
27+
2028
########################
2129
# App secrets / other #
2230
########################

packages/server/src/controllers/BackendController/BackendController.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { DatabaseService } from "db";
2+
import { DatabaseService } from "db";
23
import type { IncomingMessage, Server, ServerResponse } from "http";
34

45
import type { BackendControllerTypes } from "@/controllers/BackendController/BackendController.types";

packages/server/src/controllers/LapController/LapController.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export class LapController implements LapControllerType {
158158
// this function is for calling when lap completes via lap digital being true
159159
public async handleLapData(lapData: ILapData) {
160160
await this.backendController.socketIO.broadcastLapData(lapData);
161+
await this.backendController.mqtt.publishLapData(lapData);
161162
await this.backendController.dynamoDB.insertLapData(lapData);
162163
}
163164

0 commit comments

Comments
 (0)