Skip to content

Commit

Permalink
fix: Remove deprecated usage of CC
Browse files Browse the repository at this point in the history
  • Loading branch information
Crash-- committed Mar 16, 2023
1 parent 8268ef0 commit 88ae9f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/cozy-doctypes/src/Document.js
Expand Up @@ -13,6 +13,7 @@ const get = require('lodash/get')
const { parallelMap } = require('./utils')
const CozyClient = require('cozy-client/dist/CozyClient').default
const Q = require('cozy-client/dist/queries/dsl').Q

const log = require('cozy-logger').namespace('Document')
const querystring = require('querystring')

Expand Down Expand Up @@ -172,7 +173,7 @@ class Document {
throw new Error('doctype is not defined')
}

const resp = await this.cozyClient.collection(this.doctype).get(id)
const resp = await this.cozyClient.query(Q(this.doctype).getById(id))
return resp.data
}

Expand Down
10 changes: 8 additions & 2 deletions packages/cozy-doctypes/src/File.spec.js
Expand Up @@ -37,7 +37,10 @@ describe('File model', () => {
getSpy.mockImplementation(() =>
Promise.resolve({
data: {
path: parentDirPath
path: parentDirPath,
_type: 'io.cozy.files',
id: '1',
_id: 1
}
})
)
Expand Down Expand Up @@ -259,7 +262,10 @@ describe('File model', () => {
getSpy.mockImplementation(() =>
Promise.resolve({
data: {
path: '/GrandParent/Parent'
path: '/GrandParent/Parent',
_type: 'io.cozy.files',
id: '1',
_id: '1'
}
})
)
Expand Down
5 changes: 4 additions & 1 deletion packages/cozy-doctypes/src/Folder.js
@@ -1,3 +1,4 @@
const { Q } = require('cozy-client/dist/queries/dsl')
const Application = require('./Application')
const CozyFile = require('./File')

Expand All @@ -21,7 +22,9 @@ class CozyFolder extends CozyFile {
}
])

const { data: dirInfos } = await collection.get(dirId)
const { data: dirInfos } = await this.cozyClient.query(
Q(CozyFile.doctype).getById(dirId)
)

return dirInfos
}
Expand Down

0 comments on commit 88ae9f5

Please sign in to comment.