merge
This commit is contained in:
commit
cc939b6d87
|
|
@ -18,16 +18,18 @@ export async function syncSmsTemplate(params, context) {
|
|||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
const existsTemplateIds = existTemplateList.map((ele) => ele.templateCode);
|
||||
const newTemplateList = templateFormalData.filter((ele) => !existsTemplateIds.includes(ele.templateCode));
|
||||
const newTemplateIds = newTemplateList.map((ele) => ele.templateCode);
|
||||
// const existsTemplateIds = existTemplateList.map((ele) => ele.templateCode);
|
||||
// const newTemplateList = templateFormalData.filter(
|
||||
// (ele) => !existsTemplateIds.includes(ele.templateCode)
|
||||
// );
|
||||
// const newTemplateIds = newTemplateList.map((ele) => ele.templateCode);
|
||||
// const removeTemplateList = existTemplateList.filter(
|
||||
// (ele) => !newTemplateIds.includes(ele.templateCode!)
|
||||
// );
|
||||
for (const template of templateFormalData) {
|
||||
const { templateName, templateCode, templateContent } = template;
|
||||
const existTemplateId = existsTemplateIds.find((ele) => ele === template.templateCode);
|
||||
if (existTemplateId) {
|
||||
const existTemplate = existTemplateList.find((ele) => ele.templateCode === template.templateCode);
|
||||
if (existTemplate) {
|
||||
await context.operate('smsTemplate', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'update',
|
||||
|
|
@ -37,7 +39,7 @@ export async function syncSmsTemplate(params, context) {
|
|||
syncAt: Date.now(),
|
||||
},
|
||||
filter: {
|
||||
id: existTemplateId,
|
||||
id: existTemplate.id,
|
||||
},
|
||||
}, {
|
||||
dontCollect: true,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "article", false, {
|
||||
tocClosed: boolean;
|
||||
tocFixed: boolean;
|
||||
tocPosition: "none" | "left" | "right";
|
||||
tocPosition: "left" | "right" | "none";
|
||||
highlightBgColor: string;
|
||||
headerTop: number;
|
||||
className: string;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, {
|
||||
tocClosed: boolean;
|
||||
tocFixed: boolean;
|
||||
tocPosition: "none" | "left" | "right";
|
||||
tocPosition: "left" | "right" | "none";
|
||||
highlightBgColor: string;
|
||||
headerTop: number;
|
||||
className: string;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { EntityDict } from '../../../oak-app-domain';
|
|||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "article", false, {
|
||||
articleMenuId: string;
|
||||
changeIsEdit: () => void;
|
||||
tocPosition: "none" | "left" | "right";
|
||||
tocPosition: "left" | "right" | "none";
|
||||
highlightBgColor: string;
|
||||
onArticlePreview: (content?: string, title?: string) => void;
|
||||
origin: string;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
|
|||
show: "edit" | "doc" | "preview";
|
||||
articleMenuId: string;
|
||||
articleId: string;
|
||||
tocPosition: "none" | "left" | "right";
|
||||
tocPosition: "left" | "right" | "none";
|
||||
highlightBgColor: string;
|
||||
onMenuView: () => void;
|
||||
onMenuViewById: (articleMenuId: string) => void;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Style } from '../../../../types/Style';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../../oak-app-domain").EntityDict, keyof import("../../../../oak-app-domain").EntityDict, false, {
|
||||
style: Style;
|
||||
entity: "application" | "system" | "platform";
|
||||
entity: "platform" | "application" | "system";
|
||||
entityId: string;
|
||||
name: string;
|
||||
}>) => React.ReactElement;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Config } from '../../../types/Config';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, {
|
||||
config: Config;
|
||||
entity: "system" | "platform";
|
||||
entity: "platform" | "system";
|
||||
name: string;
|
||||
entityId: string;
|
||||
}>) => React.ReactElement;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
|
|||
type?: ButtonProps['type'] | AmButtonProps['type'];
|
||||
executeText?: string | undefined;
|
||||
buttonProps?: (ButtonProps & {
|
||||
color?: "default" | "success" | "primary" | "warning" | "danger" | undefined;
|
||||
color?: "default" | "success" | "warning" | "primary" | "danger" | undefined;
|
||||
fill?: "none" | "solid" | "outline" | undefined;
|
||||
size?: "small" | "large" | "middle" | "mini" | undefined;
|
||||
block?: boolean | undefined;
|
||||
|
|
@ -24,10 +24,10 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
|
|||
loadingIcon?: import("react").ReactNode;
|
||||
disabled?: boolean | undefined;
|
||||
onClick?: ((event: import("react").MouseEvent<HTMLButtonElement, MouseEvent>) => unknown) | undefined;
|
||||
type?: "reset" | "submit" | "button" | undefined;
|
||||
type?: "button" | "submit" | "reset" | undefined;
|
||||
shape?: "default" | "rounded" | "rectangular" | undefined;
|
||||
children?: import("react").ReactNode;
|
||||
} & Pick<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, "id" | "onMouseUp" | "onMouseDown" | "onTouchStart" | "onTouchEnd"> & {
|
||||
} & Pick<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, "id" | "onMouseDown" | "onMouseUp" | "onTouchEnd" | "onTouchStart"> & {
|
||||
className?: string | undefined;
|
||||
style?: (import("react").CSSProperties & Partial<Record<"--text-color" | "--background-color" | "--border-radius" | "--border-width" | "--border-style" | "--border-color", string>>) | undefined;
|
||||
tabIndex?: number | undefined;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,14 @@ export default function Render(props) {
|
|||
</Button>
|
||||
<Button type="default" disabled={syncDisable} onClick={async () => {
|
||||
setSyncDisable(true);
|
||||
await syncTemplate();
|
||||
setSyncDisable(false);
|
||||
try {
|
||||
await syncTemplate();
|
||||
setSyncDisable(false);
|
||||
}
|
||||
catch (err) {
|
||||
setSyncDisable(false);
|
||||
throw err;
|
||||
}
|
||||
}}>
|
||||
{'同步模板'}
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ export default function Render(props: WebComponentProps<EntityDict, 'platform',
|
|||
name: string;
|
||||
description: string;
|
||||
oakId: string;
|
||||
folder: string;
|
||||
super: boolean;
|
||||
oakExecutable: boolean;
|
||||
}>): React.JSX.Element | null;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { Row, Modal, Descriptions, Typography, Button, Space } from 'antd';
|
|||
import SystemUpsert from '../upsert';
|
||||
import Styles from './web.pc.module.less';
|
||||
export default function Render(props) {
|
||||
const { oakId, folder, name, description, 'super': isSuper, oakFullpath, oakExecutable, oakExecuting } = props.data;
|
||||
const { oakId, name, description, 'super': isSuper, oakFullpath, oakExecutable, oakExecuting } = props.data;
|
||||
const { t, execute, clean } = props.methods;
|
||||
const [open, setOpen] = useState(false);
|
||||
if (oakFullpath) {
|
||||
|
|
@ -46,9 +46,6 @@ export default function Render(props) {
|
|||
<Descriptions.Item label={t('system:attr.super')}>
|
||||
{isSuper ? '是' : '否'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t('system:attr.folder')}>
|
||||
{folder}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item>
|
||||
<Row justify="end">
|
||||
<Button type="primary" onClick={() => setOpen(true)}>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ export default OakComponent({
|
|||
config: 1,
|
||||
description: 1,
|
||||
super: 1,
|
||||
folder: 1,
|
||||
domain$system: {
|
||||
$entity: 'domain',
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ export default OakComponent({
|
|||
config: 1,
|
||||
description: 1,
|
||||
super: 1,
|
||||
folder: 1,
|
||||
},
|
||||
formData({ data }) {
|
||||
return data || {};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"tips": {
|
||||
"isSuper": "超级用户属性可能影响程序的运行逻辑,请谨慎修改"
|
||||
"isSuper": "超级系统属性可能影响程序的运行逻辑,请谨慎修改"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,5 @@ import { WebComponentProps } from 'oak-frontend-base';
|
|||
export default function Render(props: WebComponentProps<EntityDict, 'system', false, {
|
||||
name: string;
|
||||
description: string;
|
||||
folder: string;
|
||||
super: boolean;
|
||||
}>): React.JSX.Element;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { Form, Switch, Input } from 'antd';
|
||||
export default function Render(props) {
|
||||
const { name, description, folder, super: super2, } = props.data;
|
||||
const { name, description, super: super2, } = props.data;
|
||||
const { t, update } = props.methods;
|
||||
return (<Form colon={true} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
|
||||
<Form.Item label={t('system:attr.name')} required>
|
||||
|
|
@ -13,7 +13,7 @@ export default function Render(props) {
|
|||
}} value={name}/>
|
||||
</>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('system:attr.desc')} required>
|
||||
<Form.Item label={t('system:attr.description')} required>
|
||||
<>
|
||||
<Input.TextArea onChange={(e) => {
|
||||
update({
|
||||
|
|
@ -22,7 +22,7 @@ export default function Render(props) {
|
|||
}} value={description}/>
|
||||
</>
|
||||
</Form.Item>
|
||||
<Form.Item label={t('system:attr.isSuper')} required tooltip={t('tips.isSuper')}>
|
||||
<Form.Item label={t('system:attr.super')} required tooltip={t('tips.isSuper')}>
|
||||
<>
|
||||
<Switch checkedChildren={t('common::yes')} unCheckedChildren={t('common::no')} checked={super2} onChange={(checked) => {
|
||||
update({
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
import { EntityDict } from "../../../../oak-app-domain";
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "user", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
|
||||
export default _default;
|
||||
|
|
@ -13,8 +13,10 @@ export declare abstract class BackendRuntimeContext<ED extends EntityDict & Base
|
|||
protected amIReallyRoot?: boolean;
|
||||
protected rootMode?: boolean;
|
||||
private userId?;
|
||||
protected platformManager?: boolean;
|
||||
protected applicationProjection: import("../oak-app-domain/Application/Schema").Projection;
|
||||
refineOpRecords(): Promise<void>;
|
||||
setPlatformManager(tokenValue?: string, userId?: string): Promise<void>;
|
||||
setTokenValue(tokenValue?: string, userId?: string): Promise<void>;
|
||||
setApplication(appId: string): Promise<void>;
|
||||
initialize(data?: SerializedData, later?: boolean): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
|||
import { applicationProjection } from '../types/Projection';
|
||||
import { getMpUnlimitWxaCode } from '../aspects/wechatQrCode';
|
||||
import { BackendRuntimeContext as BRC } from 'oak-frontend-base/lib/context/BackendRuntimeContext';
|
||||
import { cloneDeep } from 'oak-domain/lib/utils/lodash';
|
||||
import { cloneDeep, unset } from 'oak-domain/lib/utils/lodash';
|
||||
import { composeServerUrl } from '../utils/domain';
|
||||
import { maskPassword } from '../utils/user';
|
||||
/**
|
||||
|
|
@ -19,8 +19,11 @@ export class BackendRuntimeContext extends BRC {
|
|||
amIReallyRoot;
|
||||
rootMode;
|
||||
userId;
|
||||
platformManager;
|
||||
applicationProjection = cloneDeep(applicationProjection);
|
||||
async refineOpRecords() {
|
||||
const isRoot = this.isRoot();
|
||||
const isPlatformManager = this.platformManager;
|
||||
for (const opRecord of this.opRecords) {
|
||||
if (opRecord.a === 's') {
|
||||
const { d } = opRecord;
|
||||
|
|
@ -39,35 +42,62 @@ export class BackendRuntimeContext extends BRC {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (['application', 'system', 'platform'].includes(entity)
|
||||
&& process.env.NODE_ENV !== 'development') {
|
||||
// 删除掉config中的敏感返回信息
|
||||
// 目前删掉会影响前端上传,原因待核实
|
||||
/* const rowDict = d[entity as 'system'];
|
||||
for (const id in rowDict) {
|
||||
const { config } = rowDict[id] as EntityDict['system']['OpSchema'];
|
||||
if (config) {
|
||||
// application中可能的保密信息
|
||||
unset(config, 'appSecret');
|
||||
unset(config, 'server.token');
|
||||
unset(config, 'server.mode');
|
||||
unset(config, 'server.encodingAESKey');
|
||||
unset(config, 'wechat.appSecret');
|
||||
// server/platform中可能的保密信息
|
||||
if (config.Account) {
|
||||
for (const k in config.Account) {
|
||||
config.Account[k as keyof typeof config.Account]?.forEach(
|
||||
(ele) => {
|
||||
unset(ele, 'securityKey');
|
||||
unset(ele, 'secretKey');
|
||||
unset(ele, 'webApiKey');
|
||||
unset(ele, 'accessKeySecret');
|
||||
else if (entity === 'application') {
|
||||
if (!(isRoot || isPlatformManager)) {
|
||||
const rowDict = d[entity];
|
||||
for (const id in rowDict) {
|
||||
const { config } = rowDict[id];
|
||||
if (config) {
|
||||
// application中可能的保密信息
|
||||
unset(config, 'appSecret');
|
||||
unset(config, 'server.token');
|
||||
unset(config, 'server.mode');
|
||||
unset(config, 'server.encodingAESKey');
|
||||
unset(config, 'wechat.appSecret');
|
||||
unset(config, 'wechatNative.appSecret');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (['system', 'platform'].includes(entity)) {
|
||||
if (!(isRoot || isPlatformManager)) {
|
||||
const rowDict = d[entity];
|
||||
for (const id in rowDict) {
|
||||
const { config } = rowDict[id];
|
||||
if (config) {
|
||||
// server/platform中可能的保密信息
|
||||
if (config.Account) {
|
||||
for (const k in config.Account) {
|
||||
if (config.Account[k] instanceof Array) {
|
||||
config.Account[k]?.forEach((ele) => {
|
||||
unset(ele, 'securityKey');
|
||||
unset(ele, 'secretKey');
|
||||
unset(ele, 'webApiKey');
|
||||
unset(ele, 'accessKeySecret');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
if (config.Sms) {
|
||||
for (const k in config.Sms) {
|
||||
if (config.Sms[k] instanceof Array) {
|
||||
config.Sms[k]?.forEach((ele) => {
|
||||
unset(ele, 'securityKey');
|
||||
unset(ele, 'secretKey');
|
||||
unset(ele, 'webApiKey');
|
||||
unset(ele, 'accessKeySecret');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Emails) {
|
||||
config.Emails?.forEach((ele) => {
|
||||
unset(ele, 'password');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
else if (entity === 'user') {
|
||||
for (const id in d[entity]) {
|
||||
|
|
@ -82,6 +112,67 @@ export class BackendRuntimeContext extends BRC {
|
|||
}
|
||||
}
|
||||
}
|
||||
async setPlatformManager(tokenValue, userId) {
|
||||
if (tokenValue) {
|
||||
// 前台传递
|
||||
const result = await this.select('platform', {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
userRelation$entity: {
|
||||
user: {
|
||||
token$user: {
|
||||
$or: [
|
||||
{
|
||||
value: tokenValue,
|
||||
},
|
||||
{
|
||||
oldValue: tokenValue,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
relationId: {
|
||||
$in: ["platform-owner" /* RelationId.Platform.Owner */, "platform-manager" /* RelationId.Platform.Manager */]
|
||||
}
|
||||
},
|
||||
},
|
||||
}, {
|
||||
dontCollect: true,
|
||||
blockTrigger: true,
|
||||
});
|
||||
if (result.length > 0) {
|
||||
this.platformManager = true;
|
||||
}
|
||||
else {
|
||||
this.platformManager = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (userId) {
|
||||
// 若是后台环境,用userId来查询处理
|
||||
const result = await this.select('platform', {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
userRelation$entity: {
|
||||
userId,
|
||||
relationId: {
|
||||
$in: ["platform-owner" /* RelationId.Platform.Owner */, "platform-manager" /* RelationId.Platform.Manager */]
|
||||
}
|
||||
},
|
||||
},
|
||||
}, { dontCollect: true });
|
||||
if (result.length > 0) {
|
||||
this.platformManager = true;
|
||||
}
|
||||
else {
|
||||
this.platformManager = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
async setTokenValue(tokenValue, userId) {
|
||||
if (tokenValue) {
|
||||
// 前台传递
|
||||
|
|
@ -175,6 +266,7 @@ export class BackendRuntimeContext extends BRC {
|
|||
}
|
||||
if (tokenValue || userId) {
|
||||
promises.push(this.setTokenValue(tokenValue, userId));
|
||||
promises.push(this.setPlatformManager(tokenValue, userId));
|
||||
}
|
||||
if (promises.length > 0) {
|
||||
await Promise.all(promises);
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ export interface Schema extends EntityShape {
|
|||
entity?: String<32>;
|
||||
entityId?: String<64>;
|
||||
}
|
||||
export declare const entityDesc: EntityDesc<Schema>;
|
||||
export type Relation = 'owner' | 'manager';
|
||||
export declare const entityDesc: EntityDesc<Schema, '', Relation>;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ export const entityDesc = {
|
|||
entity: '关联对象',
|
||||
entityId: '关联对象id',
|
||||
},
|
||||
r: {
|
||||
owner: '拥有者',
|
||||
manager: '管理员',
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ import { JsonProjection } from "oak-domain/lib/types/DataType";
|
|||
import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf } from "oak-domain/lib/types/Polyfill";
|
||||
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import { GenericAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Text } from "oak-domain/lib/types/DataType";
|
||||
import { Config } from "../../types/Config";
|
||||
import { Style } from "../../types/Style";
|
||||
import * as Message from "../Message/Schema";
|
||||
import * as System from "../System/Schema";
|
||||
import * as Relation from "../Relation/Schema";
|
||||
import * as UserRelation from "../UserRelation/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
name: String<32>;
|
||||
description?: Text | null;
|
||||
|
|
@ -19,15 +21,23 @@ export type OpSchema = EntityShape & {
|
|||
export type OpAttr = keyof OpSchema;
|
||||
type Message$platformAggr = "message$platform$$aggr" | "message$platform$$0$$aggr" | "message$platform$$1$$aggr" | "message$platform$$2$$aggr" | "message$platform$$3$$aggr" | "message$platform$$4$$aggr" | "message$platform$$5$$aggr" | "message$platform$$6$$aggr" | "message$platform$$7$$aggr" | "message$platform$$8$$aggr" | "message$platform$$9$$aggr";
|
||||
type System$platformAggr = "system$platform$$aggr" | "system$platform$$0$$aggr" | "system$platform$$1$$aggr" | "system$platform$$2$$aggr" | "system$platform$$3$$aggr" | "system$platform$$4$$aggr" | "system$platform$$5$$aggr" | "system$platform$$6$$aggr" | "system$platform$$7$$aggr" | "system$platform$$8$$aggr" | "system$platform$$9$$aggr";
|
||||
type Relation$entityAggr = "relation$entity$$aggr" | "relation$entity$$0$$aggr" | "relation$entity$$1$$aggr" | "relation$entity$$2$$aggr" | "relation$entity$$3$$aggr" | "relation$entity$$4$$aggr" | "relation$entity$$5$$aggr" | "relation$entity$$6$$aggr" | "relation$entity$$7$$aggr" | "relation$entity$$8$$aggr" | "relation$entity$$9$$aggr";
|
||||
type UserRelation$entityAggr = "userRelation$entity$$aggr" | "userRelation$entity$$0$$aggr" | "userRelation$entity$$1$$aggr" | "userRelation$entity$$2$$aggr" | "userRelation$entity$$3$$aggr" | "userRelation$entity$$4$$aggr" | "userRelation$entity$$5$$aggr" | "userRelation$entity$$6$$aggr" | "userRelation$entity$$7$$aggr" | "userRelation$entity$$8$$aggr" | "userRelation$entity$$9$$aggr";
|
||||
export type Schema = OpSchema & {
|
||||
message$platform?: Array<Message.Schema>;
|
||||
system$platform?: Array<System.Schema>;
|
||||
relation$entity?: Array<Relation.Schema>;
|
||||
userRelation$entity?: Array<UserRelation.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
} & {
|
||||
[A in Message$platformAggr]?: AggregationResult<Message.Schema>;
|
||||
} & {
|
||||
[A in System$platformAggr]?: AggregationResult<System.Schema>;
|
||||
} & {
|
||||
[A in Relation$entityAggr]?: AggregationResult<Relation.Schema>;
|
||||
} & {
|
||||
[A in UserRelation$entityAggr]?: AggregationResult<UserRelation.Schema>;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
|
|
@ -42,6 +52,8 @@ type AttrFilter = {
|
|||
entityId: Q_StringValue;
|
||||
message$platform: Message.Filter & SubQueryPredicateMetadata;
|
||||
system$platform: System.Filter & SubQueryPredicateMetadata;
|
||||
relation$entity: Relation.Filter & SubQueryPredicateMetadata;
|
||||
userRelation$entity: UserRelation.Filter & SubQueryPredicateMetadata;
|
||||
};
|
||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export type Projection = {
|
||||
|
|
@ -63,6 +75,12 @@ export type Projection = {
|
|||
system$platform?: System.Selection & {
|
||||
$entity: "system";
|
||||
};
|
||||
relation$entity?: Relation.Selection & {
|
||||
$entity: "relation";
|
||||
};
|
||||
userRelation$entity?: UserRelation.Selection & {
|
||||
$entity: "userRelation";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>> & {
|
||||
[A in Message$platformAggr]?: Message.Aggregation & {
|
||||
$entity: "message";
|
||||
|
|
@ -71,6 +89,14 @@ export type Projection = {
|
|||
[A in System$platformAggr]?: System.Aggregation & {
|
||||
$entity: "system";
|
||||
};
|
||||
} & {
|
||||
[A in Relation$entityAggr]?: Relation.Aggregation & {
|
||||
$entity: "relation";
|
||||
};
|
||||
} & {
|
||||
[A in UserRelation$entityAggr]?: UserRelation.Aggregation & {
|
||||
$entity: "userRelation";
|
||||
};
|
||||
};
|
||||
type PlatformIdProjection = OneOf<{
|
||||
id: number;
|
||||
|
|
@ -113,6 +139,8 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|||
}) & {
|
||||
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
|
||||
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
|
||||
relation$entity?: OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">> | OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">>>;
|
||||
userRelation$entity?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">>>;
|
||||
};
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
|
|
@ -121,8 +149,10 @@ export type UpdateOperationData = FormUpdateData<OpSchema> & {
|
|||
[k: string]: any;
|
||||
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
|
||||
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
|
||||
relation$entity?: OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<Relation.RemoveOperation["action"], Omit<Relation.RemoveOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">> | OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<Relation.RemoveOperation["action"], Omit<Relation.RemoveOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">>>;
|
||||
userRelation$entity?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<UserRelation.RemoveOperation["action"], Omit<UserRelation.RemoveOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<UserRelation.RemoveOperation["action"], Omit<UserRelation.RemoveOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type UpdateOperation = OakOperation<"update" | RelationAction | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {};
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
|
|
@ -130,7 +160,7 @@ export type PlatformIdSubQuery = Selection<PlatformIdProjection>;
|
|||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Action: OakMakeAction<GenericAction | RelationAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
|
|
|
|||
|
|
@ -32,5 +32,6 @@ export const desc = {
|
|||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
actions,
|
||||
relation: ["owner", "manager"]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,5 +7,9 @@
|
|||
"style": "样式",
|
||||
"entity": "关联对象",
|
||||
"entityId": "关联对象id"
|
||||
},
|
||||
"r": {
|
||||
"owner": "拥有者",
|
||||
"manager": "管理员"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,14 @@
|
|||
export const relations = [
|
||||
{
|
||||
id: "platform-owner",
|
||||
entity: "platform",
|
||||
name: "owner"
|
||||
},
|
||||
{
|
||||
id: "platform-manager",
|
||||
entity: "platform",
|
||||
name: "manager"
|
||||
},
|
||||
{
|
||||
id: "session-partner",
|
||||
entity: "session",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { OneOf } from "oak-domain/lib/types/Polyfill";
|
|||
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import { String } from "oak-domain/lib/types/DataType";
|
||||
import * as Platform from "../Platform/Schema";
|
||||
import * as Session from "../Session/Schema";
|
||||
import * as ToDo from "../ToDo/Schema";
|
||||
import * as ActionAuth from "../ActionAuth/Schema";
|
||||
|
|
@ -11,7 +12,7 @@ import * as RelationAuth from "../RelationAuth/Schema";
|
|||
import * as UserEntityClaim from "../UserEntityClaim/Schema";
|
||||
import * as UserRelation from "../UserRelation/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
entity: "session" | "toDo" | string;
|
||||
entity: "platform" | "session" | "toDo" | string;
|
||||
entityId?: String<64> | null;
|
||||
name?: String<32> | null;
|
||||
display?: String<32> | null;
|
||||
|
|
@ -23,6 +24,7 @@ type RelationAuth$destRelationAggr = "relationAuth$destRelation$$aggr" | "relati
|
|||
type UserEntityClaim$relationAggr = "userEntityClaim$relation$$aggr" | "userEntityClaim$relation$$0$$aggr" | "userEntityClaim$relation$$1$$aggr" | "userEntityClaim$relation$$2$$aggr" | "userEntityClaim$relation$$3$$aggr" | "userEntityClaim$relation$$4$$aggr" | "userEntityClaim$relation$$5$$aggr" | "userEntityClaim$relation$$6$$aggr" | "userEntityClaim$relation$$7$$aggr" | "userEntityClaim$relation$$8$$aggr" | "userEntityClaim$relation$$9$$aggr";
|
||||
type UserRelation$relationAggr = "userRelation$relation$$aggr" | "userRelation$relation$$0$$aggr" | "userRelation$relation$$1$$aggr" | "userRelation$relation$$2$$aggr" | "userRelation$relation$$3$$aggr" | "userRelation$relation$$4$$aggr" | "userRelation$relation$$5$$aggr" | "userRelation$relation$$6$$aggr" | "userRelation$relation$$7$$aggr" | "userRelation$relation$$8$$aggr" | "userRelation$relation$$9$$aggr";
|
||||
export type Schema = OpSchema & {
|
||||
platform?: Platform.Schema;
|
||||
session?: Session.Schema;
|
||||
toDo?: ToDo.Schema;
|
||||
actionAuth$relation?: Array<ActionAuth.Schema>;
|
||||
|
|
@ -48,10 +50,11 @@ type AttrFilter = {
|
|||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
entity: Q_EnumValue<"session" | "toDo" | string>;
|
||||
entity: Q_EnumValue<"platform" | "session" | "toDo" | string>;
|
||||
entityId: Q_StringValue;
|
||||
name: Q_StringValue;
|
||||
display: Q_StringValue;
|
||||
platform: Platform.Filter;
|
||||
session: Session.Filter;
|
||||
toDo: ToDo.Filter;
|
||||
actionAuth$relation: ActionAuth.Filter & SubQueryPredicateMetadata;
|
||||
|
|
@ -72,6 +75,7 @@ export type Projection = {
|
|||
entityId?: number;
|
||||
name?: number;
|
||||
display?: number;
|
||||
platform?: Platform.Projection;
|
||||
session?: Session.Projection;
|
||||
toDo?: ToDo.Projection;
|
||||
actionAuth$relation?: ActionAuth.Selection & {
|
||||
|
|
@ -113,6 +117,9 @@ export type Projection = {
|
|||
type RelationIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type PlatformIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type SessionIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
|
|
@ -135,6 +142,8 @@ export type SortAttr = {
|
|||
name: number;
|
||||
} | {
|
||||
display: number;
|
||||
} | {
|
||||
platform: Platform.SortAttr;
|
||||
} | {
|
||||
session: Session.SortAttr;
|
||||
} | {
|
||||
|
|
@ -151,6 +160,18 @@ export type SelectOperation<P extends Object = Projection> = OakSelection<"selec
|
|||
export type Selection<P extends Object = Projection> = SelectOperation<P>;
|
||||
export type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
||||
export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId">> & ({
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
platform?: Platform.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "platform";
|
||||
entityId?: ForeignKey<"Platform">;
|
||||
platform?: Platform.UpdateOperation;
|
||||
} | {
|
||||
entity: "platform";
|
||||
entityId?: ForeignKey<"Platform">;
|
||||
platform?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
session?: Session.CreateSingleOperation;
|
||||
|
|
@ -186,6 +207,10 @@ export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "entityId">> & ({
|
||||
platform?: Platform.CreateSingleOperation | Platform.UpdateOperation | Platform.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
session?: Session.CreateSingleOperation | Session.UpdateOperation | Session.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
|
|
@ -194,8 +219,9 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("session" | "toDo" | string) | null;
|
||||
entityId?: ForeignKey<"Session" | "ToDo">;
|
||||
entity?: ("platform" | "session" | "toDo" | string) | null;
|
||||
entityId?: ForeignKey<"Platform" | "Session" | "ToDo">;
|
||||
platform?: never;
|
||||
session?: never;
|
||||
toDo?: never;
|
||||
}) & {
|
||||
|
|
@ -205,6 +231,8 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & ({
|
||||
platform?: Platform.UpdateOperation | Platform.RemoveOperation;
|
||||
} | {
|
||||
session?: Session.UpdateOperation | Session.RemoveOperation;
|
||||
} | {
|
||||
toDo?: ToDo.UpdateOperation | ToDo.RemoveOperation;
|
||||
|
|
@ -213,6 +241,7 @@ export type RemoveOperationData = {} & ({
|
|||
});
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type PlatformIdSubQuery = Selection<PlatformIdProjection>;
|
||||
export type SessionIdSubQuery = Selection<SessionIdProjection>;
|
||||
export type ToDoIdSubQuery = Selection<ToDoIdProjection>;
|
||||
export type RelationIdSubQuery = Selection<RelationIdProjection>;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export const desc = {
|
|||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["session", "toDo"]
|
||||
ref: ["platform", "session", "toDo"]
|
||||
},
|
||||
entityId: {
|
||||
type: "varchar",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
export declare namespace RelationId {
|
||||
const enum Platform {
|
||||
Owner = "platform-owner",
|
||||
Manager = "platform-manager"
|
||||
}
|
||||
const enum Session {
|
||||
Partner = "session-partner"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,12 @@
|
|||
"codes": "微信分享二维码",
|
||||
"isRoot": "是否超级用户",
|
||||
"addresses": "收货地址",
|
||||
<<<<<<< HEAD
|
||||
"hasPassword": "用户是否存在密码",
|
||||
"verifyPasswordAt": "最近验证密码时间"
|
||||
=======
|
||||
"hasPassword": "用户是否存在密码"
|
||||
>>>>>>> 8d982431d03b19c280f08d7d3857641ee55c6ca7
|
||||
},
|
||||
"action": {
|
||||
"activate": "激活",
|
||||
|
|
@ -27,8 +31,12 @@
|
|||
"enable": "启用",
|
||||
"disable": "禁用",
|
||||
"mergeTo": "合并",
|
||||
<<<<<<< HEAD
|
||||
"mergeFrom": "使合并",
|
||||
"play": "扮演"
|
||||
=======
|
||||
"mergeFrom": "使合并"
|
||||
>>>>>>> 8d982431d03b19c280f08d7d3857641ee55c6ca7
|
||||
},
|
||||
"v": {
|
||||
"userState": {
|
||||
|
|
|
|||
|
|
@ -6,13 +6,14 @@ import { GenericAction } from "oak-domain/lib/actions/action";
|
|||
import { String } from "oak-domain/lib/types/DataType";
|
||||
import * as User from "../User/Schema";
|
||||
import * as Relation from "../Relation/Schema";
|
||||
import * as Platform from "../Platform/Schema";
|
||||
import * as Session from "../Session/Schema";
|
||||
import * as ToDo from "../ToDo/Schema";
|
||||
import * as UserEntityClaim from "../UserEntityClaim/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
userId: ForeignKey<"user">;
|
||||
relationId: ForeignKey<"relation">;
|
||||
entity: "session" | "toDo" | string;
|
||||
entity: "platform" | "session" | "toDo" | string;
|
||||
entityId: String<64>;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
|
|
@ -20,6 +21,7 @@ type UserEntityClaim$userRelationAggr = "userEntityClaim$userRelation$$aggr" | "
|
|||
export type Schema = OpSchema & {
|
||||
user: User.Schema;
|
||||
relation: Relation.Schema;
|
||||
platform?: Platform.Schema;
|
||||
session?: Session.Schema;
|
||||
toDo?: ToDo.Schema;
|
||||
userEntityClaim$userRelation?: Array<UserEntityClaim.Schema>;
|
||||
|
|
@ -37,8 +39,9 @@ type AttrFilter = {
|
|||
user: User.Filter;
|
||||
relationId: Q_StringValue;
|
||||
relation: Relation.Filter;
|
||||
entity: Q_EnumValue<"session" | "toDo" | string>;
|
||||
entity: Q_EnumValue<"platform" | "session" | "toDo" | string>;
|
||||
entityId: Q_StringValue;
|
||||
platform: Platform.Filter;
|
||||
session: Session.Filter;
|
||||
toDo: ToDo.Filter;
|
||||
userEntityClaim$userRelation: UserEntityClaim.Filter & SubQueryPredicateMetadata;
|
||||
|
|
@ -57,6 +60,7 @@ export type Projection = {
|
|||
relation?: Relation.Projection;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
platform?: Platform.Projection;
|
||||
session?: Session.Projection;
|
||||
toDo?: ToDo.Projection;
|
||||
userEntityClaim$userRelation?: UserEntityClaim.Selection & {
|
||||
|
|
@ -76,6 +80,9 @@ type UserIdProjection = OneOf<{
|
|||
type RelationIdProjection = OneOf<{
|
||||
relationId: number;
|
||||
}>;
|
||||
type PlatformIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type SessionIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
|
|
@ -102,6 +109,8 @@ export type SortAttr = {
|
|||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
platform: Platform.SortAttr;
|
||||
} | {
|
||||
session: Session.SortAttr;
|
||||
} | {
|
||||
|
|
@ -136,6 +145,18 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|||
relation?: never;
|
||||
relationId: ForeignKey<"relation">;
|
||||
})) & ({
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
platform: Platform.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "platform";
|
||||
entityId: ForeignKey<"Platform">;
|
||||
platform?: Platform.UpdateOperation;
|
||||
} | {
|
||||
entity: "platform";
|
||||
entityId: ForeignKey<"Platform">;
|
||||
platform?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
session: Session.CreateSingleOperation;
|
||||
|
|
@ -194,6 +215,10 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
relation?: never;
|
||||
relationId?: ForeignKey<"relation">;
|
||||
})) & ({
|
||||
platform?: Platform.CreateSingleOperation | Platform.UpdateOperation | Platform.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
session?: Session.CreateSingleOperation | Session.UpdateOperation | Session.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
|
|
@ -202,8 +227,9 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("session" | "toDo" | string) | null;
|
||||
entityId?: ForeignKey<"Session" | "ToDo"> | null;
|
||||
entity?: ("platform" | "session" | "toDo" | string) | null;
|
||||
entityId?: ForeignKey<"Platform" | "Session" | "ToDo"> | null;
|
||||
platform?: never;
|
||||
session?: never;
|
||||
toDo?: never;
|
||||
}) & {
|
||||
|
|
@ -216,6 +242,8 @@ export type RemoveOperationData = {} & (({
|
|||
}) & ({
|
||||
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
||||
})) & ({
|
||||
platform?: Platform.UpdateOperation | Platform.RemoveOperation;
|
||||
} | {
|
||||
session?: Session.UpdateOperation | Session.RemoveOperation;
|
||||
} | {
|
||||
toDo?: ToDo.UpdateOperation | ToDo.RemoveOperation;
|
||||
|
|
@ -226,6 +254,7 @@ export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter
|
|||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export type RelationIdSubQuery = Selection<RelationIdProjection>;
|
||||
export type PlatformIdSubQuery = Selection<PlatformIdProjection>;
|
||||
export type SessionIdSubQuery = Selection<SessionIdProjection>;
|
||||
export type ToDoIdSubQuery = Selection<ToDoIdProjection>;
|
||||
export type UserRelationIdSubQuery = Selection<UserRelationIdProjection>;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export const desc = {
|
|||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["session", "toDo"]
|
||||
ref: ["platform", "session", "toDo"]
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
|
|
|
|||
|
|
@ -373,6 +373,10 @@ export type PlatformIdSubQuery = {
|
|||
entity: "message";
|
||||
}) | (System.PlatformIdSubQuery & {
|
||||
entity: "system";
|
||||
}) | (Relation.PlatformIdSubQuery & {
|
||||
entity: "relation";
|
||||
}) | (UserRelation.PlatformIdSubQuery & {
|
||||
entity: "userRelation";
|
||||
}) | (Platform.PlatformIdSubQuery & {
|
||||
entity: "platform";
|
||||
}) | any;
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@ export const applicationProjection = {
|
|||
config: 1,
|
||||
platformId: 1,
|
||||
style: 1,
|
||||
folder: 1,
|
||||
super: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
|
|
|
|||
|
|
@ -21,16 +21,18 @@ async function syncSmsTemplate(params, context) {
|
|||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
const existsTemplateIds = existTemplateList.map((ele) => ele.templateCode);
|
||||
const newTemplateList = templateFormalData.filter((ele) => !existsTemplateIds.includes(ele.templateCode));
|
||||
const newTemplateIds = newTemplateList.map((ele) => ele.templateCode);
|
||||
// const existsTemplateIds = existTemplateList.map((ele) => ele.templateCode);
|
||||
// const newTemplateList = templateFormalData.filter(
|
||||
// (ele) => !existsTemplateIds.includes(ele.templateCode)
|
||||
// );
|
||||
// const newTemplateIds = newTemplateList.map((ele) => ele.templateCode);
|
||||
// const removeTemplateList = existTemplateList.filter(
|
||||
// (ele) => !newTemplateIds.includes(ele.templateCode!)
|
||||
// );
|
||||
for (const template of templateFormalData) {
|
||||
const { templateName, templateCode, templateContent } = template;
|
||||
const existTemplateId = existsTemplateIds.find((ele) => ele === template.templateCode);
|
||||
if (existTemplateId) {
|
||||
const existTemplate = existTemplateList.find((ele) => ele.templateCode === template.templateCode);
|
||||
if (existTemplate) {
|
||||
await context.operate('smsTemplate', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'update',
|
||||
|
|
@ -40,7 +42,7 @@ async function syncSmsTemplate(params, context) {
|
|||
syncAt: Date.now(),
|
||||
},
|
||||
filter: {
|
||||
id: existTemplateId,
|
||||
id: existTemplate.id,
|
||||
},
|
||||
}, {
|
||||
dontCollect: true,
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ export declare abstract class BackendRuntimeContext<ED extends EntityDict & Base
|
|||
protected amIReallyRoot?: boolean;
|
||||
protected rootMode?: boolean;
|
||||
private userId?;
|
||||
protected platformManager?: boolean;
|
||||
protected applicationProjection: import("../oak-app-domain/Application/Schema").Projection;
|
||||
refineOpRecords(): Promise<void>;
|
||||
setPlatformManager(tokenValue?: string, userId?: string): Promise<void>;
|
||||
setTokenValue(tokenValue?: string, userId?: string): Promise<void>;
|
||||
setApplication(appId: string): Promise<void>;
|
||||
initialize(data?: SerializedData, later?: boolean): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,11 @@ class BackendRuntimeContext extends BackendRuntimeContext_1.BackendRuntimeContex
|
|||
amIReallyRoot;
|
||||
rootMode;
|
||||
userId;
|
||||
platformManager;
|
||||
applicationProjection = (0, lodash_1.cloneDeep)(Projection_1.applicationProjection);
|
||||
async refineOpRecords() {
|
||||
const isRoot = this.isRoot();
|
||||
const isPlatformManager = this.platformManager;
|
||||
for (const opRecord of this.opRecords) {
|
||||
if (opRecord.a === 's') {
|
||||
const { d } = opRecord;
|
||||
|
|
@ -42,35 +45,62 @@ class BackendRuntimeContext extends BackendRuntimeContext_1.BackendRuntimeContex
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (['application', 'system', 'platform'].includes(entity)
|
||||
&& process.env.NODE_ENV !== 'development') {
|
||||
// 删除掉config中的敏感返回信息
|
||||
// 目前删掉会影响前端上传,原因待核实
|
||||
/* const rowDict = d[entity as 'system'];
|
||||
for (const id in rowDict) {
|
||||
const { config } = rowDict[id] as EntityDict['system']['OpSchema'];
|
||||
if (config) {
|
||||
// application中可能的保密信息
|
||||
unset(config, 'appSecret');
|
||||
unset(config, 'server.token');
|
||||
unset(config, 'server.mode');
|
||||
unset(config, 'server.encodingAESKey');
|
||||
unset(config, 'wechat.appSecret');
|
||||
// server/platform中可能的保密信息
|
||||
if (config.Account) {
|
||||
for (const k in config.Account) {
|
||||
config.Account[k as keyof typeof config.Account]?.forEach(
|
||||
(ele) => {
|
||||
unset(ele, 'securityKey');
|
||||
unset(ele, 'secretKey');
|
||||
unset(ele, 'webApiKey');
|
||||
unset(ele, 'accessKeySecret');
|
||||
else if (entity === 'application') {
|
||||
if (!(isRoot || isPlatformManager)) {
|
||||
const rowDict = d[entity];
|
||||
for (const id in rowDict) {
|
||||
const { config } = rowDict[id];
|
||||
if (config) {
|
||||
// application中可能的保密信息
|
||||
(0, lodash_1.unset)(config, 'appSecret');
|
||||
(0, lodash_1.unset)(config, 'server.token');
|
||||
(0, lodash_1.unset)(config, 'server.mode');
|
||||
(0, lodash_1.unset)(config, 'server.encodingAESKey');
|
||||
(0, lodash_1.unset)(config, 'wechat.appSecret');
|
||||
(0, lodash_1.unset)(config, 'wechatNative.appSecret');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (['system', 'platform'].includes(entity)) {
|
||||
if (!(isRoot || isPlatformManager)) {
|
||||
const rowDict = d[entity];
|
||||
for (const id in rowDict) {
|
||||
const { config } = rowDict[id];
|
||||
if (config) {
|
||||
// server/platform中可能的保密信息
|
||||
if (config.Account) {
|
||||
for (const k in config.Account) {
|
||||
if (config.Account[k] instanceof Array) {
|
||||
config.Account[k]?.forEach((ele) => {
|
||||
(0, lodash_1.unset)(ele, 'securityKey');
|
||||
(0, lodash_1.unset)(ele, 'secretKey');
|
||||
(0, lodash_1.unset)(ele, 'webApiKey');
|
||||
(0, lodash_1.unset)(ele, 'accessKeySecret');
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
if (config.Sms) {
|
||||
for (const k in config.Sms) {
|
||||
if (config.Sms[k] instanceof Array) {
|
||||
config.Sms[k]?.forEach((ele) => {
|
||||
(0, lodash_1.unset)(ele, 'securityKey');
|
||||
(0, lodash_1.unset)(ele, 'secretKey');
|
||||
(0, lodash_1.unset)(ele, 'webApiKey');
|
||||
(0, lodash_1.unset)(ele, 'accessKeySecret');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Emails) {
|
||||
config.Emails?.forEach((ele) => {
|
||||
(0, lodash_1.unset)(ele, 'password');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
else if (entity === 'user') {
|
||||
for (const id in d[entity]) {
|
||||
|
|
@ -85,6 +115,67 @@ class BackendRuntimeContext extends BackendRuntimeContext_1.BackendRuntimeContex
|
|||
}
|
||||
}
|
||||
}
|
||||
async setPlatformManager(tokenValue, userId) {
|
||||
if (tokenValue) {
|
||||
// 前台传递
|
||||
const result = await this.select('platform', {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
userRelation$entity: {
|
||||
user: {
|
||||
token$user: {
|
||||
$or: [
|
||||
{
|
||||
value: tokenValue,
|
||||
},
|
||||
{
|
||||
oldValue: tokenValue,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
relationId: {
|
||||
$in: ["platform-owner" /* RelationId.Platform.Owner */, "platform-manager" /* RelationId.Platform.Manager */]
|
||||
}
|
||||
},
|
||||
},
|
||||
}, {
|
||||
dontCollect: true,
|
||||
blockTrigger: true,
|
||||
});
|
||||
if (result.length > 0) {
|
||||
this.platformManager = true;
|
||||
}
|
||||
else {
|
||||
this.platformManager = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (userId) {
|
||||
// 若是后台环境,用userId来查询处理
|
||||
const result = await this.select('platform', {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
userRelation$entity: {
|
||||
userId,
|
||||
relationId: {
|
||||
$in: ["platform-owner" /* RelationId.Platform.Owner */, "platform-manager" /* RelationId.Platform.Manager */]
|
||||
}
|
||||
},
|
||||
},
|
||||
}, { dontCollect: true });
|
||||
if (result.length > 0) {
|
||||
this.platformManager = true;
|
||||
}
|
||||
else {
|
||||
this.platformManager = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
async setTokenValue(tokenValue, userId) {
|
||||
if (tokenValue) {
|
||||
// 前台传递
|
||||
|
|
@ -178,6 +269,7 @@ class BackendRuntimeContext extends BackendRuntimeContext_1.BackendRuntimeContex
|
|||
}
|
||||
if (tokenValue || userId) {
|
||||
promises.push(this.setTokenValue(tokenValue, userId));
|
||||
promises.push(this.setPlatformManager(tokenValue, userId));
|
||||
}
|
||||
if (promises.length > 0) {
|
||||
await Promise.all(promises);
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ export interface Schema extends EntityShape {
|
|||
entity?: String<32>;
|
||||
entityId?: String<64>;
|
||||
}
|
||||
export declare const entityDesc: EntityDesc<Schema>;
|
||||
export type Relation = 'owner' | 'manager';
|
||||
export declare const entityDesc: EntityDesc<Schema, '', Relation>;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ exports.entityDesc = {
|
|||
entity: '关联对象',
|
||||
entityId: '关联对象id',
|
||||
},
|
||||
r: {
|
||||
owner: '拥有者',
|
||||
manager: '管理员',
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ import { JsonProjection } from "oak-domain/lib/types/DataType";
|
|||
import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf } from "oak-domain/lib/types/Polyfill";
|
||||
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import { GenericAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Text } from "oak-domain/lib/types/DataType";
|
||||
import { Config } from "../../types/Config";
|
||||
import { Style } from "../../types/Style";
|
||||
import * as Message from "../Message/Schema";
|
||||
import * as System from "../System/Schema";
|
||||
import * as Relation from "../Relation/Schema";
|
||||
import * as UserRelation from "../UserRelation/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
name: String<32>;
|
||||
description?: Text | null;
|
||||
|
|
@ -19,15 +21,23 @@ export type OpSchema = EntityShape & {
|
|||
export type OpAttr = keyof OpSchema;
|
||||
type Message$platformAggr = "message$platform$$aggr" | "message$platform$$0$$aggr" | "message$platform$$1$$aggr" | "message$platform$$2$$aggr" | "message$platform$$3$$aggr" | "message$platform$$4$$aggr" | "message$platform$$5$$aggr" | "message$platform$$6$$aggr" | "message$platform$$7$$aggr" | "message$platform$$8$$aggr" | "message$platform$$9$$aggr";
|
||||
type System$platformAggr = "system$platform$$aggr" | "system$platform$$0$$aggr" | "system$platform$$1$$aggr" | "system$platform$$2$$aggr" | "system$platform$$3$$aggr" | "system$platform$$4$$aggr" | "system$platform$$5$$aggr" | "system$platform$$6$$aggr" | "system$platform$$7$$aggr" | "system$platform$$8$$aggr" | "system$platform$$9$$aggr";
|
||||
type Relation$entityAggr = "relation$entity$$aggr" | "relation$entity$$0$$aggr" | "relation$entity$$1$$aggr" | "relation$entity$$2$$aggr" | "relation$entity$$3$$aggr" | "relation$entity$$4$$aggr" | "relation$entity$$5$$aggr" | "relation$entity$$6$$aggr" | "relation$entity$$7$$aggr" | "relation$entity$$8$$aggr" | "relation$entity$$9$$aggr";
|
||||
type UserRelation$entityAggr = "userRelation$entity$$aggr" | "userRelation$entity$$0$$aggr" | "userRelation$entity$$1$$aggr" | "userRelation$entity$$2$$aggr" | "userRelation$entity$$3$$aggr" | "userRelation$entity$$4$$aggr" | "userRelation$entity$$5$$aggr" | "userRelation$entity$$6$$aggr" | "userRelation$entity$$7$$aggr" | "userRelation$entity$$8$$aggr" | "userRelation$entity$$9$$aggr";
|
||||
export type Schema = OpSchema & {
|
||||
message$platform?: Array<Message.Schema>;
|
||||
system$platform?: Array<System.Schema>;
|
||||
relation$entity?: Array<Relation.Schema>;
|
||||
userRelation$entity?: Array<UserRelation.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
} & {
|
||||
[A in Message$platformAggr]?: AggregationResult<Message.Schema>;
|
||||
} & {
|
||||
[A in System$platformAggr]?: AggregationResult<System.Schema>;
|
||||
} & {
|
||||
[A in Relation$entityAggr]?: AggregationResult<Relation.Schema>;
|
||||
} & {
|
||||
[A in UserRelation$entityAggr]?: AggregationResult<UserRelation.Schema>;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
|
|
@ -42,6 +52,8 @@ type AttrFilter = {
|
|||
entityId: Q_StringValue;
|
||||
message$platform: Message.Filter & SubQueryPredicateMetadata;
|
||||
system$platform: System.Filter & SubQueryPredicateMetadata;
|
||||
relation$entity: Relation.Filter & SubQueryPredicateMetadata;
|
||||
userRelation$entity: UserRelation.Filter & SubQueryPredicateMetadata;
|
||||
};
|
||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export type Projection = {
|
||||
|
|
@ -63,6 +75,12 @@ export type Projection = {
|
|||
system$platform?: System.Selection & {
|
||||
$entity: "system";
|
||||
};
|
||||
relation$entity?: Relation.Selection & {
|
||||
$entity: "relation";
|
||||
};
|
||||
userRelation$entity?: UserRelation.Selection & {
|
||||
$entity: "userRelation";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>> & {
|
||||
[A in Message$platformAggr]?: Message.Aggregation & {
|
||||
$entity: "message";
|
||||
|
|
@ -71,6 +89,14 @@ export type Projection = {
|
|||
[A in System$platformAggr]?: System.Aggregation & {
|
||||
$entity: "system";
|
||||
};
|
||||
} & {
|
||||
[A in Relation$entityAggr]?: Relation.Aggregation & {
|
||||
$entity: "relation";
|
||||
};
|
||||
} & {
|
||||
[A in UserRelation$entityAggr]?: UserRelation.Aggregation & {
|
||||
$entity: "userRelation";
|
||||
};
|
||||
};
|
||||
type PlatformIdProjection = OneOf<{
|
||||
id: number;
|
||||
|
|
@ -113,6 +139,8 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|||
}) & {
|
||||
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
|
||||
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
|
||||
relation$entity?: OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">> | OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">>>;
|
||||
userRelation$entity?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">>>;
|
||||
};
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
|
|
@ -121,8 +149,10 @@ export type UpdateOperationData = FormUpdateData<OpSchema> & {
|
|||
[k: string]: any;
|
||||
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
|
||||
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
|
||||
relation$entity?: OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<Relation.RemoveOperation["action"], Omit<Relation.RemoveOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">> | OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<Relation.RemoveOperation["action"], Omit<Relation.RemoveOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">>>;
|
||||
userRelation$entity?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<UserRelation.RemoveOperation["action"], Omit<UserRelation.RemoveOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<UserRelation.RemoveOperation["action"], Omit<UserRelation.RemoveOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type UpdateOperation = OakOperation<"update" | RelationAction | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {};
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
|
|
@ -130,7 +160,7 @@ export type PlatformIdSubQuery = Selection<PlatformIdProjection>;
|
|||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Action: OakMakeAction<GenericAction | RelationAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
|
|
|
|||
|
|
@ -35,5 +35,6 @@ exports.desc = {
|
|||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions: action_1.genericActions
|
||||
actions: action_1.genericActions,
|
||||
relation: ["owner", "manager"]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,5 +7,9 @@
|
|||
"style": "样式",
|
||||
"entity": "关联对象",
|
||||
"entityId": "关联对象id"
|
||||
},
|
||||
"r": {
|
||||
"owner": "拥有者",
|
||||
"manager": "管理员"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,16 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.relations = void 0;
|
||||
exports.relations = [
|
||||
{
|
||||
id: "platform-owner",
|
||||
entity: "platform",
|
||||
name: "owner"
|
||||
},
|
||||
{
|
||||
id: "platform-manager",
|
||||
entity: "platform",
|
||||
name: "manager"
|
||||
},
|
||||
{
|
||||
id: "session-partner",
|
||||
entity: "session",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { OneOf } from "oak-domain/lib/types/Polyfill";
|
|||
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { GenericAction } from "oak-domain/lib/actions/action";
|
||||
import { String } from "oak-domain/lib/types/DataType";
|
||||
import * as Platform from "../Platform/Schema";
|
||||
import * as Session from "../Session/Schema";
|
||||
import * as ToDo from "../ToDo/Schema";
|
||||
import * as ActionAuth from "../ActionAuth/Schema";
|
||||
|
|
@ -11,7 +12,7 @@ import * as RelationAuth from "../RelationAuth/Schema";
|
|||
import * as UserEntityClaim from "../UserEntityClaim/Schema";
|
||||
import * as UserRelation from "../UserRelation/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
entity: "session" | "toDo" | string;
|
||||
entity: "platform" | "session" | "toDo" | string;
|
||||
entityId?: String<64> | null;
|
||||
name?: String<32> | null;
|
||||
display?: String<32> | null;
|
||||
|
|
@ -23,6 +24,7 @@ type RelationAuth$destRelationAggr = "relationAuth$destRelation$$aggr" | "relati
|
|||
type UserEntityClaim$relationAggr = "userEntityClaim$relation$$aggr" | "userEntityClaim$relation$$0$$aggr" | "userEntityClaim$relation$$1$$aggr" | "userEntityClaim$relation$$2$$aggr" | "userEntityClaim$relation$$3$$aggr" | "userEntityClaim$relation$$4$$aggr" | "userEntityClaim$relation$$5$$aggr" | "userEntityClaim$relation$$6$$aggr" | "userEntityClaim$relation$$7$$aggr" | "userEntityClaim$relation$$8$$aggr" | "userEntityClaim$relation$$9$$aggr";
|
||||
type UserRelation$relationAggr = "userRelation$relation$$aggr" | "userRelation$relation$$0$$aggr" | "userRelation$relation$$1$$aggr" | "userRelation$relation$$2$$aggr" | "userRelation$relation$$3$$aggr" | "userRelation$relation$$4$$aggr" | "userRelation$relation$$5$$aggr" | "userRelation$relation$$6$$aggr" | "userRelation$relation$$7$$aggr" | "userRelation$relation$$8$$aggr" | "userRelation$relation$$9$$aggr";
|
||||
export type Schema = OpSchema & {
|
||||
platform?: Platform.Schema;
|
||||
session?: Session.Schema;
|
||||
toDo?: ToDo.Schema;
|
||||
actionAuth$relation?: Array<ActionAuth.Schema>;
|
||||
|
|
@ -48,10 +50,11 @@ type AttrFilter = {
|
|||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
entity: Q_EnumValue<"session" | "toDo" | string>;
|
||||
entity: Q_EnumValue<"platform" | "session" | "toDo" | string>;
|
||||
entityId: Q_StringValue;
|
||||
name: Q_StringValue;
|
||||
display: Q_StringValue;
|
||||
platform: Platform.Filter;
|
||||
session: Session.Filter;
|
||||
toDo: ToDo.Filter;
|
||||
actionAuth$relation: ActionAuth.Filter & SubQueryPredicateMetadata;
|
||||
|
|
@ -72,6 +75,7 @@ export type Projection = {
|
|||
entityId?: number;
|
||||
name?: number;
|
||||
display?: number;
|
||||
platform?: Platform.Projection;
|
||||
session?: Session.Projection;
|
||||
toDo?: ToDo.Projection;
|
||||
actionAuth$relation?: ActionAuth.Selection & {
|
||||
|
|
@ -113,6 +117,9 @@ export type Projection = {
|
|||
type RelationIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type PlatformIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type SessionIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
|
|
@ -135,6 +142,8 @@ export type SortAttr = {
|
|||
name: number;
|
||||
} | {
|
||||
display: number;
|
||||
} | {
|
||||
platform: Platform.SortAttr;
|
||||
} | {
|
||||
session: Session.SortAttr;
|
||||
} | {
|
||||
|
|
@ -151,6 +160,18 @@ export type SelectOperation<P extends Object = Projection> = OakSelection<"selec
|
|||
export type Selection<P extends Object = Projection> = SelectOperation<P>;
|
||||
export type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
||||
export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId">> & ({
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
platform?: Platform.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "platform";
|
||||
entityId?: ForeignKey<"Platform">;
|
||||
platform?: Platform.UpdateOperation;
|
||||
} | {
|
||||
entity: "platform";
|
||||
entityId?: ForeignKey<"Platform">;
|
||||
platform?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
session?: Session.CreateSingleOperation;
|
||||
|
|
@ -186,6 +207,10 @@ export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "entityId">> & ({
|
||||
platform?: Platform.CreateSingleOperation | Platform.UpdateOperation | Platform.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
session?: Session.CreateSingleOperation | Session.UpdateOperation | Session.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
|
|
@ -194,8 +219,9 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("session" | "toDo" | string) | null;
|
||||
entityId?: ForeignKey<"Session" | "ToDo">;
|
||||
entity?: ("platform" | "session" | "toDo" | string) | null;
|
||||
entityId?: ForeignKey<"Platform" | "Session" | "ToDo">;
|
||||
platform?: never;
|
||||
session?: never;
|
||||
toDo?: never;
|
||||
}) & {
|
||||
|
|
@ -205,6 +231,8 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & ({
|
||||
platform?: Platform.UpdateOperation | Platform.RemoveOperation;
|
||||
} | {
|
||||
session?: Session.UpdateOperation | Session.RemoveOperation;
|
||||
} | {
|
||||
toDo?: ToDo.UpdateOperation | ToDo.RemoveOperation;
|
||||
|
|
@ -213,6 +241,7 @@ export type RemoveOperationData = {} & ({
|
|||
});
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type PlatformIdSubQuery = Selection<PlatformIdProjection>;
|
||||
export type SessionIdSubQuery = Selection<SessionIdProjection>;
|
||||
export type ToDoIdSubQuery = Selection<ToDoIdProjection>;
|
||||
export type RelationIdSubQuery = Selection<RelationIdProjection>;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ exports.desc = {
|
|||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["session", "toDo"]
|
||||
ref: ["platform", "session", "toDo"]
|
||||
},
|
||||
entityId: {
|
||||
type: "varchar",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
export declare namespace RelationId {
|
||||
const enum Platform {
|
||||
Owner = "platform-owner",
|
||||
Manager = "platform-manager"
|
||||
}
|
||||
const enum Session {
|
||||
Partner = "session-partner"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,12 @@
|
|||
"codes": "微信分享二维码",
|
||||
"isRoot": "是否超级用户",
|
||||
"addresses": "收货地址",
|
||||
<<<<<<< HEAD
|
||||
"hasPassword": "用户是否存在密码",
|
||||
"verifyPasswordAt": "最近验证密码时间"
|
||||
=======
|
||||
"hasPassword": "用户是否存在密码"
|
||||
>>>>>>> 8d982431d03b19c280f08d7d3857641ee55c6ca7
|
||||
},
|
||||
"action": {
|
||||
"activate": "激活",
|
||||
|
|
@ -27,8 +31,12 @@
|
|||
"enable": "启用",
|
||||
"disable": "禁用",
|
||||
"mergeTo": "合并",
|
||||
<<<<<<< HEAD
|
||||
"mergeFrom": "使合并",
|
||||
"play": "扮演"
|
||||
=======
|
||||
"mergeFrom": "使合并"
|
||||
>>>>>>> 8d982431d03b19c280f08d7d3857641ee55c6ca7
|
||||
},
|
||||
"v": {
|
||||
"userState": {
|
||||
|
|
|
|||
|
|
@ -6,13 +6,14 @@ import { GenericAction } from "oak-domain/lib/actions/action";
|
|||
import { String } from "oak-domain/lib/types/DataType";
|
||||
import * as User from "../User/Schema";
|
||||
import * as Relation from "../Relation/Schema";
|
||||
import * as Platform from "../Platform/Schema";
|
||||
import * as Session from "../Session/Schema";
|
||||
import * as ToDo from "../ToDo/Schema";
|
||||
import * as UserEntityClaim from "../UserEntityClaim/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
userId: ForeignKey<"user">;
|
||||
relationId: ForeignKey<"relation">;
|
||||
entity: "session" | "toDo" | string;
|
||||
entity: "platform" | "session" | "toDo" | string;
|
||||
entityId: String<64>;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
|
|
@ -20,6 +21,7 @@ type UserEntityClaim$userRelationAggr = "userEntityClaim$userRelation$$aggr" | "
|
|||
export type Schema = OpSchema & {
|
||||
user: User.Schema;
|
||||
relation: Relation.Schema;
|
||||
platform?: Platform.Schema;
|
||||
session?: Session.Schema;
|
||||
toDo?: ToDo.Schema;
|
||||
userEntityClaim$userRelation?: Array<UserEntityClaim.Schema>;
|
||||
|
|
@ -37,8 +39,9 @@ type AttrFilter = {
|
|||
user: User.Filter;
|
||||
relationId: Q_StringValue;
|
||||
relation: Relation.Filter;
|
||||
entity: Q_EnumValue<"session" | "toDo" | string>;
|
||||
entity: Q_EnumValue<"platform" | "session" | "toDo" | string>;
|
||||
entityId: Q_StringValue;
|
||||
platform: Platform.Filter;
|
||||
session: Session.Filter;
|
||||
toDo: ToDo.Filter;
|
||||
userEntityClaim$userRelation: UserEntityClaim.Filter & SubQueryPredicateMetadata;
|
||||
|
|
@ -57,6 +60,7 @@ export type Projection = {
|
|||
relation?: Relation.Projection;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
platform?: Platform.Projection;
|
||||
session?: Session.Projection;
|
||||
toDo?: ToDo.Projection;
|
||||
userEntityClaim$userRelation?: UserEntityClaim.Selection & {
|
||||
|
|
@ -76,6 +80,9 @@ type UserIdProjection = OneOf<{
|
|||
type RelationIdProjection = OneOf<{
|
||||
relationId: number;
|
||||
}>;
|
||||
type PlatformIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type SessionIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
|
|
@ -102,6 +109,8 @@ export type SortAttr = {
|
|||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
platform: Platform.SortAttr;
|
||||
} | {
|
||||
session: Session.SortAttr;
|
||||
} | {
|
||||
|
|
@ -136,6 +145,18 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|||
relation?: never;
|
||||
relationId: ForeignKey<"relation">;
|
||||
})) & ({
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
platform: Platform.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "platform";
|
||||
entityId: ForeignKey<"Platform">;
|
||||
platform?: Platform.UpdateOperation;
|
||||
} | {
|
||||
entity: "platform";
|
||||
entityId: ForeignKey<"Platform">;
|
||||
platform?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
session: Session.CreateSingleOperation;
|
||||
|
|
@ -194,6 +215,10 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
relation?: never;
|
||||
relationId?: ForeignKey<"relation">;
|
||||
})) & ({
|
||||
platform?: Platform.CreateSingleOperation | Platform.UpdateOperation | Platform.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
session?: Session.CreateSingleOperation | Session.UpdateOperation | Session.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
|
|
@ -202,8 +227,9 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("session" | "toDo" | string) | null;
|
||||
entityId?: ForeignKey<"Session" | "ToDo"> | null;
|
||||
entity?: ("platform" | "session" | "toDo" | string) | null;
|
||||
entityId?: ForeignKey<"Platform" | "Session" | "ToDo"> | null;
|
||||
platform?: never;
|
||||
session?: never;
|
||||
toDo?: never;
|
||||
}) & {
|
||||
|
|
@ -216,6 +242,8 @@ export type RemoveOperationData = {} & (({
|
|||
}) & ({
|
||||
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
||||
})) & ({
|
||||
platform?: Platform.UpdateOperation | Platform.RemoveOperation;
|
||||
} | {
|
||||
session?: Session.UpdateOperation | Session.RemoveOperation;
|
||||
} | {
|
||||
toDo?: ToDo.UpdateOperation | ToDo.RemoveOperation;
|
||||
|
|
@ -226,6 +254,7 @@ export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter
|
|||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export type RelationIdSubQuery = Selection<RelationIdProjection>;
|
||||
export type PlatformIdSubQuery = Selection<PlatformIdProjection>;
|
||||
export type SessionIdSubQuery = Selection<SessionIdProjection>;
|
||||
export type ToDoIdSubQuery = Selection<ToDoIdProjection>;
|
||||
export type UserRelationIdSubQuery = Selection<UserRelationIdProjection>;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ exports.desc = {
|
|||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["session", "toDo"]
|
||||
ref: ["platform", "session", "toDo"]
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
|
|
|
|||
|
|
@ -373,6 +373,10 @@ export type PlatformIdSubQuery = {
|
|||
entity: "message";
|
||||
}) | (System.PlatformIdSubQuery & {
|
||||
entity: "system";
|
||||
}) | (Relation.PlatformIdSubQuery & {
|
||||
entity: "relation";
|
||||
}) | (UserRelation.PlatformIdSubQuery & {
|
||||
entity: "userRelation";
|
||||
}) | (Platform.PlatformIdSubQuery & {
|
||||
entity: "platform";
|
||||
}) | any;
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@ exports.applicationProjection = {
|
|||
config: 1,
|
||||
platformId: 1,
|
||||
style: 1,
|
||||
folder: 1,
|
||||
super: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
|
|
|
|||
|
|
@ -35,20 +35,20 @@ export async function syncSmsTemplate<ED extends EntityDict>(
|
|||
dontCollect: true,
|
||||
}
|
||||
);
|
||||
const existsTemplateIds = existTemplateList.map((ele) => ele.templateCode);
|
||||
const newTemplateList = templateFormalData.filter(
|
||||
(ele) => !existsTemplateIds.includes(ele.templateCode)
|
||||
);
|
||||
const newTemplateIds = newTemplateList.map((ele) => ele.templateCode);
|
||||
// const existsTemplateIds = existTemplateList.map((ele) => ele.templateCode);
|
||||
// const newTemplateList = templateFormalData.filter(
|
||||
// (ele) => !existsTemplateIds.includes(ele.templateCode)
|
||||
// );
|
||||
// const newTemplateIds = newTemplateList.map((ele) => ele.templateCode);
|
||||
// const removeTemplateList = existTemplateList.filter(
|
||||
// (ele) => !newTemplateIds.includes(ele.templateCode!)
|
||||
// );
|
||||
for (const template of templateFormalData) {
|
||||
const { templateName, templateCode, templateContent } = template;
|
||||
const existTemplateId = existsTemplateIds.find(
|
||||
(ele) => ele === template.templateCode
|
||||
const existTemplate = existTemplateList.find(
|
||||
(ele) => ele.templateCode === template.templateCode
|
||||
);
|
||||
if (existTemplateId) {
|
||||
if (existTemplate) {
|
||||
await context.operate(
|
||||
'smsTemplate',
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ export async function syncSmsTemplate<ED extends EntityDict>(
|
|||
syncAt: Date.now(),
|
||||
},
|
||||
filter: {
|
||||
id: existTemplateId,
|
||||
id: existTemplate.id!,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,8 +70,14 @@ export default function Render(
|
|||
disabled={syncDisable}
|
||||
onClick={async () => {
|
||||
setSyncDisable(true);
|
||||
await syncTemplate();
|
||||
setSyncDisable(false);
|
||||
try {
|
||||
await syncTemplate();
|
||||
setSyncDisable(false);
|
||||
}
|
||||
catch (err: any) {
|
||||
setSyncDisable(false);
|
||||
throw err;
|
||||
}
|
||||
}}
|
||||
>
|
||||
{'同步模板'}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,12 @@ export default function Render(
|
|||
name: string;
|
||||
description: string;
|
||||
oakId: string;
|
||||
folder: string;
|
||||
super: boolean;
|
||||
oakExecutable: boolean;
|
||||
}
|
||||
>
|
||||
) {
|
||||
const { oakId, folder, name, description, 'super': isSuper, oakFullpath, oakExecutable, oakExecuting } = props.data;
|
||||
const { oakId, name, description, 'super': isSuper, oakFullpath, oakExecutable, oakExecuting } = props.data;
|
||||
const { t, execute, clean } = props.methods;
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
|
|
@ -81,9 +80,6 @@ export default function Render(
|
|||
<Descriptions.Item label={t('system:attr.super')}>
|
||||
{isSuper ? '是' : '否'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t('system:attr.folder')}>
|
||||
{folder}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item>
|
||||
<Row justify="end">
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ export default OakComponent({
|
|||
config: 1,
|
||||
description: 1,
|
||||
super: 1,
|
||||
folder: 1,
|
||||
domain$system: {
|
||||
$entity: 'domain',
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ export default OakComponent({
|
|||
config: 1,
|
||||
description: 1,
|
||||
super: 1,
|
||||
folder: 1,
|
||||
},
|
||||
formData({ data }) {
|
||||
return data || {};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"tips": {
|
||||
"isSuper": "超级用户属性可能影响程序的运行逻辑,请谨慎修改"
|
||||
"isSuper": "超级系统属性可能影响程序的运行逻辑,请谨慎修改"
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,6 @@ export default function Render(
|
|||
{
|
||||
name: string;
|
||||
description: string;
|
||||
folder: string;
|
||||
super: boolean;
|
||||
}
|
||||
>
|
||||
|
|
@ -20,7 +19,6 @@ export default function Render(
|
|||
const {
|
||||
name,
|
||||
description,
|
||||
folder,
|
||||
super: super2,
|
||||
} = props.data;
|
||||
const { t, update } = props.methods;
|
||||
|
|
@ -47,9 +45,8 @@ export default function Render(
|
|||
</>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t('system:attr.desc')}
|
||||
label={t('system:attr.description')}
|
||||
required
|
||||
//name="description"
|
||||
>
|
||||
<>
|
||||
<Input.TextArea
|
||||
|
|
@ -63,7 +60,7 @@ export default function Render(
|
|||
</>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t('system:attr.isSuper')}
|
||||
label={t('system:attr.super')}
|
||||
required
|
||||
tooltip={t('tips.isSuper')}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { RuntimeContext } from './RuntimeContext';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RelationId } from '../oak-app-domain/RelationId';
|
||||
import { SerializedData } from './FrontendRuntimeContext';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
|
|
@ -32,10 +33,13 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
|
|||
protected amIReallyRoot?: boolean;
|
||||
protected rootMode?: boolean;
|
||||
private userId?: string;
|
||||
protected platformManager?: boolean;
|
||||
|
||||
protected applicationProjection = cloneDeep(applicationProjection);
|
||||
|
||||
async refineOpRecords(): Promise<void> {
|
||||
const isRoot = this.isRoot();
|
||||
const isPlatformManager = this.platformManager;
|
||||
for (const opRecord of this.opRecords) {
|
||||
if (opRecord.a === 's') {
|
||||
const { d } = opRecord as SelectOpResult<ED>;
|
||||
|
|
@ -59,37 +63,69 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
|
|||
});
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
['application', 'system', 'platform'].includes(entity)
|
||||
&& process.env.NODE_ENV !== 'development'
|
||||
) {
|
||||
// 删除掉config中的敏感返回信息
|
||||
// 目前删掉会影响前端上传,原因待核实
|
||||
/* const rowDict = d[entity as 'system'];
|
||||
for (const id in rowDict) {
|
||||
const { config } = rowDict[id] as EntityDict['system']['OpSchema'];
|
||||
if (config) {
|
||||
// application中可能的保密信息
|
||||
unset(config, 'appSecret');
|
||||
unset(config, 'server.token');
|
||||
unset(config, 'server.mode');
|
||||
unset(config, 'server.encodingAESKey');
|
||||
unset(config, 'wechat.appSecret');
|
||||
// server/platform中可能的保密信息
|
||||
if (config.Account) {
|
||||
for (const k in config.Account) {
|
||||
config.Account[k as keyof typeof config.Account]?.forEach(
|
||||
}
|
||||
else if (entity === 'application') {
|
||||
if (!(isRoot || isPlatformManager)) {
|
||||
const rowDict = d[entity as 'application'];
|
||||
for (const id in rowDict) {
|
||||
const { config } = rowDict[id] as EntityDict['application']['OpSchema'];
|
||||
if (config) {
|
||||
// application中可能的保密信息
|
||||
unset(config, 'appSecret');
|
||||
unset(config, 'server.token');
|
||||
unset(config, 'server.mode');
|
||||
unset(config, 'server.encodingAESKey');
|
||||
unset(config, 'wechat.appSecret');
|
||||
unset(config, 'wechatNative.appSecret');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (['system', 'platform'].includes(entity)) {
|
||||
if (!(isRoot || isPlatformManager)) {
|
||||
const rowDict = d[entity as 'system'];
|
||||
for (const id in rowDict) {
|
||||
const { config } = rowDict[id] as EntityDict['system']['OpSchema'];
|
||||
if (config) {
|
||||
// server/platform中可能的保密信息
|
||||
if (config.Account) {
|
||||
for (const k in config.Account) {
|
||||
if (config.Account[k as keyof typeof config.Account] instanceof Array) {
|
||||
config.Account[k as keyof typeof config.Account]?.forEach(
|
||||
(ele) => {
|
||||
unset(ele, 'securityKey');
|
||||
unset(ele, 'secretKey');
|
||||
unset(ele, 'webApiKey');
|
||||
unset(ele, 'accessKeySecret');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Sms) {
|
||||
for (const k in config.Sms) {
|
||||
if (config.Sms[k as 'ali'] instanceof Array) {
|
||||
config.Sms[k as 'ali']?.forEach(
|
||||
(ele) => {
|
||||
unset(ele, 'securityKey');
|
||||
unset(ele, 'secretKey');
|
||||
unset(ele, 'webApiKey');
|
||||
unset(ele, 'accessKeySecret');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Emails) {
|
||||
config.Emails?.forEach(
|
||||
(ele) => {
|
||||
unset(ele, 'securityKey');
|
||||
unset(ele, 'secretKey');
|
||||
unset(ele, 'webApiKey');
|
||||
unset(ele, 'accessKeySecret');
|
||||
unset(ele, 'password');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
else if (entity === 'user') {
|
||||
for (const id in d[entity]) {
|
||||
|
|
@ -105,6 +141,73 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
|
|||
}
|
||||
}
|
||||
|
||||
async setPlatformManager(tokenValue?: string, userId?: string) {
|
||||
if (tokenValue) {
|
||||
// 前台传递
|
||||
const result = await this.select(
|
||||
'platform',
|
||||
{
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
userRelation$entity: {
|
||||
user: {
|
||||
token$user: {
|
||||
$or: [
|
||||
{
|
||||
value: tokenValue,
|
||||
},
|
||||
{
|
||||
oldValue: tokenValue,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
relationId: {
|
||||
$in: [RelationId.Platform.Owner, RelationId.Platform.Manager]
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
dontCollect: true,
|
||||
blockTrigger: true,
|
||||
}
|
||||
);
|
||||
if (result.length > 0) {
|
||||
this.platformManager = true;
|
||||
}
|
||||
else {
|
||||
this.platformManager = false;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (userId) {
|
||||
// 若是后台环境,用userId来查询处理
|
||||
const result = await this.select('platform', {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
userRelation$entity: {
|
||||
userId,
|
||||
relationId: {
|
||||
$in: [RelationId.Platform.Owner, RelationId.Platform.Manager]
|
||||
}
|
||||
},
|
||||
},
|
||||
}, { dontCollect: true });
|
||||
if (result.length > 0) {
|
||||
this.platformManager = true;
|
||||
}
|
||||
else {
|
||||
this.platformManager = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async setTokenValue(tokenValue?: string, userId?: string) {
|
||||
if (tokenValue) {
|
||||
// 前台传递
|
||||
|
|
@ -215,6 +318,7 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
|
|||
}
|
||||
if (tokenValue || userId) {
|
||||
promises.push(this.setTokenValue(tokenValue, userId));
|
||||
promises.push(this.setPlatformManager(tokenValue, userId));
|
||||
}
|
||||
if (promises.length > 0) {
|
||||
await Promise.all(promises);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { String, Int, Datetime, Image, Boolean, Text } from 'oak-domain/lib/types/DataType';
|
||||
import { String, Text } from 'oak-domain/lib/types/DataType';
|
||||
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||
import { Config } from '../types/Config';
|
||||
import { Style } from '../types/Style';
|
||||
|
|
@ -13,7 +13,9 @@ export interface Schema extends EntityShape {
|
|||
entityId?: String<64>;
|
||||
};
|
||||
|
||||
export const entityDesc: EntityDesc<Schema> = {
|
||||
export type Relation = 'owner' | 'manager';
|
||||
|
||||
export const entityDesc: EntityDesc<Schema, '', Relation> = {
|
||||
locales: {
|
||||
zh_CN: {
|
||||
name: '平台',
|
||||
|
|
@ -25,6 +27,10 @@ export const entityDesc: EntityDesc<Schema> = {
|
|||
entity: '关联对象',
|
||||
entityId: '关联对象id',
|
||||
},
|
||||
r: {
|
||||
owner: '拥有者',
|
||||
manager: '管理员',
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -156,7 +156,6 @@ export const applicationProjection: EntityDict['application']['Selection']['data
|
|||
config: 1,
|
||||
platformId: 1,
|
||||
style: 1,
|
||||
folder: 1,
|
||||
super: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue