Files
json-server/db/audit-log.js
2024-03-29 14:32:56 +07:00

51 lines
1.1 KiB
JavaScript

import { faker } from "@faker-js/faker";
const MAX = 10;
function createAuditLog() {
return {
guid: faker.string.uuid(),
dateOfAction: faker.date.anytime(),
actionBy: faker.internet.displayName(),
mainModule: faker.helpers.arrayElement([
"Customer Accounts",
"Reports",
"Settings",
"Notification Management",
"Announcement Management",
"Cron Job Management",
"Audit Log",
]),
subModule: faker.helpers.arrayElement(["Role", "Account", "Detail"]),
action: faker.helpers.arrayElement([
"Edit Role",
"edit User",
"edit Account",
"create Announcement",
"Filter Log",
]),
oldValue: faker.helpers.arrayElement([
null,
faker.animal.cat(),
faker.location.country(),
]),
newValue: faker.helpers.arrayElement([
null,
faker.animal.cat(),
faker.location.country(),
]),
};
}
export default () => {
const data = {
status: 200,
data: {
totalRecords: MAX,
auditLogList: faker.helpers.multiple(createAuditLog, { count: MAX }),
},
};
return data;
};