You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
530 B

from app.models.pin import Pin
def pin_serialize(pin: list) -> Pin:
return Pin(**{
"id": str(pin["_id"]),
"title": pin["title"],
"description": pin["description"],
"location": pin["location"],
"files": pin["files"],
"user_id": pin["user_id"]
})
def pins_serialize(pins: list, uid: str) -> list:
serialized_pins: list = []
for pin in pins:
if pin["user_id"] == uid:
serialized_pins.append(pin_serialize(pin))
return serialized_pins