Skip to content
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

Begin isolating object creation code into an externalizable API. #1569

Merged
merged 13 commits into from
Apr 20, 2016

Conversation

drew-gross
Copy link
Contributor

This makes a copy of transformKeyValue, strips out all the parts not relevant to creating new objects, and uses that for createObject in the db adapter. It will still require some more tweaks later.

@@ -91,7 +91,7 @@ const requiredColumns = Object.freeze({
_Role: ["name", "ACL"]
});

const systemClasses = Object.freeze(['_User', '_Installation', '_Role', '_Session', '_Product']);
const systemClasses = Object.freeze(['_User', '_Installation', '_Role', '_Session', '_Product', '_PushStatus']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall discussing that change earlier with you and were advised not to put it there :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. At this point I think it's the best plan. _PushStatus in Parse.com is not a Parse Object, but in Parse Server it does seem to be a Parse Object, kinda. We don't want it to be changeable by clients though, maybe I should add a test for that. Making it visible in the dash and/or modifiable by master key seems fine though.

We definitely want to have the ability to store _PushStatus in a separate DB, so having it go through the database adapter is the right way to go.

@codecov-io
Copy link

Current coverage is 92.82%

Merging #1569 into master will increase coverage by +0.07% as of 15877f8

@@            master   #1569   diff @@
======================================
  Files           87      87       
  Stmts         5478    5520    +42
  Branches      1020    1031    +11
  Methods          0       0       
======================================
+ Hit           5081    5124    +43
- Partial          9      10     +1
+ Missed         388     386     -2

Review entire Coverage Diff as of 15877f8

Powered by Codecov. Updated on successful CI builds.

const mongoObject = transform.parseObjectToMongoObject(schema, className, object);
// TODO: As yet not particularly well specified. Creates an object. Shouldn't need the
// schemaController, but MongoTransform still needs it :( maybe shouldn't even need the schema,
// and should infer from the type. Or maybe does need the schema for validations. Or maybe needs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the adapter point of view, we should not need the schema, validation should be taken care of by the DBController.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is my thought as well. The legacy format needs to know if a field is a pointer though, because it saves them differently 😢 either way, later PR.

@facebook-github-bot
Copy link

@drew-gross updated the pull request.

let coercedToDate;
switch(restKey) {
case 'objectId': return {key: '_id', value: restValue};
case '_created_at'://TODO: for some reason, _PushStatus is already transformed when it gets here. For now,
Copy link
Contributor

@flovilmart flovilmart Apr 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should update the created at from _PushStatus as it's a bug that emerged when I moved it to use the DBController instead of the direct mongo access.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh? if _PushStatus is a Parse Object, it should have createdAt when in Parse Format and _created_at when in Mongo Format. It should never have _created_at when inside Parse Server.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's what I'm saying :) originally it was a pure mongo object, then I updated to use the DBController and it passed review without changing that. I'll do a PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah OK. Your original note was a little confusing. Can you wait for this to merge, then do a single PR that fixes the bug and also removed the special casing and TODOs from this function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem

@drew-gross
Copy link
Contributor Author

Reviewed in slack

@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Nov 1, 2021
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.0.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants