-
Notifications
You must be signed in to change notification settings - Fork 523
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
Feature: Users / Team / Organization Activities #798
Comments
We can implement it generically like an 'activity logging' service which logs changes in the database along with the user id who sent the request. |
@rmagon not only user id, but also it can be changed with user Id = null because some "changes" events could be raised by the Gauzy system (e.g. on schedule) or by integration, etc. |
@evereq I'm planning to implement a basic system initially & ultimately we will have to do some database partitioning (perhaps something like horizontal partitioning so the table structure remains the same but we have multiple tables based on tenants) else the activity log would grow to be huge & if the table grows then the query would become really slow & pulling the data would be slow. |
@rmagon think let's work on this task at later stage |
@evereq Ya makes sense |
@rmagon my thinking is this way:
I.e. it's pretty common approach to denormalize such structures and store same activity related data multiple times in different tables for fast queries Also, we can just have additionally tables for each type of activity separately, e.g. so we have EmployeeActivity Table, OrganizationActivity Table, TenantActivity Table, InvoiceActivity Table etc I.e. there are LOTs of possible solutions for that and that's why it's best to do it at later stage :) |
@prysiazhna did some work on history for candidates, we probably can base the solution on it making it more generic. |
maybe we could consider another type of data storage as configurable options rather lock in ourself to only postgres, as logging type of data is not so well fit into RDBMS, e.g we could use firestore from Google cloud. or any NoSQL kind. any concern if I planning ahead on this direction and make it dynamic configurable default to postgres. |
@ryusoft we do not lock ourselves to PostgreSQL, because of TypeORM supports lots of different storage options.... Firestore - no go for sure (as it's not open-source... maybe only via some extension), some NoSQL which supported by TypeORM we can consider in the future, e.g. MongoDB. But I wound not focus on that at all, let's keep it simple and in the currently used stack. |
@evereq what i try to suggest is multiple database type. like normal we go for RDBMS and logging type then we can use mongodb. as logging data and end up very huge then might cause the query very slow. there are some idea like make a generic and some decorator and make table that we wish to have activity logs and that trigger on typeorm event and transform those changes to JSON, plan around and see doable or not first. |
@ryusoft well, at some point we may do it, but not now. For now, I would prefer to keep it simple and focus on functionality first. (otherwise, we end up with Redis, RabbitMQ and many other things very quickly). PostgreSQL can hold easy millions of historical records in one table, we will quickly index by userId / teamId etc and till some time it will be enough, we don't need to introduce another storage (yet). At the same time, regarding idea with a decorator... could be doable, but I would prefer to not make some kind of "framework" on top of TypeORM, unless you can find someone who already did it. In addition, I think we should level up that activity logging to say "service" layer, not do it in DB layer. Because we are interested in Application commands/events logging, NOT really how DB data inserts / changed. So Application Business layer (or services layer in our case) has more knowledge about what should be logged etc. I will give you another example, say someone created record A, but in DB it triggers 10 create operations. We are not interested in writing 10 records to our Activity log, we interested in just one record with lots of specific details, etc. My line of thinking in such tasks is that: do it like you don't know about some interceptors etc, but take some Junior developer approach (you can see it's halfway done already for activity logging of candidates) and just make it more generic with what we already using. In this case, it's CQRS + some base classes, etc. |
okay try it out |
@ryusoft few comments:
|
We need to build a feature that will show the history of activity in Gauzy:
Note: do not mix it with "Activity" related to Time Tracking! In this Epic we are talking about user actions inside Gauzy Platform, like someone added expense today, someone fire employee yesterday, some employee joined an organization today and so on.
So basically, we need to have activity tabs for:
The best form for such "Tabs" is to display timeline (top represent recent events, bottom old events).
Example of Events in Activities:
The text was updated successfully, but these errors were encountered: