Module - ChangeLog
It will track insert, update and delete operations on your entities.
Once you have it setup, assign you the role "ChangeLog.Admin"
(You can get it via
Roles_ChangeLog.ChangeLog_Admin
), and in Admin UI, you will be able to see all changes in the
entity named FF Change Logs
.
Installation
Section titled “Installation”npm add firstly@latest -D
import { changeLog } from 'firstly/changeLog/server'
export const api = remultApi({ modules: [changeLog()],})
Wrap your entity options with the withChangeLog
function to opt-in changeLog.
import { withChangeLog } from 'firstly/changeLog'
@Entity('users', withChangeLog({ // ... }),)class User {}
Yes, that’s it! 🎉
(Optional) @APP_Entity
decorator
Section titled “(Optional) @APP_Entity decorator”Create your own @APP_Entity
decorator and use it instead of @Entity
.
import { Entity, type EntityOptions } from 'remult'import { withChangeLog } from 'firstly/changeLog'
export function APP_Entity<entityType>( key: string, options?: EntityOptions< entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType >,) { return Entity( key, withChangeLog({ ...options, // other app specific default options }), )}