Skip to content

Commit

Permalink
Add support for indexes in capabilities response
Browse files Browse the repository at this point in the history
  • Loading branch information
MXPOL committed Mar 31, 2024
1 parent 50e0f23 commit 0a81420
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
14 changes: 8 additions & 6 deletions apps/velo-external-db/test/e2e/app.e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { authOwner } from '@wix-velo/external-db-testkit'
import { initApp, teardownApp, dbTeardown, setupDb, currentDbImplementationName, env } from '../resources/e2e_resources'
import { initApp, teardownApp, dbTeardown, setupDb, currentDbImplementationName, env, supportedOperations } from '../resources/e2e_resources'
import { SchemaOperations } from '@wix-velo/velo-external-db-types'
import { givenHideAppInfoEnvIsTrue } from '../drivers/app_info_config_test_support'

const axios = require('axios').create({
Expand Down Expand Up @@ -36,11 +37,12 @@ describe(`Velo External DB: ${currentDbImplementationName()}`, () => {
expect((await axios.post('/v3/capabilities/get', { }, authOwner)).data).toEqual(expect.objectContaining({
supportsCollectionModifications: true,
supportedFieldTypes: expect.toBeArray(),
supportsCollectionDisplayName: false,
supportsCollectionDisplayField: false,
supportsCollectionPermissions: false,
supportsCollectionFieldDisplayName: false,
supportsCollectionFieldDescription: false,
indexptions: {
supportsIndexes: supportedOperations.includes(SchemaOperations.Indexing),
maxNumberOfRegularIndexesPerCollection: 10,
maxNumberOfUniqueIndexesPerCollection: 10,
maxNumberOfIndexesPerCollection: 20,
},
}))
})

Expand Down
11 changes: 6 additions & 5 deletions libs/velo-external-db-core/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,12 @@ export const createRouter = () => {
const capabilitiesResponse = {
supportsCollectionModifications: cfg.readOnlySchema ? false : true,
supportedFieldTypes: Object.values(schemaSource.FieldType).filter(t => !unsupportedFieldTypes.includes(t)),
supportsCollectionDisplayName: false,
supportsCollectionDisplayField: false,
supportsCollectionPermissions: false,
supportsCollectionFieldDisplayName: false,
supportsCollectionFieldDescription: false,
indexptions: {
supportsIndexes: indexService.storage ? true : false,
maxNumberOfRegularIndexesPerCollection: 10,
maxNumberOfUniqueIndexesPerCollection: 10,
maxNumberOfIndexesPerCollection: 20,
}
}

res.json(capabilitiesResponse)
Expand Down

0 comments on commit 0a81420

Please sign in to comment.