nest-typeorm-object-activites
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

Features

  • Provide a way to store entity activities
  • Provide easy to use options by default

Installation

$ npm i --save nest-typeorm-object-activites

Usage

If we want to track activities for our User entity we should create following entity:

@Entity()
export class UserActivity extends Activity {
  @ManyToOne(() => User)
  sourceObject: User;
}

After that we should add entity to imports in our module as well as add ActivityModule for this newly created entity with second parameter as baseUrl

imports: [TypeOrmModule.forFeature([User, UserActivity]), ActivityModule.forFeature(UserActivity, 'user')],

No we can use new endpoints to store and list all activities for particular object with replacing <related object id> with user id:

### create activity
POST {{APP_URL}}/activity/user/<related object id>
Content-Type: application/json

{
  "description": "test description"
}

### get activities
GET {{APP_URL}}/activity/user/<related object id>

Package Sidebar

Install

npm i nest-typeorm-object-activites

Weekly Downloads

0

Version

1.0.7

License

ISC

Unpacked Size

31.7 kB

Total Files

15

Last publish

Collaborators

  • widmo