diff --git a/package-lock.json b/package-lock.json
index e1b770f1a0bcc6b46eca650a16d932179f0329ed..05c4c11f6797b7d67226fa03b30c6327b6fe9c69 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3125,8 +3125,7 @@
         "ansi-regex": {
           "version": "2.1.1",
           "bundled": true,
-          "dev": true,
-          "optional": true
+          "dev": true
         },
         "aproba": {
           "version": "1.2.0",
@@ -3147,14 +3146,12 @@
         "balanced-match": {
           "version": "1.0.0",
           "bundled": true,
-          "dev": true,
-          "optional": true
+          "dev": true
         },
         "brace-expansion": {
           "version": "1.1.11",
           "bundled": true,
           "dev": true,
-          "optional": true,
           "requires": {
             "balanced-match": "^1.0.0",
             "concat-map": "0.0.1"
@@ -3169,20 +3166,17 @@
         "code-point-at": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true,
-          "optional": true
+          "dev": true
         },
         "concat-map": {
           "version": "0.0.1",
           "bundled": true,
-          "dev": true,
-          "optional": true
+          "dev": true
         },
         "console-control-strings": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true,
-          "optional": true
+          "dev": true
         },
         "core-util-is": {
           "version": "1.0.2",
@@ -3299,8 +3293,7 @@
         "inherits": {
           "version": "2.0.3",
           "bundled": true,
-          "dev": true,
-          "optional": true
+          "dev": true
         },
         "ini": {
           "version": "1.3.5",
@@ -3312,7 +3305,6 @@
           "version": "1.0.0",
           "bundled": true,
           "dev": true,
-          "optional": true,
           "requires": {
             "number-is-nan": "^1.0.0"
           }
@@ -3327,7 +3319,6 @@
           "version": "3.0.4",
           "bundled": true,
           "dev": true,
-          "optional": true,
           "requires": {
             "brace-expansion": "^1.1.7"
           }
@@ -3439,8 +3430,7 @@
         "number-is-nan": {
           "version": "1.0.1",
           "bundled": true,
-          "dev": true,
-          "optional": true
+          "dev": true
         },
         "object-assign": {
           "version": "4.1.1",
@@ -3452,7 +3442,6 @@
           "version": "1.4.0",
           "bundled": true,
           "dev": true,
-          "optional": true,
           "requires": {
             "wrappy": "1"
           }
@@ -3538,8 +3527,7 @@
         "safe-buffer": {
           "version": "5.1.2",
           "bundled": true,
-          "dev": true,
-          "optional": true
+          "dev": true
         },
         "safer-buffer": {
           "version": "2.1.2",
@@ -3575,7 +3563,6 @@
           "version": "1.0.2",
           "bundled": true,
           "dev": true,
-          "optional": true,
           "requires": {
             "code-point-at": "^1.0.0",
             "is-fullwidth-code-point": "^1.0.0",
@@ -3595,7 +3582,6 @@
           "version": "3.0.1",
           "bundled": true,
           "dev": true,
-          "optional": true,
           "requires": {
             "ansi-regex": "^2.0.0"
           }
@@ -3639,14 +3625,12 @@
         "wrappy": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true,
-          "optional": true
+          "dev": true
         },
         "yallist": {
           "version": "3.0.3",
           "bundled": true,
-          "dev": true,
-          "optional": true
+          "dev": true
         }
       }
     },
diff --git a/src/game/game.dto.ts b/src/game/game.dto.ts
index 7a8b4935549afb7ccd53b1744a5929a566aa4f61..6a21db70c718a578c632700f69da5b010554f1df 100644
--- a/src/game/game.dto.ts
+++ b/src/game/game.dto.ts
@@ -38,7 +38,7 @@ export class GameDTO {
   // custom validation for array length (arr>min, arr<max)
   //@Validate(ArrayLength, [4, 8])
   passwords: string[];
-  factions?: FactionDTO[];
+  factions: FactionDTO[];
 }
 
 export class FactionDTO {
diff --git a/src/game/game.entity.ts b/src/game/game.entity.ts
index 5d36417ebc1e01a31ed02d9d4937c00fe489d1d9..0dc0cdf36d3b973a424a4788e3608a6571a8e80f 100644
--- a/src/game/game.entity.ts
+++ b/src/game/game.entity.ts
@@ -38,7 +38,8 @@ export class FactionEntity {
   @Column('text') name: string;
   @ManyToOne(type => GameEntity, game => game.factions)
   game: GameEntity;
-  @OneToMany(type => Game_PersonEntity, game_persons => game_persons.faction)
+  @OneToMany(type => Game_PersonEntity, game_persons => game_persons.faction,
+    {onUpdate: 'CASCADE'})
   game_persons: Game_PersonEntity[];
 
 }
diff --git a/src/game/game.service.ts b/src/game/game.service.ts
index b909d10acb9f0bbf3cb47bb462e5f0253ae4441d..6caa2c2a1d3061657c49e9e8a4ef927c2442f7fe 100644
--- a/src/game/game.service.ts
+++ b/src/game/game.service.ts
@@ -1,6 +1,6 @@
 import { Injectable, Logger, HttpException, HttpStatus } from '@nestjs/common';
 import { InjectRepository } from '@nestjs/typeorm';
-import { Repository, In } from 'typeorm';
+import { Repository, In, QueryBuilder } from 'typeorm';
 
 import { GameEntity, FactionEntity, Game_PersonEntity } from './game.entity';
 import { GameDTO } from './game.dto';
@@ -38,24 +38,41 @@ export class GameService {
   }
 
   // edit already created game
-  async editGame(gamedata) {
- /*    // get the id of the game created to pass it to factions table
-    const gameid = await this.gameRepository.findOne({
-      where: { name: gameData.name },
-    });
+  async editGame(id: string, gameData: Partial<GameDTO>) {
+    try {
+      
+      // update game entry in db
+      const updatedGame = await this.gameRepository.create({
+        ...gameData,
+        factions: gameData.factions
+      })
+      updatedGame["id"] = id
+      const gameId = await this.gameRepository.save(updatedGame);
+      
+      // get all the factions that are associated with the game to deny duplicate entries
+      const factions = await this.factionRepository.find({select: ["name"], where: {game: gameId}})
+      const factionNames = factions.map(({ name }) => name)
+      
+      // add the factions to db
+      if (gameData.factions) {
+        gameData.factions.map(async faction => {
+          if (!Object.values(factionNames).includes(faction.name)) {
+            let name = await this.factionRepository.create({
+              ...faction,
+              game: gameId,
+            });
+            await this.factionRepository.insert(name);
+          }
+        });
+      }
 
-    gameData.factions.map(async faction => {
-      let name = await this.factionRepository.create({
-        ...faction,
-        game: gameid,
-      });
-      await this.factionRepository.insert(name);
-    }); */
-    return {
-      "message": "Game updated"
-    }
+      return {
+        message: 'Game updated',
+      };
+    } catch (error) {console.log(error)}
   }
 
+
   // checks the password, creates an entry in GamePerson table with associated role&faction
   async joinGame(person, gameId, json) {
     const user = await this.personRepository.findOne({
diff --git a/src/mapmarkers/mapmarker.entity.ts b/src/mapmarkers/mapmarker.entity.ts
index bc6d33112149f23e52e493c374be19ca0f18e536..da7ed5e8935d3b8a8aade0beb99578bf4e62e426 100644
--- a/src/mapmarkers/mapmarker.entity.ts
+++ b/src/mapmarkers/mapmarker.entity.ts
@@ -1,6 +1,7 @@
 import { Entity, Column, PrimaryGeneratedColumn, Timestamp, ManyToOne } from 'typeorm';
 
 import { PersonEntity } from '../user/user.entity'
+import { FactionEntity } from '../game/game.entity';
 
 /*
 Entity: MapMarker 
@@ -15,5 +16,6 @@ export class MapMarkerEntity {
     @Column({type: 'timestamp'}) timestamp: Timestamp;
     @Column({type: 'json', nullable: true}) features: JSON;
     @ManyToOne(type => PersonEntity, player => player.markers)
-    player: PersonEntity;
+    player?: PersonEntity;
+    @ManyToOne(type => FactionEntity)
 }
\ No newline at end of file
diff --git a/src/mapmarkers/mapmarker.service.ts b/src/mapmarkers/mapmarker.service.ts
index 3c2fcb077515bab12ae4e219412ddeca75935175..0a7c20f2ddbb93a0e2d88ac572a57c007b8dd42d 100644
--- a/src/mapmarkers/mapmarker.service.ts
+++ b/src/mapmarkers/mapmarker.service.ts
@@ -53,4 +53,8 @@ export class MapMarkerService {
             throw error;
         }
     }
+
+    async getFactionMarkers(){
+        
+    }
 }
\ No newline at end of file