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

Update the data model & fixtures #101

Closed
11 tasks done
ErisDS opened this issue Jun 1, 2013 · 6 comments
Closed
11 tasks done

Update the data model & fixtures #101

ErisDS opened this issue Jun 1, 2013 · 6 comments
Assignees
Milestone

Comments

@ErisDS
Copy link
Member

ErisDS commented Jun 1, 2013

The post data model is currently very rough. Discussion on the topic has died, so I'm gonna put this issue out there and try to make some progress.

Posts:

  • Add a uuid
  • Add published_at and published_by
  • Add author_id, automatically set to the same as created_by
  • Add meta_title (SEO)
  • Add meta_description (SEO)
  • Add meta_keywords (SEO)

A decision needs to be made about what to do with image. That will go into a separate story.

Users:

  • Add a uuid
  • Remove username
  • Merge first_name and last_name into full_name

Settings:

  • Add a uuid
  • Add type / group, defaults to 'general'

This issue should encompass updating the two 001.js files so that we have a better model & fixtures to go with it.

@ErisDS
Copy link
Member Author

ErisDS commented Jun 4, 2013

@tgriesser I've done most of this, but I got a bit stuck trying to set published_at and published_by. I intended to use the existing on saving method on the post model, but I can't find any way to get the old values. There is a this._previousAttributes, but this contains the same as attributes.

Also, I'm thinking having both created_by and author_id might be over the top... if we make it possible to change the author, we could just change the created by... and we can just name the relationship from post to user "author" rather than user.

Am really interested to hear thoughts an opinions on these changes.

@JohnONolan
Copy link
Member

We definitely will allow changing of assigned authors later - it also may be worth thinking about how post revisions (potentially by multiple authors) might work

@ErisDS
Copy link
Member Author

ErisDS commented Jun 5, 2013

This is the reason why I wanted to add author_id, so that created_by refers only to who created the post, not who shows as the author. This doesn't make much sense right now, but when we have multiple versions of a post & advanced workflows, created_by will be the user who made the change, and author_id will still be who we show as the author on a post.

My only concern right now was whether this would cause confusion, but I think I have just convinced myself that it is necessary.

@tgriesser
Copy link
Contributor

@ErisDS - For the published_at and published_by items, I'm going to take a look at how to best handle keeping original values until the model is sync'ed with the db in Bookshelf.

About the author_id, would this make sense to implement as a many-to-many relation (authors_posts)?

@ErisDS
Copy link
Member Author

ErisDS commented Jun 6, 2013

Hmm.. many to many authors.. interesting idea.

I'm not done with this issue yet, still have the custom data bits to do. Gonna create a separate issues for published at/by & generating uuids

@ErisDS
Copy link
Member Author

ErisDS commented Jun 17, 2013

@tgriesser I've closed this, but whilst I was messing around with the tests I noticed some oddness with dates. Please see api_post_spec.js line 86&86.. I'm not sure why these assertions were finding timestamps rather than date objects?

morficus pushed a commit to morficus/Ghost that referenced this issue Sep 4, 2014
Further changes to the data model to ensure created_by, author_id and updated_by are all set to user 1
Updated settings such that the default type is always 'general', and changed the types in the fixtures to be slightly more useful
Added additional assertions to tests to cover more assumptions about data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants