hoodiehq / pouchdb-hoodie-api

:dog: Hoodie-like API for PouchDB
https://hoodiehq.github.io/pouchdb-hoodie-api
Apache License 2.0
44 stars 11 forks source link

add createdAt / updatedAt / deletedAt timestamps #47

Closed gr2m closed 9 years ago

gr2m commented 9 years ago
gr2m commented 9 years ago

I wonder if createdAt and deletedAt are the right names here, as the matching methods are called .add and .remove

Now would be the time to change the timestamp properties to addedAt and removedAt, to be more consistent.

janl commented 9 years ago

I’m torn, I’m really used to createdAt, at least. I’m not sure if parity with the method names adds anything. I do like the symmetry though.

tamacodechi commented 9 years ago

Sorry to bother with this, I'm a little confused, it seems that createdAt and updatedAt already exist: https://github.com/hoodiehq/hoodie.js/blob/master/src/hoodie/store/localstore.js#L25-L29 Are these required on another level? I'm completely missing what needs to be done, but I'd love to help :)

gr2m commented 9 years ago

@Althaire don't be sorry, thanks for taking the time to look into it :)

createdAt and updatedAt indeed already exist in current hoodie.js, but pouchdb-hoodie-api is a rebuild from scratch of what currently is hoodie.store, so we are discussing how to add it again.

What needs to be done is, to

  1. When an object gets created (it doesn't exist yet), then set createdAt to now, and updatedAt to now.
  2. When an existing object gets updated, then set updatedAt to now.
  3. When an existing object gets removed, then set deletedAt to now.

See https://github.com/hoodiehq/hoodie.js/blob/master/src/hoodie/store/localstore.js#L93-L94 for how it's currently implemented.

NickColley commented 9 years ago

Working on this.

varjmes commented 9 years ago

@nickcolley could you assign yourself to what ever issues you are working on, to avoid duplication of effort? The assignee button is on the right hand column. Cheers!

NickColley commented 9 years ago

@Charlotteis I don't have permission rights to do that sorry, hope you weren't working on this!

gr2m commented 9 years ago

@Charlotteis @nickcolley my fault. Nick, you should be able to do it now. Also, welcome to @hoodiehq/committers :tada: (you might need to confirm the invitation first)

NickColley commented 9 years ago

@gr2m cheers, sorry for the confusion :+1:

varjmes commented 9 years ago

@nickcolley My bad! I wasn't working on it, I just wanted to make sure no-one else started to. Welcome to the team! :tada:

gr2m commented 9 years ago

closed via #69