Skip to content

Commit

Permalink
controller: Use constant for merged api points
Browse files Browse the repository at this point in the history
Signed-off-by: Shashank Verma <[email protected]>
  • Loading branch information
shank03 committed Sep 24, 2023
1 parent a841525 commit 36f8df6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.mnnit.moticlubs.utils.Constants
import com.mnnit.moticlubs.utils.Constants.BASE_PATH
import com.mnnit.moticlubs.utils.Constants.CLUBS_ROUTE
import com.mnnit.moticlubs.utils.Constants.CLUB_ID_CLAIM
import com.mnnit.moticlubs.utils.Constants.URL_ROUTE
import com.mnnit.moticlubs.utils.ResponseStamp
import com.mnnit.moticlubs.utils.ServiceLogger
import com.mnnit.moticlubs.utils.apiWrapper
Expand Down Expand Up @@ -71,7 +72,7 @@ class ClubController(
.invalidateStamp { ResponseStamp.CLUB }
.wrapError()

@GetMapping("/url")
@GetMapping("/$URL_ROUTE")
@Operation(summary = "Returns list of urls for the club")
fun getUrls(
@RequestParam clubId: Long,
Expand All @@ -86,7 +87,7 @@ class ClubController(
},
)

@PostMapping("/url")
@PostMapping("/$URL_ROUTE")
@Operation(summary = "Updates the list of urls for the club")
fun updateUrls(
@RequestBody dto: SaveUrlsDTO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.mnnit.moticlubs.utils.Constants
import com.mnnit.moticlubs.utils.Constants.BASE_PATH
import com.mnnit.moticlubs.utils.Constants.POSTS_ROUTE
import com.mnnit.moticlubs.utils.Constants.POST_ID_CLAIM
import com.mnnit.moticlubs.utils.Constants.VIEWS_ROUTE
import com.mnnit.moticlubs.utils.ResponseStamp
import com.mnnit.moticlubs.utils.ServiceLogger
import com.mnnit.moticlubs.utils.apiWrapper
Expand Down Expand Up @@ -104,7 +105,7 @@ class PostController(
.invalidateStamp { ResponseStamp.POST }
.wrapError()

@GetMapping("/views")
@GetMapping("/$VIEWS_ROUTE")
@Operation(summary = "Get number of views of a post")
fun getViews(@RequestParam postId: Long): Mono<List<View>> = pathAuthorization
.userAuthorization()
Expand All @@ -114,7 +115,7 @@ class PostController(
}
.wrapError()

@PostMapping("/views")
@PostMapping("/$VIEWS_ROUTE")
@Operation(summary = "Add views of a post")
fun addView(@RequestBody view: View): Mono<View> = pathAuthorization
.userAuthorization()
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/com/mnnit/moticlubs/utils/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ object Constants {
const val POSTS_ROUTE = "posts"
const val SUPER_ADMIN_ROUTE = "admin"
const val CHANNEL_ROUTE = "channel"
const val URL_ROUTE = "url"
const val VIEWS_ROUTE = "views"
const val REPLY_ROUTE = "reply"

Expand Down

0 comments on commit 36f8df6

Please sign in to comment.