Repository: pablosnt/rekono (language: python)

Issue:
Change Wordlists endpoint to /api/wordlists/ instead of /api/resources/wordlists
Replace `/api/resources/wordlists/` endpoint by `/api/wordlists/`


Discussion / hints:

Fix patch:
diff --git a/rekono/frontend/src/components/Wordlists.vue b/rekono/frontend/src/components/Wordlists.vue
index 2ecca417d..28d5f873b 100644
--- a/rekono/frontend/src/components/Wordlists.vue
+++ b/rekono/frontend/src/components/Wordlists.vue
@@ -77,20 +77,20 @@ export default {
   methods: {
     fetchData (params = {}) {
       params.o = 'type,name'
-      return this.getOnePage('/api/resources/wordlists/', params)
+      return this.getOnePage('/api/wordlists/', params)
         .then(response => {
           this.data = response.data.results
           this.total = response.data.count
         })
     },
     deleteWordlist () {
-      this.delete(`/api/resources/wordlists/${this.selectedWordlist.id}/`, this.selectedWordlist.name, 'Wordlist deleted successfully').then(() => this.fetchData())
+      this.delete(`/api/wordlists/${this.selectedWordlist.id}/`, this.selectedWordlist.name, 'Wordlist deleted successfully').then(() => this.fetchData())
     },
     likeWordlist (wordlistId) {
-      this.post(`/api/resources/wordlists/${wordlistId}/like/`, { }).then(() => this.fetchData())
+      this.post(`/api/wordlists/${wordlistId}/like/`, { }).then(() => this.fetchData())
     },
     dislikeWordlist (wordlistId) {
-      this.post(`/api/resources/wordlists/${wordlistId}/dislike/`, { }).then(() => this.fetchData())
+      this.post(`/api/wordlists/${wordlistId}/dislike/`, { }).then(() => this.fetchData())
     }
   }
 }
diff --git a/rekono/frontend/src/modals/Task.vue b/rekono/frontend/src/modals/Task.vue
index f7c22d7cf..f94a1f1a6 100644
--- a/rekono/frontend/src/modals/Task.vue
+++ b/rekono/frontend/src/modals/Task.vue
@@ -354,7 +354,7 @@ export default {
       }
     },
     updateWordlists () {
-      this.getAllPages('/api/resources/wordlists/', { o: 'type,name' }).then(results => this.wordlists = results)
+      this.getAllPages('/api/wordlists/', { o: 'type,name' }).then(results => this.wordlists = results)
     },
     cleanScheduledIn () {
       this.scheduledIn = null
diff --git a/rekono/frontend/src/modals/Wordlist.vue b/rekono/frontend/src/modals/Wordlist.vue
index 1f99c783e..1a794db16 100644
--- a/rekono/frontend/src/modals/Wordlist.vue
+++ b/rekono/frontend/src/modals/Wordlist.vue
@@ -86,14 +86,14 @@ export default {
     },
     create () {
       return this.post(
-        '/api/resources/wordlists/',
+        '/api/wordlists/',
         this.getFormData(),
         this.name, 'New wordlist created successfully',
         true, { 'Content-Type': 'multipart/form-data' }
       )
     },
     update () {
-      return this.put(`/api/resources/wordlists/${this.wordlist.id}/`, { 'name': this.name, 'type': this.type }, this.name, 'Wordlist updated successfully')
+      return this.put(`/api/wordlists/${this.wordlist.id}/`, { 'name': this.name, 'type': this.type }, this.name, 'Wordlist updated successfully')
     },
     getFormData () {
       const data = new FormData()
diff --git a/rekono/resources/urls.py b/rekono/resources/urls.py
index 807fb76ed..4e1e676b4 100644
--- a/rekono/resources/urls.py
+++ b/rekono/resources/urls.py
@@ -4,6 +4,6 @@
 # Register your views here.
 
 router = SimpleRouter()
-router.register('resources/wordlists', WordlistViewSet)
+router.register('wordlists', WordlistViewSet)
 
 urlpatterns = router.urls


Test patch:
diff --git a/rekono/testing/api/test_resources.py b/rekono/testing/api/test_resources.py
index 74b2aea46..7b3d4315b 100644
--- a/rekono/testing/api/test_resources.py
+++ b/rekono/testing/api/test_resources.py
@@ -12,7 +12,7 @@ class WordlistsTest(RekonoApiTestCase):
 
     def setUp(self) -> None:
         '''Create initial data before run tests.'''
-        self.endpoint = '/api/resources/wordlists/'                             # Wordlists API endpoint
+        self.endpoint = '/api/wordlists/'                                       # Wordlists API endpoint
         super().setUp()
         # Wordlists paths
         self.resources = os.path.join(self.data_path, 'resources')