shotvibe / shotvibe-web

ShotVibe REST API webservice
1 stars 0 forks source link

When adding new phone numbers to an Album, use a nickname supplied in the request for the new user (instead of "noname") #21

Closed benny-shotvibe closed 11 years ago

benny-shotvibe commented 11 years ago

New members are added to an album in two views: photos_api.views.Album.post and photos_api.views.AlbumDetail.post

They both use serializers, for reading the user's request, and for phone numbers this serializer is used: photos_api.serializers.MemberIdentifierSerializer.

This serializer works by accepting some JSON like:

{ "user_id": 4 }

or

{ "phone_number":"12345", "default_country":"US" }

We need to modify the second one, to also take a new field called "contact_nickname" (with a string value):

{ "phone_number":"12345", "default_country":"US", "contact_nickname":"John Smith" }

If the request causes a new user to be created for this phone number, then the new user's "nickname" should be set to the supplied value (instead of the current behavior of setting it to "noname").

Notes:

prudnikov commented 11 years ago

I'm moving phone parsing and validation from the View to the Serializer validation method which is right place to do validation of user's input.

I found that according to documentation parsed phone number should be checked if it is possible and valid using methods phonenumbers.is_possible_number() and phonenumbers.is_valid_number() https://github.com/daviddrysdale/python-phonenumbers. However, there is no checking for valid number https://github.com/shotvibe/shotvibe-web/blob/master/photos_api/views.py#L66. Is this intentionally or not? Should I add this checking?

prudnikov commented 11 years ago

Isn't this issue completed?

benny-shotvibe commented 11 years ago

Yes, this was merged in 4207b9e6d9b0d05611960217206803a36f6f6ac6. Closing