Intercode SaaS Kit
  • Welcome to SaaS Starter Kit
  • Getting Started
    • Technology stack
    • Database Setup
    • Local Environment Setup
  • Basics
    • Dependencies
    • App architecture
    • Deployment
    • App roles
    • Endpoints List
      • Auth
      • Two Factor Auth
      • Businesses
      • Demo
      • Email
      • Export Document
      • Email Files
      • Files Demo
      • Leads
      • Orders
      • Payments
      • Subscriptions
      • Teams
      • Team Memberships
      • User Admin
  • Animation and Styles
    • Framer Motion
    • Ant Design and Styles
  • Pages
    • Auth
      • Working with PassportJS
      • Two-Factor Auth
      • OAuth Providers
    • Leads
    • Businesses
    • Team management
      • Ownership
    • Profile
    • User Settings
      • App Tour
    • App Settings
      • Lead Statuses
    • Dashboard
      • Lead volume widget
      • Doughnut chart widget
      • Recent leads table widget
      • Lead count over period widget
    • Demo
  • Features
    • Impersonation
    • Subscriptions (Stripe)
    • Search
    • Sentry
    • Captcha
    • Audit Logs
    • Internationalization
  • External integrations
    • Mailer
    • Google oAuth2
    • Facebook oAuth2
    • S3 compatible storage (AWS, MinIO)
Powered by GitBook
On this page
  1. Features

Audit Logs

Here you will learn about app audit logs system

In our app we have audit log system to monitor changes that can influence user data by the time logs monitor any changes on businesses and leads (edit, create, delete, assign lead to business), also they monitor comments delete and comments update. With that system members of the team can easily monitor who performed specifyc actions. Every user can work with logs only in read only mode, there is no possibility to delete or update any of logs. Logs generating automatically when user perform actions. It is one table for all entity logs.

Now let's see what the AuditLoggerEntity consists of:

  • action - Identifies which action the log recorded (e.g., business update, lead update). For each action, we use an enum AuditLogActions and simple integers to identify actions (for better database performance, as integers are faster than strings). Note: Do not change these numbers if logs already exist, as this will cause incorrect display in the UI. To add a new action to monitor, add a new value at the end of the enum with the identifier number set to max + 1.

  • changedObjects - A jsonb field that consists of three objects:

    • previous - The full entity object before a certain action.

    • current - The full entity object after the action is performed.

    • difference - Contains only the fields that were changed.

  • user - A nullable relation to the auth-users table. On user deletion, this field is set to null to retain the log regardless.

  • userEmail - A string field duplicating user.email, allowing tracking of who performed the action even if the user is deleted.

  • entityType - Identifies the entity on which the action was performed (e.g., LeadEntity or BusinessEntity). This is also an integer field for performance. Other entities can be added to the AuditLogEntityTypes enum.

  • numberIdentifier - Stores the ID of the record on which the action was performed.

  • isImpersonated - A boolean field indicating if the action was performed during impersonation.

  • createdAt - A timestamp to record when the action was performed (we don’t need an updatedAt field, as logs cannot be edited).

PreviousCaptchaNextInternationalization

Last updated 5 months ago