added geography_id
parent
877701faf9
commit
4afa558cd8
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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
|
||||
(%(account_id)s, %(name)s, %(wake_word_id)s, %(text_to_speech_id)s, %(geography_id)s)
|
||||
RETURNING id
|
||||
|
|
Loading…
Reference in New Issue