Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Replace API route constants #5037

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ go 1.23

require (
github.com/eclipse/paho.mqtt.golang v1.5.0
github.com/edgexfoundry/go-mod-bootstrap/v4 v4.0.0-dev.14
github.com/edgexfoundry/go-mod-bootstrap/v4 v4.0.0-dev.15
github.com/edgexfoundry/go-mod-configuration/v4 v4.0.0-dev.10
github.com/edgexfoundry/go-mod-core-contracts/v4 v4.0.0-dev.15
github.com/edgexfoundry/go-mod-core-contracts/v4 v4.0.0-dev.16
github.com/edgexfoundry/go-mod-messaging/v4 v4.0.0-dev.10
github.com/edgexfoundry/go-mod-secrets/v4 v4.0.0-dev.4
github.com/edgexfoundry/go-mod-secrets/v4 v4.0.0-dev.5
github.com/fxamacker/cbor/v2 v2.7.0
github.com/go-co-op/gocron/v2 v2.14.0
github.com/gomodule/redigo v1.9.2
Expand All @@ -30,7 +30,7 @@ require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/edgexfoundry/go-mod-registry/v4 v4.0.0-dev.2 // indirect
github.com/edgexfoundry/go-mod-registry/v4 v4.0.0-dev.3 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/eclipse/paho.mqtt.golang v1.5.0 h1:EH+bUVJNgttidWFkLLVKaQPGmkTUfQQqjOsyvMGvD6o=
github.com/eclipse/paho.mqtt.golang v1.5.0/go.mod h1:du/2qNQVqJf/Sqs4MEL77kR8QTqANF7XU7Fk0aOTAgk=
github.com/edgexfoundry/go-mod-bootstrap/v4 v4.0.0-dev.14 h1:C2D1RppHFKME7q/nVJVPHlzLYs12UTkJBz/q/4ZxBTA=
github.com/edgexfoundry/go-mod-bootstrap/v4 v4.0.0-dev.14/go.mod h1:g0H805nWxtzJplM6nFnbTJi1TgXRD730NO9xxhC6xXk=
github.com/edgexfoundry/go-mod-bootstrap/v4 v4.0.0-dev.15 h1:oeSDtoah8q3sBo8huqNdRjjxRF5IcsLh0kby0gJW/o4=
github.com/edgexfoundry/go-mod-bootstrap/v4 v4.0.0-dev.15/go.mod h1:D+fSf0PWO9E4nz+1tVe0OGYnBeRQ1nHdF3B1tnYrq60=
github.com/edgexfoundry/go-mod-configuration/v4 v4.0.0-dev.10 h1:DMv5LZDxcqUeb1dREMd/vK+reXmZYlpafgtm8XhYdHQ=
github.com/edgexfoundry/go-mod-configuration/v4 v4.0.0-dev.10/go.mod h1:ltUpMcOpJSzmabBtZox5qg1AK2wEikvZJyIBXtJ7mUQ=
github.com/edgexfoundry/go-mod-core-contracts/v4 v4.0.0-dev.15 h1:4FbSL5rsNXVonrYz4K5v1oCNmi64LvcEx8xCgr6mXOo=
github.com/edgexfoundry/go-mod-core-contracts/v4 v4.0.0-dev.15/go.mod h1:M5JXcRrmnIVNAmqeDNVXd0PSOGdq96fgrEmzivx02c8=
github.com/edgexfoundry/go-mod-core-contracts/v4 v4.0.0-dev.16 h1:Kb0W7HAFoXdWGN7aYJcLOEgGUTo2v2/BJicGGlOLLng=
github.com/edgexfoundry/go-mod-core-contracts/v4 v4.0.0-dev.16/go.mod h1:M5JXcRrmnIVNAmqeDNVXd0PSOGdq96fgrEmzivx02c8=
github.com/edgexfoundry/go-mod-messaging/v4 v4.0.0-dev.10 h1:xvDQDIJtmj/ZCmKzbAzg3h1F2ZdWz1MPoJSNfYZANGc=
github.com/edgexfoundry/go-mod-messaging/v4 v4.0.0-dev.10/go.mod h1:ibaiw7r3RgLYDuuFfWT1kh//bjP+onDOOQsnSsdD4E8=
github.com/edgexfoundry/go-mod-registry/v4 v4.0.0-dev.2 h1:iHu8JPpmrEOrIZdv0iYW69FlMmkyal/FpbXtC3pHt2c=
github.com/edgexfoundry/go-mod-registry/v4 v4.0.0-dev.2/go.mod h1:0qsKMZkTP3jE0GisaNcMjn6euhAIVEFPy4WXbjgzgD0=
github.com/edgexfoundry/go-mod-secrets/v4 v4.0.0-dev.4 h1:3YPeukLHkgDEG7dCWYosTNuqOoQHrVFVt65/LlG4LlQ=
github.com/edgexfoundry/go-mod-secrets/v4 v4.0.0-dev.4/go.mod h1:6P6KEOfPuzy8lXBkYCWTg7ZCHCJXL3ijYnkJQMEGvvc=
github.com/edgexfoundry/go-mod-registry/v4 v4.0.0-dev.3 h1:6tw6JqEJDOqo2lEgxjZ+scvsub5R20WGpInCuoxS6zE=
github.com/edgexfoundry/go-mod-registry/v4 v4.0.0-dev.3/go.mod h1:QpZW5bWxsk0Leh1nvgojBZrpHA/B6dSw6LgT0zxh9hg=
github.com/edgexfoundry/go-mod-secrets/v4 v4.0.0-dev.5 h1:PnbvMnedIlbqXsnUp2+i18BJ9e6CJ7GzwNA9vjPU3Jk=
github.com/edgexfoundry/go-mod-secrets/v4 v4.0.0-dev.5/go.mod h1:zAIZIOlTbX7KUZlNF1ylx8pKV16ld/7hmyjpFLiDSKo=
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
Expand Down
6 changes: 3 additions & 3 deletions internal/core/command/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func LoadRestRoutes(r *echo.Echo, dic *di.Container, serviceName string) {
// Command
cmd := commandController.NewCommandController(dic)
r.GET(common.ApiAllDeviceRoute, cmd.AllCommands, authenticationHook)
r.GET(common.ApiDeviceByNameEchoRoute, cmd.CommandsByDeviceName, authenticationHook)
r.GET(common.ApiDeviceNameCommandNameEchoRoute, cmd.IssueGetCommandByName, authenticationHook)
r.PUT(common.ApiDeviceNameCommandNameEchoRoute, cmd.IssueSetCommandByName, authenticationHook)
r.GET(common.ApiDeviceByNameRoute, cmd.CommandsByDeviceName, authenticationHook)
r.GET(common.ApiDeviceNameCommandNameRoute, cmd.IssueGetCommandByName, authenticationHook)
r.PUT(common.ApiDeviceNameCommandNameRoute, cmd.IssueSetCommandByName, authenticationHook)
}
14 changes: 7 additions & 7 deletions internal/core/data/controller/http/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func TestAddEvent(t *testing.T) {
require.NoError(t, err)

reader := strings.NewReader(string(byteData))
req, err := http.NewRequest(http.MethodPost, common.ApiEventServiceNameProfileNameDeviceNameSourceNameEchoRoute, reader)
req, err := http.NewRequest(http.MethodPost, common.ApiEventServiceNameProfileNameDeviceNameSourceNameRoute, reader)
req.Header.Set(common.ContentType, testCase.RequestContentType)
require.NoError(t, err)

Expand Down Expand Up @@ -336,7 +336,7 @@ func TestAddEventSize(t *testing.T) {
require.NoError(t, err)

reader := strings.NewReader(string(byteData))
req, err := http.NewRequest(http.MethodPost, common.ApiEventServiceNameProfileNameDeviceNameSourceNameEchoRoute, reader)
req, err := http.NewRequest(http.MethodPost, common.ApiEventServiceNameProfileNameDeviceNameSourceNameRoute, reader)
req.Header.Set(common.ContentType, testCase.RequestContentType)
require.NoError(t, err)

Expand Down Expand Up @@ -552,7 +552,7 @@ func TestEventCountByDeviceName(t *testing.T) {
ec := NewEventController(dic)

e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiEventCountByDeviceNameEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiEventCountByDeviceNameRoute, http.NoBody)
require.NoError(t, err)

recorder := httptest.NewRecorder()
Expand Down Expand Up @@ -590,7 +590,7 @@ func TestDeleteEventsByDeviceName(t *testing.T) {
ec := NewEventController(dic)

e := echo.New()
req, err := http.NewRequest(http.MethodDelete, common.ApiEventByDeviceNameEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodDelete, common.ApiEventByDeviceNameRoute, http.NoBody)
require.NoError(t, err)

recorder := httptest.NewRecorder()
Expand Down Expand Up @@ -742,7 +742,7 @@ func TestAllEventsByDeviceName(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiEventByDeviceNameEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiEventByDeviceNameRoute, http.NoBody)
query := req.URL.Query()
query.Add(common.Offset, testCase.offset)
query.Add(common.Limit, testCase.limit)
Expand Down Expand Up @@ -822,7 +822,7 @@ func TestAllEventsByTimeRange(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiEventByTimeRangeEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiEventByTimeRangeRoute, http.NoBody)
query := req.URL.Query()
query.Add(common.Offset, testCase.offset)
query.Add(common.Limit, testCase.limit)
Expand Down Expand Up @@ -890,7 +890,7 @@ func TestDeleteEventsByAge(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiEventByTimeRangeEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiEventByTimeRangeRoute, http.NoBody)
require.NoError(t, err)

// Act
Expand Down
16 changes: 8 additions & 8 deletions internal/core/data/controller/http/reading_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func TestReadingsByTimeRange(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByTimeRangeEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByTimeRangeRoute, http.NoBody)
query := req.URL.Query()
query.Add(common.Offset, testCase.offset)
query.Add(common.Limit, testCase.limit)
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestReadingsByResourceName(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByResourceNameEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByResourceNameRoute, http.NoBody)
query := req.URL.Query()
if testCase.offset != "" {
query.Add(common.Offset, testCase.offset)
Expand Down Expand Up @@ -308,7 +308,7 @@ func TestReadingsByDeviceName(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByDeviceNameEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByDeviceNameRoute, http.NoBody)
query := req.URL.Query()
if testCase.offset != "" {
query.Add(common.Offset, testCase.offset)
Expand Down Expand Up @@ -365,7 +365,7 @@ func TestReadingCountByDeviceName(t *testing.T) {
rc := NewReadingController(dic)

e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiReadingCountByDeviceNameEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiReadingCountByDeviceNameRoute, http.NoBody)
require.NoError(t, err)

recorder := httptest.NewRecorder()
Expand Down Expand Up @@ -423,7 +423,7 @@ func TestReadingsByResourceNameAndTimeRange(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByResourceNameAndTimeRangeEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByResourceNameAndTimeRangeRoute, http.NoBody)
query := req.URL.Query()
query.Add(common.Offset, testCase.offset)
query.Add(common.Limit, testCase.limit)
Expand Down Expand Up @@ -496,7 +496,7 @@ func TestReadingsByDeviceNameAndResourceName(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByDeviceNameAndResourceNameEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByDeviceNameAndResourceNameRoute, http.NoBody)
require.NoError(t, err)
query := req.URL.Query()
if testCase.offset != "" {
Expand Down Expand Up @@ -579,7 +579,7 @@ func TestReadingsByDeviceNameAndResourceNameAndTimeRange(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByDeviceNameAndResourceNameAndTimeRangeEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByDeviceNameAndResourceNameAndTimeRangeRoute, http.NoBody)
require.NoError(t, err)
query := req.URL.Query()
query.Add(common.Offset, testCase.offset)
Expand Down Expand Up @@ -673,7 +673,7 @@ func TestReadingsByDeviceNameAndResourceNamesAndTimeRange(t *testing.T) {
} else {
reader = http.NoBody
}
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByDeviceNameAndTimeRangeEchoRoute, reader)
req, err := http.NewRequest(http.MethodGet, common.ApiReadingByDeviceNameAndTimeRangeRoute, reader)
req.Header.Set(common.ContentType, common.ContentTypeJSON)
require.NoError(t, err)
query := req.URL.Query()
Expand Down
32 changes: 16 additions & 16 deletions internal/core/data/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ func LoadRestRoutes(r *echo.Echo, dic *di.Container, serviceName string) {

// Events
ec := dataController.NewEventController(dic)
r.POST(common.ApiEventServiceNameProfileNameDeviceNameSourceNameEchoRoute, ec.AddEvent, authenticationHook)
r.GET(common.ApiEventIdEchoRoute, ec.EventById, authenticationHook)
r.DELETE(common.ApiEventIdEchoRoute, ec.DeleteEventById, authenticationHook)
r.POST(common.ApiEventServiceNameProfileNameDeviceNameSourceNameRoute, ec.AddEvent, authenticationHook)
r.GET(common.ApiEventIdRoute, ec.EventById, authenticationHook)
r.DELETE(common.ApiEventIdRoute, ec.DeleteEventById, authenticationHook)
r.GET(common.ApiEventCountRoute, ec.EventTotalCount, authenticationHook)
r.GET(common.ApiEventCountByDeviceNameEchoRoute, ec.EventCountByDeviceName, authenticationHook)
r.GET(common.ApiEventCountByDeviceNameRoute, ec.EventCountByDeviceName, authenticationHook)
r.GET(common.ApiAllEventRoute, ec.AllEvents, authenticationHook)
r.GET(common.ApiEventByDeviceNameEchoRoute, ec.EventsByDeviceName, authenticationHook)
r.DELETE(common.ApiEventByDeviceNameEchoRoute, ec.DeleteEventsByDeviceName, authenticationHook)
r.GET(common.ApiEventByTimeRangeEchoRoute, ec.EventsByTimeRange, authenticationHook)
r.DELETE(common.ApiEventByAgeEchoRoute, ec.DeleteEventsByAge, authenticationHook) // TODO: Add authentication to support-scheduler
r.GET(common.ApiEventByDeviceNameRoute, ec.EventsByDeviceName, authenticationHook)
r.DELETE(common.ApiEventByDeviceNameRoute, ec.DeleteEventsByDeviceName, authenticationHook)
r.GET(common.ApiEventByTimeRangeRoute, ec.EventsByTimeRange, authenticationHook)
r.DELETE(common.ApiEventByAgeRoute, ec.DeleteEventsByAge, authenticationHook) // TODO: Add authentication to support-scheduler

// Readings
rc := dataController.NewReadingController(dic)
r.GET(common.ApiReadingCountRoute, rc.ReadingTotalCount, authenticationHook)
r.GET(common.ApiAllReadingRoute, rc.AllReadings, authenticationHook)
r.GET(common.ApiReadingByDeviceNameEchoRoute, rc.ReadingsByDeviceName, authenticationHook)
r.GET(common.ApiReadingByTimeRangeEchoRoute, rc.ReadingsByTimeRange, authenticationHook)
r.GET(common.ApiReadingByResourceNameEchoRoute, rc.ReadingsByResourceName, authenticationHook)
r.GET(common.ApiReadingCountByDeviceNameEchoRoute, rc.ReadingCountByDeviceName, authenticationHook)
r.GET(common.ApiReadingByResourceNameAndTimeRangeEchoRoute, rc.ReadingsByResourceNameAndTimeRange, authenticationHook)
r.GET(common.ApiReadingByDeviceNameAndResourceNameEchoRoute, rc.ReadingsByDeviceNameAndResourceName, authenticationHook)
r.GET(common.ApiReadingByDeviceNameAndResourceNameAndTimeRangeEchoRoute, rc.ReadingsByDeviceNameAndResourceNameAndTimeRange, authenticationHook)
r.GET(common.ApiReadingByDeviceNameAndTimeRangeEchoRoute, rc.ReadingsByDeviceNameAndResourceNamesAndTimeRange, authenticationHook)
r.GET(common.ApiReadingByDeviceNameRoute, rc.ReadingsByDeviceName, authenticationHook)
r.GET(common.ApiReadingByTimeRangeRoute, rc.ReadingsByTimeRange, authenticationHook)
r.GET(common.ApiReadingByResourceNameRoute, rc.ReadingsByResourceName, authenticationHook)
r.GET(common.ApiReadingCountByDeviceNameRoute, rc.ReadingCountByDeviceName, authenticationHook)
r.GET(common.ApiReadingByResourceNameAndTimeRangeRoute, rc.ReadingsByResourceNameAndTimeRange, authenticationHook)
r.GET(common.ApiReadingByDeviceNameAndResourceNameRoute, rc.ReadingsByDeviceNameAndResourceName, authenticationHook)
r.GET(common.ApiReadingByDeviceNameAndResourceNameAndTimeRangeRoute, rc.ReadingsByDeviceNameAndResourceNameAndTimeRange, authenticationHook)
r.GET(common.ApiReadingByDeviceNameAndTimeRangeRoute, rc.ReadingsByDeviceNameAndResourceNamesAndTimeRange, authenticationHook)
}
6 changes: 3 additions & 3 deletions internal/core/keeper/controller/http/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestKeys_KeyValue(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiKVSByKeyEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiKVSByKeyRoute, http.NoBody)
query := req.URL.Query()
query.Add(constants.Plaintext, testCase.plaintext)

Expand Down Expand Up @@ -183,7 +183,7 @@ func TestKeys_KeyOnly(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiKVSByKeyEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiKVSByKeyRoute, http.NoBody)
query := req.URL.Query()
query.Add(constants.KeyOnly, "true")

Expand Down Expand Up @@ -303,7 +303,7 @@ func TestAddKeys(t *testing.T) {
require.NoError(t, err)

reader := strings.NewReader(string(jsonData))
req, err := http.NewRequest(http.MethodPut, common.ApiKVSByKeyEchoRoute, reader)
req, err := http.NewRequest(http.MethodPut, common.ApiKVSByKeyRoute, reader)
query := req.URL.Query()
query.Add(constants.Flatten, testCase.flatten)

Expand Down
4 changes: 2 additions & 2 deletions internal/core/keeper/controller/http/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func TestRegistryController_Deregister(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodDelete, common.ApiRegistrationByServiceIdEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodDelete, common.ApiRegistrationByServiceIdRoute, http.NoBody)
require.NoError(t, err)

// Act
Expand Down Expand Up @@ -288,7 +288,7 @@ func TestRegistryController_RegistrationByServiceId(t *testing.T) {
for _, testCase := range tests {
t.Run(testCase.name, func(t *testing.T) {
e := echo.New()
req, err := http.NewRequest(http.MethodGet, common.ApiRegistrationByServiceIdEchoRoute, http.NoBody)
req, err := http.NewRequest(http.MethodGet, common.ApiRegistrationByServiceIdRoute, http.NoBody)
require.NoError(t, err)

// Act
Expand Down
10 changes: 5 additions & 5 deletions internal/core/keeper/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ func LoadRestRoutes(r *echo.Echo, dic *di.Container, serviceName string) {

// KV
kv := keeperController.NewKVController(dic)
r.GET(common.ApiKVSByKeyEchoRoute, kv.Keys, authenticationHook)
r.PUT(common.ApiKVSByKeyEchoRoute, kv.AddKeys, authenticationHook)
r.DELETE(common.ApiKVSByKeyEchoRoute, kv.DeleteKeys, authenticationHook)
r.GET(common.ApiKVSByKeyRoute, kv.Keys, authenticationHook)
r.PUT(common.ApiKVSByKeyRoute, kv.AddKeys, authenticationHook)
r.DELETE(common.ApiKVSByKeyRoute, kv.DeleteKeys, authenticationHook)

// Registry
rc := keeperController.NewRegistryController(dic)
r.POST(common.ApiRegisterRoute, rc.Register, authenticationHook)
r.PUT(common.ApiRegisterRoute, rc.UpdateRegister, authenticationHook)
r.GET(common.ApiAllRegistrationsRoute, rc.Registrations, authenticationHook)
r.GET(common.ApiRegistrationByServiceIdEchoRoute, rc.RegistrationByServiceId, authenticationHook)
r.DELETE(common.ApiRegistrationByServiceIdEchoRoute, rc.Deregister, authenticationHook)
r.GET(common.ApiRegistrationByServiceIdRoute, rc.RegistrationByServiceId, authenticationHook)
r.DELETE(common.ApiRegistrationByServiceIdRoute, rc.Deregister, authenticationHook)
}
Loading
Loading