think/packages/domains/lib/util.js

47 lines
1.5 KiB
JavaScript
Raw Normal View History

2022-03-11 13:57:55 +08:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPublicDocument = exports.getWikiUserRoleText = exports.isPublicWiki = exports.getWikiStatusText = exports.DOCUMENT_STATUS = exports.WIKI_USER_ROLES = exports.WIKI_STATUS_LIST = void 0;
const models_1 = require("./models");
exports.WIKI_STATUS_LIST = [
{
value: models_1.WikiStatus.private,
2022-04-02 17:57:30 +08:00
label: '私有',
2022-03-11 13:57:55 +08:00
},
{
value: models_1.WikiStatus.public,
2022-04-02 17:57:30 +08:00
label: '公开',
2022-03-11 13:57:55 +08:00
},
];
exports.WIKI_USER_ROLES = [
{
2022-04-02 17:57:30 +08:00
value: 'admin',
label: '管理员',
2022-03-11 13:57:55 +08:00
},
{
2022-04-02 17:57:30 +08:00
value: 'normal',
label: '成员',
2022-03-11 13:57:55 +08:00
},
];
exports.DOCUMENT_STATUS = [
{
value: models_1.DocumentStatus.private,
2022-04-02 17:57:30 +08:00
label: '私有',
2022-03-11 13:57:55 +08:00
},
{
value: models_1.DocumentStatus.public,
2022-04-02 17:57:30 +08:00
label: '公开',
2022-03-11 13:57:55 +08:00
},
];
const getWikiStatusText = (wiki) => {
return exports.WIKI_STATUS_LIST.find((t) => t.value === wiki.status).label;
};
exports.getWikiStatusText = getWikiStatusText;
const isPublicWiki = (currentStatus) => currentStatus === models_1.WikiStatus.public;
exports.isPublicWiki = isPublicWiki;
const getWikiUserRoleText = (role) => {
return exports.WIKI_USER_ROLES.find((d) => d.value === role).label;
};
exports.getWikiUserRoleText = getWikiUserRoleText;
const isPublicDocument = (currentStatus) => currentStatus === models_1.DocumentStatus.public;
exports.isPublicDocument = isPublicDocument;
//# sourceMappingURL=util.js.map