affinitize / PhotoSpot

Photo Location app
0 stars 0 forks source link

Set up Parse with our schema #1

Closed pjm824 closed 7 years ago

dfried2007 commented 7 years ago

Here is what I am thinking today for a service interface. Please let me know your input and/or additional requirements. If you approve, I will go ahead and implement these 6 service calls for you in Parse DB. ...df...

package parse;

/**

public String url; public int width; public int height; public String type; public int colordepth; public float longitude; public float latitude; public String[] categories; public int likes; public int dislikes; public String comment; public String createdby; public long createdtime; public String source;

}


package parse;

import java.util.HashMap; import java.util.List;

/**

public ServiceResponse<List> getFotos(HashMap<String, Object> params); public ServiceResponse postFoto(Foto foto); public ServiceResponse updateFoto(Foto foto); public ServiceResponse deleteFoto(Foto foto); public ServiceResponse likeFoto(String url); public ServiceResponse dislikeFoto(String url); }

On Mon, Apr 3, 2017 at 9:34 PM, Paul Min notifications@github.com wrote:

Assigned #1 https://github.com/affinitize/ShotSpot/issues/1 to @dfried2007 https://github.com/dfried2007.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/affinitize/ShotSpot/issues/1#event-1027734817, or mute the thread https://github.com/notifications/unsubscribe-auth/AXskjIxFaH5FRglVICI85j6MuGMgeURHks5rschygaJpZM4MyX-K .

pjm824 commented 7 years ago

Hey Dave, I think that looks good! Are you pretty set on calling it Foto? I would prefer Photo if you don't feel strongly about it.

dfried2007 commented 7 years ago

Ok. I have changed it to Photo; also did some refactoring; also quickly implemented the first 2 Parse services for you to test with - getPhotos and postPhoto. BUT, I was not able to push to Github - seems my credentials are not good enough. When I try to push, It accepts my keyphrase, but then says I have no access privilege. Can you authorize me, or tell me how to resolve this? I'd love to submit ASAP. ...df...

On Tue, Apr 4, 2017 at 7:37 PM, Paul Min notifications@github.com wrote:

Hey Dave, I think that looks good! Are you pretty set on calling it Foto? I would prefer Photo if you don't feel strongly about it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/affinitize/ShotSpot/issues/1#issuecomment-291724896, or mute the thread https://github.com/notifications/unsubscribe-auth/AXskjCIZy8topsEPqs4DCge96A_doqPQks5rsv5cgaJpZM4MyX-K .

dfried2007 commented 7 years ago

...to avoid any painful merges...

On Wed, Apr 5, 2017 at 3:14 PM, Dave Friedman dfried2007@gmail.com wrote:

Ok. I have changed it to Photo; also did some refactoring; also quickly implemented the first 2 Parse services for you to test with - getPhotos and postPhoto. BUT, I was not able to push to Github - seems my credentials are not good enough. When I try to push, It accepts my keyphrase, but then says I have no access privilege. Can you authorize me, or tell me how to resolve this? I'd love to submit ASAP. ...df...

On Tue, Apr 4, 2017 at 7:37 PM, Paul Min notifications@github.com wrote:

Hey Dave, I think that looks good! Are you pretty set on calling it Foto? I would prefer Photo if you don't feel strongly about it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/affinitize/ShotSpot/issues/1#issuecomment-291724896, or mute the thread https://github.com/notifications/unsubscribe-auth/AXskjCIZy8topsEPqs4DCge96A_doqPQks5rsv5cgaJpZM4MyX-K .

pjm824 commented 7 years ago

http://guides.codepath.com/android/Configuring-a-Parse-Server#setting-a-new-parse-server

... this looks like it will be useful

dfried2007 commented 7 years ago

108 git remote rm origin 109 git remote add origin git@github.com: dfried2009/com-codepath-photospot.git 110 git add . 111 git status 112 git add . 113 git commit -am "Added first services" 114 git status 115 git push origin master

Well, this is bad. I cannot push. I see this after recreating the local repo:

ERROR: Repository not found. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

Do you know what I am doing wrong? ...df...

On Wed, Apr 5, 2017 at 7:23 PM, Paul Min notifications@github.com wrote:

http://guides.codepath.com/android/Configuring-a-Parse- Server#setting-a-new-parse-server

... this looks like it will be useful

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/affinitize/PhotoSpot/issues/1#issuecomment-292051049, or mute the thread https://github.com/notifications/unsubscribe-auth/AXskjGMmCBgRk6BBQ_-e6vo0HwDxEtUuks5rtEy2gaJpZM4MyX-K .

pjm824 commented 7 years ago

hmmm, im not sure. If you can't get it to work, maybe you should just create a new repo. We don't have anything in the current one anyways, besides the readme

dfried2007 commented 7 years ago

Ok.

I'll do that tonight.

Retrofit looks good for the interface from Flickr. Since I am using the Photo object as a DAO for Parse persistence, which needs a hashset of its data, can we avoid having two separate data transfer objects and use the same Photo object as the java POJO for Retrofit?

I think this would work. I am betting that in Retrofit's onResponse(), the response.body() Photo object is populated by calls to our enhanced setters, and not direct reflectively into the strings.

It would look something like this:

@ParseClassName("Photo") @Root(name = "flickrPictureTag", strict = false) public class Photo extends ParseObject {

    @Element(name = "title")
    private String title;

    @Element(name = "link")
    private String link;

public Photo() { super(); }

    public String getTitle() {
            return title;
    }
    public void setTitle(String title) {
            this.title = title;

put("title", title); }

    public String getLink() {
            return link;
    }
    public void setLink(String link) {
            this.link = link;

put("link", link); } }

On Thu, Apr 6, 2017 at 11:19 AM, Paul Min notifications@github.com wrote:

hmmm, im not sure. If you can't get it to work, maybe you should just create a new repo. We don't have anything in the current one anyways, besides the readme

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/affinitize/PhotoSpot/issues/1#issuecomment-292262719, or mute the thread https://github.com/notifications/unsubscribe-auth/AXskjCpAvUauZ1MMkwLdLJmmIkGHzG8cks5rtSy0gaJpZM4MyX-K .

dfried2007 commented 7 years ago

Looks like I was wrong. Using Retrofit, which uses GSON, deserializing the JSON key always ignores any annotated setter and uses reflection on the private fields.

Is there a way to tell GSON to use only getters and setters? Not yet. From the design doc: "There are good arguments to support properties as well. We intend to enhance Gson in a latter version to support properties as an alternate mapping for indicating Json fields. For now, Gson is fields-based."

So I will keep two model objects in models (pojos) and daos (ParseObjects). One may be constructed from the other. This way we will avoid any conflicts with a possible custom serializer/deserializer,

...df...

On Thu, Apr 6, 2017 at 12:38 PM, Dave Friedman dfried2007@gmail.com wrote:

Ok.

I'll do that tonight.

Retrofit looks good for the interface from Flickr. Since I am using the Photo object as a DAO for Parse persistence, which needs a hashset of its data, can we avoid having two separate data transfer objects and use the same Photo object as the java POJO for Retrofit?

I think this would work. I am betting that in Retrofit's onResponse(), the response.body() Photo object is populated by calls to our enhanced setters, and not direct reflectively into the strings.

It would look something like this:

@ParseClassName("Photo") @Root(name = "flickrPictureTag", strict = false) public class Photo extends ParseObject {

    @Element(name = "title")
    private String title;

    @Element(name = "link")
    private String link;

public Photo() { super(); }

    public String getTitle() {
            return title;
    }
    public void setTitle(String title) {
            this.title = title;

put("title", title); }

    public String getLink() {
            return link;
    }
    public void setLink(String link) {
            this.link = link;

put("link", link); } }

On Thu, Apr 6, 2017 at 11:19 AM, Paul Min notifications@github.com wrote:

hmmm, im not sure. If you can't get it to work, maybe you should just create a new repo. We don't have anything in the current one anyways, besides the readme

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/affinitize/PhotoSpot/issues/1#issuecomment-292262719, or mute the thread https://github.com/notifications/unsubscribe-auth/AXskjCpAvUauZ1MMkwLdLJmmIkGHzG8cks5rtSy0gaJpZM4MyX-K .

pjm824 commented 7 years ago

I can not use retrofit and handle the request manually if that makes it easier to deal with parse

dfried2007 commented 7 years ago

https://github.com/dfried2007/PhotoSpot/settings/collaboration

Hi.

I added the code to a new repository - the affinitize one just was not behaving. Send me your GitHub Id and I shall add you as a collaborator.

When you get the code, look at the Photo object for your Retrofit, and the ParseService for an understanding of how to use this. Let me know if I need to change anything, I will forge forward tomorrow. We will need to integrate soon.

...df...

On Thu, Apr 6, 2017 at 7:50 PM, Paul Min notifications@github.com wrote:

I can not use retrofit and handle the request manually if that makes it easier to deal with parse

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/affinitize/PhotoSpot/issues/1#issuecomment-292410814, or mute the thread https://github.com/notifications/unsubscribe-auth/AXskjNyJ8fQ4w8ySU3jzIK_l1lxOY_M1ks5rtaR7gaJpZM4MyX-K .

pjm824 commented 7 years ago

The repo has to be in an organization and not a repo directly owned by you. Step two on this page, https://courses.codepath.com/courses/intro_to_android/unit/4#!milestone

So you can create a new repo under the Affinitize organization or create a new organization. Also my username is pjm824

https://github.com/affinitize

dfried2007 commented 7 years ago

ok, But to keep the same name under the Affinitize organization I will first delete the existing project, then recreate it. ...df...

On Fri, Apr 7, 2017 at 12:18 PM, Paul Min notifications@github.com wrote:

The repo has to be in an organization and not a repo directly owned by you. Step two on this page, https://courses.codepath.com/ courses/intro_to_android/unit/4#!milestone

So you can create a new repo under the Affinitize organization or create a new organization. Also my username is pjm824

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/affinitize/PhotoSpot/issues/1#issuecomment-292628233, or mute the thread https://github.com/notifications/unsubscribe-auth/AXskjO6vTuHMRliUvoQCGFTaQqWgbKeQks5rtowegaJpZM4MyX-K .

pjm824 commented 7 years ago

ok. let I'll wait to merge in any changes til you've created the new repo

dfried2007 commented 7 years ago

Hey. You are good to go now. I figured out the git problems and did a manual merge to the existing repository: https://github.com/affinitize/PhotoSpot Sorry it took so long. I'll wait for your changes to see if we have a UI I can test with. ...df...

On Fri, Apr 7, 2017 at 8:35 PM, Paul Min notifications@github.com wrote:

ok. let I'll wait to merge in any changes til you've created the new repo

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/affinitize/PhotoSpot/issues/1#issuecomment-292691932, or mute the thread https://github.com/notifications/unsubscribe-auth/AXskjLf7zDY7GBfmJGMxAL4_tB7_BRxsks5rtwB2gaJpZM4MyX-K .

dfried2007 commented 7 years ago

Completed version 1 of the Parse PhotoDao based persistence/retrieval/query API in ParseServiceImpl.java