# F11C Routes Exercise
Break into groups of 3. The only rule is that no one in the group of 3 can be in your project team. In your team, you will be given 5-10 minutes to analyse the current API specification for your project, and to (as a team) propose one (or a couple) of new "route(s)" (i.e. url) to the interface to add some cool functionality to the product. Find something that you as a team get excited about. You'll be sharing your answer with the class, and will be expected to provide for each route:
* A route (i.e. /this/url/name)
* A CRUD method (e.g. GET)
* Input parameters
* Return object
* Description of what it does
## Group 1
@APP.route('/channel/remove_channel', methods = ['DELETE'])
def channel_remove_channel(token, channel_id):
'''
Received a token and a channel_id to remove the channel represented by the channel id.
Check if token belongs to either channel owner or dreams owner otherwise throws access error.
Removes all other members and owners form channel when function is called.
Throws input error if channel id is invalid.
Input: token, channel_id
Exception: invalid token, invalid channel id, user with token is not a global onwer of Dream or a onwer
Assumptions:
- Channel is removed from the main frame but all details are archived.
'''
return{ } #return nothing
## Group 2
@APP.route("/user/profile/banner", methods=['POST'])
input: token, img_url, x_start, y_start, x_end, y_end
return {}
Description: Given a URL of an image on the internet, crops the image within bounds (x_start, y_start) and (x_end, y_end). The image is the banner of the user profile.
## Group 3
@APP.route("/user/friend/addfriend", methods=['POST'])
input: token, u_id
return {} # return nothing
add a u_id to a list of users that you are more likely to talk to
@APP.route("/user/friend/friendList", methods=['GET'])
input: token
return{dict of user profile}
Returns and prints the list of a the users friends
@APP.route("/user/friend/removeFriend", methods=['POST'])
input: token, u_id
return {} # return nothing
Removes the u_id from the users friends list
@APP.route("/channel/shareScreen", methods=['POST'])
input:token, channel_id
Shares the users screen to other users in the channel
## Group 4
@app.route('/user/favouriteDm',methods=['POST'])
def favouriteDM(u_id):
user = get_user_by_u_id()
Satisfaction_list_for_user = []
for dm in data.dms:
Satisfaction = get_users_Satisfaction_for_dm(dm)
Satisfaction_list_for_user.append(Satisfaction)
max_Satisfaction = max(Satisfaction_list_for_user)
favouriteDM = get_dm_by_dm_id()
return favouriteDM
@app.route('/user/favouriteChannel',methods=['POST'])
def favouriteChannel():
@app.route('/user/status',methods=['GET'])
def getStatus():
return user is online or offline
## Group 5
Route
- URL: '/user/setavatar'
- methods: 'POST'
- Token containing Auth user id, photo
- Return nil
- Sets the avatar for user with auth user id
- URL: '/user/getavatar'
- methods: 'GET'
- Token containing Auth user id
- Return the avatar of user with auth user id
- Gets the avatar of user with auth user id
## Group 6
## Group 7
## Group 8