diff --git a/README.md b/README.md index 5051419..bf74c90 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,28 @@ From source, you just have to clone the project, then `run godep get` to install - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/** - _GET_ - - [basicRoutes.func1](/api/api.go#L44) + - [basicRoutes.func1](/api/api.go#L103) + + +
+`/avatar` + +- [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) +- [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) +- [Logger](https://github.com/pressly/chi/middleware/logger.go#L26) +- [Recoverer](https://github.com/pressly/chi/middleware/recoverer.go#L16) +- [StripSlashes](https://github.com/pressly/chi/middleware/strip.go#L12) +- [Timeout.func1](https://github.com/pressly/chi/middleware/timeout.go#L33) +- [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) +- [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) +- **/avatar** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/** + - _GET_ + - [getAllAvatar](/api/avatar_route.go#L149) + - _POST_ + - [newAvatar](/api/avatar_route.go#L186)
@@ -46,11 +67,13 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/avatar** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:avatarID** - - [avatarContext](/api/avatar_route.go#L42) + - [avatarContext](/api/avatar_route.go#L133) - **/delete** - _DELETE_ - - [deleteAvatar](/api/avatar_route.go#L141) + - [deleteAvatar](/api/avatar_route.go#L239)
@@ -65,15 +88,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/avatar** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:avatarID** - - [avatarContext](/api/avatar_route.go#L42) + - [avatarContext](/api/avatar_route.go#L133) - **/update** - _PUT_ - - [updateAvatar](/api/avatar_route.go#L114) + - [updateAvatar](/api/avatar_route.go#L212)
-`/avatar/get` +`/avatar/all` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -84,14 +109,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/avatar** - - **/get** - - **/** - - _GET_ - - [getAllAvatar](/api/avatar_route.go#L58) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/all** + - _GET_ + - [getAllAvatar](/api/avatar_route.go#L149)
-`/avatar/get/all` +`/avatar/link/:avatarLink` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -102,14 +128,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/avatar** - - **/get** - - **/all** - - _GET_ - - [getAllAvatar](/api/avatar_route.go#L58) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/link** + - **/:avatarLink** + - [avatarContext](/api/avatar_route.go#L133) + - **/** + - _GET_ + - [getAvatarFromLink](/api/avatar_route.go#L173)
-`/avatar/get/fromlink/:avatarLink` +`/avatar/name/:avatarName` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -120,17 +150,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/avatar** - - **/get** - - **/fromlink** - - **/:avatarLink** - - [avatarContext](/api/avatar_route.go#L42) - - **/** - - _GET_ - - [getAvatarFromLink](/api/avatar_route.go#L79) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/name** + - **/:avatarName** + - [avatarContext](/api/avatar_route.go#L133) + - **/** + - _GET_ + - [getAvatarFromName](/api/avatar_route.go#L160)
-`/avatar/get/fromname/:avatarName` +`/avatar/new` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -141,17 +172,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/avatar** - - **/get** - - **/fromname** - - **/:avatarName** - - [avatarContext](/api/avatar_route.go#L42) - - **/** - - _GET_ - - [getAvatarFromName](/api/avatar_route.go#L70) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/new** + - _POST_ + - [newAvatar](/api/avatar_route.go#L186)
-`/avatar/new` +`/channel` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -161,10 +190,14 @@ From source, you just have to clone the project, then `run godep get` to install - [Timeout.func1](https://github.com/pressly/chi/middleware/timeout.go#L33) - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) -- **/avatar** - - **/new** +- **/channel** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/** + - _GET_ + - [getAllChannel](/api/channel_route.go#L170) - _POST_ - - [newAvatar](/api/avatar_route.go#L88) + - [newChannel](/api/channel_route.go#L224)
@@ -179,11 +212,13 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/channel** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:channelID** - - [channelContext](/api/channel_route.go#L44) + - [channelContext](/api/channel_route.go#L154) - **/delete** - _DELETE_ - - [deleteChannel](/api/channel_route.go#L169) + - [deleteChannel](/api/channel_route.go#L277)
@@ -198,15 +233,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/channel** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:channelID** - - [channelContext](/api/channel_route.go#L44) + - [channelContext](/api/channel_route.go#L154) - **/update** - _PUT_ - - [updateChannel](/api/channel_route.go#L142) + - [updateChannel](/api/channel_route.go#L250)
-`/channel/get` +`/channel/all` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -217,14 +254,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/channel** - - **/get** - - **/** - - _GET_ - - [getAllChannel](/api/channel_route.go#L62) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/all** + - _GET_ + - [getAllChannel](/api/channel_route.go#L170)
-`/channel/get/all` +`/channel/name/:channelName` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -235,14 +273,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/channel** - - **/get** - - **/all** - - _GET_ - - [getAllChannel](/api/channel_route.go#L62) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/name** + - **/:channelName** + - [channelContext](/api/channel_route.go#L154) + - **/** + - _GET_ + - [getChannelFromName](/api/channel_route.go#L206)
-`/channel/get/fromname/:channelName` +`/channel/new` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -253,17 +295,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/channel** - - **/get** - - **/fromname** - - **/:channelName** - - [channelContext](/api/channel_route.go#L44) - - **/** - - _GET_ - - [getChannelFromName](/api/channel_route.go#L98) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/new** + - _POST_ + - [newChannel](/api/channel_route.go#L224)
-`/channel/get/fromtype/:channelType` +`/channel/private` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -274,17 +314,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/channel** - - **/get** - - **/fromtype** - - **/:channelType** - - [channelContext](/api/channel_route.go#L44) - - **/** - - _GET_ - - [getChannelFromType](/api/channel_route.go#L107) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/private** + - _GET_ + - [getPrivateChannel](/api/channel_route.go#L194)
-`/channel/get/private` +`/channel/public` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -295,14 +333,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/channel** - - **/get** - - **/private** - - _GET_ - - [getPrivateChannel](/api/channel_route.go#L86) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/public** + - _GET_ + - [getPublicChannel](/api/channel_route.go#L182)
-`/channel/get/public` +`/channel/type/:channelType` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -313,14 +352,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/channel** - - **/get** - - **/public** - - _GET_ - - [getPublicChannel](/api/channel_route.go#L74) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/type** + - **/:channelType** + - [channelContext](/api/channel_route.go#L154) + - **/** + - _GET_ + - [getChannelFromType](/api/channel_route.go#L215)
-`/channel/new` +`/emoji` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -330,10 +373,14 @@ From source, you just have to clone the project, then `run godep get` to install - [Timeout.func1](https://github.com/pressly/chi/middleware/timeout.go#L33) - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) -- **/channel** - - **/new** +- **/emoji** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/** + - _GET_ + - [getAllEmoji](/api/emojis_route.go#L167) - _POST_ - - [newChannel](/api/channel_route.go#L116) + - [newEmoji](/api/emojis_route.go#L206)
@@ -348,11 +395,13 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/emoji** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:emojiID** - - [emojiContext](/api/emojis_route.go#L48) + - [emojiContext](/api/emojis_route.go#L149) - **/delete** - _DELETE_ - - [deleteEmoji](/api/emojis_route.go#L158) + - [deleteEmoji](/api/emojis_route.go#L259)
@@ -367,15 +416,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/emoji** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:emojiID** - - [emojiContext](/api/emojis_route.go#L48) + - [emojiContext](/api/emojis_route.go#L149) - **/update** - _PUT_ - - [updateEmoji](/api/emojis_route.go#L131) + - [updateEmoji](/api/emojis_route.go#L232)
-`/emoji/get` +`/emoji/all` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -386,14 +437,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/emoji** - - **/get** - - **/** - - _GET_ - - [getAllEmoji](/api/emojis_route.go#L66) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/all** + - _GET_ + - [getAllEmoji](/api/emojis_route.go#L167)
-`/emoji/get/all` +`/emoji/link/:emojiLink` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -404,14 +456,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/emoji** - - **/get** - - **/all** - - _GET_ - - [getAllEmoji](/api/emojis_route.go#L66) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/link** + - **/:emojiLink** + - [emojiContext](/api/emojis_route.go#L149) + - **/** + - _GET_ + - [getEmojiFromLink](/api/emojis_route.go#L197)
-`/emoji/get/fromlink/:emojiLink` +`/emoji/name/:emojiName` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -422,17 +478,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/emoji** - - **/get** - - **/fromlink** - - **/:emojiLink** - - [emojiContext](/api/emojis_route.go#L48) - - **/** - - _GET_ - - [getEmojiFromLink](/api/emojis_route.go#L96) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/name** + - **/:emojiName** + - [emojiContext](/api/emojis_route.go#L149) + - **/** + - _GET_ + - [getEmojiFromName](/api/emojis_route.go#L179)
-`/emoji/get/fromname/:emojiName` +`/emoji/new` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -443,17 +500,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/emoji** - - **/get** - - **/fromname** - - **/:emojiName** - - [emojiContext](/api/emojis_route.go#L48) - - **/** - - _GET_ - - [getEmojiFromName](/api/emojis_route.go#L78) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/new** + - _POST_ + - [newEmoji](/api/emojis_route.go#L206)
-`/emoji/get/fromshortcut/:emojiShortcut` +`/emoji/shortcut/:emojiShortcut` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -464,17 +519,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/emoji** - - **/get** - - **/fromshortcut** - - **/:emojiShortcut** - - [emojiContext](/api/emojis_route.go#L48) - - **/** - - _GET_ - - [getEmojiFromShortcut](/api/emojis_route.go#L87) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/shortcut** + - **/:emojiShortcut** + - [emojiContext](/api/emojis_route.go#L149) + - **/** + - _GET_ + - [getEmojiFromShortcut](/api/emojis_route.go#L188)
-`/emoji/new` +`/folder` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -484,10 +540,14 @@ From source, you just have to clone the project, then `run godep get` to install - [Timeout.func1](https://github.com/pressly/chi/middleware/timeout.go#L33) - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) -- **/emoji** - - **/new** +- **/folder** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/** + - _GET_ + - [getAllFolder](/api/folder_route.go#L179) - _POST_ - - [newEmoji](/api/emojis_route.go#L105) + - [newFolder](/api/folder_route.go#L240)
@@ -502,11 +562,13 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/folder** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:folderID** - - [folderContext](/api/folder_route.go#L49) + - [folderContext](/api/folder_route.go#L161) - **/delete** - _DELETE_ - - [deleteFolder](/api/folder_route.go#L181) + - [deleteFolder](/api/folder_route.go#L293)
@@ -521,15 +583,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/folder** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:folderID** - - [folderContext](/api/folder_route.go#L49) + - [folderContext](/api/folder_route.go#L161) - **/update** - _PUT_ - - [updateFolder](/api/folder_route.go#L154) + - [updateFolder](/api/folder_route.go#L266)
-`/folder/get` +`/folder/all` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -540,14 +604,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/folder** - - **/get** - - **/** - - _GET_ - - [getAllFolder](/api/folder_route.go#L67) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/all** + - _GET_ + - [getAllFolder](/api/folder_route.go#L179)
-`/folder/get/all` +`/folder/link/:folderLink` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -558,14 +623,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/folder** - - **/get** - - **/all** - - _GET_ - - [getAllFolder](/api/folder_route.go#L67) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/link** + - **/:folderLink** + - [folderContext](/api/folder_route.go#L161) + - **/** + - _GET_ + - [getFolderFromLink](/api/folder_route.go#L209)
-`/folder/get/foldername/:folderName` +`/folder/message` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -576,17 +645,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/folder** - - **/get** - - **/foldername** - - **/:folderName** - - [folderContext](/api/folder_route.go#L49) - - **/** - - _GET_ - - [getFolderFromName](/api/folder_route.go#L79) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/message** + - _POST_ + - [getFolderFromMessage](/api/folder_route.go#L218)
-`/folder/get/link/:folderLink` +`/folder/name/:folderName` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -597,17 +664,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/folder** - - **/get** - - **/link** - - **/:folderLink** - - [folderContext](/api/folder_route.go#L49) - - **/** - - _GET_ - - [getFolderFromLink](/api/folder_route.go#L97) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/name** + - **/:folderName** + - [folderContext](/api/folder_route.go#L161) + - **/** + - _GET_ + - [getFolderFromName](/api/folder_route.go#L191)
-`/folder/get/message` +`/folder/new` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -618,14 +686,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/folder** - - **/get** - - **/message** - - _POST_ - - [getFolderFromMessage](/api/folder_route.go#L106) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/new** + - _POST_ + - [newFolder](/api/folder_route.go#L240)
-`/folder/get/type/:folderType` +`/folder/type/:folderType` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -636,17 +705,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/folder** - - **/get** - - **/type** - - **/:folderType** - - [folderContext](/api/folder_route.go#L49) - - **/** - - _GET_ - - [getFolderFromType](/api/folder_route.go#L88) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/type** + - **/:folderType** + - [folderContext](/api/folder_route.go#L161) + - **/** + - _GET_ + - [getFolderFromType](/api/folder_route.go#L200)
-`/folder/new` +`/heartbeat` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -656,14 +726,29 @@ From source, you just have to clone the project, then `run godep get` to install - [Timeout.func1](https://github.com/pressly/chi/middleware/timeout.go#L33) - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) -- **/folder** - - **/new** - - _POST_ - - [newFolder](/api/folder_route.go#L128) +- **/heartbeat** + - _GET_ + - [basicRoutes.func3](/api/api.go#L118)
-`/message/:messageID/delete` +`/login` + +- [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) +- [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) +- [Logger](https://github.com/pressly/chi/middleware/logger.go#L26) +- [Recoverer](https://github.com/pressly/chi/middleware/recoverer.go#L16) +- [StripSlashes](https://github.com/pressly/chi/middleware/strip.go#L12) +- [Timeout.func1](https://github.com/pressly/chi/middleware/timeout.go#L33) +- [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) +- [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) +- **/login** + - _POST_ + - [loginMiddleware](/api/api.go#L146) + +
+
+`/message` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -674,15 +759,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/message** - - **/:messageID** - - [messageContext](/api/messge_route.go#L38) - - **/delete** - - _DELETE_ - - [deleteMessage](/api/messge_route.go#L170) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/** + - _GET_ + - [getAllMessage](/api/message_route.go#L154) + - _POST_ + - [newMessage](/api/message_route.go#L219)
-`/message/:messageID/update` +`/message/:messageID/delete` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -693,15 +780,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/message** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:messageID** - - [messageContext](/api/messge_route.go#L38) - - **/update** - - _PUT_ - - [updateMessage](/api/messge_route.go#L143) + - [messageContext](/api/message_route.go#L140) + - **/delete** + - _DELETE_ + - [deleteMessageFunction](/api/message_route.go#L272)
-`/message/get` +`/message/:messageID/update` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -712,14 +801,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/message** - - **/get** - - **/** - - _GET_ - - [getAllMessage](/api/messge_route.go#L52) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/:messageID** + - [messageContext](/api/message_route.go#L140) + - **/update** + - _PUT_ + - [updateMessage](/api/message_route.go#L245)
-`/message/get/all` +`/message/all` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -730,14 +822,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/message** - - **/get** - - **/all** - - _GET_ - - [getAllMessage](/api/messge_route.go#L52) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/all** + - _GET_ + - [getAllMessage](/api/message_route.go#L154)
-`/message/get/channel` +`/message/channel` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -748,14 +841,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/message** - - **/get** - - **/channel** - - _POST_ - - [getMessageFromChannel](/api/messge_route.go#L95) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/channel** + - _POST_ + - [getMessageFromChannel](/api/message_route.go#L197)
-`/message/get/creator` +`/message/creator` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -766,14 +860,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/message** - - **/get** - - **/creator** - - _POST_ - - [getMessageFromUser](/api/messge_route.go#L73) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/creator** + - _POST_ + - [getMessageFromUser](/api/message_route.go#L175)
-`/message/get/date/:date` +`/message/date/:messageDate` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -784,13 +879,14 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/message** - - **/get** - - **/date** - - **/:date** - - [messageContext](/api/messge_route.go#L38) - - **/** - - _GET_ - - [getMessageFromDate](/api/messge_route.go#L64) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/date** + - **/:messageDate** + - [messageContext](/api/message_route.go#L140) + - **/** + - _GET_ + - [getMessageFromDate](/api/message_route.go#L166)
@@ -805,13 +901,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/message** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/new** - _POST_ - - [newMessage](/api/messge_route.go#L117) + - [newMessage](/api/message_route.go#L219)
-`/organisation/:organisationID/update` +`/organisation` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -822,15 +920,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/organisation** - - **/:organisationID** - - [organisationContext](/api/organisation_route.go#L29) - - **/update** - - _PUT_ - - [updateOrganisation](/api/organisation_route.go#L79) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/** + - _GET_ + - [getAllOrganisation](/api/organisation_route.go#L98) + - _POST_ + - [newOrganisation](/api/organisation_route.go#L110)
-`/organisation/get` +`/organisation/:organisationID/update` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -841,14 +941,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/organisation** - - **/get** - - **/** - - _GET_ - - [getAllOrganisation](/api/organisation_route.go#L41) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/:organisationID** + - [organisationContext](/api/organisation_route.go#L86) + - **/update** + - _PUT_ + - [updateOrganisation](/api/organisation_route.go#L136)
-`/organisation/get/all` +`/organisation/all` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -859,10 +962,11 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/organisation** - - **/get** - - **/all** - - _GET_ - - [getAllOrganisation](/api/organisation_route.go#L41) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/all** + - _GET_ + - [getAllOrganisation](/api/organisation_route.go#L98)
@@ -877,9 +981,11 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/organisation** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/new** - _POST_ - - [newOrganisation](/api/organisation_route.go#L53) + - [newOrganisation](/api/organisation_route.go#L110)
@@ -895,11 +1001,11 @@ From source, you just have to clone the project, then `run godep get` to install - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/panic** - _GET_ - - [basicRoutes.func3](/api/api.go#L52) + - [basicRoutes.func4](/api/api.go#L128)
-`/parameter/:parameterID/update` +`/parameter` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -910,15 +1016,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/parameter** - - **/:parameterID** - - [parameterContext](/api/parameter_route.go#L29) - - **/update** - - _PUT_ - - [updateParameter](/api/parameter_route.go#L79) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/** + - _POST_ + - [newParameter](/api/parameter_route.go#L111) + - _GET_ + - [getAllParameter](/api/parameter_route.go#L99)
-`/parameter/get` +`/parameter/:parameterID/update` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -929,14 +1037,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/parameter** - - **/get** - - **/** - - _GET_ - - [getAllParameter](/api/parameter_route.go#L41) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/:parameterID** + - [parameterContext](/api/parameter_route.go#L87) + - **/update** + - _PUT_ + - [updateParameter](/api/parameter_route.go#L137)
-`/parameter/get/all` +`/parameter/all` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -947,10 +1058,11 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/parameter** - - **/get** - - **/all** - - _GET_ - - [getAllParameter](/api/parameter_route.go#L41) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/all** + - _GET_ + - [getAllParameter](/api/parameter_route.go#L99)
@@ -965,9 +1077,11 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/parameter** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/new** - _POST_ - - [newParameter](/api/parameter_route.go#L53) + - [newParameter](/api/parameter_route.go#L111)
@@ -983,11 +1097,11 @@ From source, you just have to clone the project, then `run godep get` to install - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/ping** - _GET_ - - [basicRoutes.func2](/api/api.go#L48) + - [basicRoutes.func2](/api/api.go#L115)
-`/role/:roleID/delete` +`/role` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -998,15 +1112,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/role** - - **/:roleID** - - [roleContext](/api/role_route.go#L37) - - **/delete** - - _DELETE_ - - [deleteRole](/api/role_route.go#L147) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/** + - _POST_ + - [newRole](/api/role_route.go#L183) + - _GET_ + - [getAllRole](/api/role_route.go#L140)
-`/role/:roleID/update` +`/role/:roleID/delete` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1017,15 +1133,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/role** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:roleID** - - [roleContext](/api/role_route.go#L37) - - **/update** - - _PUT_ - - [updateRole](/api/role_route.go#L120) + - [roleContext](/api/role_route.go#L126) + - **/delete** + - _DELETE_ + - [deleteRole](/api/role_route.go#L236)
-`/role/get` +`/role/:roleID/update` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1036,14 +1154,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/role** - - **/get** - - **/** - - _GET_ - - [getAllRole](/api/role_route.go#L51) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/:roleID** + - [roleContext](/api/role_route.go#L126) + - **/update** + - _PUT_ + - [updateRole](/api/role_route.go#L209)
-`/role/get/all` +`/role/all` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1054,14 +1175,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/role** - - **/get** - - **/all** - - _GET_ - - [getAllRole](/api/role_route.go#L51) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/all** + - _GET_ + - [getAllRole](/api/role_route.go#L140)
-`/role/get/fromname/:roleName` +`/role/name/:roleName` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1072,17 +1194,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/role** - - **/get** - - **/fromname** - - **/:roleName** - - [roleContext](/api/role_route.go#L37) - - **/** - - _GET_ - - [getRoleFromName](/api/role_route.go#L63) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/name** + - **/:roleName** + - [roleContext](/api/role_route.go#L126) + - **/** + - _GET_ + - [getRoleFromName](/api/role_route.go#L152)
-`/role/get/fromrights` +`/role/new` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1093,14 +1216,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/role** - - **/get** - - **/fromrights** - - _POST_ - - [getRoleFromRight](/api/role_route.go#L72) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/new** + - _POST_ + - [newRole](/api/role_route.go#L183)
-`/role/new` +`/role/rights` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1111,13 +1235,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/role** - - **/new** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/rights** - _POST_ - - [newRole](/api/role_route.go#L94) + - [getRoleFromRight](/api/role_route.go#L161)
-`/user/:userID/delete` +`/user` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1128,15 +1254,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/:userID** - - [userContext](/api/user_route.go#L68) - - **/delete** - - _DELETE_ - - [deleteUser](/api/user_route.go#L245) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/** + - _GET_ + - [getAllUser](/api/user_route.go#L233) + - _POST_ + - [newUser](/api/user_route.go#L333)
-`/user/:userID/update` +`/user/:userID/delete` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1147,15 +1275,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) - **/:userID** - - [userContext](/api/user_route.go#L68) - - **/update** - - _PUT_ - - [updateUser](/api/user_route.go#L218) + - [userContext](/api/user_route.go#L209) + - **/delete** + - _DELETE_ + - [deleteUser](/api/user_route.go#L386)
-`/user/get` +`/user/:userID/update` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1166,14 +1296,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/get** - - **/** - - _GET_ - - [getAllUser](/api/user_route.go#L92) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/:userID** + - [userContext](/api/user_route.go#L209) + - **/update** + - _PUT_ + - [updateUser](/api/user_route.go#L359)
-`/user/get/all` +`/user/all` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1184,14 +1317,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/get** - - **/all** - - _GET_ - - [getAllUser](/api/user_route.go#L92) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/all** + - _GET_ + - [getAllUser](/api/user_route.go#L233)
-`/user/get/date/:date` +`/user/date` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1202,17 +1336,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/get** - - **/date** - - **/:date** - - [userContext](/api/user_route.go#L68) - - **/** - - _GET_ - - [getUserFromDate](/api/user_route.go#L161) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/date** + - _GET_ + - [getOrderedByDate](/api/user_route.go#L302)
-`/user/get/deleted` +`/user/deleted` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1223,14 +1355,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/get** - - **/deleted** - - _GET_ - - [getDeletedUser](/api/user_route.go#L104) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/deleted** + - _GET_ + - [getDeletedUser](/api/user_route.go#L245)
-`/user/get/email/:userEmail` +`/user/email/:userEmail` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1241,17 +1374,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/get** - - **/email** - - **/:userEmail** - - [userContext](/api/user_route.go#L68) - - **/** - - _GET_ - - [getUserFromEmail](/api/user_route.go#L152) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/email** + - **/:userEmail** + - [userContext](/api/user_route.go#L209) + - **/** + - _GET_ + - [getUserFromEmail](/api/user_route.go#L293)
-`/user/get/firstname/:firstName` +`/user/firstname/:firstName` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1262,17 +1396,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/get** - - **/firstname** - - **/:firstName** - - [userContext](/api/user_route.go#L68) - - **/** - - _GET_ - - [getUserFromFirstName](/api/user_route.go#L134) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/firstname** + - **/:firstName** + - [userContext](/api/user_route.go#L209) + - **/** + - _GET_ + - [getUserFromFirstName](/api/user_route.go#L275)
-`/user/get/lastname/:lastName` +`/user/lastname/:lastName` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1283,17 +1418,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/get** - - **/lastname** - - **/:lastName** - - [userContext](/api/user_route.go#L68) - - **/** - - _GET_ - - [getUserFromLastName](/api/user_route.go#L143) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/lastname** + - **/:lastName** + - [userContext](/api/user_route.go#L209) + - **/** + - _GET_ + - [getUserFromLastName](/api/user_route.go#L284)
-`/user/get/nickname/:nickName` +`/user/new` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1304,17 +1440,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/get** - - **/nickname** - - **/:nickName** - - [userContext](/api/user_route.go#L68) - - **/** - - _GET_ - - [getUserFromNickName](/api/user_route.go#L125) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/new** + - _POST_ + - [newUser](/api/user_route.go#L333)
-`/user/get/role` +`/user/nickname/:nickName` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1325,14 +1459,18 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/get** - - **/role** - - _POST_ - - [getUserFromRole](/api/user_route.go#L170) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/nickname** + - **/:nickName** + - [userContext](/api/user_route.go#L209) + - **/** + - _GET_ + - [getUserFromNickName](/api/user_route.go#L266)
-`/user/get/username/:userName` +`/user/role` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1343,17 +1481,15 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/get** - - **/username** - - **/:userName** - - [userContext](/api/user_route.go#L68) - - **/** - - _GET_ - - [getUserFromName](/api/user_route.go#L116) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/role** + - _POST_ + - [getUserFromRole](/api/user_route.go#L311)
-`/user/new` +`/user/username/:userName` - [RequestID](https://github.com/pressly/chi/middleware/request_id.go#L63) - [RealIP](https://github.com/pressly/chi/middleware/realip.go#L29) @@ -1364,14 +1500,17 @@ From source, you just have to clone the project, then `run godep get` to install - [Heartbeat.func1](https://github.com/pressly/chi/middleware/heartbeat.go#L13) - [CloseNotify](https://github.com/pressly/chi/middleware/closenotify17.go#L16) - **/user** - - **/new** - - _POST_ - - [newUser](/api/user_route.go#L192) + - [github.com/goware/jwtauth.(*JwtAuth).Verifier-fm](/api/avatar_route.go#L23) + - [Authenticator](https://github.com/goware/jwtauth/jwtauth.go#L196) + - **/username** + - **/:userName** + - [userContext](/api/user_route.go#L209) + - **/** + - _GET_ + - [getUserFromName](/api/user_route.go#L257)
-Total # of routes: 72 - ## Models ### Avatar diff --git a/api/api.go b/api/api.go index ec7b6ed..481e2be 100644 --- a/api/api.go +++ b/api/api.go @@ -1,17 +1,25 @@ package api import ( + "bytes" + "crypto/rand" + "encoding/base32" "flag" "log" "net/http" + jwt "github.com/dgrijalva/jwt-go" + "github.com/goware/jwtauth" "github.com/jinzhu/gorm" "github.com/pressly/chi" "github.com/pressly/chi/docgen" "github.com/pressly/chi/middleware" + chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/configs" "github.com/titouanfreville/popcubeapi/datastores" + "github.com/titouanfreville/popcubeapi/models" "github.com/titouanfreville/popcubeapi/utils" + renderPackage "github.com/unrolled/render" ) type saveDb struct { @@ -22,12 +30,50 @@ type saveDb struct { type key string var ( - routes = flag.Bool("routes", false, "Generate router documentation") - dbStore = saveDb{} - error422 = utils.NewAPIError(422, "parse.request.body", "Request json object not correct.") - error503 = utils.NewAPIError(503, "database.maintenance", "Database is currently in maintenance state. We are doing our best to get it back online ASAP.") + hmacSampleSecret []byte + tokenAuth *jwtauth.JwtAuth + userToken *jwt.Token + encoding = base32.NewEncoding("ybndrfg8ejkmcpqxot1uwisza345h769") + render = renderPackage.New() + routes = flag.Bool("routes", false, "Generate router documentation") + dbStore = saveDb{} + error401 = utils.NewAPIError(401, "unauthorized", "You did not login into the app. Please login to access those resources") + error422 = utils.NewAPIError(422, "parse.request.body", "Request json object not correct.") + error503 = utils.NewAPIError(503, "database.maintenance", "Database is currently in maintenance state. We are doing our best to get it back online ASAP.") ) +func newRandomString(length int) string { + var b bytes.Buffer + str := make([]byte, length+8) + rand.Read(str) + encoder := base32.NewEncoder(encoding, &b) + encoder.Write(str) + encoder.Close() + b.Truncate(length) + return b.String() +} +func initAuth() { + secret := newRandomString(100) + hmacSampleSecret = []byte(secret) + tokenAuth = jwtauth.New("HS256", hmacSampleSecret, hmacSampleSecret) +} + +// createToken create JWT auth token for current login user +func createToken(user models.User) (string, error) { + claims := jwt.MapClaims{ + "name": user.Username, + "email": user.Email, + } + unsignedToken := *jwt.NewWithClaims(jwt.SigningMethodHS256, claims) + tokenString, err := unsignedToken.SignedString(hmacSampleSecret) + + if err != nil { + return "", err + } + + return tokenString, nil +} + // newRouter initialise api serveur. func newRouter() *chi.Mux { return chi.NewRouter() @@ -41,7 +87,7 @@ func initMiddleware(router *chi.Mux) { router.Use(middleware.Recoverer) router.Use(middleware.StripSlashes) router.Use(middleware.Timeout(5 * 1000)) - // router.Use(middleware.Heartbeat("/heartbeat")) + router.Use(middleware.Heartbeat("/heartbeat")) router.Use(middleware.CloseNotify) } @@ -69,6 +115,7 @@ func basicRoutes(router *chi.Mux) { router.Get("/ping", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("pong")) }) + router.Get("/heartbeat", func(w http.ResponseWriter, r *http.Request) {}) // swagger:route GET /panic Test panic // // Should result in 500 @@ -81,6 +128,52 @@ func basicRoutes(router *chi.Mux) { router.Get("/panic", func(w http.ResponseWriter, r *http.Request) { panic("C'est la panique, panique, panique. Sur le périphérique") }) + // swagger:route POST /login Login login + // + // Try to log user in + // + // Login user with provided USERNAME && Password + // + // Responses: + // 200: loginOk + // 404: incorrectIds + // 422: wrongEntity + // 503: databaseError + router.Post("/login", loginMiddleware) +} + +// loginMiddleware login funcion providing user && jwt auth token +func loginMiddleware(w http.ResponseWriter, r *http.Request) { + var data struct { + Login string `json:"login"` + Password string `json:"password"` + OmitID interface{} `json:"id,omitempty"` + } + store := datastores.Store() + response := loginOk{} + db := dbStore.db + request := r.Body + err := chiRender.Bind(request, &data) + if err != nil { + render.JSON(w, error422.StatusCode, error422) + return + } + if err := db.DB().Ping(); err == nil { + user, err := store.User().Login(data.Login, data.Password, db) + if err == nil { + var terr error + response.User = user + response.Token, terr = createToken(user) + if terr == nil { + render.JSON(w, 200, response) + return + } + render.JSON(w, err.StatusCode, err) + return + } + } + render.JSON(w, error503.StatusCode, error503) + } // StartAPI initialise the api with provided host and port. @@ -93,7 +186,7 @@ func StartAPI(hostname string, port string, DbConnectionInfo *configs.DbConnecti host := DbConnectionInfo.Host dbport := DbConnectionInfo.Port dbStore.db = datastores.Store().InitConnection(user, db, pass, host, dbport) - + initAuth() initMiddleware(router) basicRoutes(router) initAvatarRoute(router) @@ -109,14 +202,12 @@ func StartAPI(hostname string, port string, DbConnectionInfo *configs.DbConnecti // Passing -routes to the program will generate docs for the above // router definition. See the `routes.json` file in this folder for // the output. - if *routes { - log.Println(docgen.JSONRoutesDoc(router)) - log.Println(docgen.BuildDoc(router)) - log.Println(docgen.MarkdownRoutesDoc(router, docgen.MarkdownOpts{ - ProjectPath: "github.com/titouanfreville/popcubeapi", - Intro: "Welcomme to popcube user api.", - })) - } + log.Println(docgen.JSONRoutesDoc(router)) + log.Println(docgen.BuildDoc(router)) + log.Println(docgen.MarkdownRoutesDoc(router, docgen.MarkdownOpts{ + ProjectPath: "github.com/titouanfreville/popcubeapi", + Intro: "Welcomme to popcube user api.", + })) http.ListenAndServe(hostname+":"+port, router) } diff --git a/api/api_parameters.go b/api/api_parameters.go index 5917c20..1be9ec2 100644 --- a/api/api_parameters.go +++ b/api/api_parameters.go @@ -309,3 +309,23 @@ type userObjectParam struct { } // <><><><><> <><><><><> <><><><><> <><><><><> // +// <><><><><> LOGIN PARAMETERS <><><><><> // + +// loginParameterModel is the object you have to pass to login +// +// swagger:model loginParameterModel +type loginParameterModel struct { + // user name + // required: true + Login string `json:"login"` + // user password hashed + // required: true + Password string `json:"password"` +} + +// swagger:parameters Login +type loginParam struct { + // Login informations + // in:body + Login loginParameterModel `json:"login"` +} diff --git a/api/api_responses.go b/api/api_responses.go index bf7d606..5ee9f32 100644 --- a/api/api_responses.go +++ b/api/api_responses.go @@ -16,6 +16,16 @@ type generalOk struct { Message string `json:"message,omitempty"` } +// loginOk when login correctly proceed, return the user and an auth token. +// +// swagger:response loginOk +type loginOk struct { + // in:body + User models.User + // in:body + Token string +} + // --------------------------------------------------- // Errors -------------------------------------------- @@ -43,6 +53,14 @@ type databaseError struct { Error utils.AppError } +// incorrectIds return error login message +// +// swagger:response incorrectIds +type incorrectIds struct { + // in:body + Error utils.AppError +} + // --------------------------------------------------- // Unknow -------------------------------------------- diff --git a/api/avatar_route.go b/api/avatar_route.go index 492d022..3c13237 100644 --- a/api/avatar_route.go +++ b/api/avatar_route.go @@ -5,11 +5,11 @@ import ( "net/http" "strconv" + "github.com/goware/jwtauth" "github.com/pressly/chi" chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/datastores" "github.com/titouanfreville/popcubeapi/models" - renderPackage "github.com/unrolled/render" ) const ( @@ -20,6 +20,8 @@ const ( func initAvatarRoute(router chi.Router) { router.Route("/avatar", func(r chi.Router) { + r.Use(tokenAuth.Verifier) + r.Use(jwtauth.Authenticator) // swagger:route GET /avatar Avatars getAllAvatar // // Get avatars @@ -146,7 +148,6 @@ func avatarContext(next http.Handler) http.Handler { func getAllAvatar(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Avatar().GetAll(db) @@ -158,7 +159,7 @@ func getAllAvatar(w http.ResponseWriter, r *http.Request) { func getAvatarFromName(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { name := r.Context().Value(avatarNameKey).(string) @@ -171,7 +172,7 @@ func getAvatarFromName(w http.ResponseWriter, r *http.Request) { func getAvatarFromLink(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { link := r.Context().Value(avatarLinkKey).(string) @@ -188,7 +189,7 @@ func newAvatar(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -214,7 +215,7 @@ func updateAvatar(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -238,7 +239,7 @@ func updateAvatar(w http.ResponseWriter, r *http.Request) { func deleteAvatar(w http.ResponseWriter, r *http.Request) { avatar := r.Context().Value(oldAvatarKey).(models.Avatar) store := datastores.Store() - render := renderPackage.New() + message := deleteMessageModel{ Object: avatar, } diff --git a/api/channel_route.go b/api/channel_route.go index 6df5026..e7fca20 100644 --- a/api/channel_route.go +++ b/api/channel_route.go @@ -5,11 +5,11 @@ import ( "net/http" "strconv" + "github.com/goware/jwtauth" "github.com/pressly/chi" chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/datastores" "github.com/titouanfreville/popcubeapi/models" - renderPackage "github.com/unrolled/render" ) const ( @@ -20,6 +20,8 @@ const ( func initChannelRoute(router chi.Router) { router.Route("/channel", func(r chi.Router) { + r.Use(tokenAuth.Verifier) + r.Use(jwtauth.Authenticator) // swagger:route GET /channel Channels getAllChannel // // Get channels @@ -167,7 +169,7 @@ func channelContext(next http.Handler) http.Handler { func getAllChannel(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Channel().GetAll(db) @@ -179,7 +181,7 @@ func getAllChannel(w http.ResponseWriter, r *http.Request) { func getPublicChannel(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Channel().GetPublic(db) @@ -191,7 +193,7 @@ func getPublicChannel(w http.ResponseWriter, r *http.Request) { func getPrivateChannel(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Channel().GetPrivate(db) @@ -203,7 +205,7 @@ func getPrivateChannel(w http.ResponseWriter, r *http.Request) { func getChannelFromName(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db name := r.Context().Value(channelNameKey).(string) channel := store.Channel().GetByName(name, db) @@ -212,7 +214,7 @@ func getChannelFromName(w http.ResponseWriter, r *http.Request) { func getChannelFromType(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db channelType := r.Context().Value(channelTypeKey).(string) channel := store.Channel().GetByType(channelType, db) @@ -225,7 +227,7 @@ func newChannel(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -251,7 +253,7 @@ func updateChannel(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -275,7 +277,7 @@ func updateChannel(w http.ResponseWriter, r *http.Request) { func deleteChannel(w http.ResponseWriter, r *http.Request) { channel := r.Context().Value(oldChannelKey).(models.Channel) store := datastores.Store() - render := renderPackage.New() + message := deleteMessageModel{ Object: channel, } diff --git a/api/emojis_route.go b/api/emojis_route.go index ac63518..6ccd8f5 100644 --- a/api/emojis_route.go +++ b/api/emojis_route.go @@ -5,11 +5,11 @@ import ( "net/http" "strconv" + "github.com/goware/jwtauth" "github.com/pressly/chi" chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/datastores" "github.com/titouanfreville/popcubeapi/models" - renderPackage "github.com/unrolled/render" ) const ( @@ -21,6 +21,8 @@ const ( func initEmojiRoute(router chi.Router) { router.Route("/emoji", func(r chi.Router) { + r.Use(tokenAuth.Verifier) + r.Use(jwtauth.Authenticator) // swagger:route GET /emoji Emojis getAllEmoji // // Get emojis @@ -164,7 +166,7 @@ func emojiContext(next http.Handler) http.Handler { func getAllEmoji(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Emoji().GetAll(db) @@ -176,7 +178,7 @@ func getAllEmoji(w http.ResponseWriter, r *http.Request) { func getEmojiFromName(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db name := r.Context().Value(emojiNameKey).(string) emoji := store.Emoji().GetByName(name, db) @@ -185,7 +187,7 @@ func getEmojiFromName(w http.ResponseWriter, r *http.Request) { func getEmojiFromShortcut(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db link := r.Context().Value(emojiShortcutKey).(string) emoji := store.Emoji().GetByShortcut(link, db) @@ -194,7 +196,7 @@ func getEmojiFromShortcut(w http.ResponseWriter, r *http.Request) { func getEmojiFromLink(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db link := r.Context().Value(emojiLinkKey).(string) emoji := store.Emoji().GetByLink(link, db) @@ -207,7 +209,7 @@ func newEmoji(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -233,7 +235,7 @@ func updateEmoji(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -257,7 +259,7 @@ func updateEmoji(w http.ResponseWriter, r *http.Request) { func deleteEmoji(w http.ResponseWriter, r *http.Request) { emoji := r.Context().Value(oldEmojiKey).(models.Emoji) store := datastores.Store() - render := renderPackage.New() + message := deleteMessageModel{ Object: emoji, } diff --git a/api/folder_route.go b/api/folder_route.go index 2c58034..8a58b91 100644 --- a/api/folder_route.go +++ b/api/folder_route.go @@ -5,11 +5,11 @@ import ( "net/http" "strconv" + "github.com/goware/jwtauth" "github.com/pressly/chi" chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/datastores" "github.com/titouanfreville/popcubeapi/models" - renderPackage "github.com/unrolled/render" ) const ( @@ -21,6 +21,8 @@ const ( func initFolderRoute(router chi.Router) { router.Route("/folder", func(r chi.Router) { + r.Use(tokenAuth.Verifier) + r.Use(jwtauth.Authenticator) // swagger:route GET /folder Folders getAllFolder // // Get folders @@ -176,7 +178,7 @@ func folderContext(next http.Handler) http.Handler { func getAllFolder(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Folder().GetAll(db) @@ -188,7 +190,7 @@ func getAllFolder(w http.ResponseWriter, r *http.Request) { func getFolderFromName(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db name := r.Context().Value(folderNameKey).(string) folder := store.Folder().GetByName(name, db) @@ -197,7 +199,7 @@ func getFolderFromName(w http.ResponseWriter, r *http.Request) { func getFolderFromType(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db folderType := r.Context().Value(folderTypeKey).(string) folder := store.Folder().GetByType(folderType, db) @@ -206,7 +208,7 @@ func getFolderFromType(w http.ResponseWriter, r *http.Request) { func getFolderFromLink(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db link := r.Context().Value(folderLinkKey).(string) folder := store.Folder().GetByLink(link, db) @@ -219,7 +221,7 @@ func getFolderFromMessage(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -241,7 +243,7 @@ func newFolder(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -267,7 +269,7 @@ func updateFolder(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -291,7 +293,7 @@ func updateFolder(w http.ResponseWriter, r *http.Request) { func deleteFolder(w http.ResponseWriter, r *http.Request) { folder := r.Context().Value("folder").(models.Folder) store := datastores.Store() - render := renderPackage.New() + message := deleteMessageModel{ Object: folder, } diff --git a/api/member_route.go b/api/member_route.go index 75993ee..eae5c45 100644 --- a/api/member_route.go +++ b/api/member_route.go @@ -5,11 +5,11 @@ import ( "net/http" "strconv" + "github.com/goware/jwtauth" "github.com/pressly/chi" chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/datastores" "github.com/titouanfreville/popcubeapi/models" - renderPackage "github.com/unrolled/render" ) const ( @@ -18,6 +18,8 @@ const ( func initMemberRoute(router chi.Router) { router.Route("/member", func(r chi.Router) { + r.Use(tokenAuth.Verifier) + r.Use(jwtauth.Authenticator) // swagger:route GET /member Members getAllMember // // Get members @@ -144,7 +146,7 @@ func memberContext(next http.Handler) http.Handler { func getAllMember(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Member().GetAll(db) @@ -160,7 +162,7 @@ func getMemberFromUser(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -182,7 +184,7 @@ func getMemberFromChannel(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -204,7 +206,7 @@ func getMemberFromRole(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -226,7 +228,7 @@ func newMember(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -252,7 +254,7 @@ func updateMember(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -276,7 +278,7 @@ func updateMember(w http.ResponseWriter, r *http.Request) { func deleteMember(w http.ResponseWriter, r *http.Request) { member := r.Context().Value(oldMemberKey).(models.Member) store := datastores.Store() - render := renderPackage.New() + message := deleteMessageModel{ Object: member, } diff --git a/api/message_route.go b/api/message_route.go index f4be1ba..ca016fa 100644 --- a/api/message_route.go +++ b/api/message_route.go @@ -5,11 +5,11 @@ import ( "net/http" "strconv" + "github.com/goware/jwtauth" "github.com/pressly/chi" chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/datastores" "github.com/titouanfreville/popcubeapi/models" - renderPackage "github.com/unrolled/render" ) const ( @@ -19,6 +19,8 @@ const ( func initMessageRoute(router chi.Router) { router.Route("/message", func(r chi.Router) { + r.Use(tokenAuth.Verifier) + r.Use(jwtauth.Authenticator) // swagger:route GET /message Messages getAllMessage // // Get messages @@ -151,7 +153,7 @@ func messageContext(next http.Handler) http.Handler { func getAllMessage(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Message().GetAll(db) @@ -163,7 +165,7 @@ func getAllMessage(w http.ResponseWriter, r *http.Request) { func getMessageFromDate(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db date := r.Context().Value(messageDateKey).(int) message := store.Message().GetByDate(date, db) @@ -176,7 +178,7 @@ func getMessageFromUser(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -198,7 +200,7 @@ func getMessageFromChannel(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -220,7 +222,7 @@ func newMessage(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -246,7 +248,7 @@ func updateMessage(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -270,7 +272,7 @@ func updateMessage(w http.ResponseWriter, r *http.Request) { func deleteMessageFunction(w http.ResponseWriter, r *http.Request) { message := r.Context().Value(oldMessageKey).(models.Message) store := datastores.Store() - render := renderPackage.New() + dmessage := deleteMessageModel{ Object: message, } diff --git a/api/organisation_route.go b/api/organisation_route.go index f2d2426..9c298c5 100644 --- a/api/organisation_route.go +++ b/api/organisation_route.go @@ -5,11 +5,11 @@ import ( "net/http" "strconv" + "github.com/goware/jwtauth" "github.com/pressly/chi" chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/datastores" "github.com/titouanfreville/popcubeapi/models" - renderPackage "github.com/unrolled/render" ) const ( @@ -18,6 +18,8 @@ const ( func initOrganisationRoute(router chi.Router) { router.Route("/organisation", func(r chi.Router) { + r.Use(tokenAuth.Verifier) + r.Use(jwtauth.Authenticator) // swagger:route GET /organisation Organisations getAllOrganisation // // Get organisations @@ -95,7 +97,7 @@ func organisationContext(next http.Handler) http.Handler { func getAllOrganisation(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Organisation().Get(db) @@ -111,7 +113,7 @@ func newOrganisation(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -137,7 +139,7 @@ func updateOrganisation(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) diff --git a/api/parameter_route.go b/api/parameter_route.go index 8b98fd9..b00fe9f 100644 --- a/api/parameter_route.go +++ b/api/parameter_route.go @@ -5,11 +5,11 @@ import ( "net/http" "strconv" + "github.com/goware/jwtauth" "github.com/pressly/chi" chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/datastores" "github.com/titouanfreville/popcubeapi/models" - renderPackage "github.com/unrolled/render" ) const ( @@ -18,6 +18,8 @@ const ( func initParameterRoute(router chi.Router) { router.Route("/parameter", func(r chi.Router) { + r.Use(tokenAuth.Verifier) + r.Use(jwtauth.Authenticator) // swagger:route GET /parameter Parameters getAllParameter // // Get parameters @@ -96,7 +98,7 @@ func parameterContext(next http.Handler) http.Handler { func getAllParameter(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Parameter().Get(db) @@ -112,7 +114,7 @@ func newParameter(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -138,7 +140,7 @@ func updateParameter(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) diff --git a/api/role_route.go b/api/role_route.go index 24fe918..b17a2b1 100644 --- a/api/role_route.go +++ b/api/role_route.go @@ -5,11 +5,11 @@ import ( "net/http" "strconv" + "github.com/goware/jwtauth" "github.com/pressly/chi" chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/datastores" "github.com/titouanfreville/popcubeapi/models" - renderPackage "github.com/unrolled/render" ) const ( @@ -19,6 +19,8 @@ const ( func initRoleRoute(router chi.Router) { router.Route("/role", func(r chi.Router) { + r.Use(tokenAuth.Verifier) + r.Use(jwtauth.Authenticator) // swagger:route GET /role Roles getAllRole // // Get roles @@ -137,7 +139,7 @@ func roleContext(next http.Handler) http.Handler { func getAllRole(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.Role().GetAll(db) @@ -149,7 +151,7 @@ func getAllRole(w http.ResponseWriter, r *http.Request) { func getRoleFromName(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db name := r.Context().Value(roleNameKey).(string) role := store.Role().GetByName(name, db) @@ -162,7 +164,7 @@ func getRoleFromRight(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -184,7 +186,7 @@ func newRole(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -210,7 +212,7 @@ func updateRole(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -234,7 +236,7 @@ func updateRole(w http.ResponseWriter, r *http.Request) { func deleteRole(w http.ResponseWriter, r *http.Request) { role := r.Context().Value(oldRoleKey).(models.Role) store := datastores.Store() - render := renderPackage.New() + message := deleteMessageModel{ Object: role, } diff --git a/api/routes.json b/api/routes.json index 3b394d4..2d01f66 100644 --- a/api/routes.json +++ b/api/routes.json @@ -55,7 +55,7 @@ { "pkg": "github.com/pressly/chi/middleware", "func": "CloseNotify", - "comment": "CloseNotify is a middleware that cancels ctx when the underlying\nconnection has gone away. It can be used to cancel long operations\non the server when the client disconnects before the response is ready.\n\nNote: this behaviour is standard in Go 1.8+ so the middleware is no\nlonger provided and exists just for backwards compatability.\n", + "comment": "CloseNotify is a middleware that cancels ctx when the underlying\nconnection has gone away. It can be used to cancel long operations\non the server when the client disconnects before the response is ready.\n\nNote: this behaviour is standard in Go 1.8+, so the middleware does nothing\non 1.8+ and exists just for backwards compatibility.\n", "file": "github.com/pressly/chi/middleware/closenotify17.go", "line": 16 } @@ -68,17 +68,55 @@ "method": "GET", "pkg": "github.com/titouanfreville/popcubeapi/api", "func": "basicRoutes.func1", - "comment": "", + "comment": "swagger:route GET / Test hello\n\nHello World\n\n\tResponses:\n 200: generalOk\n\t default: genericError\n", "file": "github.com/titouanfreville/popcubeapi/api/api.go", - "line": 44, + "line": 103, "anonymous": true } } }, "/avatar": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "", + "func": "github.com/goware/jwtauth.(*JwtAuth).Verifier-fm", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 23, + "unresolvable": true + }, + { + "pkg": "github.com/goware/jwtauth", + "func": "Authenticator", + "comment": "Authenticator is a default authentication middleware to enforce access following\nthe Verifier middleware. The Authenticator sends a 401 Unauthorized response for\nall unverified tokens and passes the good ones through. It's just fine until you\ndecide to write something similar and customize your client response.\n", + "file": "github.com/goware/jwtauth/jwtauth.go", + "line": 196 + } + ], "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllAvatar", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 149 + }, + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "newAvatar", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 186 + } + } + }, "/:avatarID": { "router": { "middlewares": [ @@ -87,7 +125,7 @@ "func": "avatarContext", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", - "line": 42 + "line": 133 } ], "routes": { @@ -100,7 +138,7 @@ "func": "deleteAvatar", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", - "line": 141 + "line": 239 } } }, @@ -113,107 +151,87 @@ "func": "updateAvatar", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", - "line": 114 + "line": 212 } } } } } }, - "/get": { + "/all": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllAvatar", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 149 + } + } + }, + "/link": { "router": { "middlewares": [], "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllAvatar", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", - "line": 58 - } - } - }, - "/all": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllAvatar", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", - "line": 58 - } - } - }, - "/fromlink": { + "/:avatarLink": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "avatarContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 133 + } + ], "routes": { - "/:avatarLink": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "avatarContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", - "line": 42 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAvatarFromLink", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", - "line": 79 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAvatarFromLink", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 173 } } } } } - }, - "/fromname": { + } + } + } + }, + "/name": { + "router": { + "middlewares": [], + "routes": { + "/:avatarName": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "avatarContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 133 + } + ], "routes": { - "/:avatarName": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "avatarContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", - "line": 42 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAvatarFromName", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", - "line": 70 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAvatarFromName", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 160 } } } @@ -232,7 +250,7 @@ "func": "newAvatar", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", - "line": 88 + "line": 186 } } } @@ -241,8 +259,46 @@ }, "/channel": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "", + "func": "github.com/goware/jwtauth.(*JwtAuth).Verifier-fm", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 23, + "unresolvable": true + }, + { + "pkg": "github.com/goware/jwtauth", + "func": "Authenticator", + "comment": "Authenticator is a default authentication middleware to enforce access following\nthe Verifier middleware. The Authenticator sends a 401 Unauthorized response for\nall unverified tokens and passes the good ones through. It's just fine until you\ndecide to write something similar and customize your client response.\n", + "file": "github.com/goware/jwtauth/jwtauth.go", + "line": 196 + } + ], "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllChannel", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", + "line": 170 + }, + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "newChannel", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", + "line": 224 + } + } + }, "/:channelID": { "router": { "middlewares": [ @@ -251,7 +307,7 @@ "func": "channelContext", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 44 + "line": 154 } ], "routes": { @@ -264,7 +320,7 @@ "func": "deleteChannel", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 169 + "line": 277 } } }, @@ -277,138 +333,57 @@ "func": "updateChannel", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 142 + "line": 250 } } } } } }, - "/get": { + "/all": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllChannel", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", + "line": 170 + } + } + }, + "/name": { "router": { "middlewares": [], "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllChannel", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 62 - } - } - }, - "/all": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllChannel", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 62 - } - } - }, - "/fromname": { + "/:channelName": { "router": { - "middlewares": [], - "routes": { - "/:channelName": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "channelContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 44 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getChannelFromName", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 98 - } - } - } - } - } + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "channelContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", + "line": 154 } - } - } - }, - "/fromtype": { - "router": { - "middlewares": [], + ], "routes": { - "/:channelType": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "channelContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 44 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getChannelFromType", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 107 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getChannelFromName", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", + "line": 206 } } } } } - }, - "/private": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getPrivateChannel", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 86 - } - } - }, - "/public": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getPublicChannel", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 74 - } - } } } } @@ -422,7 +397,68 @@ "func": "newChannel", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", - "line": 116 + "line": 224 + } + } + }, + "/private": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getPrivateChannel", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", + "line": 194 + } + } + }, + "/public": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getPublicChannel", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", + "line": 182 + } + } + }, + "/type": { + "router": { + "middlewares": [], + "routes": { + "/:channelType": { + "router": { + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "channelContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", + "line": 154 + } + ], + "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getChannelFromType", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/channel_route.go", + "line": 215 + } + } + } + } + } + } } } } @@ -431,8 +467,46 @@ }, "/emoji": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "", + "func": "github.com/goware/jwtauth.(*JwtAuth).Verifier-fm", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 23, + "unresolvable": true + }, + { + "pkg": "github.com/goware/jwtauth", + "func": "Authenticator", + "comment": "Authenticator is a default authentication middleware to enforce access following\nthe Verifier middleware. The Authenticator sends a 401 Unauthorized response for\nall unverified tokens and passes the good ones through. It's just fine until you\ndecide to write something similar and customize your client response.\n", + "file": "github.com/goware/jwtauth/jwtauth.go", + "line": 196 + } + ], "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllEmoji", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", + "line": 167 + }, + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "newEmoji", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", + "line": 206 + } + } + }, "/:emojiID": { "router": { "middlewares": [ @@ -441,7 +515,7 @@ "func": "emojiContext", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 48 + "line": 149 } ], "routes": { @@ -454,7 +528,7 @@ "func": "deleteEmoji", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 158 + "line": 259 } } }, @@ -467,142 +541,87 @@ "func": "updateEmoji", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 131 + "line": 232 } } } } } }, - "/get": { + "/all": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllEmoji", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", + "line": 167 + } + } + }, + "/link": { "router": { "middlewares": [], "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllEmoji", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 66 - } - } - }, - "/all": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllEmoji", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 66 - } - } - }, - "/fromlink": { + "/:emojiLink": { "router": { - "middlewares": [], - "routes": { - "/:emojiLink": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "emojiContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 48 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getEmojiFromLink", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 96 - } - } - } - } - } + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "emojiContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", + "line": 149 } - } - } - }, - "/fromname": { - "router": { - "middlewares": [], + ], "routes": { - "/:emojiName": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "emojiContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 48 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getEmojiFromName", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 78 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getEmojiFromLink", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", + "line": 197 } } } } } - }, - "/fromshortcut": { + } + } + } + }, + "/name": { + "router": { + "middlewares": [], + "routes": { + "/:emojiName": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "emojiContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", + "line": 149 + } + ], "routes": { - "/:emojiShortcut": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "emojiContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 48 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getEmojiFromShortcut", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 87 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getEmojiFromName", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", + "line": 179 } } } @@ -621,7 +640,42 @@ "func": "newEmoji", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", - "line": 105 + "line": 206 + } + } + }, + "/shortcut": { + "router": { + "middlewares": [], + "routes": { + "/:emojiShortcut": { + "router": { + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "emojiContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", + "line": 149 + } + ], + "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getEmojiFromShortcut", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/emojis_route.go", + "line": 188 + } + } + } + } + } + } } } } @@ -630,8 +684,46 @@ }, "/folder": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "", + "func": "github.com/goware/jwtauth.(*JwtAuth).Verifier-fm", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 23, + "unresolvable": true + }, + { + "pkg": "github.com/goware/jwtauth", + "func": "Authenticator", + "comment": "Authenticator is a default authentication middleware to enforce access following\nthe Verifier middleware. The Authenticator sends a 401 Unauthorized response for\nall unverified tokens and passes the good ones through. It's just fine until you\ndecide to write something similar and customize your client response.\n", + "file": "github.com/goware/jwtauth/jwtauth.go", + "line": 196 + } + ], "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllFolder", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", + "line": 179 + }, + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "newFolder", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", + "line": 240 + } + } + }, "/:folderID": { "router": { "middlewares": [ @@ -640,7 +732,7 @@ "func": "folderContext", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 49 + "line": 161 } ], "routes": { @@ -653,7 +745,7 @@ "func": "deleteFolder", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 181 + "line": 293 } } }, @@ -666,155 +758,100 @@ "func": "updateFolder", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 154 + "line": 266 } } } } } }, - "/get": { + "/all": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllFolder", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", + "line": 179 + } + } + }, + "/link": { "router": { "middlewares": [], "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllFolder", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 67 + "/:folderLink": { + "router": { + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "folderContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", + "line": 161 + } + ], + "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getFolderFromLink", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", + "line": 209 + } + } + } } } - }, - "/all": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllFolder", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 67 - } - } - }, - "/foldername": { - "router": { - "middlewares": [], - "routes": { - "/:folderName": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "folderContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 49 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getFolderFromName", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 79 - } - } - } - } - } - } - } - } - }, - "/link": { + } + } + } + }, + "/message": { + "handlers": { + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getFolderFromMessage", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", + "line": 218 + } + } + }, + "/name": { + "router": { + "middlewares": [], + "routes": { + "/:folderName": { "router": { - "middlewares": [], - "routes": { - "/:folderLink": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "folderContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 49 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getFolderFromLink", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 97 - } - } - } - } - } + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "folderContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", + "line": 161 } - } - } - }, - "/message": { - "handlers": { - "POST": { - "middlewares": [], - "method": "POST", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getFolderFromMessage", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 106 - } - } - }, - "/type": { - "router": { - "middlewares": [], + ], "routes": { - "/:folderType": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "folderContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 49 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getFolderFromType", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 88 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getFolderFromName", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", + "line": 191 } } } @@ -833,17 +870,117 @@ "func": "newFolder", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", - "line": 128 + "line": 240 + } + } + }, + "/type": { + "router": { + "middlewares": [], + "routes": { + "/:folderType": { + "router": { + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "folderContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", + "line": 161 + } + ], + "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getFolderFromType", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/folder_route.go", + "line": 200 + } + } + } + } + } + } } } } } } }, + "/heartbeat": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "basicRoutes.func3", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/api.go", + "line": 118, + "anonymous": true + } + } + }, + "/login": { + "handlers": { + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "loginMiddleware", + "comment": "loginMiddleware login funcion providing user \u0026\u0026 jwt auth token\n", + "file": "github.com/titouanfreville/popcubeapi/api/api.go", + "line": 146 + } + } + }, "/message": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "", + "func": "github.com/goware/jwtauth.(*JwtAuth).Verifier-fm", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 23, + "unresolvable": true + }, + { + "pkg": "github.com/goware/jwtauth", + "func": "Authenticator", + "comment": "Authenticator is a default authentication middleware to enforce access following\nthe Verifier middleware. The Authenticator sends a 401 Unauthorized response for\nall unverified tokens and passes the good ones through. It's just fine until you\ndecide to write something similar and customize your client response.\n", + "file": "github.com/goware/jwtauth/jwtauth.go", + "line": 196 + } + ], "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllMessage", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 154 + }, + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "newMessage", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 219 + } + } + }, "/:messageID": { "router": { "middlewares": [ @@ -851,8 +988,8 @@ "pkg": "github.com/titouanfreville/popcubeapi/api", "func": "messageContext", "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/messge_route.go", - "line": 38 + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 140 } ], "routes": { @@ -862,10 +999,10 @@ "middlewares": [], "method": "DELETE", "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "deleteMessage", + "func": "deleteMessageFunction", "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/messge_route.go", - "line": 170 + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 272 } } }, @@ -877,99 +1014,79 @@ "pkg": "github.com/titouanfreville/popcubeapi/api", "func": "updateMessage", "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/messge_route.go", - "line": 143 + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 245 } } } } } }, - "/get": { + "/all": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllMessage", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 154 + } + } + }, + "/channel": { + "handlers": { + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getMessageFromChannel", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 197 + } + } + }, + "/creator": { + "handlers": { + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getMessageFromUser", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 175 + } + } + }, + "/date": { "router": { "middlewares": [], "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllMessage", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/messge_route.go", - "line": 52 - } - } - }, - "/all": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllMessage", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/messge_route.go", - "line": 52 - } - } - }, - "/channel": { - "handlers": { - "POST": { - "middlewares": [], - "method": "POST", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getMessageFromChannel", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/messge_route.go", - "line": 95 - } - } - }, - "/creator": { - "handlers": { - "POST": { - "middlewares": [], - "method": "POST", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getMessageFromUser", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/messge_route.go", - "line": 73 - } - } - }, - "/date": { + "/:messageDate": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "messageContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 140 + } + ], "routes": { - "/:date": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "messageContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/messge_route.go", - "line": 38 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getMessageFromDate", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/messge_route.go", - "line": 64 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getMessageFromDate", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 166 } } } @@ -987,8 +1104,8 @@ "pkg": "github.com/titouanfreville/popcubeapi/api", "func": "newMessage", "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/messge_route.go", - "line": 117 + "file": "github.com/titouanfreville/popcubeapi/api/message_route.go", + "line": 219 } } } @@ -997,8 +1114,46 @@ }, "/organisation": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "", + "func": "github.com/goware/jwtauth.(*JwtAuth).Verifier-fm", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 23, + "unresolvable": true + }, + { + "pkg": "github.com/goware/jwtauth", + "func": "Authenticator", + "comment": "Authenticator is a default authentication middleware to enforce access following\nthe Verifier middleware. The Authenticator sends a 401 Unauthorized response for\nall unverified tokens and passes the good ones through. It's just fine until you\ndecide to write something similar and customize your client response.\n", + "file": "github.com/goware/jwtauth/jwtauth.go", + "line": 196 + } + ], "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllOrganisation", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/organisation_route.go", + "line": 98 + }, + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "newOrganisation", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/organisation_route.go", + "line": 110 + } + } + }, "/:organisationID": { "router": { "middlewares": [ @@ -1007,7 +1162,7 @@ "func": "organisationContext", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/organisation_route.go", - "line": 29 + "line": 86 } ], "routes": { @@ -1020,43 +1175,23 @@ "func": "updateOrganisation", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/organisation_route.go", - "line": 79 + "line": 136 } } } } } }, - "/get": { - "router": { - "middlewares": [], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllOrganisation", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/organisation_route.go", - "line": 41 - } - } - }, - "/all": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllOrganisation", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/organisation_route.go", - "line": 41 - } - } - } + "/all": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllOrganisation", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/organisation_route.go", + "line": 98 } } }, @@ -1069,7 +1204,7 @@ "func": "newOrganisation", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/organisation_route.go", - "line": 53 + "line": 110 } } } @@ -1082,18 +1217,56 @@ "middlewares": [], "method": "GET", "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "basicRoutes.func3", - "comment": "", + "func": "basicRoutes.func4", + "comment": "swagger:route GET /panic Test panic\n\nShould result in 500\n\nTest panic cautching\n\n\tResponses:\n 500: genericError\n\t default: genericError\n", "file": "github.com/titouanfreville/popcubeapi/api/api.go", - "line": 52, + "line": 128, "anonymous": true } } }, "/parameter": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "", + "func": "github.com/goware/jwtauth.(*JwtAuth).Verifier-fm", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 23, + "unresolvable": true + }, + { + "pkg": "github.com/goware/jwtauth", + "func": "Authenticator", + "comment": "Authenticator is a default authentication middleware to enforce access following\nthe Verifier middleware. The Authenticator sends a 401 Unauthorized response for\nall unverified tokens and passes the good ones through. It's just fine until you\ndecide to write something similar and customize your client response.\n", + "file": "github.com/goware/jwtauth/jwtauth.go", + "line": 196 + } + ], "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllParameter", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/parameter_route.go", + "line": 99 + }, + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "newParameter", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/parameter_route.go", + "line": 111 + } + } + }, "/:parameterID": { "router": { "middlewares": [ @@ -1102,7 +1275,7 @@ "func": "parameterContext", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/parameter_route.go", - "line": 29 + "line": 87 } ], "routes": { @@ -1115,43 +1288,23 @@ "func": "updateParameter", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/parameter_route.go", - "line": 79 + "line": 137 } } } } } }, - "/get": { - "router": { - "middlewares": [], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllParameter", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/parameter_route.go", - "line": 41 - } - } - }, - "/all": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllParameter", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/parameter_route.go", - "line": 41 - } - } - } + "/all": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllParameter", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/parameter_route.go", + "line": 99 } } }, @@ -1164,7 +1317,7 @@ "func": "newParameter", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/parameter_route.go", - "line": 53 + "line": 111 } } } @@ -1178,17 +1331,55 @@ "method": "GET", "pkg": "github.com/titouanfreville/popcubeapi/api", "func": "basicRoutes.func2", - "comment": "", + "comment": "swagger:route GET /ping Test ping\n\nPong\n\nTest api ping\n\n\tResponses:\n 200: generalOk\n\t default: genericError\n", "file": "github.com/titouanfreville/popcubeapi/api/api.go", - "line": 48, + "line": 115, "anonymous": true } } }, "/role": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "", + "func": "github.com/goware/jwtauth.(*JwtAuth).Verifier-fm", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 23, + "unresolvable": true + }, + { + "pkg": "github.com/goware/jwtauth", + "func": "Authenticator", + "comment": "Authenticator is a default authentication middleware to enforce access following\nthe Verifier middleware. The Authenticator sends a 401 Unauthorized response for\nall unverified tokens and passes the good ones through. It's just fine until you\ndecide to write something similar and customize your client response.\n", + "file": "github.com/goware/jwtauth/jwtauth.go", + "line": 196 + } + ], "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllRole", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", + "line": 140 + }, + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "newRole", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", + "line": 183 + } + } + }, "/:roleID": { "router": { "middlewares": [ @@ -1197,7 +1388,7 @@ "func": "roleContext", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", - "line": 37 + "line": 126 } ], "routes": { @@ -1210,7 +1401,7 @@ "func": "deleteRole", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", - "line": 147 + "line": 236 } } }, @@ -1223,90 +1414,57 @@ "func": "updateRole", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", - "line": 120 + "line": 209 } } } } } }, - "/get": { + "/all": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllRole", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", + "line": 140 + } + } + }, + "/name": { "router": { "middlewares": [], "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllRole", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", - "line": 51 - } - } - }, - "/all": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllRole", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", - "line": 51 - } - } - }, - "/fromname": { + "/:roleName": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "roleContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", + "line": 126 + } + ], "routes": { - "/:roleName": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "roleContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", - "line": 37 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getRoleFromName", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", - "line": 63 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getRoleFromName", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", + "line": 152 } } } } } - }, - "/fromrights": { - "handlers": { - "POST": { - "middlewares": [], - "method": "POST", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getRoleFromRight", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", - "line": 72 - } - } } } } @@ -1320,7 +1478,20 @@ "func": "newRole", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", - "line": 94 + "line": 183 + } + } + }, + "/rights": { + "handlers": { + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getRoleFromRight", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/role_route.go", + "line": 161 } } } @@ -1329,8 +1500,46 @@ }, "/user": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "", + "func": "github.com/goware/jwtauth.(*JwtAuth).Verifier-fm", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/avatar_route.go", + "line": 23, + "unresolvable": true + }, + { + "pkg": "github.com/goware/jwtauth", + "func": "Authenticator", + "comment": "Authenticator is a default authentication middleware to enforce access following\nthe Verifier middleware. The Authenticator sends a 401 Unauthorized response for\nall unverified tokens and passes the good ones through. It's just fine until you\ndecide to write something similar and customize your client response.\n", + "file": "github.com/goware/jwtauth/jwtauth.go", + "line": 196 + } + ], "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllUser", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 233 + }, + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "newUser", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 333 + } + } + }, "/:userID": { "router": { "middlewares": [ @@ -1339,7 +1548,7 @@ "func": "userContext", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 68 + "line": 209 } ], "routes": { @@ -1352,7 +1561,7 @@ "func": "deleteUser", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 245 + "line": 386 } } }, @@ -1365,273 +1574,196 @@ "func": "updateUser", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 218 + "line": 359 } } } } } }, - "/get": { + "/all": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getAllUser", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 233 + } + } + }, + "/date": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getOrderedByDate", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 302 + } + } + }, + "/deleted": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getDeletedUser", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 245 + } + } + }, + "/email": { "router": { "middlewares": [], "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllUser", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 92 - } - } - }, - "/all": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getAllUser", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 92 - } - } - }, - "/date": { + "/:userEmail": { "router": { - "middlewares": [], - "routes": { - "/:date": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "userContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 68 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getUserFromDate", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 161 - } - } - } - } - } + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "userContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 209 } - } - } - }, - "/deleted": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getDeletedUser", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 104 - } - } - }, - "/email": { - "router": { - "middlewares": [], + ], "routes": { - "/:userEmail": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "userContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 68 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getUserFromEmail", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 152 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getUserFromEmail", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 293 } } } } } - }, - "/firstname": { + } + } + } + }, + "/firstname": { + "router": { + "middlewares": [], + "routes": { + "/:firstName": { "router": { - "middlewares": [], - "routes": { - "/:firstName": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "userContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 68 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getUserFromFirstName", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 134 - } - } - } - } - } + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "userContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 209 } - } - } - }, - "/lastname": { - "router": { - "middlewares": [], + ], "routes": { - "/:lastName": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "userContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 68 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getUserFromLastName", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 143 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getUserFromFirstName", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 275 } } } } } - }, - "/nickname": { + } + } + } + }, + "/lastname": { + "router": { + "middlewares": [], + "routes": { + "/:lastName": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "userContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 209 + } + ], "routes": { - "/:nickName": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "userContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 68 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getUserFromNickName", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 125 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getUserFromLastName", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 284 } } } } } - }, - "/role": { - "handlers": { - "POST": { - "middlewares": [], - "method": "POST", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getUserFromRole", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 170 - } - } - }, - "/username": { + } + } + } + }, + "/new": { + "handlers": { + "POST": { + "middlewares": [], + "method": "POST", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "newUser", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 333 + } + } + }, + "/nickname": { + "router": { + "middlewares": [], + "routes": { + "/:nickName": { "router": { - "middlewares": [], + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "userContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 209 + } + ], "routes": { - "/:userName": { - "router": { - "middlewares": [ - { - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "userContext", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 68 - } - ], - "routes": { - "/": { - "handlers": { - "GET": { - "middlewares": [], - "method": "GET", - "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "getUserFromName", - "comment": "", - "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 116 - } - } - } + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getUserFromNickName", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 266 } } } @@ -1641,16 +1773,51 @@ } } }, - "/new": { + "/role": { "handlers": { "POST": { "middlewares": [], "method": "POST", "pkg": "github.com/titouanfreville/popcubeapi/api", - "func": "newUser", + "func": "getUserFromRole", "comment": "", "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", - "line": 192 + "line": 311 + } + } + }, + "/username": { + "router": { + "middlewares": [], + "routes": { + "/:userName": { + "router": { + "middlewares": [ + { + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "userContext", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 209 + } + ], + "routes": { + "/": { + "handlers": { + "GET": { + "middlewares": [], + "method": "GET", + "pkg": "github.com/titouanfreville/popcubeapi/api", + "func": "getUserFromName", + "comment": "", + "file": "github.com/titouanfreville/popcubeapi/api/user_route.go", + "line": 257 + } + } + } + } + } + } } } } diff --git a/api/user_route.go b/api/user_route.go index 16a80be..7a1a942 100644 --- a/api/user_route.go +++ b/api/user_route.go @@ -5,11 +5,11 @@ import ( "net/http" "strconv" + "github.com/goware/jwtauth" "github.com/pressly/chi" chiRender "github.com/pressly/chi/render" "github.com/titouanfreville/popcubeapi/datastores" "github.com/titouanfreville/popcubeapi/models" - renderPackage "github.com/unrolled/render" ) const ( @@ -24,6 +24,8 @@ const ( func initUserRoute(router chi.Router) { router.Route("/user", func(r chi.Router) { + r.Use(tokenAuth.Verifier) + r.Use(jwtauth.Authenticator) // swagger:route GET /user Users getAllUser // // Get users @@ -230,7 +232,7 @@ func userContext(next http.Handler) http.Handler { func getAllUser(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.User().GetAll(db) @@ -242,7 +244,7 @@ func getAllUser(w http.ResponseWriter, r *http.Request) { func getDeletedUser(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db if err := db.DB().Ping(); err == nil { result := store.User().GetDeleted(db) @@ -254,7 +256,7 @@ func getDeletedUser(w http.ResponseWriter, r *http.Request) { func getUserFromName(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db name := r.Context().Value("userName").(string) user := store.User().GetByUserName(name, db) @@ -263,7 +265,7 @@ func getUserFromName(w http.ResponseWriter, r *http.Request) { func getUserFromNickName(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db name := r.Context().Value(nickNameKey).(string) user := store.User().GetByNickName(name, db) @@ -272,7 +274,7 @@ func getUserFromNickName(w http.ResponseWriter, r *http.Request) { func getUserFromFirstName(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db name := r.Context().Value(firstNameKey).(string) user := store.User().GetByFirstName(name, db) @@ -281,7 +283,7 @@ func getUserFromFirstName(w http.ResponseWriter, r *http.Request) { func getUserFromLastName(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db name := r.Context().Value(lastNameKey).(string) user := store.User().GetByLastName(name, db) @@ -290,7 +292,7 @@ func getUserFromLastName(w http.ResponseWriter, r *http.Request) { func getUserFromEmail(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db email := r.Context().Value(userEmailKey).(string) user := store.User().GetByEmail(email, db) @@ -299,7 +301,7 @@ func getUserFromEmail(w http.ResponseWriter, r *http.Request) { func getOrderedByDate(w http.ResponseWriter, r *http.Request) { store := datastores.Store() - render := renderPackage.New() + db := dbStore.db date := r.Context().Value(userDateKey).(int) user := store.User().GetOrderedByDate(date, db) @@ -312,7 +314,7 @@ func getUserFromRole(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -334,7 +336,7 @@ func newUser(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -360,7 +362,7 @@ func updateUser(w http.ResponseWriter, r *http.Request) { OmitID interface{} `json:"id,omitempty"` } store := datastores.Store() - render := renderPackage.New() + db := dbStore.db request := r.Body err := chiRender.Bind(request, &data) @@ -384,7 +386,7 @@ func updateUser(w http.ResponseWriter, r *http.Request) { func deleteUser(w http.ResponseWriter, r *http.Request) { user := r.Context().Value(oldUserKey).(models.User) store := datastores.Store() - render := renderPackage.New() + message := deleteMessageModel{ Object: user, } diff --git a/datastores/data_store.go b/datastores/data_store.go index 06b3578..213dd3b 100644 --- a/datastores/data_store.go +++ b/datastores/data_store.go @@ -242,4 +242,5 @@ type UserStore interface { GetByRole(role *models.Role, db *gorm.DB) []models.User GetAll(db *gorm.DB) []models.User Delete(user *models.User, db *gorm.DB) *u.AppError + Login(userName string, pass string, db *gorm.DB) (models.User, *u.AppError) } diff --git a/datastores/user_store.go b/datastores/user_store.go index 7af3d5c..d45ec96 100644 --- a/datastores/user_store.go +++ b/datastores/user_store.go @@ -76,6 +76,21 @@ func (usi UserStoreImpl) GetByUserName(userName string, db *gorm.DB) models.User return user } +// Login Used to log user in +func (usi UserStoreImpl) Login(userName string, pass string, db *gorm.DB) (models.User, *u.AppError) { + user := models.User{} + empty := models.User{} + err := u.NewAPIError(404, "Wrong user name or password", "Can't proceed to login. Password or user name is not correct") + db.Where("userName = ?", userName).First(&user) + if (user == models.User{}) { + return empty, err + } + if models.ComparePassword(user.Password, pass) { + return user, nil + } + return empty, err +} + // GetByEmail Used to get user from DB by email func (usi UserStoreImpl) GetByEmail(userEmail string, db *gorm.DB) models.User { user := models.User{} diff --git a/docker/gobase.Dockerfile b/docker/gobase.Dockerfile index 27b7f34..1fd905f 100644 --- a/docker/gobase.Dockerfile +++ b/docker/gobase.Dockerfile @@ -42,5 +42,7 @@ RUN go get -v github.com/tools/godep && \ godep get -v WORKDIR /$GOCOPYPATH + EXPOSE 3000 + ENTRYPOINT waitforit database:3306 -t 0 -- echo "Db is ready" && go install && popcubeapi