-
Notifications
You must be signed in to change notification settings - Fork 82
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
Columns createdBy, createdDate, lastModifiedBy and lastModifiedDate should be filled automatically #236
Columns createdBy, createdDate, lastModifiedBy and lastModifiedDate should be filled automatically #236
Comments
Quick status update on this:
I see three options to continue now:
@amanganiello90 what do you think? Any suggestions? |
HI @glutengo you are rock!! Great work!! However I don't understand your goal. Have you implemented the createdBy, lastModifyed and so on filled automatically? That is the issue. Now why you want to manipulate user and store it in the request? |
Hi @amanganiello90, thanks for getting back! I have been able to implement createdDate and lastModifiedDate. I have not managed to implement createdBy and lastModifiedBy yet because of the problems I described above. |
Ok, So I consider to use zone.js , because it is a thread-safe local storage. In this way you can store user and fill the createBy and lastModifiedBy fields. |
@amanganiello90 thanks for your appreciation! I have found a solution now which works without request-scoped providers and without zone.js. I have adjusted the method signatures for the save and update methods of the services so that a creator / updater can be passed. I will open a PR for that now. The NestJS lead developer has prepared a PR for integrating the async_hook API a while ago but refuses to merge it due to the experimental state of the API. I suggest to watch this and make use of it once it has been merged: nestjs/nest#1407 |
@glutengo great job! Now you can receive your bug bounty according the https://www.jhipster.tech/bug-bounties/ . |
$200 bug bounty claim: https://opencollective.com/generator-jhipster/expenses/43423 |
Is your feature request related to a problem? Please describe.
The base entity has the mentioned columns. However, these columns are never used when a new entity is written to the database, so they always have
null
as value.Describe the solution you'd like
These columns should be filled automatically when an entity is saved. For the date columns, this could be achived by replacing the
Column()
decorator withCreateDateColumn()
andUpdateDateColumn()
(as describe here). For the user columns this could be handled somewhere in the entity service.The text was updated successfully, but these errors were encountered: