func init() { dozy.BuildHandler(MuxRouter). Queries("email", "{email:.+@.+}", "password", "{password}"). HandleWith("GET", "/authtoken", syringe.Inject(handlers.GetAuthtokenEmail, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). HandleWith("DELETE", "/authtoken", handlers.DeleteAuthtoken) }
func init() { dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). HandleWith("GET", "/users/{userId}/notifications/count", syringe.Inject(handlers.GetUsersNotificationsCount, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). HandleWith("GET", "/users/{userId}/notifications", syringe.Inject(handlers.GetUsersNotifications, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). HandleWith("GET", "/users/{userId}/profile", syringe.Inject(handlers.GetUsersProfile, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). HandleWith("GET", "/users/{userId}/settings", syringe.Inject(handlers.GetUsersSettings, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). Schema( `{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "email": { "type": "string", "format": "email" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "phoneNumber": { "type": "integer", "multipleOf": 1 } }, "required": [ "email", "firstName", "lastName", "phoneNumber" ] }`, ). HandleWith("PUT", "/users/{userId}/settings", syringe.Inject(handlers.PutUsersSettings, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). HandleWith("GET", "/users/{userId}/myPlaces", syringe.Inject(handlers.GetUsersMyPlaces, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). Schema( `{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "places": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "address": { "type": "string" } }, "required": [ "name", "address" ] }, "required": [ "0" ] } }, "required": [ "places" ] }`, ). HandleWith("PUT", "/users/{userId}/myPlaces", syringe.Inject(handlers.PutUsersMyPlaces, mongodb.DatabaseHandler{})) }
func init() { // //TODO: confirm with Matthew of function name // dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). HandleWith("GET", "/ride/{rideId}/likes/{userId}", syringe.Inject(handlers.GetRideLikesUser, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). Schema( `{ "id": "http://jsonschema.net", "type": "object", "properties": { "isLiked": { "type": boolean } }, "required": [ "isLiked" ] }`, ). HandleWith("PUT", "/ride/{rideId}/likes/{userId}", syringe.Inject(handlers.PutRideLikesUser, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}", "startingLikeNum", "{startingLikeNum}", "numLikesToFetch", "{numLikesToFetch}"). HandleWith("GET", "/ride/{rideId}/likes", syringe.Inject(handlers.GetRideLikes, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}", "startingCommentNum", "{startingCommentNum}", "numCommentsToFetch", "{numCommentsToFetch}"). HandleWith("GET", "/ride/{rideId}/comments", syringe.Inject(handlers.GetRideComments, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). Schema( `{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "http://jsonschema.net", "type": "object", "properties": { "content": { "type": string } }, "required": [ "content" ] }`, ). HandleWith("POST", "/ride/{rideId}/comments", syringe.Inject(handlers.PostRideComments, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). Schema( `{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "http://jsonschema.net", "type": "object", "properties": { "tip": { "type": number } }, "required": [ "tip" ] }`, ). HandleWith("PUT", "/ride/{rideId}/tip", syringe.Inject(handlers.PutRideTip, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). Schema( `{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "http://jsonschema.net", "type": "object", "properties": { "acceptSplit": { "type": bool } "braintreeNonce": { "type": string }, "tipAmount": { "type": number } }, "required": [ "acceptSplit", "braintreeNonce", "tipAmount" ] }`, ). HandleWith("PUT", "/ride/{rideId}/acceptSplit", syringe.Inject(handlers.PutRideAcceptSplit, mongodb.DatabaseHandler{})) dozy.BuildHandler(MuxRouter). Queries("authtoken", "{authtoken}"). Schema( `{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "http://jsonschema.net", "type": "object", "properties": { "numPeople": { "type": number }, "description": { "type": "string" }, "otherFriends": { "type": "array", "properties": [ { "userId": { type": "number" }, "splittingPayment": { "type": "bool" } }, ], }, "privacySettings": { "type": "string" }, "driverNote": { "type": "string" } "startingAddress": { "type": "string" }, "destinationAddress": { "type": "string" }, "pickupTime": { "type": number }, "braintreeNonce": { "type": "string" } }, "required": [ "description", "otherFriends", "driverNote", "startingAddress", "destinationAddress", "pickupTime", "braintreeNonce" ] }`, ). HandleWith("POST", "/ride", syringe.Inject(handlers.PostRide, mongodb.DatabaseHandler{})) }