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