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

added socket message

parent e144ac52
No related branches found
No related tags found
2 merge requests!59Development to master,!44Development to testing
......@@ -6,6 +6,7 @@ import { DrawService } from './draw.service';
import { MapDrawingEntity } from '../draw/coordinate.entity';
import { FactionEntity } from '../faction/faction.entity';
import { Game_PersonEntity } from '../game/game.entity';
import { NotificationModule } from 'src/notifications/notifications.module';
/*
Draw
- contains everything to do with mapdrawing data.
......@@ -17,6 +18,7 @@ Draw
FactionEntity,
Game_PersonEntity,
]),
NotificationModule,
],
controllers: [DrawController],
providers: [DrawService],
......
......@@ -4,17 +4,22 @@ import { Repository } from 'typeorm';
import { MapDrawingEntity } from '../draw/coordinate.entity';
import { MapDrawingDTO, ReturnDrawingsDTO } from './mapdrawing.dto';
import { NotificationGateway } from 'src/notifications/notifications.gateway';
@Injectable()
export class DrawService {
constructor(
@InjectRepository(MapDrawingEntity)
private mapDrawingRepository: Repository<MapDrawingEntity>,
private notificationGateway: NotificationGateway,
) {}
async draw(gameId, data: MapDrawingDTO) {
data['gameId'] = gameId;
const drawing = await this.mapDrawingRepository.create(data);
this.notificationGateway.server.emit(gameId, {
type: 'drawing-update',
});
if (data.mapDrawingId == null || data.mapDrawingId == '') {
// luo uuden instanssin.
const mapDrawing = await this.mapDrawingRepository.insert(drawing);
......
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