259 lines
11 KiB
TypeScript
259 lines
11 KiB
TypeScript
import { ForeignKey } from "oak-domain/lib/types/DataType";
|
|
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, 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 { Action, ParticularAction } from "./Action";
|
|
import { Decimal, Int, String, Text, Price, Boolean } from "oak-domain/lib/types/DataType";
|
|
import * as WechatPay from "../WechatPay/Schema";
|
|
import * as System from "../System/Schema";
|
|
import * as WpProduct from "../WpProduct/Schema";
|
|
import * as ModiEntity from "../ModiEntity/Schema";
|
|
import * as OperEntity from "../OperEntity/Schema";
|
|
import * as SysAccountOper from "../SysAccountOper/Schema";
|
|
export type OpSchema = EntityShape & {
|
|
taxLossRatio: Decimal<4, 2>;
|
|
refundGapDays?: Int<4> | null;
|
|
refundCompensateRatio?: Int<4> | null;
|
|
wechatPayId: ForeignKey<"wechatPay">;
|
|
mchId: String<128>;
|
|
publicKeyFilePath: Text;
|
|
privateKeyFilePath: Text;
|
|
apiV3Key: String<32>;
|
|
price: Price;
|
|
systemId: ForeignKey<"system">;
|
|
enabled: Boolean;
|
|
};
|
|
export type OpAttr = keyof OpSchema;
|
|
export type Schema = EntityShape & {
|
|
taxLossRatio: Decimal<4, 2>;
|
|
refundGapDays?: Int<4> | null;
|
|
refundCompensateRatio?: Int<4> | null;
|
|
wechatPayId: ForeignKey<"wechatPay">;
|
|
mchId: String<128>;
|
|
publicKeyFilePath: Text;
|
|
privateKeyFilePath: Text;
|
|
apiV3Key: String<32>;
|
|
price: Price;
|
|
systemId: ForeignKey<"system">;
|
|
enabled: Boolean;
|
|
wechatPay: WechatPay.Schema;
|
|
system: System.Schema;
|
|
wpProduct$wpAccount?: Array<WpProduct.Schema>;
|
|
wpProduct$wpAccount$$aggr?: AggregationResult<WpProduct.Schema>;
|
|
modiEntity$entity?: Array<ModiEntity.Schema>;
|
|
modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
|
|
operEntity$entity?: Array<OperEntity.Schema>;
|
|
operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
|
|
sysAccountOper$entity?: Array<SysAccountOper.Schema>;
|
|
sysAccountOper$entity$$aggr?: AggregationResult<SysAccountOper.Schema>;
|
|
} & {
|
|
[A in ExpressionKey]?: any;
|
|
};
|
|
type AttrFilter = {
|
|
id: Q_StringValue;
|
|
$$createAt$$: Q_DateValue;
|
|
$$seq$$: Q_NumberValue;
|
|
$$updateAt$$: Q_DateValue;
|
|
taxLossRatio: Q_NumberValue;
|
|
refundGapDays: Q_NumberValue;
|
|
refundCompensateRatio: Q_NumberValue;
|
|
wechatPayId: Q_StringValue;
|
|
wechatPay: WechatPay.Filter;
|
|
mchId: Q_StringValue;
|
|
publicKeyFilePath: Q_StringValue;
|
|
privateKeyFilePath: Q_StringValue;
|
|
apiV3Key: Q_StringValue;
|
|
price: Q_NumberValue;
|
|
systemId: Q_StringValue;
|
|
system: System.Filter;
|
|
enabled: Q_BooleanValue;
|
|
wpProduct$wpAccount: WpProduct.Filter & SubQueryPredicateMetadata;
|
|
modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata;
|
|
operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata;
|
|
sysAccountOper$entity: SysAccountOper.Filter & SubQueryPredicateMetadata;
|
|
};
|
|
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
|
export type Projection = {
|
|
"#id"?: NodeId;
|
|
[k: string]: any;
|
|
id?: number;
|
|
$$createAt$$?: number;
|
|
$$updateAt$$?: number;
|
|
$$seq$$?: number;
|
|
taxLossRatio?: number;
|
|
refundGapDays?: number;
|
|
refundCompensateRatio?: number;
|
|
wechatPayId?: number;
|
|
wechatPay?: WechatPay.Projection;
|
|
mchId?: number;
|
|
publicKeyFilePath?: number;
|
|
privateKeyFilePath?: number;
|
|
apiV3Key?: number;
|
|
price?: number;
|
|
systemId?: number;
|
|
system?: System.Projection;
|
|
enabled?: number;
|
|
wpProduct$wpAccount?: WpProduct.Selection & {
|
|
$entity: "wpProduct";
|
|
};
|
|
wpProduct$wpAccount$$aggr?: WpProduct.Aggregation & {
|
|
$entity: "wpProduct";
|
|
};
|
|
modiEntity$entity?: ModiEntity.Selection & {
|
|
$entity: "modiEntity";
|
|
};
|
|
modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
|
|
$entity: "modiEntity";
|
|
};
|
|
operEntity$entity?: OperEntity.Selection & {
|
|
$entity: "operEntity";
|
|
};
|
|
operEntity$entity$$aggr?: OperEntity.Aggregation & {
|
|
$entity: "operEntity";
|
|
};
|
|
sysAccountOper$entity?: SysAccountOper.Selection & {
|
|
$entity: "sysAccountOper";
|
|
};
|
|
sysAccountOper$entity$$aggr?: SysAccountOper.Aggregation & {
|
|
$entity: "sysAccountOper";
|
|
};
|
|
} & Partial<ExprOp<OpAttr | string>>;
|
|
type WpAccountIdProjection = OneOf<{
|
|
id: number;
|
|
}>;
|
|
type WechatPayIdProjection = OneOf<{
|
|
wechatPayId: number;
|
|
}>;
|
|
type SystemIdProjection = OneOf<{
|
|
systemId: number;
|
|
}>;
|
|
export type SortAttr = {
|
|
id: number;
|
|
} | {
|
|
$$createAt$$: number;
|
|
} | {
|
|
$$seq$$: number;
|
|
} | {
|
|
$$updateAt$$: number;
|
|
} | {
|
|
taxLossRatio: number;
|
|
} | {
|
|
refundGapDays: number;
|
|
} | {
|
|
refundCompensateRatio: number;
|
|
} | {
|
|
wechatPayId: number;
|
|
} | {
|
|
wechatPay: WechatPay.SortAttr;
|
|
} | {
|
|
mchId: number;
|
|
} | {
|
|
publicKeyFilePath: number;
|
|
} | {
|
|
privateKeyFilePath: number;
|
|
} | {
|
|
apiV3Key: number;
|
|
} | {
|
|
price: number;
|
|
} | {
|
|
systemId: number;
|
|
} | {
|
|
system: System.SortAttr;
|
|
} | {
|
|
enabled: number;
|
|
} | {
|
|
[k: string]: any;
|
|
} | OneOf<ExprOp<OpAttr | string>>;
|
|
export type SortNode = {
|
|
$attr: SortAttr;
|
|
$direction?: "asc" | "desc";
|
|
};
|
|
export type Sorter = SortNode[];
|
|
export type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
|
|
export type Selection<P extends Object = Projection> = SelectOperation<P>;
|
|
export type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
|
export type CreateOperationData = FormCreateData<Omit<OpSchema, "wechatPayId" | "systemId">> & (({
|
|
wechatPayId?: never;
|
|
wechatPay: WechatPay.CreateSingleOperation;
|
|
} | {
|
|
wechatPayId: ForeignKey<"wechatPay">;
|
|
wechatPay?: WechatPay.UpdateOperation;
|
|
} | {
|
|
wechatPay?: never;
|
|
wechatPayId: ForeignKey<"wechatPay">;
|
|
}) & ({
|
|
systemId?: never;
|
|
system: System.CreateSingleOperation;
|
|
} | {
|
|
systemId: ForeignKey<"system">;
|
|
system?: System.UpdateOperation;
|
|
} | {
|
|
system?: never;
|
|
systemId: ForeignKey<"system">;
|
|
})) & {
|
|
wpProduct$wpAccount?: OakOperation<WpProduct.UpdateOperation["action"], Omit<WpProduct.UpdateOperationData, "wpAccount" | "wpAccountId">, Omit<WpProduct.Filter, "wpAccount" | "wpAccountId">> | OakOperation<"create", Omit<WpProduct.CreateOperationData, "wpAccount" | "wpAccountId">[]> | Array<OakOperation<"create", Omit<WpProduct.CreateOperationData, "wpAccount" | "wpAccountId">> | OakOperation<WpProduct.UpdateOperation["action"], Omit<WpProduct.UpdateOperationData, "wpAccount" | "wpAccountId">, Omit<WpProduct.Filter, "wpAccount" | "wpAccountId">>>;
|
|
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
sysAccountOper$entity?: OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "entity" | "entityId">>>;
|
|
};
|
|
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "wechatPayId" | "systemId">> & (({
|
|
wechatPay?: WechatPay.CreateSingleOperation;
|
|
wechatPayId?: never;
|
|
} | {
|
|
wechatPay?: WechatPay.UpdateOperation;
|
|
wechatPayId?: never;
|
|
} | {
|
|
wechatPay?: WechatPay.RemoveOperation;
|
|
wechatPayId?: never;
|
|
} | {
|
|
wechatPay?: never;
|
|
wechatPayId?: ForeignKey<"wechatPay">;
|
|
}) & ({
|
|
system?: System.CreateSingleOperation;
|
|
systemId?: never;
|
|
} | {
|
|
system?: System.UpdateOperation;
|
|
systemId?: never;
|
|
} | {
|
|
system?: System.RemoveOperation;
|
|
systemId?: never;
|
|
} | {
|
|
system?: never;
|
|
systemId?: ForeignKey<"system">;
|
|
})) & {
|
|
[k: string]: any;
|
|
wpProduct$wpAccount?: OakOperation<WpProduct.UpdateOperation["action"], Omit<WpProduct.UpdateOperationData, "wpAccount" | "wpAccountId">, Omit<WpProduct.Filter, "wpAccount" | "wpAccountId">> | OakOperation<WpProduct.RemoveOperation["action"], Omit<WpProduct.RemoveOperationData, "wpAccount" | "wpAccountId">, Omit<WpProduct.Filter, "wpAccount" | "wpAccountId">> | OakOperation<"create", Omit<WpProduct.CreateOperationData, "wpAccount" | "wpAccountId">[]> | Array<OakOperation<"create", Omit<WpProduct.CreateOperationData, "wpAccount" | "wpAccountId">> | OakOperation<WpProduct.UpdateOperation["action"], Omit<WpProduct.UpdateOperationData, "wpAccount" | "wpAccountId">, Omit<WpProduct.Filter, "wpAccount" | "wpAccountId">> | OakOperation<WpProduct.RemoveOperation["action"], Omit<WpProduct.RemoveOperationData, "wpAccount" | "wpAccountId">, Omit<WpProduct.Filter, "wpAccount" | "wpAccountId">>>;
|
|
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
sysAccountOper$entity?: OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "entity" | "entityId">>>;
|
|
};
|
|
export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
|
export type RemoveOperationData = {} & (({
|
|
wechatPay?: WechatPay.UpdateOperation | WechatPay.RemoveOperation;
|
|
}) & ({
|
|
system?: System.UpdateOperation | System.RemoveOperation;
|
|
}));
|
|
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
export type WechatPayIdSubQuery = Selection<WechatPayIdProjection>;
|
|
export type SystemIdSubQuery = Selection<SystemIdProjection>;
|
|
export type WpAccountIdSubQuery = Selection<WpAccountIdProjection>;
|
|
export type EntityDef = {
|
|
Schema: Schema;
|
|
OpSchema: OpSchema;
|
|
Action: OakMakeAction<Action> | string;
|
|
Selection: Selection;
|
|
Aggregation: Aggregation;
|
|
Operation: Operation;
|
|
Create: CreateOperation;
|
|
Update: UpdateOperation;
|
|
Remove: RemoveOperation;
|
|
CreateSingle: CreateSingleOperation;
|
|
CreateMulti: CreateMultipleOperation;
|
|
ParticularAction: ParticularAction;
|
|
};
|
|
export {};
|