def add_like_to_sheet(sheet_id, uid): """ Add uid as a liker of sheet_id. """ db.sheets.update({"id": sheet_id}, {"$addToSet": {"likes": uid}}) sheet = get_sheet(sheet_id) notification = Notification({"uid": sheet["owner"]}) notification.make_sheet_like(liker_id=uid, sheet_id=sheet_id) notification.save()