22 lines
512 B
Python
22 lines
512 B
Python
from core.models.Operator import Operator
|
|
from core.services.WebServiceApiService import WebServiceApiService
|
|
from typing import Optional
|
|
|
|
|
|
class OperatorController:
|
|
|
|
@staticmethod
|
|
def get(id: int):
|
|
return Operator.find_by_id(id)
|
|
|
|
@staticmethod
|
|
def get_all():
|
|
return Operator.all()
|
|
|
|
@staticmethod
|
|
def _sync(proxies: Optional[dict] = None):
|
|
|
|
operators = WebServiceApiService.get_operators(proxies)
|
|
|
|
Operator.truncate()
|
|
Operator.save_many(operators)
|