forked from p34709852/monkey
Island: Get Island mode from simulation repository in IslandMode's GET
This commit is contained in:
parent
1f96ab5ea9
commit
d9d388d41c
|
@ -6,6 +6,7 @@ from flask import request
|
|||
|
||||
from monkey_island.cc.event_queue import IIslandEventQueue, IslandEventTopic
|
||||
from monkey_island.cc.models import IslandMode as IslandModeEnum
|
||||
from monkey_island.cc.repository import ISimulationRepository
|
||||
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
||||
from monkey_island.cc.resources.request_authentication import jwt_required
|
||||
from monkey_island.cc.services import IslandModeService
|
||||
|
@ -17,10 +18,14 @@ class IslandMode(AbstractResource):
|
|||
urls = ["/api/island/mode"]
|
||||
|
||||
def __init__(
|
||||
self, island_mode_service: IslandModeService, island_event_queue: IIslandEventQueue
|
||||
self,
|
||||
island_mode_service: IslandModeService,
|
||||
island_event_queue: IIslandEventQueue,
|
||||
simulation_repository: ISimulationRepository,
|
||||
):
|
||||
self._island_mode_service = island_mode_service
|
||||
self._island_event_queue = island_event_queue
|
||||
self._simulation_repository = simulation_repository
|
||||
|
||||
@jwt_required
|
||||
def put(self):
|
||||
|
@ -38,5 +43,5 @@ class IslandMode(AbstractResource):
|
|||
|
||||
@jwt_required
|
||||
def get(self):
|
||||
island_mode = self._island_mode_service.get_mode()
|
||||
island_mode = self._simulation_repository.get_mode()
|
||||
return island_mode.value, HTTPStatus.OK
|
||||
|
|
Loading…
Reference in New Issue