def restruct_nearby_place(places: list) -> list:
    """Process data for frontend

    Args:
        places: A place nearby data from google map api.

    Returns:
        context: A place data that place-list page needed.

    Data struct:
    [
        {
            # Essential key
            'place_name': <name>,
            'place_id': <place_id>,
            'photo_ref': [<photo_ref],
            'types': [],
            # other...
        }
        . . .
    ]
    """
    context = []
    for place in places:
        init_place = {
            'place_name': None,
            'place_id': None,
            'photo_ref': [],
            'types': [],
        }

        if 'photos' in place:
            # Place have an image
            photo_ref = place['photos'][0]['photo_reference']
            init_place['photo_ref'].append(photo_ref)
        else:
            # Place don't have an image
            continue
        init_place['place_name'] = place['name']
        init_place['place_id'] = place['place_id']
        init_place['types'] = place['types']
        context.append(init_place)
    return context