Spaces:
Sleeping
Sleeping
Create updatedynamicendpoint.py
Browse files
components/updatedynamicendpoint.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from components.mongodbconnection import provideClient
|
| 2 |
+
|
| 3 |
+
mc=provideClient()
|
| 4 |
+
|
| 5 |
+
db=mc["x402ify_db"]
|
| 6 |
+
coll=db["x402ify_col"]
|
| 7 |
+
|
| 8 |
+
def UpdateDynamicEndpoint(owner,tag,newendpoint):
|
| 9 |
+
|
| 10 |
+
try:
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
coll.find_one_and_update(
|
| 14 |
+
{"owner": owner},
|
| 15 |
+
{ "$set": {"dynamicendpoints.$[elem].endpoint": newendpoint}
|
| 16 |
+
},
|
| 17 |
+
array_filters=[{"elem.endpoint_linker": tag}],
|
| 18 |
+
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
return {"status":True}
|
| 22 |
+
except Exception as e:
|
| 23 |
+
return {"status":False}
|
| 24 |
+
|