Ejemplo n.º 1
0
 def setUp(self):
     DAOTestCase.setUp(self)
     self.config = SearchConfig(table=UserFeatures,
                                columns={
                                    'lastname': UserFeatures.lastname,
                                    'firstname': UserFeatures.firstname,
                                    'simultcalls': UserFeatures.simultcalls,
                                    'userfield': UserFeatures.userfield
                                },
                                default_sort='lastname')
     self.search = SearchSystem(self.config)
Ejemplo n.º 2
0
 def setUp(self):
     DAOTestCase.setUp(self)
     self.config = SearchConfig(table=UserFeatures,
                                columns={'lastname': UserFeatures.lastname,
                                         'firstname': UserFeatures.firstname,
                                         'simultcalls': UserFeatures.simultcalls,
                                         'userfield': UserFeatures.userfield},
                                default_sort='lastname')
     self.search = SearchSystem(self.config)
Ejemplo n.º 3
0
class TestSearchSystem(DAOTestCase):
    def setUp(self):
        DAOTestCase.setUp(self)
        self.config = SearchConfig(table=UserFeatures,
                                   columns={
                                       'lastname': UserFeatures.lastname,
                                       'firstname': UserFeatures.firstname,
                                       'simultcalls': UserFeatures.simultcalls,
                                       'userfield': UserFeatures.userfield
                                   },
                                   default_sort='lastname')
        self.search = SearchSystem(self.config)

    def test_given_no_parameters_then_sorts_rows_using_default_sort_and_direction(
            self):
        last_user_row = self.add_user(lastname='Zintrabi')
        first_user_row = self.add_user(lastname='Abigale')

        rows, total = self.search.search(self.session)

        assert_that(total, equal_to(2))
        assert_that(rows, contains(first_user_row, last_user_row))

    def test_given_order_then_sorts_rows_using_order(self):
        last_user_row = self.add_user(firstname='Bob', lastname='Abigale')
        first_user_row = self.add_user(firstname='Alice', lastname='Zintrabi')

        rows, total = self.search.search(self.session, {'order': 'firstname'})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(first_user_row, last_user_row))

    def test_given_direction_then_sorts_rows_using_direction(self):
        first_user_row = self.add_user(lastname='Abigale')
        last_user_row = self.add_user(lastname='Zintrabi')

        rows, total = self.search.search(self.session, {'direction': 'desc'})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(last_user_row, first_user_row))

    def test_given_limit_is_negative_number_then_raises_error(self):
        self.assertRaises(InputError, self.search.search, self.session,
                          {'limit': -1})

    def test_given_limit_is_zero_then_raises_error(self):
        self.assertRaises(InputError, self.search.search, self.session,
                          {'limit': 0})

    def test_given_offset_is_negative_number_then_raises_error(self):
        self.assertRaises(InputError, self.search.search, self.session,
                          {'offset': -1})

    def test_given_limit_then_returns_same_number_of_rows_as_limit(self):
        self.add_user()
        self.add_user()

        rows, total = self.search.search(self.session, {'limit': 1})

        assert_that(total, equal_to(2))
        assert_that(rows, has_length(1))

    def test_given_offset_then_offsets_a_number_of_rows(self):
        self.add_user(lastname='Abigale')
        last_user_row = self.add_user(lastname='Zintrabi')

        rows, total = self.search.search(self.session, {'offset': 1})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(last_user_row))

    def test_given_offset_is_zero_then_does_not_offset_rows(self):
        first_user_row = self.add_user(lastname='Abigale')
        last_user_row = self.add_user(lastname='Zintrabi')

        rows, total = self.search.search(self.session, {'offset': 0})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(first_user_row, last_user_row))

    def test_given_search_without_accent_term_then_searches_in_column_with_accent(
            self):
        user_row = self.add_user(firstname='accênt')

        rows, total = self.search.search(self.session, {'search': 'accent'})

        assert_that(total, equal_to(1))
        assert_that(rows, contains(user_row))

    def test_given_search_wit_accent_term_then_searches_in_column_without_accent(
            self):
        user_row1 = self.add_user(firstname='accént')
        user_row2 = self.add_user(firstname='unaccent')

        rows, total = self.search.search(self.session, {'search': 'accént'})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(user_row1, user_row2))

    def test_given_search_term_then_searches_in_columns_and_uses_default_sort(
            self):
        user_row1 = self.add_user(firstname='a123bcd', lastname='eeefghi')
        user_row2 = self.add_user(firstname='eeefghi', lastname='a123zzz')
        self.add_user(description='123')

        rows, total = self.search.search(self.session, {'search': '123'})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(user_row2, user_row1))

    def test_given_search_term_then_searches_in_numeric_columns(self):
        self.add_user(simultcalls=1)
        user_row2 = self.add_user(simultcalls=2)

        rows, total = self.search.search(self.session, {'search': '2'})

        assert_that(total, equal_to(1))
        assert_that(rows, contains(user_row2))

    def test_given_exact_match_numeric_term_in_param(self):
        self.add_user(firstname='Alice', lastname='First', simultcalls=3)
        user_row2 = self.add_user(firstname='Alice',
                                  lastname='Second',
                                  simultcalls=2)

        rows, total = self.search.search(self.session, {
            'search': 'ali',
            'simultcalls': '2'
        })

        assert_that(total, equal_to(1))
        assert_that(rows, contains(user_row2))

    def test_given_exact_match_userfield_term_in_param(self):
        self.add_user(firstname='Alice', lastname='First', userfield='mtl')
        user_row2 = self.add_user(firstname='Alice',
                                  lastname='Second',
                                  userfield='qc')

        rows, total = self.search.search(self.session, {
            'search': 'ali',
            'userfield': 'qc'
        })

        assert_that(total, equal_to(1))
        assert_that(rows, contains(user_row2))

    def test_given_exact_match_string_term_in_param_numeric_column(self):
        self.add_user(firstname='Alice', lastname='First', simultcalls=2)

        rows, total = self.search.search(self.session,
                                         {'simultcalls': 'invalid-integer'})

        assert_that(total, equal_to(0))

    def test_given_no_search_with_params(self):
        self.add_user(firstname='Alïce', userfield='mtl')
        user_row2 = self.add_user(firstname='Bõb', userfield='qc')
        user_row3 = self.add_user(firstname='Çharles', userfield='qc')

        rows, total = self.search.search(self.session, {'userfield': 'qc'})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(user_row2, user_row3))
Ejemplo n.º 4
0
# -*- coding: utf-8 -*-
# Copyright 2016-2021 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.incall import Incall
from xivo_dao.resources.utils.search import SearchSystem, SearchConfig

config = SearchConfig(
    table=Incall,
    columns={
        'id': Incall.id,
        'preprocess_subroutine': Incall.preprocess_subroutine,
        'greeting_sound': Incall.greeting_sound,
        'user_id': Incall.user_id,
        'description': Incall.description,
        'exten': Incall.exten,
    },
    default_sort='id',
)

incall_search = SearchSystem(config)
Ejemplo n.º 5
0
 def search_from_query(self, query, parameters=None):
     query = self._apply_type_filter(query, parameters)
     return SearchSystem.search_from_query(self, query, parameters)
Ejemplo n.º 6
0
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Avencall
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.rightcall import RightCall as CallPermission
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(table=CallPermission,
                      columns={
                          'id': CallPermission.id,
                          'name': CallPermission.name,
                          'description': CallPermission.description,
                          'enabled': CallPermission.enabled,
                          'mode': CallPermission.mode
                      },
                      default_sort='name')

call_permission_search = SearchSystem(config)
Ejemplo n.º 7
0
# -*- coding: utf-8 -*-
# Copyright 2015-2020 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.endpoint_sip import EndpointSIP
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig


config = SearchConfig(
    table=EndpointSIP,
    columns={
        'name': EndpointSIP.name,
        'asterisk_id': EndpointSIP.asterisk_id,
        'label': EndpointSIP.label,
        'template': EndpointSIP.template,
    },
    default_sort='label',
)

sip_search = SearchSystem(config)
Ejemplo n.º 8
0
# -*- coding: utf-8 -*-
# Copyright 2016-2021 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.trunkfeatures import TrunkFeatures as Trunk
from xivo_dao.resources.utils.search import SearchSystem, SearchConfig


config = SearchConfig(
    table=Trunk,
    columns={
        'id': Trunk.id,
        'context': Trunk.context,
        'description': Trunk.description,
        'name': Trunk.name,
        'label': Trunk.label,
    },
    default_sort='id',
)

trunk_search = SearchSystem(config)
Ejemplo n.º 9
0
# -*- coding: utf-8 -*-
# Copyright 2017 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.moh import MOH
from xivo_dao.resources.utils.search import (SearchSystem,
                                             SearchConfig)


config = SearchConfig(table=MOH,
                      columns={'name': MOH.name,
                               'label': MOH.label},
                      default_sort='label')

moh_search = SearchSystem(config)
Ejemplo n.º 10
0
# -*- coding: utf-8 -*-
# Copyright 2021 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.ingress_http import IngressHTTP
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(
    table=IngressHTTP,
    columns={'uri': IngressHTTP.uri},
    default_sort='uri',
)

http_ingress_search = SearchSystem(config)
Ejemplo n.º 11
0
# -*- coding: utf-8 -*-
# Copyright 2021-2022 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.meeting_authorization import MeetingAuthorization
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(
    table=MeetingAuthorization,
    columns={
        'guest_name': MeetingAuthorization.guest_name,
        'creation_time': MeetingAuthorization.created_at,
    },
    search=['guest_name'],
    default_sort='guest_name',
)

meeting_authorization_search = SearchSystem(config)
Ejemplo n.º 12
0
# -*- coding: utf-8 -*-
# Copyright 2016-2022 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.parking_lot import ParkingLot
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(
    table=ParkingLot,
    columns={
        'id': ParkingLot.id,
        'name': ParkingLot.name,
        'slots_start': ParkingLot.slots_start,
        'slots_end': ParkingLot.slots_end,
        'timeout': ParkingLot.timeout,
        'exten': ParkingLot.exten,
    },
    search=[
        'name',
        'slots_start',
        'slots_end',
        'timeout',
        'exten',
    ],
    default_sort='name',
)

parking_lot_search = SearchSystem(config)
Ejemplo n.º 13
0
# -*- coding: utf-8 -*-
# Copyright 2016-2021 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.conference import Conference
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(
    table=Conference,
    columns={
        'id': Conference.id,
        'name': Conference.name,
        'preprocess_subroutine': Conference.preprocess_subroutine,
        'exten': Conference.exten,
    },
    default_sort='name',
)

conference_search = SearchSystem(config)
Ejemplo n.º 14
0
# -*- coding: utf-8 -*-
# Copyright 2018 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.pickup import Pickup as CallPickup
from xivo_dao.resources.utils.search import SearchConfig, SearchSystem

config = SearchConfig(table=CallPickup,
                      columns={
                          'id': CallPickup.id,
                          'name': CallPickup.name,
                          'description': CallPickup.description,
                          'enabled': CallPickup.enabled
                      },
                      search=['name', 'description'],
                      default_sort='name')

call_pickup_search = SearchSystem(config)
Ejemplo n.º 15
0
# -*- coding: utf-8 -*-
# Copyright 2019 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.accessfeatures import AccessFeatures
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(
    table=AccessFeatures,
    columns={
        'id': AccessFeatures.id,
        'host': AccessFeatures.host,
        'feature': AccessFeatures.feature,
        'enabled': AccessFeatures.enabled,
    },
    default_sort='host',
)

access_feature_search = SearchSystem(config)
Ejemplo n.º 16
0
# -*- coding: utf-8 -*-
# Copyright 2018 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.application import Application
from xivo_dao.resources.utils.search import SearchSystem, SearchConfig

config = SearchConfig(
    table=Application,
    columns={
        'uuid': Application.uuid,
        'name': Application.name,
    },
    default_sort='uuid',
)

application_search = SearchSystem(config)
Ejemplo n.º 17
0
# -*- coding: utf-8 -*-
# Copyright 2020 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.pjsip_transport import PJSIPTransport
from xivo_dao.resources.utils.search import SearchConfig, SearchSystem

config = SearchConfig(
    table=PJSIPTransport,
    columns={
        'uuid': PJSIPTransport.uuid,
        'name': PJSIPTransport.name,
    },
    search={'name': PJSIPTransport.name},
    default_sort='name',
)
transport_search = SearchSystem(config)
Ejemplo n.º 18
0
# -*- coding: utf-8 -*-
# Copyright 2018 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.queueskillrule import QueueSkillRule
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig


config = SearchConfig(
    table=QueueSkillRule,
    columns={
        'id': QueueSkillRule.id,
        'name': QueueSkillRule.name,
    },
    default_sort='name'
)

skill_rule_search = SearchSystem(config)
Ejemplo n.º 19
0
class TestSearchSystem(DAOTestCase):

    def setUp(self):
        DAOTestCase.setUp(self)
        self.config = SearchConfig(table=UserFeatures,
                                   columns={'lastname': UserFeatures.lastname,
                                            'firstname': UserFeatures.firstname,
                                            'simultcalls': UserFeatures.simultcalls,
                                            'userfield': UserFeatures.userfield},
                                   default_sort='lastname')
        self.search = SearchSystem(self.config)

    def test_given_no_parameters_then_sorts_rows_using_default_sort_and_direction(self):
        last_user_row = self.add_user(lastname='Zintrabi')
        first_user_row = self.add_user(lastname='Abigale')

        rows, total = self.search.search(self.session)

        assert_that(total, equal_to(2))
        assert_that(rows, contains(first_user_row, last_user_row))

    def test_given_order_then_sorts_rows_using_order(self):
        last_user_row = self.add_user(firstname='Bob', lastname='Abigale')
        first_user_row = self.add_user(firstname='Alice', lastname='Zintrabi')

        rows, total = self.search.search(self.session, {'order': 'firstname'})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(first_user_row, last_user_row))

    def test_given_direction_then_sorts_rows_using_direction(self):
        first_user_row = self.add_user(lastname='Abigale')
        last_user_row = self.add_user(lastname='Zintrabi')

        rows, total = self.search.search(self.session, {'direction': 'desc'})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(last_user_row, first_user_row))

    def test_given_limit_is_negative_number_then_raises_error(self):
        self.assertRaises(InputError,
                          self.search.search,
                          self.session, {'limit': -1})

    def test_given_limit_is_zero_then_raises_error(self):
        self.assertRaises(InputError,
                          self.search.search,
                          self.session, {'limit': 0})

    def test_given_offset_is_negative_number_then_raises_error(self):
        self.assertRaises(InputError,
                          self.search.search,
                          self.session, {'offset': -1})

    def test_given_limit_then_returns_same_number_of_rows_as_limit(self):
        self.add_user()
        self.add_user()

        rows, total = self.search.search(self.session, {'limit': 1})

        assert_that(total, equal_to(2))
        assert_that(rows, has_length(1))

    def test_given_offset_then_offsets_a_number_of_rows(self):
        self.add_user(lastname='Abigale')
        last_user_row = self.add_user(lastname='Zintrabi')

        rows, total = self.search.search(self.session, {'offset': 1})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(last_user_row))

    def test_given_offset_is_zero_then_does_not_offset_rows(self):
        first_user_row = self.add_user(lastname='Abigale')
        last_user_row = self.add_user(lastname='Zintrabi')

        rows, total = self.search.search(self.session, {'offset': 0})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(first_user_row, last_user_row))

    def test_given_skip_then_offset_a_number_of_rows(self):
        self.add_user(lastname='Abigale')
        last_user_row = self.add_user(lastname='Zintrabi')

        rows, total = self.search.search(self.session, {'skip': 1})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(last_user_row))

    def test_given_search_term_then_searches_in_columns_and_uses_default_sort(self):
        user_row1 = self.add_user(firstname='a123bcd', lastname='eeefghi')
        user_row2 = self.add_user(firstname='eeefghi', lastname='a123zzz')
        self.add_user(description='123')

        rows, total = self.search.search(self.session, {'search': '123'})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(user_row2, user_row1))

    def test_given_search_term_then_searches_in_numeric_columns(self):
        self.add_user(simultcalls=1)
        user_row2 = self.add_user(simultcalls=2)

        rows, total = self.search.search(self.session, {'search': '2'})

        assert_that(total, equal_to(1))
        assert_that(rows, contains(user_row2))

    def test_given_exact_match_numeric_term_in_param(self):
        self.add_user(firstname='Alice', lastname='First', simultcalls=3)
        user_row2 = self.add_user(firstname='Alice', lastname='Second', simultcalls=2)

        rows, total = self.search.search(self.session, {'search': 'ali', 'simultcalls': '2'})

        assert_that(total, equal_to(1))
        assert_that(rows, contains(user_row2))

    def test_given_exact_match_userfield_term_in_param(self):
        self.add_user(firstname='Alice', lastname='First', userfield='mtl')
        user_row2 = self.add_user(firstname='Alice', lastname='Second', userfield='qc')

        rows, total = self.search.search(self.session, {'search': 'ali', 'userfield': 'qc'})

        assert_that(total, equal_to(1))
        assert_that(rows, contains(user_row2))

    def test_given_no_search_with_params(self):
        self.add_user(firstname=u'Alïce', userfield='mtl')
        user_row2 = self.add_user(firstname=u'Bõb', userfield='qc')
        user_row3 = self.add_user(firstname=u'Çharles', userfield='qc')

        rows, total = self.search.search(self.session, {'userfield': 'qc'})

        assert_that(total, equal_to(2))
        assert_that(rows, contains(user_row2, user_row3))
Ejemplo n.º 20
0
# -*- coding: utf-8 -*-
# Copyright 2018 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.queueskill import QueueSkill
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(table=QueueSkill,
                      columns={
                          'id': QueueSkill.id,
                          'name': QueueSkill.name,
                          'category': QueueSkill.category,
                          'description': QueueSkill.description,
                      },
                      default_sort='name')

skill_search = SearchSystem(config)
Ejemplo n.º 21
0
# -*- coding: utf-8 -*-
# Copyright 2018 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.agentfeatures import AgentFeatures as Agent
from xivo_dao.resources.utils.search import SearchSystem, SearchConfig

config = SearchConfig(table=Agent,
                      columns={
                          'id': Agent.id,
                          'firstname': Agent.firstname,
                          'lastname': Agent.lastname,
                          'number': Agent.number,
                          'preprocess_subroutine': Agent.preprocess_subroutine
                      },
                      default_sort='id')

agent_search = SearchSystem(config)
Ejemplo n.º 22
0
# -*- coding: utf-8 -*-
# Copyright 2020 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.tenant import Tenant
from xivo_dao.resources.utils.search import (
    SearchConfig,
    SearchSystem,
)

config = SearchConfig(
    table=Tenant,
    columns={
        'uuid': Tenant.uuid,
    },
    default_sort='uuid',
)

tenant_search = SearchSystem(config)
Ejemplo n.º 23
0
# -*- coding: utf-8 -*-
# Copyright 2018-2021 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.queuefeatures import QueueFeatures
from xivo_dao.resources.utils.search import SearchSystem, SearchConfig

config = SearchConfig(
    table=QueueFeatures,
    columns={
        'id': QueueFeatures.id,
        'name': QueueFeatures.name,
        'label': QueueFeatures.label,
        'preprocess_subroutine': QueueFeatures.preprocess_subroutine,
        'exten': QueueFeatures.exten,
    },
    default_sort='id',
)

queue_search = SearchSystem(config)
Ejemplo n.º 24
0
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Avencall
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.voicemail import Voicemail
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(table=Voicemail,
                      columns={
                          'name': Voicemail.fullname,
                          'number': Voicemail.mailbox,
                          'email': Voicemail.email,
                          'context': Voicemail.context,
                          'language': Voicemail.language,
                          'timezone': Voicemail.tz,
                          'pager': Voicemail.pager
                      },
                      search=['name', 'number', 'email', 'pager'],
                      default_sort='number')

voicemail_search = SearchSystem(config)
Ejemplo n.º 25
0
# -*- coding: utf-8 -*-
# Copyright 2014-2018 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.extension import Extension
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(table=Extension,
                      columns={
                          'exten': Extension.exten,
                          'context': Extension.context,
                          'feature': Extension.feature,
                          'is_feature': Extension.is_feature,
                          'type': Extension.context_type
                      },
                      default_sort='exten')

extension_search = SearchSystem(config)
Ejemplo n.º 26
0
# -*- coding: utf-8 -*-
# Copyright 2018 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.useriax import UserIAX
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(table=UserIAX,
                      columns={
                          'name': UserIAX.name,
                          'type': UserIAX.type,
                          'host': UserIAX.host
                      },
                      default_sort='name')

iax_search = SearchSystem(config)
Ejemplo n.º 27
0
# -*- coding: utf-8 -*-
# Copyright 2020 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.user_external_app import UserExternalApp
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(
    table=UserExternalApp,
    columns={'name': UserExternalApp.name},
    default_sort='name',
)

user_external_app_search = SearchSystem(config)
Ejemplo n.º 28
0
# -*- coding: utf-8 -*-
# Copyright 2016-2021 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.context import Context
from xivo_dao.resources.utils.search import SearchSystem, SearchConfig

config = SearchConfig(
    table=Context,
    columns={
        'id': Context.id,
        'description': Context.description,
        'name': Context.name,
        'label': Context.label,
        'type': Context.type,
    },
    default_sort='id',
)

context_search = SearchSystem(config)
Ejemplo n.º 29
0
# -*- coding: utf-8 -*-
# Copyright 2016 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.paging import Paging
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(table=Paging,
                      columns={
                          'id': Paging.id,
                          'name': Paging.name,
                          'number': Paging.number,
                          'announce_sound': Paging.announce_sound
                      },
                      default_sort='name')

paging_search = SearchSystem(config)
Ejemplo n.º 30
0
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2016 Avencall
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.usercustom import UserCustom
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(table=UserCustom,
                      columns={
                          'id': UserCustom.id,
                          'interface': UserCustom.interface,
                          'context': UserCustom.context
                      },
                      default_sort='interface')

custom_search = SearchSystem(config)
Ejemplo n.º 31
0
# -*- coding: utf-8 -*-
# Copyright 2017 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.schedule import Schedule
from xivo_dao.resources.utils.search import SearchSystem
from xivo_dao.resources.utils.search import SearchConfig

config = SearchConfig(table=Schedule,
                      columns={
                          'id': Schedule.id,
                          'name': Schedule.name,
                          'timezone': Schedule.timezone
                      },
                      default_sort='name')

schedule_search = SearchSystem(config)
Ejemplo n.º 32
0
# -*- coding: utf-8 -*-
# Copyright 2018 The Wazo Authors  (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from xivo_dao.alchemy.callfilter import Callfilter as CallFilter
from xivo_dao.resources.utils.search import SearchConfig, SearchSystem

config = SearchConfig(table=CallFilter,
                      columns={'id': CallFilter.id,
                               'name': CallFilter.name,
                               'description': CallFilter.description},
                      default_sort='name')

call_filter_search = SearchSystem(config)