Creating timestamp plugin
wenderjean opened this issue · comments
My proposal is to create a new plugin to add timestamp behavior to a structure, what I mean?
I am current in a project that adds a document to a NoSQL database, I want to have a created_at
and updated_at
to that document, what if I could create a new structure and invoke something like mystructure.updateTimestamps()
to set created and updated times to me.
I think it's a good idea. We could create a plugin system that is passed as the second parameter os attributes
, like:
attributes({
name: String
}, {
plugins: [timestampsPlugin]
})(class User { });
Question: should the plugin add those fields automatically to the model or will they just update the values?
I think It should add fields automatically to model to allow a behavior totally transparent, agree?
@wenderjean seems like a good idea!