0.10.5 • Published 7 months ago
activity-log-module v0.10.5
activity-log-module
Table of Contents
Installation
For npm
npm i --save activity-log-module
For yarn
yarn add activity-log-module
Usage
Import dynamic module
- In memory cache
import { ActivityLogModule } from 'activity-log-module';
@Module({
imports: [
ActivityLogModule.register(),
],
})
- MySQL
import { ActivityLogModule } from 'activity-log-module';
import * as mysql from 'mysql2/promise';
@Module({
imports: [
ScheduleModule.forRoot(), <-- For Injection SchedulerRegistry
ActivityLogModule.register({
storeFactory: async (schedulerRegistry: SchedulerRegistry) => {
const connection = await mysql.createConnection({
// ConnectionOptions
});
const keepAliveOption: keepAliveOption = {
enableKeepAlive: true,
schedulerRegistry,
cronJobName: 'example-cron-job'
} <-- Optional for cron ping DB connection
return new MysqlStore(connection, keepAliveOption);
},
inject: [SchedulerRegistry], <-- For Injection SchedulerRegistry
}),
],
})
Method
- Log
ActivityLogService.log(actionBy: ActionBy & ObjectLiteral, action: string, actionAt: ActionAt & ObjectLiteral, actionDetail?: Record<string, any>): Promise<void>
- Get by action
ActivityLogService.getByAction(action: string, from: Date, to: Date, searchOptions?: SearchOption): Promise<ActivityLogType[]>
- Get by actor
ActivityLogService.getByActor(id: string, from: Date, to: Date, searchOptions?: SearchOption): Promise<ActivityLogType[]>
Type Specification
Enums
- SortOrder
- ASC
- DESC
Types
SearchOption
- sortOrder: SortOrder
KeepAliveOption (For MySQL)
- enableKeepAlive: boolean
- schedulerRegistry: SchedulerRegistry
- cronJobName: string
ActionBy
- id: string
ActionAt
- time: Date
ActivityLogType
- actionBy: ActionBy
- action: string
- actionAt: ActionAt
- actionDetail?: Record<string, any>
0.10.5
7 months ago
0.10.4
9 months ago
0.9.12
10 months ago
0.9.11
10 months ago
0.10.1
10 months ago
0.10.2
10 months ago
0.10.3
10 months ago
0.9.9
1 year ago
0.9.10
1 year ago
0.9.8
1 year ago
0.9.7
1 year ago
0.9.6
1 year ago
0.9.4
1 year ago
0.9.3
1 year ago
0.9.5
1 year ago
0.9.2
1 year ago
0.9.0
1 year ago
0.9.1
1 year ago
0.1.1
1 year ago
0.0.9
1 year ago
0.1.0
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.3
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago