Socket
Socket
Sign inDemoInstall

nest-typeorm-object-activites

Package Overview
Dependencies
4
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nest-typeorm-object-activites

NestJS TypeORM Object Activities Tracking


Version published
Weekly downloads
8
Maintainers
1
Install size
17.2 MB
Created
Weekly downloads
 

Readme

Source

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>

Keywords

FAQs

Last updated on 16 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc