Skip to content

Commit

Permalink
Merge pull request #62 from evrone/refactor/endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
sashamelentyev committed Sep 6, 2021
2 parents 9e7a8fa + 53df608 commit 2d9ef89
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ issues:
linters:
- paralleltest
- godot
- path: internal/controller/http
linters:
- godot

run:
skip-dirs:
Expand Down
2 changes: 1 addition & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ type swaggerInfo struct {
var SwaggerInfo = swaggerInfo{
Version: "1.0",
Host: "localhost:8080",
BasePath: "/api/v1",
BasePath: "/v1",
Schemes: []string{},
Title: "Go Clean Template API",
Description: "Using a translation service as an example",
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"version": "1.0"
},
"host": "localhost:8080",
"basePath": "/api/v1",
"basePath": "/v1",
"paths": {
"/translation/do-translate": {
"post": {
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
basePath: /api/v1
basePath: /v1
definitions:
entity.Translation:
properties:
Expand Down
2 changes: 1 addition & 1 deletion integration-test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
attempts = 20

// HTTP REST
basePath = "http://" + host + "/api/v1"
basePath = "http://" + host + "/v1"

// RabbitMQ RPC
rmqURL = "amqp://guest:guest@rabbitmq:5672/"
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/http/v1/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
// @description Using a translation service as an example
// @version 1.0
// @host localhost:8080
// @BasePath /api/v1
// @BasePath /v1
func NewRouter(handler *gin.Engine, l logger.Interface, t usecase.Translation) {
// Options
handler.Use(gin.Logger())
Expand All @@ -34,7 +34,7 @@ func NewRouter(handler *gin.Engine, l logger.Interface, t usecase.Translation) {
handler.GET("/healthz", func(c *gin.Context) { c.Status(http.StatusOK) })

// Routers
h := handler.Group("/api/v1")
h := handler.Group("/v1")
{
newTranslationRoutes(h, t, l)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/http/v1/translation.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type historyResponse struct {
// @Produce json
// @Success 200 {object} historyResponse
// @Failure 500 {object} response
// @Router /translation/history [get].
// @Router /translation/history [get]
func (r *translationRoutes) history(c *gin.Context) {
translations, err := r.t.History(c.Request.Context())
if err != nil {
Expand Down Expand Up @@ -66,7 +66,7 @@ type doTranslateRequest struct {
// @Success 200 {object} entity.Translation
// @Failure 400 {object} response
// @Failure 500 {object} response
// @Router /translation/do-translate [post].
// @Router /translation/do-translate [post]
func (r *translationRoutes) doTranslate(c *gin.Context) {
var request doTranslateRequest
if err := c.ShouldBindJSON(&request); err != nil {
Expand Down

0 comments on commit 2d9ef89

Please sign in to comment.