2018-01-18 01:56:13 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
|
2018-05-22 10:22:06 +00:00
|
|
|
from jms_storage.es import ESStorage
|
2018-01-18 01:56:13 +00:00
|
|
|
from .base import CommandBase
|
2018-03-28 07:47:20 +00:00
|
|
|
from .models import AbstractSessionCommand
|
2018-01-18 01:56:13 +00:00
|
|
|
|
|
|
|
|
2018-05-22 10:22:06 +00:00
|
|
|
class CommandStore(ESStorage, CommandBase):
|
2018-01-21 09:27:27 +00:00
|
|
|
def __init__(self, params):
|
2018-05-22 10:22:06 +00:00
|
|
|
super().__init__(params)
|
2018-01-18 01:56:13 +00:00
|
|
|
|
|
|
|
def filter(self, date_from=None, date_to=None,
|
|
|
|
user=None, asset=None, system_user=None,
|
|
|
|
input=None, session=None):
|
|
|
|
|
2018-05-22 10:22:06 +00:00
|
|
|
data = super().filter(date_from=date_from, date_to=date_to,
|
|
|
|
user=user, asset=asset, system_user=system_user,
|
|
|
|
input=input, session=session)
|
2018-03-28 07:47:20 +00:00
|
|
|
return AbstractSessionCommand.from_multi_dict(
|
|
|
|
[item["_source"] for item in data["hits"] if item]
|
|
|
|
)
|