Skip to content

Instantly share code, notes, and snippets.

@chalasr
Last active December 23, 2016 11:49
Show Gist options
  • Select an option

  • Save chalasr/4100eaa35a1f28469c34 to your computer and use it in GitHub Desktop.

Select an option

Save chalasr/4100eaa35a1f28469c34 to your computer and use it in GitHub Desktop.
Tasks Sportroops 24/01 - 28/01

System

Back office

  • Integrate the User->Sport association by creating a field in the AdminBundle/BaseUserAdmin : ~3 hours.
    We must be able to add multiple sports to an user (from all types).
    We must be able to remove multiple sports from an user (from all types).
    (Same as previous association's embedded fields, but the Sport entity is already known by Sonata).

  • Make a working multi-upload in CoachAdmin : ~3 hours.

Api

User profile picture : ~6 hours
  • POST /v1/users/{id}/picture
    parameters: file, type:file (resouece) controller: UserBundle
    method: updatePicture
    You have to use uploadPicture() method of the User entity.
    Ask Thomas for which format you will receive the image (base64, ... I think multi-part/form-data should be the right way).
    See documentation and stackoverlow for how handle file upload in REST.
    When you the file is retrieved in request, take example from the BaseUserAdmin (called in prePersist and preUpdate) to see how upload the file (! note: you will do setFile() manually) .
    Use an HTTP client like Postman for testing, only when you know the format.
User's follows/followers : ~2 hours.

(Add the two next resources to the 'Followers' ticket (#28) which have the tasks but need details for Thuy)

  • GET /v1/users/{id}/followers
    controller: UserBundle/UsersController
    method: getFollowers($id)
    Returns the followers of a User (all users which are following the given user {id})

  • GET /v1/users/{id}/follows
    controller: UserBundle/UsersController
    method: getFollows($id)
    Returns the follows of a User (all users followed by the given user {id})

User's sports : ~4 hours.
  • GET /v1/users/{id}/sports
    controller: UserBundle/UsersController
    method: getSports($id)
    Returns the list of Sports associated to the given User. (represented by $id in uri)

  • POST /v1/users/{id}/sports
    parameters: 'sport_id' (the sport to be added), requirements: \d+ (int regexp for @Rest\RequestParam annotation), required, not blank.
    controller: UserBundle/UsersController
    method: addSport($id)
    Add a sport to the given user (represented by $id in uri)

  • DELETE /v1/users/{id}/sports
    parameters: 'sport_id' (the sport to remove), requirements: \d+ (int regexp for @Rest\RequestParam annotation), required, not blank.
    controller: UserBundle/UsersController
    method: removeSport($id)
    Remove a sport from the given user (represented by $id in uri)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment