2024-08-22 04:19:30 +00:00
|
|
|
import type { Page } from "entities/Page";
|
2024-03-21 11:22:36 +00:00
|
|
|
import * as Factory from "factory.ts";
|
|
|
|
|
|
2024-06-11 09:44:54 +00:00
|
|
|
function generateRandomHexId() {
|
|
|
|
|
const hexChars = "0123456789abcdef";
|
|
|
|
|
let id = "";
|
|
|
|
|
for (let i = 0; i < 24; i++) {
|
|
|
|
|
id += hexChars[Math.floor(Math.random() * 16)];
|
|
|
|
|
}
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-21 11:22:36 +00:00
|
|
|
export const PageFactory = Factory.Sync.makeFactory<Page>({
|
|
|
|
|
pageName: Factory.each((i) => `Page${i + 1}`),
|
2024-06-11 09:44:54 +00:00
|
|
|
pageId: Factory.each(() => generateRandomHexId()),
|
2024-07-31 02:54:51 +00:00
|
|
|
basePageId: Factory.each(() => generateRandomHexId()),
|
2024-03-21 11:22:36 +00:00
|
|
|
isDefault: false,
|
|
|
|
|
isHidden: false,
|
|
|
|
|
slug: Factory.each((i) => `pageSlug${i + 1}`),
|
|
|
|
|
userPermissions: [
|
|
|
|
|
"read:pages",
|
|
|
|
|
"manage:pages",
|
|
|
|
|
"create:pageActions",
|
|
|
|
|
"delete:pages",
|
|
|
|
|
],
|
|
|
|
|
});
|