Skip to content
Snippets Groups Projects
Commit d3090652 authored by L4168's avatar L4168
Browse files

added socket emit for tracking update

parent 63051fc0
No related branches found
No related tags found
3 merge requests!59Development to master,!48Development,!46Small fixes to Development
......@@ -10,6 +10,7 @@ import { FactionService } from '../faction/faction.service';
import { TrackingService } from '../tracking/tracking.service';
import { TrackingEntity } from 'src/tracking/tracking.entity';
import { PersonEntity } from 'src/user/user.entity';
import { NotificationModule } from 'src/notifications/notifications.module';
@Module({
imports: [
......@@ -21,6 +22,7 @@ import { PersonEntity } from 'src/user/user.entity';
GameGroupEntity,
Game_PersonEntity,
]),
NotificationModule,
],
controllers: [ReplayController],
providers: [ReplayService, UserService, FactionService, TrackingService],
......
......@@ -4,9 +4,10 @@ import { TypeOrmModule } from '@nestjs/typeorm';
import { TrackingController } from './tracking.controller';
import { TrackingService } from './tracking.service';
import { TrackingEntity } from './tracking.entity';
import { NotificationModule } from '../notifications/notifications.module';
@Module({
imports: [TypeOrmModule.forFeature([TrackingEntity])],
imports: [TypeOrmModule.forFeature([TrackingEntity]), NotificationModule],
controllers: [TrackingController],
providers: [TrackingService],
})
......
......@@ -5,12 +5,14 @@ import { Repository } from 'typeorm';
import { Game_PersonEntity } from '../game/game.entity';
import { TrackingEntity } from './tracking.entity';
import { GeoDTO } from './geo.dto';
import { NotificationGateway } from '../notifications/notifications.gateway';
@Injectable()
export class TrackingService {
constructor(
@InjectRepository(TrackingEntity)
private trackingrepository: Repository<TrackingEntity>,
private notificationGateway: NotificationGateway,
) {}
async trackLocation(
......@@ -23,6 +25,9 @@ export class TrackingService {
gamepersonId: gameperson,
});
// if player has pushed tracking data, update entry
this.notificationGateway.server.emit(gameId, {
type: 'tracking-update',
});
if (trackedperson) {
trackdata['time'] = Date.now();
//add coordinates
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment