aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-02-22 23:57:11 -0800
committerclarkzjw <[email protected]>2023-02-23 12:07:32 -0800
commit5402e3a2e9df24a883e2e20dfae6c92f11b8d499 (patch)
tree0337ca914685d2f52fbe34bf3fb7be89d7aa9721 /dbstore/peewee_store.py
parent736ba02520802499c9970afd9d1ee6a537fb2230 (diff)
downloadswarm2fediverse-5402e3a2e9df24a883e2e20dfae6c92f11b8d499.tar.gz
bot: change create_poi to create_or_update_poi
Diffstat (limited to 'dbstore/peewee_store.py')
-rw-r--r--dbstore/peewee_store.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/dbstore/peewee_store.py b/dbstore/peewee_store.py
index 00897d7..89e4b4b 100644
--- a/dbstore/peewee_store.py
+++ b/dbstore/peewee_store.py
@@ -52,14 +52,13 @@ def get_poi_by_fsq_id(fsq_id) -> dict:
52 return {} 52 return {}
53 53
54 54
55def create_poi(poi: dict): 55def create_or_update_poi(poi: dict) -> int:
56 with db.connection_context(): 56 with db.connection_context():
57 poi = Location.create( 57 return Location.insert(
58 fsq_id=poi["fsq_id"], 58 fsq_id=poi["fsq_id"],
59 name=poi["name"], 59 name=poi["name"],
60 locality=poi["locality"], 60 locality=poi["locality"],
61 region=poi["region"], 61 region=poi["region"],
62 latitude=poi["latitude"], 62 latitude=poi["latitude"],
63 longitude=poi["longitude"], 63 longitude=poi["longitude"],
64 ) 64 ).on_conflict_replace().execute()
65 poi.save()
Powered by cgit v1.2.3 (git 2.41.0)