exception去除了对domain的引用,user和userEntityGrant改为继承写法

This commit is contained in:
Xu Chang 2024-04-11 20:14:28 +08:00
parent 2d2a517449
commit cd8e553ee1
22 changed files with 155 additions and 203 deletions

View File

@ -1,7 +1,7 @@
import { Style } from '../../../../types/Style'; 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, { declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../../oak-app-domain").EntityDict, keyof import("../../../../oak-app-domain").EntityDict, false, {
style: Style; style: Style;
entity: "application" | "platform" | "system"; entity: "application" | "system" | "platform";
entityId: string; entityId: string;
name: string; name: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>; }>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;

View File

@ -1,7 +1,7 @@
import { Config } from '../../../types/Config'; 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, { declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, {
config: Config; config: Config;
entity: "platform" | "system"; entity: "system" | "platform";
name: string; name: string;
entityId: string; entityId: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>; }>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;

View File

@ -12,7 +12,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
type?: ButtonProps['type'] | AmButtonProps['type']; type?: ButtonProps['type'] | AmButtonProps['type'];
executeText?: string | undefined; executeText?: string | undefined;
buttonProps?: (ButtonProps & { buttonProps?: (ButtonProps & {
color?: "success" | "default" | "primary" | "warning" | "danger" | undefined; color?: "default" | "success" | "primary" | "warning" | "danger" | undefined;
fill?: "none" | "solid" | "outline" | undefined; fill?: "none" | "solid" | "outline" | undefined;
size?: "small" | "large" | "middle" | "mini" | undefined; size?: "small" | "large" | "middle" | "mini" | undefined;
block?: boolean | undefined; block?: boolean | undefined;

View File

@ -2,20 +2,16 @@ import { String, Text, Boolean, Datetime } from 'oak-domain/lib/types/DataType';
import { ActionDef } from 'oak-domain/lib/types/Action'; import { ActionDef } from 'oak-domain/lib/types/Action';
import { Schema as ExtraFile } from './ExtraFile'; import { Schema as ExtraFile } from './ExtraFile';
import { Schema as WechatQrCode } from './WechatQrCode'; import { Schema as WechatQrCode } from './WechatQrCode';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc'; import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
import { Schema as Address } from './Address'; import { Schema as Address } from './Address';
import { Schema as Account } from './Account'; import { Schema as Account } from './Account';
export interface Schema extends EntityShape { import { Schema as User } from 'oak-domain/lib/entities/User';
name?: String<16>; export interface Schema extends User {
nickname?: String<64>;
password?: Text;
passwordSha1?: Text; passwordSha1?: Text;
birth?: Datetime; birth?: Datetime;
gender?: 'male' | 'female'; gender?: 'male' | 'female';
idCardType?: 'ID-Card' | 'passport' | 'Mainland-passport'; idCardType?: 'ID-Card' | 'passport' | 'Mainland-passport';
idNumber?: String<32>; idNumber?: String<32>;
ref?: Schema;
files: Array<ExtraFile>; files: Array<ExtraFile>;
codes: Array<WechatQrCode>; codes: Array<WechatQrCode>;
isRoot?: Boolean; isRoot?: Boolean;

View File

@ -1,10 +1,9 @@
import { String, Text, Datetime, Boolean } from 'oak-domain/lib/types/DataType'; import { String, Text, Datetime, Boolean } from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { Schema as User } from './User'; import { Schema as User } from './User';
import { Schema as WechatQrCode } from './WechatQrCode'; import { Schema as WechatQrCode } from './WechatQrCode';
import { QrCodeType } from '../types/Config'; import { QrCodeType } from '../types/Config';
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc'; import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
type RelationIds = string[]; import { Schema as UserEntityGrant } from 'oak-domain/lib/entities/UserEntityGrant';
export type RedirectToProps = { export type RedirectToProps = {
pathname: string; pathname: string;
props?: Record<string, any>; props?: Record<string, any>;
@ -12,12 +11,9 @@ export type RedirectToProps = {
isTabBar?: boolean; isTabBar?: boolean;
}; };
type Rule = 'single' | 'all' | 'free'; type Rule = 'single' | 'all' | 'free';
export interface Schema extends EntityShape { export interface Schema extends UserEntityGrant {
entity: String<32>; entity: String<32>;
entityId: String<64>; entityId: String<64>;
relationEntity: String<32>;
relationEntityFilter: Object;
relationIds: RelationIds;
type: 'grant' | 'transfer'; type: 'grant' | 'transfer';
rule: Rule; rule: Rule;
ruleOnRow: Rule; ruleOnRow: Rule;

View File

@ -31,12 +31,12 @@ export type OpSchema = EntityShape & {
name?: String<16> | null; name?: String<16> | null;
nickname?: String<64> | null; nickname?: String<64> | null;
password?: Text | null; password?: Text | null;
refId?: ForeignKey<"user"> | null;
passwordSha1?: Text | null; passwordSha1?: Text | null;
birth?: Datetime | null; birth?: Datetime | null;
gender?: ("male" | "female") | null; gender?: ("male" | "female") | null;
idCardType?: ("ID-Card" | "passport" | "Mainland-passport") | null; idCardType?: ("ID-Card" | "passport" | "Mainland-passport") | null;
idNumber?: String<32> | null; idNumber?: String<32> | null;
refId?: ForeignKey<"user"> | null;
isRoot?: Boolean | null; isRoot?: Boolean | null;
idState?: IdState | null; idState?: IdState | null;
userState?: UserState | null; userState?: UserState | null;
@ -46,12 +46,12 @@ export type Schema = EntityShape & {
name?: String<16> | null; name?: String<16> | null;
nickname?: String<64> | null; nickname?: String<64> | null;
password?: Text | null; password?: Text | null;
refId?: ForeignKey<"user"> | null;
passwordSha1?: Text | null; passwordSha1?: Text | null;
birth?: Datetime | null; birth?: Datetime | null;
gender?: ("male" | "female") | null; gender?: ("male" | "female") | null;
idCardType?: ("ID-Card" | "passport" | "Mainland-passport") | null; idCardType?: ("ID-Card" | "passport" | "Mainland-passport") | null;
idNumber?: String<32> | null; idNumber?: String<32> | null;
refId?: ForeignKey<"user"> | null;
isRoot?: Boolean | null; isRoot?: Boolean | null;
idState?: IdState | null; idState?: IdState | null;
userState?: UserState | null; userState?: UserState | null;
@ -115,13 +115,13 @@ type AttrFilter = {
name: Q_StringValue; name: Q_StringValue;
nickname: Q_StringValue; nickname: Q_StringValue;
password: Q_StringValue; password: Q_StringValue;
refId: Q_StringValue;
ref: Filter;
passwordSha1: Q_StringValue; passwordSha1: Q_StringValue;
birth: Q_DateValue; birth: Q_DateValue;
gender: Q_EnumValue<"male" | "female">; gender: Q_EnumValue<"male" | "female">;
idCardType: Q_EnumValue<"ID-Card" | "passport" | "Mainland-passport">; idCardType: Q_EnumValue<"ID-Card" | "passport" | "Mainland-passport">;
idNumber: Q_StringValue; idNumber: Q_StringValue;
refId: Q_StringValue;
ref: Filter;
isRoot: Q_BooleanValue; isRoot: Q_BooleanValue;
idState: Q_EnumValue<IdState>; idState: Q_EnumValue<IdState>;
userState: Q_EnumValue<UserState>; userState: Q_EnumValue<UserState>;
@ -161,13 +161,13 @@ export type Projection = {
name?: number; name?: number;
nickname?: number; nickname?: number;
password?: number; password?: number;
refId?: number;
ref?: Projection;
passwordSha1?: number; passwordSha1?: number;
birth?: number; birth?: number;
gender?: number; gender?: number;
idCardType?: number; idCardType?: number;
idNumber?: number; idNumber?: number;
refId?: number;
ref?: Projection;
isRoot?: number; isRoot?: number;
idState?: number; idState?: number;
userState?: number; userState?: number;
@ -334,6 +334,10 @@ export type SortAttr = {
nickname: number; nickname: number;
} | { } | {
password: number; password: number;
} | {
refId: number;
} | {
ref: SortAttr;
} | { } | {
passwordSha1: number; passwordSha1: number;
} | { } | {
@ -344,10 +348,6 @@ export type SortAttr = {
idCardType: number; idCardType: number;
} | { } | {
idNumber: number; idNumber: number;
} | {
refId: number;
} | {
ref: SortAttr;
} | { } | {
isRoot: number; isRoot: number;
} | { } | {

View File

@ -16,6 +16,10 @@ export const desc = {
password: { password: {
type: "text" type: "text"
}, },
refId: {
type: "ref",
ref: "user"
},
passwordSha1: { passwordSha1: {
type: "text" type: "text"
}, },
@ -36,10 +40,6 @@ export const desc = {
length: 32 length: 32
} }
}, },
refId: {
type: "ref",
ref: "user"
},
isRoot: { isRoot: {
type: "boolean" type: "boolean"
}, },

View File

@ -10,7 +10,6 @@ import * as UserEntityClaim from "../UserEntityClaim/Schema";
import * as ModiEntity from "../ModiEntity/Schema"; import * as ModiEntity from "../ModiEntity/Schema";
import * as OperEntity from "../OperEntity/Schema"; import * as OperEntity from "../OperEntity/Schema";
import * as WechatQrCode from "../WechatQrCode/Schema"; import * as WechatQrCode from "../WechatQrCode/Schema";
type RelationIds = string[];
export type RedirectToProps = { export type RedirectToProps = {
pathname: string; pathname: string;
props?: Record<string, any>; props?: Record<string, any>;
@ -18,12 +17,13 @@ export type RedirectToProps = {
isTabBar?: boolean; isTabBar?: boolean;
}; };
type Rule = "single" | "all" | "free"; type Rule = "single" | "all" | "free";
type RelationIds = string[];
export type OpSchema = EntityShape & { export type OpSchema = EntityShape & {
entity: String<32>;
entityId: String<64>;
relationEntity: String<32>; relationEntity: String<32>;
relationEntityFilter: Object; relationEntityFilter: Object;
relationIds: RelationIds; relationIds: RelationIds;
entity: String<32>;
entityId: String<64>;
type: "grant" | "transfer"; type: "grant" | "transfer";
rule: Rule; rule: Rule;
ruleOnRow: Rule; ruleOnRow: Rule;
@ -38,11 +38,11 @@ export type OpSchema = EntityShape & {
}; };
export type OpAttr = keyof OpSchema; export type OpAttr = keyof OpSchema;
export type Schema = EntityShape & { export type Schema = EntityShape & {
entity: String<32>;
entityId: String<64>;
relationEntity: String<32>; relationEntity: String<32>;
relationEntityFilter: Object; relationEntityFilter: Object;
relationIds: RelationIds; relationIds: RelationIds;
entity: String<32>;
entityId: String<64>;
type: "grant" | "transfer"; type: "grant" | "transfer";
rule: Rule; rule: Rule;
ruleOnRow: Rule; ruleOnRow: Rule;
@ -71,11 +71,11 @@ type AttrFilter = {
$$createAt$$: Q_DateValue; $$createAt$$: Q_DateValue;
$$seq$$: Q_NumberValue; $$seq$$: Q_NumberValue;
$$updateAt$$: Q_DateValue; $$updateAt$$: Q_DateValue;
entity: Q_StringValue;
entityId: Q_StringValue;
relationEntity: Q_StringValue; relationEntity: Q_StringValue;
relationEntityFilter: Object; relationEntityFilter: Object;
relationIds: JsonFilter<RelationIds>; relationIds: JsonFilter<RelationIds>;
entity: Q_StringValue;
entityId: Q_StringValue;
type: Q_EnumValue<"grant" | "transfer">; type: Q_EnumValue<"grant" | "transfer">;
rule: Q_EnumValue<Rule>; rule: Q_EnumValue<Rule>;
ruleOnRow: Q_EnumValue<Rule>; ruleOnRow: Q_EnumValue<Rule>;
@ -101,11 +101,11 @@ export type Projection = {
$$createAt$$?: number; $$createAt$$?: number;
$$updateAt$$?: number; $$updateAt$$?: number;
$$seq$$?: number; $$seq$$?: number;
entity?: number;
entityId?: number;
relationEntity?: number; relationEntity?: number;
relationEntityFilter?: number | Object; relationEntityFilter?: number | Object;
relationIds?: number | JsonProjection<RelationIds>; relationIds?: number | JsonProjection<RelationIds>;
entity?: number;
entityId?: number;
type?: number; type?: number;
rule?: number; rule?: number;
ruleOnRow?: number; ruleOnRow?: number;
@ -157,14 +157,14 @@ export type SortAttr = {
$$seq$$: number; $$seq$$: number;
} | { } | {
$$updateAt$$: number; $$updateAt$$: number;
} | {
entity: number;
} | {
entityId: number;
} | { } | {
relationEntity: number; relationEntity: number;
} | { } | {
relationIds: number; relationIds: number;
} | {
entity: number;
} | {
entityId: number;
} | { } | {
type: number; type: number;
} | { } | {

View File

@ -1,20 +1,6 @@
import { actions } from "./Action"; import { actions } from "./Action";
export const desc = { export const desc = {
attributes: { attributes: {
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
relationEntity: { relationEntity: {
notNull: true, notNull: true,
type: "varchar", type: "varchar",
@ -30,6 +16,20 @@ export const desc = {
notNull: true, notNull: true,
type: "object" type: "object"
}, },
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
type: { type: {
notNull: true, notNull: true,
type: "enum", type: "enum",

View File

@ -1,2 +1,2 @@
declare const _default: (import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "account", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMpJump", import("..").BRC<import("../oak-app-domain").EntityDict>>)[]; declare const _default: (import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "account", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMpJump", import("..").BRC<import("../oak-app-domain").EntityDict>>)[];
export default _default; export default _default;

View File

@ -1,4 +1,4 @@
import { OakUserException, makeException as makeException2, OakException } from "oak-domain/lib/types"; import { OakUserException, OakException } from "oak-domain/lib/types";
export class OakNotEnoughMoneyException extends OakUserException { export class OakNotEnoughMoneyException extends OakUserException {
constructor(message) { constructor(message) {
super(message || '您的余额不足'); super(message || '您的余额不足');
@ -107,49 +107,41 @@ export class OakUploadException extends OakUserException {
} }
; ;
export function makeException(data) { export function makeException(data) {
const exception = makeException2(data);
if (exception) {
return exception;
}
const { name, message, opRecords } = data; const { name, message, opRecords } = data;
let e;
switch (name) { switch (name) {
case 'OakNotEnoughMoneyException': { case 'OakNotEnoughMoneyException': {
const e = new OakNotEnoughMoneyException(message); e = new OakNotEnoughMoneyException(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakDistinguishUserException': { case 'OakDistinguishUserException': {
const e = new OakDistinguishUserException(data.userId, data.usingPassword, data.usingIdCard, data.usingWechatUser, data.usingEmail, message); e = new OakDistinguishUserException(data.userId, data.usingPassword, data.usingIdCard, data.usingWechatUser, data.usingEmail, message);
e.setOpRecords(opRecords);
return e;
} }
case 'OakUserDisabledException': { case 'OakUserDisabledException': {
const e = new OakUserDisabledException(message); e = new OakUserDisabledException(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakTokenExpiredException': { case 'OakTokenExpiredException': {
const e = new OakTokenExpiredException(message); e = new OakTokenExpiredException(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakMobileUnsetException': { case 'OakMobileUnsetException': {
const e = new OakMobileUnsetException(message); e = new OakMobileUnsetException(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakUserInfoUncompletedException': { case 'OakUserInfoUncompletedException': {
const e = new OakUserInfoUncompletedException(message); e = new OakUserInfoUncompletedException(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakUploadException': { case 'OakUploadException': {
const e = new OakUploadException(message); e = new OakUploadException(message);
break;
}
default: {
}
}
if (e) {
e.setOpRecords(opRecords); e.setOpRecords(opRecords);
return e; return e;
} }
default: {
return;
}
}
} }

View File

@ -2,20 +2,16 @@ import { String, Text, Boolean, Datetime } from 'oak-domain/lib/types/DataType';
import { ActionDef } from 'oak-domain/lib/types/Action'; import { ActionDef } from 'oak-domain/lib/types/Action';
import { Schema as ExtraFile } from './ExtraFile'; import { Schema as ExtraFile } from './ExtraFile';
import { Schema as WechatQrCode } from './WechatQrCode'; import { Schema as WechatQrCode } from './WechatQrCode';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc'; import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
import { Schema as Address } from './Address'; import { Schema as Address } from './Address';
import { Schema as Account } from './Account'; import { Schema as Account } from './Account';
export interface Schema extends EntityShape { import { Schema as User } from 'oak-domain/lib/entities/User';
name?: String<16>; export interface Schema extends User {
nickname?: String<64>;
password?: Text;
passwordSha1?: Text; passwordSha1?: Text;
birth?: Datetime; birth?: Datetime;
gender?: 'male' | 'female'; gender?: 'male' | 'female';
idCardType?: 'ID-Card' | 'passport' | 'Mainland-passport'; idCardType?: 'ID-Card' | 'passport' | 'Mainland-passport';
idNumber?: String<32>; idNumber?: String<32>;
ref?: Schema;
files: Array<ExtraFile>; files: Array<ExtraFile>;
codes: Array<WechatQrCode>; codes: Array<WechatQrCode>;
isRoot?: Boolean; isRoot?: Boolean;

View File

@ -1,10 +1,9 @@
import { String, Text, Datetime, Boolean } from 'oak-domain/lib/types/DataType'; import { String, Text, Datetime, Boolean } from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { Schema as User } from './User'; import { Schema as User } from './User';
import { Schema as WechatQrCode } from './WechatQrCode'; import { Schema as WechatQrCode } from './WechatQrCode';
import { QrCodeType } from '../types/Config'; import { QrCodeType } from '../types/Config';
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc'; import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
type RelationIds = string[]; import { Schema as UserEntityGrant } from 'oak-domain/lib/entities/UserEntityGrant';
export type RedirectToProps = { export type RedirectToProps = {
pathname: string; pathname: string;
props?: Record<string, any>; props?: Record<string, any>;
@ -12,12 +11,9 @@ export type RedirectToProps = {
isTabBar?: boolean; isTabBar?: boolean;
}; };
type Rule = 'single' | 'all' | 'free'; type Rule = 'single' | 'all' | 'free';
export interface Schema extends EntityShape { export interface Schema extends UserEntityGrant {
entity: String<32>; entity: String<32>;
entityId: String<64>; entityId: String<64>;
relationEntity: String<32>;
relationEntityFilter: Object;
relationIds: RelationIds;
type: 'grant' | 'transfer'; type: 'grant' | 'transfer';
rule: Rule; rule: Rule;
ruleOnRow: Rule; ruleOnRow: Rule;

View File

@ -31,12 +31,12 @@ export type OpSchema = EntityShape & {
name?: String<16> | null; name?: String<16> | null;
nickname?: String<64> | null; nickname?: String<64> | null;
password?: Text | null; password?: Text | null;
refId?: ForeignKey<"user"> | null;
passwordSha1?: Text | null; passwordSha1?: Text | null;
birth?: Datetime | null; birth?: Datetime | null;
gender?: ("male" | "female") | null; gender?: ("male" | "female") | null;
idCardType?: ("ID-Card" | "passport" | "Mainland-passport") | null; idCardType?: ("ID-Card" | "passport" | "Mainland-passport") | null;
idNumber?: String<32> | null; idNumber?: String<32> | null;
refId?: ForeignKey<"user"> | null;
isRoot?: Boolean | null; isRoot?: Boolean | null;
idState?: IdState | null; idState?: IdState | null;
userState?: UserState | null; userState?: UserState | null;
@ -46,12 +46,12 @@ export type Schema = EntityShape & {
name?: String<16> | null; name?: String<16> | null;
nickname?: String<64> | null; nickname?: String<64> | null;
password?: Text | null; password?: Text | null;
refId?: ForeignKey<"user"> | null;
passwordSha1?: Text | null; passwordSha1?: Text | null;
birth?: Datetime | null; birth?: Datetime | null;
gender?: ("male" | "female") | null; gender?: ("male" | "female") | null;
idCardType?: ("ID-Card" | "passport" | "Mainland-passport") | null; idCardType?: ("ID-Card" | "passport" | "Mainland-passport") | null;
idNumber?: String<32> | null; idNumber?: String<32> | null;
refId?: ForeignKey<"user"> | null;
isRoot?: Boolean | null; isRoot?: Boolean | null;
idState?: IdState | null; idState?: IdState | null;
userState?: UserState | null; userState?: UserState | null;
@ -115,13 +115,13 @@ type AttrFilter = {
name: Q_StringValue; name: Q_StringValue;
nickname: Q_StringValue; nickname: Q_StringValue;
password: Q_StringValue; password: Q_StringValue;
refId: Q_StringValue;
ref: Filter;
passwordSha1: Q_StringValue; passwordSha1: Q_StringValue;
birth: Q_DateValue; birth: Q_DateValue;
gender: Q_EnumValue<"male" | "female">; gender: Q_EnumValue<"male" | "female">;
idCardType: Q_EnumValue<"ID-Card" | "passport" | "Mainland-passport">; idCardType: Q_EnumValue<"ID-Card" | "passport" | "Mainland-passport">;
idNumber: Q_StringValue; idNumber: Q_StringValue;
refId: Q_StringValue;
ref: Filter;
isRoot: Q_BooleanValue; isRoot: Q_BooleanValue;
idState: Q_EnumValue<IdState>; idState: Q_EnumValue<IdState>;
userState: Q_EnumValue<UserState>; userState: Q_EnumValue<UserState>;
@ -161,13 +161,13 @@ export type Projection = {
name?: number; name?: number;
nickname?: number; nickname?: number;
password?: number; password?: number;
refId?: number;
ref?: Projection;
passwordSha1?: number; passwordSha1?: number;
birth?: number; birth?: number;
gender?: number; gender?: number;
idCardType?: number; idCardType?: number;
idNumber?: number; idNumber?: number;
refId?: number;
ref?: Projection;
isRoot?: number; isRoot?: number;
idState?: number; idState?: number;
userState?: number; userState?: number;
@ -334,6 +334,10 @@ export type SortAttr = {
nickname: number; nickname: number;
} | { } | {
password: number; password: number;
} | {
refId: number;
} | {
ref: SortAttr;
} | { } | {
passwordSha1: number; passwordSha1: number;
} | { } | {
@ -344,10 +348,6 @@ export type SortAttr = {
idCardType: number; idCardType: number;
} | { } | {
idNumber: number; idNumber: number;
} | {
refId: number;
} | {
ref: SortAttr;
} | { } | {
isRoot: number; isRoot: number;
} | { } | {

View File

@ -19,6 +19,10 @@ exports.desc = {
password: { password: {
type: "text" type: "text"
}, },
refId: {
type: "ref",
ref: "user"
},
passwordSha1: { passwordSha1: {
type: "text" type: "text"
}, },
@ -39,10 +43,6 @@ exports.desc = {
length: 32 length: 32
} }
}, },
refId: {
type: "ref",
ref: "user"
},
isRoot: { isRoot: {
type: "boolean" type: "boolean"
}, },

View File

@ -10,7 +10,6 @@ import * as UserEntityClaim from "../UserEntityClaim/Schema";
import * as ModiEntity from "../ModiEntity/Schema"; import * as ModiEntity from "../ModiEntity/Schema";
import * as OperEntity from "../OperEntity/Schema"; import * as OperEntity from "../OperEntity/Schema";
import * as WechatQrCode from "../WechatQrCode/Schema"; import * as WechatQrCode from "../WechatQrCode/Schema";
type RelationIds = string[];
export type RedirectToProps = { export type RedirectToProps = {
pathname: string; pathname: string;
props?: Record<string, any>; props?: Record<string, any>;
@ -18,12 +17,13 @@ export type RedirectToProps = {
isTabBar?: boolean; isTabBar?: boolean;
}; };
type Rule = "single" | "all" | "free"; type Rule = "single" | "all" | "free";
type RelationIds = string[];
export type OpSchema = EntityShape & { export type OpSchema = EntityShape & {
entity: String<32>;
entityId: String<64>;
relationEntity: String<32>; relationEntity: String<32>;
relationEntityFilter: Object; relationEntityFilter: Object;
relationIds: RelationIds; relationIds: RelationIds;
entity: String<32>;
entityId: String<64>;
type: "grant" | "transfer"; type: "grant" | "transfer";
rule: Rule; rule: Rule;
ruleOnRow: Rule; ruleOnRow: Rule;
@ -38,11 +38,11 @@ export type OpSchema = EntityShape & {
}; };
export type OpAttr = keyof OpSchema; export type OpAttr = keyof OpSchema;
export type Schema = EntityShape & { export type Schema = EntityShape & {
entity: String<32>;
entityId: String<64>;
relationEntity: String<32>; relationEntity: String<32>;
relationEntityFilter: Object; relationEntityFilter: Object;
relationIds: RelationIds; relationIds: RelationIds;
entity: String<32>;
entityId: String<64>;
type: "grant" | "transfer"; type: "grant" | "transfer";
rule: Rule; rule: Rule;
ruleOnRow: Rule; ruleOnRow: Rule;
@ -71,11 +71,11 @@ type AttrFilter = {
$$createAt$$: Q_DateValue; $$createAt$$: Q_DateValue;
$$seq$$: Q_NumberValue; $$seq$$: Q_NumberValue;
$$updateAt$$: Q_DateValue; $$updateAt$$: Q_DateValue;
entity: Q_StringValue;
entityId: Q_StringValue;
relationEntity: Q_StringValue; relationEntity: Q_StringValue;
relationEntityFilter: Object; relationEntityFilter: Object;
relationIds: JsonFilter<RelationIds>; relationIds: JsonFilter<RelationIds>;
entity: Q_StringValue;
entityId: Q_StringValue;
type: Q_EnumValue<"grant" | "transfer">; type: Q_EnumValue<"grant" | "transfer">;
rule: Q_EnumValue<Rule>; rule: Q_EnumValue<Rule>;
ruleOnRow: Q_EnumValue<Rule>; ruleOnRow: Q_EnumValue<Rule>;
@ -101,11 +101,11 @@ export type Projection = {
$$createAt$$?: number; $$createAt$$?: number;
$$updateAt$$?: number; $$updateAt$$?: number;
$$seq$$?: number; $$seq$$?: number;
entity?: number;
entityId?: number;
relationEntity?: number; relationEntity?: number;
relationEntityFilter?: number | Object; relationEntityFilter?: number | Object;
relationIds?: number | JsonProjection<RelationIds>; relationIds?: number | JsonProjection<RelationIds>;
entity?: number;
entityId?: number;
type?: number; type?: number;
rule?: number; rule?: number;
ruleOnRow?: number; ruleOnRow?: number;
@ -157,14 +157,14 @@ export type SortAttr = {
$$seq$$: number; $$seq$$: number;
} | { } | {
$$updateAt$$: number; $$updateAt$$: number;
} | {
entity: number;
} | {
entityId: number;
} | { } | {
relationEntity: number; relationEntity: number;
} | { } | {
relationIds: number; relationIds: number;
} | {
entity: number;
} | {
entityId: number;
} | { } | {
type: number; type: number;
} | { } | {

View File

@ -4,20 +4,6 @@ exports.desc = void 0;
const Action_1 = require("./Action"); const Action_1 = require("./Action");
exports.desc = { exports.desc = {
attributes: { attributes: {
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
relationEntity: { relationEntity: {
notNull: true, notNull: true,
type: "varchar", type: "varchar",
@ -33,6 +19,20 @@ exports.desc = {
notNull: true, notNull: true,
type: "object" type: "object"
}, },
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
},
type: { type: {
notNull: true, notNull: true,
type: "enum", type: "enum",

View File

@ -1,2 +1,2 @@
declare const _default: (import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "account", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMpJump", import("..").BRC<import("../oak-app-domain").EntityDict>>)[]; declare const _default: (import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "account", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMpJump", import("..").BRC<import("../oak-app-domain").EntityDict>>)[];
export default _default; export default _default;

View File

@ -121,50 +121,42 @@ class OakUploadException extends types_1.OakUserException {
exports.OakUploadException = OakUploadException; exports.OakUploadException = OakUploadException;
; ;
function makeException(data) { function makeException(data) {
const exception = (0, types_1.makeException)(data);
if (exception) {
return exception;
}
const { name, message, opRecords } = data; const { name, message, opRecords } = data;
let e;
switch (name) { switch (name) {
case 'OakNotEnoughMoneyException': { case 'OakNotEnoughMoneyException': {
const e = new OakNotEnoughMoneyException(message); e = new OakNotEnoughMoneyException(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakDistinguishUserException': { case 'OakDistinguishUserException': {
const e = new OakDistinguishUserException(data.userId, data.usingPassword, data.usingIdCard, data.usingWechatUser, data.usingEmail, message); e = new OakDistinguishUserException(data.userId, data.usingPassword, data.usingIdCard, data.usingWechatUser, data.usingEmail, message);
e.setOpRecords(opRecords);
return e;
} }
case 'OakUserDisabledException': { case 'OakUserDisabledException': {
const e = new OakUserDisabledException(message); e = new OakUserDisabledException(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakTokenExpiredException': { case 'OakTokenExpiredException': {
const e = new OakTokenExpiredException(message); e = new OakTokenExpiredException(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakMobileUnsetException': { case 'OakMobileUnsetException': {
const e = new OakMobileUnsetException(message); e = new OakMobileUnsetException(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakUserInfoUncompletedException': { case 'OakUserInfoUncompletedException': {
const e = new OakUserInfoUncompletedException(message); e = new OakUserInfoUncompletedException(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakUploadException': { case 'OakUploadException': {
const e = new OakUploadException(message); e = new OakUploadException(message);
e.setOpRecords(opRecords); break;
return e;
} }
default: { default: {
return;
} }
} }
if (e) {
e.setOpRecords(opRecords);
return e;
}
} }
exports.makeException = makeException; exports.makeException = makeException;

View File

@ -6,17 +6,14 @@ import { EntityShape } from 'oak-domain/lib/types/Entity';
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc'; import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
import { Schema as Address } from './Address'; import { Schema as Address } from './Address';
import { Schema as Account } from './Account'; import { Schema as Account } from './Account';
import { Schema as User } from 'oak-domain/lib/entities/User';
export interface Schema extends EntityShape { export interface Schema extends User {
name?: String<16>;
nickname?: String<64>;
password?: Text;
passwordSha1?: Text; passwordSha1?: Text;
birth?: Datetime; birth?: Datetime;
gender?: 'male' | 'female'; gender?: 'male' | 'female';
idCardType?: 'ID-Card' | 'passport' | 'Mainland-passport'; idCardType?: 'ID-Card' | 'passport' | 'Mainland-passport';
idNumber?: String<32>; idNumber?: String<32>;
ref?: Schema;
files: Array<ExtraFile>; files: Array<ExtraFile>;
codes: Array<WechatQrCode>; codes: Array<WechatQrCode>;
isRoot?: Boolean; isRoot?: Boolean;

View File

@ -4,8 +4,7 @@ import { Schema as User } from './User';
import { Schema as WechatQrCode } from './WechatQrCode'; import { Schema as WechatQrCode } from './WechatQrCode';
import { QrCodeType } from '../types/Config'; import { QrCodeType } from '../types/Config';
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc'; import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
import { Schema as UserEntityGrant } from 'oak-domain/lib/entities/UserEntityGrant';
type RelationIds = string[];
export type RedirectToProps = { export type RedirectToProps = {
pathname: string; pathname: string;
@ -15,12 +14,9 @@ export type RedirectToProps = {
}; };
type Rule = 'single' | 'all' | 'free'; type Rule = 'single' | 'all' | 'free';
export interface Schema extends EntityShape { export interface Schema extends UserEntityGrant {
entity: String<32>; entity: String<32>;
entityId: String<64>; entityId: String<64>;
relationEntity: String<32>;
relationEntityFilter: Object;
relationIds: RelationIds;
type: 'grant' | 'transfer'; type: 'grant' | 'transfer';
rule: Rule; // 对多个relation是单选/全选/自由选择 rule: Rule; // 对多个relation是单选/全选/自由选择
ruleOnRow: Rule; // 对多个(entity)row是单选/全选/自由选择 ruleOnRow: Rule; // 对多个(entity)row是单选/全选/自由选择

View File

@ -1,4 +1,4 @@
import { OakUserException, makeException as makeException2, OakException } from "oak-domain/lib/types"; import { OakUserException, OakException } from "oak-domain/lib/types";
import { EntityDict } from '../oak-app-domain'; import { EntityDict } from '../oak-app-domain';
import { EntityDict as BaseEntityDict, SelectOpResult } from 'oak-domain/lib/types/Entity'; import { EntityDict as BaseEntityDict, SelectOpResult } from 'oak-domain/lib/types/Entity';
@ -125,50 +125,41 @@ export function makeException<ED extends EntityDict & BaseEntityDict>(data: {
opRecords: SelectOpResult<ED>; opRecords: SelectOpResult<ED>;
[A: string]: any; [A: string]: any;
}) { }) {
const exception = makeException2<ED>(data);
if (exception) {
return exception;
}
const { name, message, opRecords } = data; const { name, message, opRecords } = data;
let e: OakException<ED> | undefined;
switch (name) { switch (name) {
case 'OakNotEnoughMoneyException': { case 'OakNotEnoughMoneyException': {
const e = new OakNotEnoughMoneyException<ED>(message); e = new OakNotEnoughMoneyException<ED>(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakDistinguishUserException': { case 'OakDistinguishUserException': {
const e = new OakDistinguishUserException<ED>(data.userId, data.usingPassword, data.usingIdCard, data.usingWechatUser, data.usingEmail, message); e = new OakDistinguishUserException<ED>(data.userId, data.usingPassword, data.usingIdCard, data.usingWechatUser, data.usingEmail, message);
e.setOpRecords(opRecords);
return e;
} }
case 'OakUserDisabledException': { case 'OakUserDisabledException': {
const e = new OakUserDisabledException<ED>(message); e = new OakUserDisabledException<ED>(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakTokenExpiredException': { case 'OakTokenExpiredException': {
const e = new OakTokenExpiredException<ED>(message); e = new OakTokenExpiredException<ED>(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakMobileUnsetException': { case 'OakMobileUnsetException': {
const e = new OakMobileUnsetException<ED>(message); e = new OakMobileUnsetException<ED>(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakUserInfoUncompletedException': { case 'OakUserInfoUncompletedException': {
const e = new OakUserInfoUncompletedException<ED>(message); e = new OakUserInfoUncompletedException<ED>(message);
e.setOpRecords(opRecords); break;
return e;
} }
case 'OakUploadException': { case 'OakUploadException': {
const e = new OakUploadException<ED>(message); e = new OakUploadException<ED>(message);
break;
}
default: {
}
}
if (e) {
e.setOpRecords(opRecords); e.setOpRecords(opRecords);
return e; return e;
} }
default: {
return;
}
}
} }