first
This commit is contained in:
50
db/audit-log.js
Normal file
50
db/audit-log.js
Normal file
@ -0,0 +1,50 @@
|
||||
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;
|
||||
};
|
65
db/cron-job.js
Normal file
65
db/cron-job.js
Normal file
@ -0,0 +1,65 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
const MAX = 10;
|
||||
|
||||
function createCronJob() {
|
||||
return {
|
||||
guid: faker.string.uuid(),
|
||||
cronjobName: faker.helpers.arrayElement([
|
||||
"cronjob-mdms-pull-meter-alert",
|
||||
"DAP PERCENTILE DATA",
|
||||
"DAP WEIS DATA",
|
||||
]),
|
||||
fileName: `DAP_WEIS_${faker.date.anytime().toTimeString()}.txt`,
|
||||
scheduleDateTime: faker.date.anytime(),
|
||||
fileReceivedTime: faker.date.anytime(),
|
||||
fileIngestionTime: faker.date.anytime(),
|
||||
totalRecords: faker.number.int({ min: 0, max: 40 }),
|
||||
totalFailedRecords: faker.number.int({ min: 0, max: 40 }),
|
||||
errorDetail: faker.helpers.arrayElement([
|
||||
null,
|
||||
"Header invalid",
|
||||
"Connect sftp failed…",
|
||||
"File incomplete ingestion",
|
||||
]),
|
||||
jobFiles: faker.helpers.multiple(
|
||||
() => ({
|
||||
guid: faker.string.uuid(),
|
||||
fileName: `FILE NAME ${faker.number.int()}.txt`,
|
||||
processTime: Math.floor(faker.date.anytime().getTime() / 1000),
|
||||
noOfRecordsSuccess: faker.number.int({ min: 2, max: 500 }),
|
||||
noOfRecordsInvalid: faker.number.int({ min: 1, max: 50 }),
|
||||
fileStatus: faker.helpers.arrayElement([
|
||||
"SUCCESS",
|
||||
"FAILED (STAGING)",
|
||||
"CANCEL",
|
||||
]),
|
||||
errorDetail: {
|
||||
message: faker.helpers.arrayElement([
|
||||
"Header invalid",
|
||||
null,
|
||||
"File incomplete ingestion",
|
||||
]),
|
||||
rejectedRecordsFile: `DAP_WEIS_${faker.date
|
||||
.anytime()
|
||||
.toTimeString()}_${faker.string.uuid()}.txt`,
|
||||
},
|
||||
}),
|
||||
{
|
||||
count: faker.number.int({ min: 1, max: 5 }),
|
||||
}
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
export default () => {
|
||||
const data = {
|
||||
status: 200,
|
||||
data: {
|
||||
totalCronjobRecords: MAX,
|
||||
cronjobLogList: faker.helpers.multiple(createCronJob, { count: MAX }),
|
||||
},
|
||||
};
|
||||
|
||||
return data;
|
||||
};
|
59
db/get-cron-job-list.js
Normal file
59
db/get-cron-job-list.js
Normal file
@ -0,0 +1,59 @@
|
||||
export default {
|
||||
status: 200,
|
||||
data: [
|
||||
{
|
||||
cronjobName: "cronjob-ebs-import-water-account",
|
||||
noOfFailedRecordsThreshold: 10,
|
||||
fileIngestionTimeThreshold: 60,
|
||||
dateOfLastUpdated: "2023-08-16T09:35:44.4775944+00:00",
|
||||
},
|
||||
{
|
||||
cronjobName: "cronjob-dap-import-dap-data",
|
||||
noOfFailedRecordsThreshold: 10,
|
||||
fileIngestionTimeThreshold: 60,
|
||||
dateOfLastUpdated: "2023-08-16T09:35:44.4776397+00:00",
|
||||
},
|
||||
{
|
||||
cronjobName: "cronjob-mdms-import-meter-alert",
|
||||
noOfFailedRecordsThreshold: 10,
|
||||
fileIngestionTimeThreshold: 60,
|
||||
dateOfLastUpdated: "2023-08-16T09:35:44.47764+00:00",
|
||||
},
|
||||
{
|
||||
cronjobName: "cronjob-mdms-pull-meter-alert",
|
||||
noOfFailedRecordsThreshold: 10,
|
||||
fileIngestionTimeThreshold: 60,
|
||||
dateOfLastUpdated: "2023-08-16T09:35:44.4776402+00:00",
|
||||
},
|
||||
{
|
||||
cronjobName: "cronjob-mdms-export-enrolment-status",
|
||||
noOfFailedRecordsThreshold: 10,
|
||||
fileIngestionTimeThreshold: 60,
|
||||
dateOfLastUpdated: "2023-08-16T09:35:44.4776403+00:00",
|
||||
},
|
||||
{
|
||||
cronjobName: "cronjob-ebs-import-avg",
|
||||
noOfFailedRecordsThreshold: 10,
|
||||
fileIngestionTimeThreshold: 60,
|
||||
dateOfLastUpdated: "2023-08-16T09:35:44.4776415+00:00",
|
||||
},
|
||||
{
|
||||
cronjobName: "cronjob-water-account-user-goal-notification",
|
||||
noOfFailedRecordsThreshold: 10,
|
||||
fileIngestionTimeThreshold: 60,
|
||||
dateOfLastUpdated: "2023-08-16T09:35:44.4776416+00:00",
|
||||
},
|
||||
{
|
||||
cronjobName: "cronjob-water-account-whitelist-sp-accounts",
|
||||
noOfFailedRecordsThreshold: 44,
|
||||
fileIngestionTimeThreshold: 44,
|
||||
dateOfLastUpdated: "2023-08-28T15:20:56.4036081Z",
|
||||
},
|
||||
{
|
||||
cronjobName: "cronjob-mdms-import-meter-data",
|
||||
noOfFailedRecordsThreshold: 4,
|
||||
fileIngestionTimeThreshold: 4,
|
||||
dateOfLastUpdated: "2023-08-28T15:19:44.4816081Z",
|
||||
},
|
||||
],
|
||||
};
|
6
db/image.js
Normal file
6
db/image.js
Normal file
@ -0,0 +1,6 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
export default {
|
||||
status: 200,
|
||||
data: faker.image.urlPicsumPhotos(),
|
||||
};
|
16
db/index.js
Normal file
16
db/index.js
Normal file
@ -0,0 +1,16 @@
|
||||
import cronJob from "./cron-job.js";
|
||||
import nameCronjobs from "./name-cronjobs.js";
|
||||
import messageTemplate from "./message-template.js";
|
||||
import auditLog from "./audit-log.js";
|
||||
import imageURL from "./image.js";
|
||||
import cronJobList from "./get-cron-job-list.js";
|
||||
|
||||
export default {
|
||||
cronjob: { ...cronJob() },
|
||||
"audit-log": { ...auditLog() },
|
||||
"name-cronjobs": nameCronjobs,
|
||||
"message-template": messageTemplate,
|
||||
"get-image": imageURL,
|
||||
"get-cronjob-list": cronJobList,
|
||||
"update-cronjob": {},
|
||||
};
|
26
db/message-template.js
Normal file
26
db/message-template.js
Normal file
@ -0,0 +1,26 @@
|
||||
import { faker } from "@faker-js/faker";
|
||||
|
||||
const MAX = 10;
|
||||
|
||||
function createMessageTemplate() {
|
||||
return {
|
||||
id: faker.string.uuid(),
|
||||
createBy: "DEV",
|
||||
templateFormat: faker.helpers.arrayElement([1, 2]),
|
||||
templateName: faker.lorem.words({ min: 2, max: 4 }),
|
||||
templateDesc: faker.lorem.words({ min: 2, max: 5 }),
|
||||
templateContent: faker.lorem.paragraphs({ min: 1, max: 10 }),
|
||||
createDate: Math.floor(faker.date.anytime().getTime() / 1000),
|
||||
lastModifyDate: Math.floor(faker.date.anytime().getTime() / 1000),
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
status: 200,
|
||||
data: {
|
||||
totalMessageTemplateRecord: MAX,
|
||||
cronjobLogList: faker.helpers.multiple(createMessageTemplate, {
|
||||
count: MAX,
|
||||
}),
|
||||
},
|
||||
};
|
8
db/name-cronjobs.js
Normal file
8
db/name-cronjobs.js
Normal file
@ -0,0 +1,8 @@
|
||||
export default {
|
||||
status: 200,
|
||||
data: [
|
||||
"cronjob-mdms-pull-meter-alert",
|
||||
"DAP PERCENTILE DATA",
|
||||
"DAP WEIS DATA",
|
||||
],
|
||||
};
|
Reference in New Issue
Block a user