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.
28 lines
791 B
28 lines
791 B
def users_serialize(users: list) -> list:
|
|
serialized_users: list = []
|
|
for user in users:
|
|
serialized_users.append({
|
|
"id": str(user["_id"]),
|
|
"username": user["username"]
|
|
})
|
|
return serialized_users
|
|
|
|
def friends_serialize(friends: list) -> list:
|
|
serialized_friends: list = []
|
|
for friend in friends:
|
|
serialized_friends.append({
|
|
"id": str(friend["_id"]),
|
|
"user_id": friend["user_id"]
|
|
})
|
|
return serialized_friends
|
|
|
|
def pins_serialize(pins: list) -> list:
|
|
serialized_pins: list = []
|
|
for pin in pins:
|
|
serialized_pins.append({
|
|
"id": str(pin["_id"]),
|
|
"title": pin["title"],
|
|
"description": pin["description"]
|
|
|
|
})
|
|
return serialized_pins |