mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
@@ -207,6 +207,11 @@ export class CollectionsService {
|
||||
|
||||
const collections: Collection[] = [];
|
||||
|
||||
/**
|
||||
* The collections as known in the schema cache.
|
||||
*/
|
||||
const knownCollections = Object.keys(this.schema.collections);
|
||||
|
||||
for (const table of tablesInDatabase) {
|
||||
const collection: Collection = {
|
||||
collection: table.name,
|
||||
@@ -214,7 +219,12 @@ export class CollectionsService {
|
||||
schema: table,
|
||||
};
|
||||
|
||||
collections.push(collection);
|
||||
// By only returning collections that are known in the schema cache, we prevent weird
|
||||
// situations where the collections endpoint returns different info from every other
|
||||
// collection
|
||||
if (knownCollections.includes(table.name)) {
|
||||
collections.push(collection);
|
||||
}
|
||||
}
|
||||
|
||||
return collections;
|
||||
@@ -266,6 +276,8 @@ export class CollectionsService {
|
||||
|
||||
const collections: Collection[] = [];
|
||||
|
||||
const knownCollections = Object.keys(this.schema.collections);
|
||||
|
||||
for (const table of tables) {
|
||||
const collection: Collection = {
|
||||
collection: table.name,
|
||||
@@ -273,7 +285,12 @@ export class CollectionsService {
|
||||
schema: table,
|
||||
};
|
||||
|
||||
collections.push(collection);
|
||||
// By only returning collections that are known in the schema cache, we prevent weird
|
||||
// situations where the collections endpoint returns different info from every other
|
||||
// collection
|
||||
if (knownCollections.includes(table.name)) {
|
||||
collections.push(collection);
|
||||
}
|
||||
}
|
||||
|
||||
return collections;
|
||||
|
||||
Reference in New Issue
Block a user