enh: make clone function use ocs

Signed-off-by: grnd-alt <git@belakkaf.net>
This commit is contained in:
grnd-alt
2024-12-19 14:05:32 +01:00
parent 22bb8d65e9
commit 60b7357ef4
3 changed files with 6 additions and 5 deletions

View File

@@ -43,7 +43,6 @@ return [
['name' => 'card#read', 'url' => '/cards/{cardId}', 'verb' => 'GET'],
['name' => 'card#create', 'url' => '/cards', 'verb' => 'POST'],
['name' => 'card#update', 'url' => '/cards/{cardId}', 'verb' => 'PUT'],
['name' => 'card#clone', 'url' => '/cards/{cardId}/clone', 'verb' => 'POST'],
['name' => 'card#delete', 'url' => '/cards/{cardId}', 'verb' => 'DELETE'],
['name' => 'card#deleted', 'url' => '/{boardId}/cards/deleted', 'verb' => 'GET'],
['name' => 'card#rename', 'url' => '/cards/{cardId}/rename', 'verb' => 'PUT'],
@@ -138,6 +137,8 @@ return [
['name' => 'comments_api#update', 'url' => '/api/v{apiVersion}/cards/{cardId}/comments/{commentId}', 'verb' => 'PUT'],
['name' => 'comments_api#delete', 'url' => '/api/v{apiVersion}/cards/{cardId}/comments/{commentId}', 'verb' => 'DELETE'],
['name' => 'card#clone', 'url' => '/api/v{apiVersion}/cards/{cardId}/clone', 'verb' => 'POST'],
['name' => 'overview_api#upcomingCards', 'url' => '/api/v{apiVersion}/overview/upcoming', 'verb' => 'GET'],
['name' => 'search#search', 'url' => '/api/v{apiVersion}/search', 'verb' => 'GET'],

View File

@@ -303,8 +303,8 @@ describe('Card', function () {
})
})
it('clone card', () => {
cy.intercept({ method: 'POST', url: '**/apps/deck/cards/*/clone' }).as('clone')
it.only('clone card', () => {
cy.intercept({ method: 'POST', url: '**/apps/deck/**/cards/*/clone' }).as('clone')
cy.get('.card:contains("Hello world")').should('be.visible').click()
cy.get('#app-sidebar-vue')
.find('.ProseMirror h1').contains('Hello world').should('be.visible')

View File

@@ -4,7 +4,7 @@
*/
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { generateOcsUrl, generateUrl } from '@nextcloud/router'
export class CardApi {
@@ -29,7 +29,7 @@ export class CardApi {
}
cloneCard(cardId, targetStackId) {
return axios.post(this.url(`/cards/${cardId}/clone`), {
return axios.post(generateOcsUrl(`apps/deck/api/v1.0/cards/${cardId}/clone`), {
targetStackId,
})
.then(