-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sets the defaultSchemas keys in the SchemaCollection #1421
Conversation
@@ -1,5 +1,6 @@ | |||
|
|||
import MongoCollection from './MongoCollection'; | |||
import { defaultColumns } from '../../../Schema'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really happy with that circular dependency, nor the fact that the adapter depends upon parse-server... but otherwise that would defer the responsibility to the router (which is not good). Solution would be to introduce a SchemaController
Current coverage is
|
Put it into the router as it acts as a controller in some ways... |
@flovilmart updated the pull request. |
@@ -14,16 +14,34 @@ function classNameMismatchResponse(bodyClass, pathClass) { | |||
); | |||
} | |||
|
|||
function injectDefaultSchema(schema) { | |||
if (Array.isArray(schema)) { | |||
let schemas = schema.map((s) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than have a function that accepts a schema or an array of schemas, can we have one that only accepts a single schema, and do the map
outside the function if it needs it?
Does this test fail if your changes aren't included? |
The test don't fail :/ ... probably because the full schema is set when you explicitly create it... also, just doing a GET won't work as the schema is not found... |
Dang. Do you think it would be too much work to make a test that creates the legacy data by digging around on Mongo directly? |
Yeah I should probably write a bad schema directly to mongo... |
@flovilmart updated the pull request. |
function getAllSchemas(req) { | ||
return req.config.database.schemaCollection() | ||
.then(collection => collection.getAllSchemas()) | ||
.then(schemas => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to be more concise, you could do
then(schemas => schemas.map(injectDefaultSchema))
Up to you though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's really valid...
Pushing the consisensee thing and squashing after |
@flovilmart updated the pull request. |
fixes #1388