You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to use this component into your LoopBack application, please follow below steps.
46
46
47
-
-Add audit model class as Entity.
47
+
-If you wish to modify the one provided by this extension create your own model class just the one shown below. You can use `lb4 model` command to create new model
- Using `lb4 repository` command, create a repository file. After that, change the inject paramater as below so as to refer to correct data source name.
163
+
- If you have a custom model and you wish to use that in your repository class you can
164
+
Using `lb4 repository` command, create a repository file. After that, change the inject paramater as below so as to refer to correct data source name.
You can pass any extra attributes to save into audit table using the `IAuditMixinOptions` parameter of mixin function. You can also pass some dynamic values to the extra columns of the audit-log table via the method options.
224
275
225
276
```ts
@@ -245,7 +296,7 @@ This will create all insert, update, delete audits for this model.
245
296
create(data, {noAudit: true});
246
297
```
247
298
248
-
- The Actor field is now configurable and can save any string type value in the field.
299
+
- The Actor field is configurable and can save any string type value in the field.
249
300
Though the default value will be userId a developer can save any string field from the current User that is being passed.
Incase you dont have current user binded in your application context and wish to log the activities within your application then in that case you can pass the actor id along with the
- The package exposes a conditional mixin for your repository classes. Just extend your repository class with `ConditionalAuditRepositoryMixin`, for all those repositories where you need audit data based on condition whether `ADD_AUDIT_LOG_MIXIN` is set true. See an example below. For a model `Group`, here we are extending the `GroupRepository` with `AuditRepositoryMixin`.
287
347
288
348
```ts
@@ -291,8 +351,10 @@ import {Group, GroupRelations} from '../models';
@@ -318,15 +380,6 @@ export class GroupRepository extends ConditionalAuditRepositoryMixin(
318
380
}
319
381
```
320
382
321
-
### Making current user not mandatory
322
-
323
-
Incase you dont have current user binded in your application context and wish to log the activities within your application then in that case you can pass the actor id along with the
If you've noticed a bug or have a question or have a feature request, [search the issue tracker](https://github.com/sourcefuse/loopback4-audit-log/issues) to see if someone else in the community has already created a ticket.
@@ -381,3 +451,7 @@ Code of conduct guidelines [here](https://github.com/sourcefuse/loopback4-audit-
0 commit comments