mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-01-31 09:03:36 +00:00
16 lines
554 B
TypeScript
16 lines
554 B
TypeScript
import { ACTION, AuditLog } from '@prisma/client';
|
|
|
|
export const generateLogMessage = (log: AuditLog) => {
|
|
const { action, entityTitle, entityType } = log;
|
|
|
|
switch (action) {
|
|
case ACTION.CREATE:
|
|
return `Created ${entityType.toLowerCase()} "${entityTitle}"`;
|
|
case ACTION.UPDATE:
|
|
return `Updated ${entityType.toLowerCase()} "${entityTitle}"`;
|
|
case ACTION.DELETE:
|
|
return `Deleted ${entityType.toLowerCase()} "${entityTitle}"`;
|
|
default:
|
|
return `Unknown action ${entityType.toLowerCase()} "${entityTitle}"`;
|
|
}
|
|
};
|