Commit 50600ecd authored by Etienne Allovon's avatar Etienne Allovon

Merge branch '2018.16' into 2414-confgend-can-not-generate-conf-due-to-sqlalchemy-security-update

parents eae9c5e0 f3b6912b
\c asterisk
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE SCHEMA xc;
FROM debian:jessie
# See https://github.com/debuerreotype/docker-debian-artifacts/issues/66
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list # Now archived
FROM debian:stretch
RUN apt-get -yqq update \
&& apt-get -yqq install python-pip \
......@@ -10,17 +7,13 @@ RUN apt-get -yqq update \
python-dev \
libyaml-dev
ADD . /usr/src/dao
WORKDIR /usr/src/dao
ADD requirements.txt .
ADD test-requirements.txt .
RUN pip install -r requirements.txt
RUN pip install -r test-requirements.txt
# Special trick to install Debian version of sqlalchemy for the tests:
# - sqlalchemy is kept in requirements for developments (for IDEs)
# - but then we force installation of sqlalchemy from debian repo
# This should install package version 0.9.8+dfsg-0.1+deb8u1
RUN pip uninstall -y sqlalchemy
RUN apt-get update \
&& apt-get -yqq install python-sqlalchemy
ADD . /usr/src/dao
CMD nosetests xivo_dao
xivo-dao [![Build Status](https://travis-ci.org/xivo-pbx/xivo-dao.png?branch=master)](https://travis-ci.org/xivo-pbx/xivo-dao)
========
# xivo-dao [![Build Status](https://travis-ci.org/xivo-pbx/xivo-dao.png?branch=master)](https://travis-ci.org/xivo-pbx/xivo-dao)
xivo-dao is a library used internally by XiVO to access and modify
different data sources (e.g. postgres database, provisoning database).
Creating the test database
--------------------------
## Running unit tests
### Via Docker Compose (recommended way)
To run with docker-compose:
docker-compose up -d db # only once
# wait a bit
docker-compose build dao && docker-compose up dao # repeat to run against new code
Note if you want to clean your test env :
docker-compose down
### Via Docker
You need the test database ``asterisktest`` installed somewhere (see below).
To run test with docker:
docker build -t xivo/dao-test .
docker run -e XIVO_TEST_DB_URL=<postgres_uri> -it xivo/dao bash
### Via your system
#### Creating the test database
```
apt-get install postgres-9.4
......@@ -18,10 +46,11 @@ Then:
CREATE DATABASE asterisktest;
CREATE USER asterisk WITH PASSWORD 'asterisk';
GRANT ALL ON DATABASE asterisktest TO asterisk;
CREATE SCHEMA xc AUTHORIZATION asterisk;
CREATE EXTENSION IF NOT EXISTS 'uuid-ossp';
```
Running unit tests
------------------
#### Launching the tests
You need the test database ``asterisktest`` installed (see above).
......@@ -32,19 +61,4 @@ tox --recreate -e py27
```
To execute tests slightly faster, you can avoid recreating all the tables in the
database by passing ```CREATE_TABLES=0``` on the command line
Docker
------
To run test with docker:
docker build -t xivo/dao-test .
docker run -e XIVO_TEST_DB_URL=<postgres_uri> -it xivo/dao bash
To run with docker-compose:
docker-compose up -d db # only once
# wait a bit
docker-compose build dao && docker-compose up dao # repeat to run against new code
database by passing ```CREATE_TABLES=0``` on the command line.
\ No newline at end of file
xivo-dao (2018.05.12) xivo-aldebaran; urgency=medium
xivo-dao (2018.16.09) xivo-borealis; urgency=medium
* Fix incompatibility with security patch of SQLAlechemy
-- Jirka HLAVACEK <jhlavacek@avencall.com> Mon, 25 Mar 2019 13:21:17 +0100
xivo-dao (2018.05.05) xivo-aldebaran; urgency=medium
xivo-dao (2018.16.08) xivo-borealis; urgency=medium
* 2375 Add a CtiProfile to user when it's not set and a login is set
-- Jean-Pierre Thomasset <jpthomasset@gmail.com> Fri, 22 Feb 2019 09:44:53 +0000
xivo-dao (2018.16.06) xivo-borealis; urgency=medium
* 2352 Add api to create func key destination for agent
-- Jean-Pierre Thomasset <jpthomasset@gmail.com> Fri, 15 Feb 2019 16:16:07 +0000
xivo-dao (2018.16.04) xivo-borealis; urgency=medium
* 2266 Add agent_group_id in user api
-- Jean-Pierre Thomasset <jpthomasset@gmail.com> Thu, 03 Jan 2019 16:13:00 +0000
xivo-dao (2018.16.03) xivo-borealis; urgency=medium
* 2233 Display mds column in users listing page
-- Tomas Taraba <ttaraba@avencall.com> Tue, 04 Dec 2018 15:09:50 +0100
xivo-dao (2018.16.02) xivo-borealis; urgency=medium
* 2173 Add API to get user with its agent number
* 2186 Add API to get all users with its agent number
-- Etienne Allovon <eallovon@avencall.com> Thu, 08 Nov 2018 11:08:04 +0100
xivo-dao (2018.15.00) xivo-borealis; urgency=medium
* 2093 XDS - Be able to route calls depending on the MDS of the peer
-- Tomas Taraba <ttaraba@avencall.com> Thu, 27 Sep 2018 15:38:12 +0200
xivo-dao (2018.14.00) xivo-borealis; urgency=medium
* 1150 sqlalchemy upgrade to 1.0
-- Etienne Allovon <eallovon@avencall.com> Fri, 28 Sep 2018 18:31:43 +0200
xivo-dao (2018.13.00) xivo-borealis; urgency=medium
* 1979 Add mediaserver table
-- Erwan Sevellec <esevellec@avencall.com> Tue, 14 Aug 2018 17:25:16 +0200
xivo-dao (2018.12.00) xivo-borealis; urgency=medium
* 1990 Add local state table for db-replic
-- Laurent Meiller <lmeiller@avencall.com> Tue, 28 Aug 2018 09:28:45 +0200
xivo-dao (2018.10.00) xivo-borealis; urgency=medium
* 1946 Can't update cti profile via csv if cti profile hasn't existed before
-- Tomas Taraba <ttaraba@avencall.com> Wed, 04 Jul 2018 10:50:12 +0200
xivo-dao (2018.05.03) xivo-aldebaran; urgency=medium
[Tomas Taraba]
* 1782 Fix outgoing caller id and call permissions when unc. fwd
xivo-dao (2018.09.00) xivo-borealis; urgency=medium
[Vojtech Sodoma]
* 1810 Create qualification tables on new xivo
* 1888 Add creation of configmgt tables
-- Etienne Allovon <eallovon@avencall.com> Wed, 13 Jun 2018 12:12:40 +0200
xivo-dao (2018.08.00) xivo-borealis; urgency=medium
* 1873 Fix outgoing caller id and call permissions when unc. fwd
-- Tomas Taraba <ttaraba@avencall.com> Tue, 15 May 2018 10:25:12 +0200
xivo-dao (2018.06.00) xivo-borealis; urgency=medium
[Etienne Allovon]
* 1807 Add fields for recording
[Vojtech Sodoma]
* 1813 Create qualification tables on new xivo
-- Vojtech Sodoma <vsodoma@avencall.com> Mon, 16 Apr 2018 12:10:08 +0200
xivo-dao (2018.04.00) xivo-aldebaran; urgency=medium
* 1722 Update Meetmefeatures table schema
......
......@@ -6,6 +6,8 @@ db:
- POSTGRES_USER=asterisk
- POSTGRES_PASSWORD=proformatique
- POSTGRES_DB=asterisk
volumes:
- "./Docker/prepare-db-for-tests.sql:/docker-entrypoint-initdb.d/prepare-db-for-tests.sql"
dao:
build: .
links:
......
git+https://gitlab.com/xivo.solutions/xivo-lib-python.git
git+https://gitlab.com/xivo.solutions/xivo-provd-client.git
psycopg2==2.5.4
pyyaml==3.11
sqlalchemy==0.9.8
psycopg2==2.7.5
pyyaml==3.12
sqlalchemy==1.0.15
......@@ -19,6 +19,7 @@ deps =
-rrequirements.txt
-rtest-requirements.txt
coverage
passenv = XIVO_TEST_DB_URL
[testenv:pep8]
commands =
......
......@@ -7,6 +7,8 @@ from xivo_dao.alchemy.agentglobalparams import AgentGlobalParams
from xivo_dao.alchemy.agentgroup import AgentGroup
from xivo_dao.alchemy.agentqueueskill import AgentQueueSkill
from xivo_dao.alchemy.attachment import Attachment
from xivo_dao.alchemy.callback_list import CallbackList
from xivo_dao.alchemy.callback_request import CallbackRequest
from xivo_dao.alchemy.call_log import CallLog
from xivo_dao.alchemy.callerid import Callerid
from xivo_dao.alchemy.callfilter import Callfilter
......@@ -84,6 +86,7 @@ from xivo_dao.alchemy.phonebooknumber import PhonebookNumber
from xivo_dao.alchemy.phonefunckey import PhoneFunckey
from xivo_dao.alchemy.pickup import Pickup
from xivo_dao.alchemy.pickupmember import PickupMember
from xivo_dao.alchemy.preferred_callback_period import PreferredCallbackPeriod
from xivo_dao.alchemy.provisioning import Provisioning
from xivo_dao.alchemy.qualification_answers import QualificationAnswers
from xivo_dao.alchemy.qualifications import Qualifications
......@@ -99,9 +102,11 @@ from xivo_dao.alchemy.queueskill import QueueSkill
from xivo_dao.alchemy.queueskillcat import QueueSkillCat
from xivo_dao.alchemy.queueskillrule import QueueSkillRule
from xivo_dao.alchemy.resolvconf import Resolvconf
from xivo_dao.alchemy.replication_state import ReplicationState
from xivo_dao.alchemy.rightcall import RightCall
from xivo_dao.alchemy.rightcallexten import RightCallExten
from xivo_dao.alchemy.rightcallmember import RightCallMember
from xivo_dao.alchemy.rights import Rights
from xivo_dao.alchemy.sccpdevice import SCCPDevice
from xivo_dao.alchemy.sccpgeneralsettings import SCCPGeneralSettings
from xivo_dao.alchemy.sccpline import SCCPLine
......@@ -133,5 +138,10 @@ from xivo_dao.alchemy.user_line import UserLine
from xivo_dao.alchemy.usercustom import UserCustom
from xivo_dao.alchemy.userfeatures import UserFeatures
from xivo_dao.alchemy.useriax import UserIAX
from xivo_dao.alchemy.users import Users
from xivo_dao.alchemy.usersip import UserSIP
from xivo_dao.alchemy.voicemail import Voicemail
from xivo_dao.alchemy.xc_queue_members_default import XCQueueMembersDefault
from xivo_dao.alchemy.xc_queues import XCQueues
from xivo_dao.alchemy.xc_users import XCUsers
from xivo_dao.alchemy.mediaserver import MediaServer
\ No newline at end of file
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint
from sqlalchemy.types import Integer, String
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy import text
from xivo_dao.helpers.db_manager import Base
class CallbackList(Base):
__tablename__ = 'callback_list'
__table_args__ = (
PrimaryKeyConstraint('uuid'),
)
uuid = Column(UUID(as_uuid=True), nullable=False, server_default=text('uuid_generate_v4()'))
name = Column(String(128), nullable=False)
queue_id = Column(Integer, nullable=False)
\ No newline at end of file
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint, ForeignKeyConstraint, Index, Sequence
from sqlalchemy.types import Integer, String, Text, Boolean, Date
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import relationship
from sqlalchemy import text
from xivo_dao.alchemy.preferred_callback_period import PreferredCallbackPeriod
from xivo_dao.alchemy.callback_list import CallbackList
from xivo_dao.helpers.db_manager import Base
class CallbackRequest(Base):
__tablename__ = 'callback_request'
__table_args__ = (
PrimaryKeyConstraint('uuid'),
ForeignKeyConstraint(('list_uuid',),
('callback_list.uuid',),),
ForeignKeyConstraint(('preferred_callback_period_uuid',),
('preferred_callback_period.uuid',),),
Index('callback_request__idx_reference_number', 'reference_number'),
)
reference_number_seq = Sequence('callback_request_reference_number_seq')
uuid = Column(UUID(as_uuid=True), nullable=False, server_default=text('uuid_generate_v4()'))
list_uuid = Column(UUID(as_uuid=True), nullable=False)
phone_number = Column(String(40))
mobile_phone_number = Column(String(40))
firstname = Column(String(128))
lastname = Column(String(128))
company = Column(String(128))
description = Column(Text)
agent_id = Column(Integer)
clotured = Column(Boolean, server_default='False')
preferred_callback_period_uuid = Column(UUID(as_uuid=True))
due_date = Column(Date, nullable=False, server_default=text('now()'))
reference_number = Column(Integer,
reference_number_seq,
server_default=reference_number_seq.next_value(),
nullable=False)
voice_message_ref = Column(String(128))
callback_list = relationship(CallbackList)
preferred_callback_period = relationship(PreferredCallbackPeriod)
\ No newline at end of file
......@@ -21,6 +21,7 @@ from sqlalchemy.types import Integer, String, Boolean
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.sql import cast
from xivo_dao.helpers.db_manager import Base
from xivo_dao.alchemy import enum
......
......@@ -39,7 +39,15 @@ class FuncKey(Base):
destination_type = relationship(FuncKeyDestinationType, foreign_keys=destination_type_id)
@classmethod
def new_for_user(cls):
def new_for_type(cls, dest_type):
type_id = FuncKeyType.query_id('speeddial').as_scalar()
destination_type_id = FuncKeyDestinationType.query_id('user').as_scalar()
destination_type_id = FuncKeyDestinationType.query_id(dest_type).as_scalar()
return cls(type_id=type_id, destination_type_id=destination_type_id)
@classmethod
def new_for_user(cls):
return FuncKey().new_for_type('user')
@classmethod
def new_for_agent(cls):
return FuncKey().new_for_type('agent')
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint, UniqueConstraint
from sqlalchemy.types import Integer, String
from xivo_dao.helpers.db_manager import Base
class MediaServer(Base):
__tablename__ = 'mediaserver'
__table_args__ = (
PrimaryKeyConstraint('id'),
UniqueConstraint('name'),
)
id = Column(Integer, nullable=False)
name = Column(String(128), nullable=False)
display_name = Column(String(128), nullable=False)
voip_ip = Column(String(39), nullable=False)
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint
from sqlalchemy.types import String, Boolean, Time
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy import text
from xivo_dao.helpers.db_manager import Base
class PreferredCallbackPeriod(Base):
__tablename__ = 'preferred_callback_period'
__table_args__ = (
PrimaryKeyConstraint('uuid'),
)
uuid = Column(UUID(as_uuid=True), nullable=False, server_default=text('uuid_generate_v4()'))
name = Column(String(128), nullable=False, server_default='')
period_start = Column(Time, nullable=False)
period_end = Column(Time, nullable=False)
default = Column(Boolean, server_default='False')
\ No newline at end of file
......@@ -18,7 +18,7 @@
from sqlalchemy.dialects.postgresql import DOUBLE_PRECISION
from sqlalchemy.schema import Column, PrimaryKeyConstraint, Index,\
UniqueConstraint
from sqlalchemy.types import Integer, String
from sqlalchemy.types import Integer, String, Enum
from xivo_dao.helpers.db_manager import Base
......@@ -55,3 +55,9 @@ class QueueFeatures(Base):
announce_holdtime = Column(Integer, nullable=False, server_default='0')
waittime = Column(Integer)
waitratio = Column(DOUBLE_PRECISION)
recording_mode = Column(Enum('notrecorded', 'recorded', 'recordedondemand',
name='queuefeatures_recordingmode',
metadata=Base.metadata),
nullable=False,
server_default='notrecorded')
recording_activated = Column(Integer, nullable=False, server_default='0')
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint
from sqlalchemy.types import Integer, String
from xivo_dao.helpers.db_manager import Base
class ReplicationState(Base):
__tablename__ = 'replication_state'
__table_args__ = (
PrimaryKeyConstraint('name'),
)
name = Column(String(128), nullable=False)
ref = Column(String(128), nullable=False)
val = Column(Integer, nullable=False)
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint, ForeignKeyConstraint
from sqlalchemy.types import Integer, Enum
from sqlalchemy.orm import relationship
from xivo_dao.alchemy.users import Users
from xivo_dao.helpers.db_manager import Base
class Rights(Base):
__tablename__ = 'rights'
__table_args__ = (
PrimaryKeyConstraint('id'),
ForeignKeyConstraint(('user_id',),
('users.id',),),
)
id = Column(Integer, nullable=False)
user_id = Column(Integer, nullable=False)
category = Column(Enum('queue', 'agentgroup', 'incall', 'recording_access',
name='right_type',
metadata=Base.metadata),
nullable=False)
category_id = Column(Integer, nullable=False)
users = relationship(Users)
\ No newline at end of file
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint
from sqlalchemy.types import Integer, String, Enum, DateTime
from xivo_dao.helpers.db_manager import Base
class Users(Base):
__tablename__ = 'users'
__table_args__ = (
PrimaryKeyConstraint('id'),
)
id = Column(Integer, nullable=False)
login = Column(String(64))
type = Column(Enum('admin', 'supervisor', 'teacher',
name='user_type',
metadata=Base.metadata))
validity_start = Column(DateTime)
validity_end = Column(DateTime)
\ No newline at end of file
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint, ForeignKeyConstraint
from sqlalchemy.types import Integer
from sqlalchemy.orm import relationship
from xivo_dao.alchemy.xc_queues import XCQueues
from xivo_dao.alchemy.xc_users import XCUsers
from xivo_dao.helpers.db_manager import Base
class XCQueueMembersDefault(Base):
__tablename__ = 'queue_members_default'
__table_args__ = (
PrimaryKeyConstraint('user_id', 'queue_id', name='queue_members_default_pkey'),
ForeignKeyConstraint(('user_id',),
('xc.users.id',),),
ForeignKeyConstraint(('queue_id',),
('xc.queues.id',),),
{'schema':'xc'},
)
user_id = Column(Integer, nullable=False)
queue_id = Column(Integer, nullable=False)
penalty = Column(Integer, nullable=False, server_default='0')
users = relationship(XCUsers)
queues = relationship(XCQueues)
\ No newline at end of file
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint
from sqlalchemy.types import Integer, String
from xivo_dao.helpers.db_manager import Base
class XCQueues(Base):
__tablename__ = 'queues'
__table_args__ = (
PrimaryKeyConstraint('id'),
{'schema':'xc'},
)
id = Column(Integer, autoincrement=False, nullable=False)
name = Column(String(128), nullable=False)
display_name = Column(String(128), nullable=False)
number = Column(String(128), nullable=False)
\ No newline at end of file
# -*- coding: utf-8 -*-
# Copyright (C) 2018 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from sqlalchemy.schema import Column, PrimaryKeyConstraint
from sqlalchemy.types import Integer, String
from xivo_dao.helpers.db_manager import Base
class XCUsers(Base):
__tablename__ = 'users'
__table_args__ = (
PrimaryKeyConstraint('id'),
{'schema':'xc'},
)
id = Column(Integer, autoincrement=False, nullable=False)
login = Column(String(64), nullable=False)