parent
32ffb3109b
commit
e432fc984c
@ -1,10 +1,16 @@
|
|||||||
|
from app.models.pin import Pin
|
||||||
|
|
||||||
|
|
||||||
|
def pin_serialize(pin: list) -> Pin:
|
||||||
|
return Pin(**{
|
||||||
|
"id": str(pin["_id"]),
|
||||||
|
"title": pin["title"],
|
||||||
|
"description": pin["description"]
|
||||||
|
})
|
||||||
|
|
||||||
def pins_serialize(pins: list) -> list:
|
def pins_serialize(pins: list) -> list:
|
||||||
serialized_pins: list = []
|
serialized_pins: list = []
|
||||||
for pin in pins:
|
for pin in pins:
|
||||||
serialized_pins.append({
|
serialized_pins.append(pin_serialize(pin))
|
||||||
"id": str(pin["_id"]),
|
|
||||||
"title": pin["title"],
|
|
||||||
"description": pin["description"]
|
|
||||||
|
|
||||||
})
|
|
||||||
return serialized_pins
|
return serialized_pins
|
Loading…
Reference in new issue