think/packages/domains/lib/util.js

67 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-03-11 05:57:55 +00:00
"use strict";
2022-05-18 08:02:29 +00:00
exports.__esModule = true;
2022-06-30 06:20:38 +00:00
exports.isPublicDocument = exports.isPublicWiki = exports.getWikiStatusText = exports.DOCUMENT_STATUS = exports.WIKI_USER_ROLES = exports.WIKI_STATUS_LIST = void 0;
2022-05-18 08:02:29 +00:00
var models_1 = require("./models");
/**
*
*/
2022-03-11 05:57:55 +00:00
exports.WIKI_STATUS_LIST = [
{
value: models_1.WikiStatus.private,
2022-05-18 08:02:29 +00:00
label: '私有'
2022-03-11 05:57:55 +00:00
},
{
value: models_1.WikiStatus.public,
2022-05-18 08:02:29 +00:00
label: '公开'
2022-03-11 05:57:55 +00:00
},
];
2022-05-18 08:02:29 +00:00
/**
*
*/
2022-03-11 05:57:55 +00:00
exports.WIKI_USER_ROLES = [
{
2022-04-02 09:57:30 +00:00
value: 'admin',
2022-05-18 08:02:29 +00:00
label: '管理员'
2022-03-11 05:57:55 +00:00
},
{
2022-04-02 09:57:30 +00:00
value: 'normal',
2022-05-18 08:02:29 +00:00
label: '成员'
2022-03-11 05:57:55 +00:00
},
];
2022-05-18 08:02:29 +00:00
/**
*
*/
2022-03-11 05:57:55 +00:00
exports.DOCUMENT_STATUS = [
{
value: models_1.DocumentStatus.private,
2022-05-18 08:02:29 +00:00
label: '私有'
2022-03-11 05:57:55 +00:00
},
{
value: models_1.DocumentStatus.public,
2022-05-18 08:02:29 +00:00
label: '公开'
2022-03-11 05:57:55 +00:00
},
];
2022-05-18 08:02:29 +00:00
/**
*
* @param wiki
* @returns
*/
var getWikiStatusText = function (wiki) {
return exports.WIKI_STATUS_LIST.find(function (t) { return t.value === wiki.status; }).label;
2022-03-11 05:57:55 +00:00
};
exports.getWikiStatusText = getWikiStatusText;
2022-05-18 08:02:29 +00:00
/**
*
* @param currentStatus wiki status
* @returns
*/
var isPublicWiki = function (currentStatus) { return currentStatus === models_1.WikiStatus.public; };
2022-03-11 05:57:55 +00:00
exports.isPublicWiki = isPublicWiki;
2022-05-18 08:02:29 +00:00
/**
*
* @param currentStatus document status
* @returns
*/
var isPublicDocument = function (currentStatus) { return currentStatus === models_1.DocumentStatus.public; };
2022-03-11 05:57:55 +00:00
exports.isPublicDocument = isPublicDocument;