From 4afa558cd8fa78f8ef8a642d54a8ca4435cca5b1 Mon Sep 17 00:00:00 2001 From: Chris Veilleux Date: Wed, 20 Mar 2019 13:33:41 -0500 Subject: [PATCH] added geography_id --- shared/selene/data/device/repository/device.py | 8 +++++--- shared/selene/data/device/repository/sql/add_device.sql | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/shared/selene/data/device/repository/device.py b/shared/selene/data/device/repository/device.py index 8d8ff262..90089b81 100644 --- a/shared/selene/data/device/repository/device.py +++ b/shared/selene/data/device/repository/device.py @@ -76,7 +76,7 @@ class DeviceRepository(object): # TODO: Remove the @ in the API v2 return {'@type': rate_period} if rate_period is not None else {'@type': 'free'} - def add_device(self, account_id: str, name: str, wake_word_id: str, text_to_speech_id: str) -> str: + def add_device(self, account_id: str, name: str, wake_word_id: str, text_to_speech_id: str, geography_id: str) -> str: """ Creates a new device with a given name and associate it to an account""" # TODO: validate foreign keys query = DatabaseRequest( @@ -85,7 +85,8 @@ class DeviceRepository(object): account_id=account_id, name=name, wake_word_id=wake_word_id, - text_to_speech_id=text_to_speech_id + text_to_speech_id=text_to_speech_id, + geography_id=geography_id ) ) result = self.cursor.insert_returning(query) @@ -113,7 +114,8 @@ class DeviceRepository(object): query = DatabaseRequest( sql=get_sql_from_file(path.join(SQL_DIR, 'add_wake_word.sql')), args=dict( - wake_word=wake_word.wake_word, + setting_name=wake_word.setting_name, + display_name=wake_word.display_name, account_id=account_id, engine=wake_word.engine ) diff --git a/shared/selene/data/device/repository/sql/add_device.sql b/shared/selene/data/device/repository/sql/add_device.sql index 40b50452..cef7a9c8 100644 --- a/shared/selene/data/device/repository/sql/add_device.sql +++ b/shared/selene/data/device/repository/sql/add_device.sql @@ -1,5 +1,5 @@ INSERT INTO - device.device (account_id, name, wake_word_id, text_to_speech_id) + device.device (account_id, name, wake_word_id, text_to_speech_id, geography_id) VALUES - (%(account_id)s, %(name)s, %(wake_word_id)s, %(text_to_speech_id)s) -RETURNING id \ No newline at end of file + (%(account_id)s, %(name)s, %(wake_word_id)s, %(text_to_speech_id)s, %(geography_id)s) +RETURNING id