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

Creating timestamp plugin #35

Open
wenderjean opened this issue Jul 24, 2017 · 3 comments
Open

Creating timestamp plugin #35

wenderjean opened this issue Jul 24, 2017 · 3 comments

Comments

@wenderjean
Copy link
Collaborator

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.

@talyssonoc
Copy link
Owner

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?

@wenderjean
Copy link
Collaborator Author

I think It should add fields automatically to model to allow a behavior totally transparent, agree?

@talyssonoc
Copy link
Owner

@wenderjean seems like a good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants