Пример #1
0
// @Title Users
// @Description Users's router group.
func Users(parentRoute *gin.RouterGroup) {
	route := parentRoute.Group("/users")
	route.POST("", createUser)
	route.GET("/:id", retrieveUser)
	route.GET("", retrieveUsers)
	route.PUT("/:id", userPermission.AuthRequired(updateUser))
	route.DELETE("/:id", userPermission.AuthRequired(deleteUser))

	route.POST("/roles", userPermission.AdminRequired(addRoleToUser))
	route.DELETE(":id/roles/:roleId", userPermission.AdminRequired(removeRoleFromUser))

	route.POST("/likings", userPermission.AuthRequired(createLikingOnUser))
	route.GET("/:id/likings", retrieveLikingsOnUsers)
	route.DELETE("/:id/likings/:userId", userPermission.AuthRequired(deleteLikingOnUser))
	route.GET("/:id/liked", retrieveLikedOnUsers)

	route = parentRoute.Group("/user")
	route.GET("/current", retrieveCurrentUser)
	route.POST("/send/password/reset/token", sendPasswordResetToken)
	route.PUT("/reset/password", resetPassword)
	route.POST("/send/email/verification/token", sendEmailVerificationToken)
	route.PUT("/verify/email", verifyEmail)
	route.GET("/email/:email", retrieveUserByEmail)
	route.GET("/email/:email/list", retrieveUsersByEmail)
	route.GET("/username/:username", retrieveUserByUsername)
	route.GET("/admin/:id", userPermission.AdminRequired(retrieveUserForAdmin))
	route.GET("/admin", userPermission.AdminRequired(retrieveUsersForAdmin))
	route.PUT("/activate/:id", userPermission.AdminRequired(activateUser))
	route.GET("/test/send/email", sendTestEmail)
}
Пример #2
0
// @Title Upload
// @Description Upload's router group.
func Upload(parentRoute *gin.RouterGroup) {
	route := parentRoute.Group("/upload")
	route.POST("/images", userPermission.AuthRequired(uploadImages))

	route.POST("/files", userPermission.AuthRequired(createFile))
	route.POST("/files/all", userPermission.AuthRequired(createFiles))
	route.GET("/files/:id", retrieveFile)
	route.GET("/files", retrieveFiles)
	route.PUT("/files/:id", userPermission.AuthRequired(updateFile))
	route.DELETE("/files/:id", userPermission.AuthRequired(deleteFile))
}
Пример #3
0
// @Title Articles
// @Description Article's router group.
func Articles(parentRoute *gin.RouterGroup) {

	route := parentRoute.Group("/articles")
	route.POST("", userPermission.AuthRequired(createArticle))
	route.POST("/all", userPermission.AuthRequired(createArticles))
	route.GET("/:id", retrieveArticle)
	route.GET("", retrieveArticles)
	route.PUT("/:id", userPermission.AuthRequired(updateArticle))
	route.DELETE("/:id", userPermission.AuthRequired(deleteArticle))
	route.POST("/sync", userPermission.AuthRequired(uploadAndSyncArticles))

	route.POST("/comments", userPermission.AuthRequired(createCommentOnArticle))
	route.GET("/:id/comments", retrieveCommentsOnArticle)
	route.PUT("/:id/comments/:commentId", userPermission.AuthRequired(updateCommentOnArticle))
	route.DELETE("/:id/comments/:commentId", userPermission.AuthRequired(deleteCommentOnArticle))

	route.POST("/likings", userPermission.AuthRequired(createLikingOnArticle))
	route.GET("/:id/likings", retrieveLikingsOnArticles)
	route.DELETE("/:id/likings/:userId", userPermission.AuthRequired(deleteLikingOnArticle))
}
Пример #4
0
// @Title Oauth
// @Description Oauth's router group.
func Oauth(parentRoute *gin.RouterGroup) {

	route := parentRoute.Group("/oauth")
	route.GET("", retrieveOauthStatus)

	route.GET("/google", googleAuth)
	route.DELETE("/google", userPermission.AuthRequired(googleRevoke))
	route.GET("/google/redirect", googleRedirect)

	route.GET("/github", githubAuth)
	route.DELETE("/github", userPermission.AuthRequired(githubRevoke))
	route.GET("/github/redirect", githubRedirect)

	// route.GET("/yahoo", yahooAuth)
	// route.DELETE("/yahoo", userPermission.AuthRequired(yahooRevoke))
	// route.GET("/yahoo/redirect", yahooRedirect)

	route.GET("/facebook", facebookAuth)
	route.DELETE("/facebook", userPermission.AuthRequired(facebookRevoke))
	route.GET("/facebook/redirect", facebookRedirect)

	// route.GET("/twitter", twitterAuth)
	// route.DELETE("/twitter", userPermission.AuthRequired(twitterRevoke))
	// route.GET("/twitter/redirect", twitterRedirect)

	route.GET("/linkedin", linkedinAuth)
	route.DELETE("/linkedin", userPermission.AuthRequired(linkedinRevoke))
	route.GET("/linkedin/redirect", linkedinRedirect)

	// route.GET("/kakao", kakaoAuth)
	// route.DELETE("/kakao", userPermission.AuthRequired(kakaoRevoke))
	// route.GET("/kakao/redirect", kakaoRedirect)

	// route.GET("/naver", naverAuth)
	// route.DELETE("/naver", userPermission.AuthRequired(naverRevoke))
	// route.GET("/naver/redirect", naverRedirect)
}
Пример #5
0
// @Title Locations
// @Description Locations's router group.
func Locations(parentRoute *gin.RouterGroup) {
	route := parentRoute.Group("/locations")
	route.POST("", userPermission.AuthRequired(createLocation))
	route.GET("/:id", retrieveLocation)
	route.GET("", retrieveLocations)
	route.PUT("/:id", userPermission.AuthRequired(updateLocation))
	route.DELETE("/:id", userPermission.AuthRequired(deleteLocation))

	route.POST("/comments", userPermission.AuthRequired(createCommentOnLocation))
	route.GET("/:id/comments", retrieveCommentsOnLocation)
	route.PUT("/:id/comments/:commentId", userPermission.AuthRequired(updateCommentOnLocation))
	route.DELETE("/:id/comments/:commentId", userPermission.AuthRequired(deleteCommentOnLocation))

	route.POST("/likings", userPermission.AuthRequired(createLikingOnLocation))
	route.GET("/:id/likings", retrieveLikingsOnLocations)
	route.DELETE("/:id/likings/:userId", userPermission.AuthRequired(deleteLikingOnLocation))
}