training_data/packages/common/src/constants.ts

98 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-12-30 08:26:40 +08:00
import { Prisma } from "@prisma/client";
2025-02-20 20:02:27 +08:00
import { AppConfigSlug, ObjectType, RolePerms, TaxonomySlug } from "./enum";
2024-09-03 20:19:33 +08:00
2024-12-30 08:26:40 +08:00
export const InitRoles: {
name: string;
permissions: string[];
system?: boolean;
}[] = [
2025-02-06 16:32:52 +08:00
{
name: "基层",
permissions: [
RolePerms.CREATE_TROUBLE,
RolePerms.CREATE_WORKPROGRESS,
RolePerms.READ_DOM_TERM,
RolePerms.READ_AUDIT_TROUBLE,
],
},
{
name: "机关",
permissions: [
RolePerms.CREATE_TROUBLE,
RolePerms.CREATE_WORKPROGRESS,
RolePerms.CREATE_ALERT,
RolePerms.READ_DOM_TERM,
RolePerms.MANAGE_DOM_TROUBLE,
RolePerms.READ_AUDIT_TROUBLE,
],
},
{
name: "领导",
permissions: [
RolePerms.READ_DOM_TERM,
RolePerms.READ_DOM_TROUBLE,
RolePerms.CREATE_INSTRUCTION,
],
},
{
name: "域管理员",
permissions: Object.keys(RolePerms).filter(
(perm) =>
![
RolePerms.READ_ANY_CHART,
RolePerms.READ_ANY_TROUBLE,
RolePerms.READ_ANY_TERM,
].includes(perm as any)
) as RolePerms[],
},
{
name: "根管理员",
permissions: Object.keys(RolePerms) as RolePerms[],
},
];
2025-02-20 20:02:27 +08:00
export const InitTaxonomies: {
name: string;
slug: string;
objectType?: string[];
}[] = [
2024-12-30 08:26:40 +08:00
{
2025-02-24 20:24:24 +08:00
name: "课程分类",
2024-12-30 08:26:40 +08:00
slug: TaxonomySlug.CATEGORY,
2025-02-24 11:50:36 +08:00
objectType: [ObjectType.COURSE],
2024-12-30 08:26:40 +08:00
},
2025-02-06 16:32:52 +08:00
{
name: "难度等级",
slug: TaxonomySlug.LEVEL,
2025-02-20 20:02:27 +08:00
objectType: [ObjectType.COURSE],
2025-02-06 16:32:52 +08:00
},
2025-02-06 19:23:48 +08:00
// {
// name: "研判单元",
// slug: TaxonomySlug.UNIT,
// },
2025-02-25 20:40:34 +08:00
// {
// name: "标签",
// slug: TaxonomySlug.TAG,
// },
2024-12-30 08:26:40 +08:00
];
export const InitAppConfigs: Prisma.AppConfigCreateInput[] = [
{
title: "基本设置",
slug: AppConfigSlug.BASE_SETTING,
description: "",
},
2024-09-03 20:19:33 +08:00
];
2025-02-25 08:46:22 +08:00
export const videoMimeTypes = [
"video/*", // 通配符 (部分浏览器可能不支持)
"video/mp4", // .mp4
"video/quicktime", // .mov
"video/x-msvideo", // .avi
"video/x-matroska", // .mkv
"video/webm", // .webm
"video/ogg", // .ogv
"video/mpeg", // .mpeg
"video/3gpp", // .3gp
"video/3gpp2", // .3g2
"video/x-flv", // .flv
"video/x-ms-wmv", // .wmv
];