315 lines
13 KiB
TypeScript
315 lines
13 KiB
TypeScript
import { ForeignKey } from "oak-domain/lib/types/DataType";
|
|
import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, 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, IState } from "./Action";
|
|
import { Price, String, Text } from "oak-domain/lib/types/DataType";
|
|
import * as Withdraw from "../Withdraw/Schema";
|
|
import * as WithdrawAccount from "../WithdrawAccount/Schema";
|
|
import * as User from "../User/Schema";
|
|
import * as SysAccountOper from "../SysAccountOper/Schema";
|
|
import * as ModiEntity from "../ModiEntity/Schema";
|
|
import * as OperEntity from "../OperEntity/Schema";
|
|
import * as AccountOper from "../AccountOper/Schema";
|
|
export type OpSchema = EntityShape & {
|
|
iState?: IState | null;
|
|
withdrawId: ForeignKey<"withdraw">;
|
|
withdrawAccountId: ForeignKey<"withdrawAccount">;
|
|
price: Price;
|
|
loss: Price;
|
|
operatorId?: ForeignKey<"user"> | null;
|
|
creatorId: ForeignKey<"user">;
|
|
externalId?: String<128> | null;
|
|
meta: Object;
|
|
reason?: Text | null;
|
|
};
|
|
export type OpAttr = keyof OpSchema;
|
|
type SysAccountOper$withdrawTransferAggr = "sysAccountOper$withdrawTransfer$$aggr" | "sysAccountOper$withdrawTransfer$$0$$aggr" | "sysAccountOper$withdrawTransfer$$1$$aggr" | "sysAccountOper$withdrawTransfer$$2$$aggr" | "sysAccountOper$withdrawTransfer$$3$$aggr" | "sysAccountOper$withdrawTransfer$$4$$aggr" | "sysAccountOper$withdrawTransfer$$5$$aggr" | "sysAccountOper$withdrawTransfer$$6$$aggr" | "sysAccountOper$withdrawTransfer$$7$$aggr" | "sysAccountOper$withdrawTransfer$$8$$aggr" | "sysAccountOper$withdrawTransfer$$9$$aggr";
|
|
type ModiEntity$entityAggr = "modiEntity$entity$$aggr" | "modiEntity$entity$$0$$aggr" | "modiEntity$entity$$1$$aggr" | "modiEntity$entity$$2$$aggr" | "modiEntity$entity$$3$$aggr" | "modiEntity$entity$$4$$aggr" | "modiEntity$entity$$5$$aggr" | "modiEntity$entity$$6$$aggr" | "modiEntity$entity$$7$$aggr" | "modiEntity$entity$$8$$aggr" | "modiEntity$entity$$9$$aggr";
|
|
type OperEntity$entityAggr = "operEntity$entity$$aggr" | "operEntity$entity$$0$$aggr" | "operEntity$entity$$1$$aggr" | "operEntity$entity$$2$$aggr" | "operEntity$entity$$3$$aggr" | "operEntity$entity$$4$$aggr" | "operEntity$entity$$5$$aggr" | "operEntity$entity$$6$$aggr" | "operEntity$entity$$7$$aggr" | "operEntity$entity$$8$$aggr" | "operEntity$entity$$9$$aggr";
|
|
type AccountOper$entityAggr = "accountOper$entity$$aggr" | "accountOper$entity$$0$$aggr" | "accountOper$entity$$1$$aggr" | "accountOper$entity$$2$$aggr" | "accountOper$entity$$3$$aggr" | "accountOper$entity$$4$$aggr" | "accountOper$entity$$5$$aggr" | "accountOper$entity$$6$$aggr" | "accountOper$entity$$7$$aggr" | "accountOper$entity$$8$$aggr" | "accountOper$entity$$9$$aggr";
|
|
export type Schema = OpSchema & {
|
|
withdraw: Withdraw.Schema;
|
|
withdrawAccount: WithdrawAccount.Schema;
|
|
operator?: User.Schema | null;
|
|
creator: User.Schema;
|
|
sysAccountOper$withdrawTransfer?: Array<SysAccountOper.Schema>;
|
|
modiEntity$entity?: Array<ModiEntity.Schema>;
|
|
operEntity$entity?: Array<OperEntity.Schema>;
|
|
accountOper$entity?: Array<AccountOper.Schema>;
|
|
} & {
|
|
[A in ExpressionKey]?: any;
|
|
} & {
|
|
[A in SysAccountOper$withdrawTransferAggr]?: AggregationResult<SysAccountOper.Schema>;
|
|
} & {
|
|
[A in ModiEntity$entityAggr]?: AggregationResult<ModiEntity.Schema>;
|
|
} & {
|
|
[A in OperEntity$entityAggr]?: AggregationResult<OperEntity.Schema>;
|
|
} & {
|
|
[A in AccountOper$entityAggr]?: AggregationResult<AccountOper.Schema>;
|
|
};
|
|
type AttrFilter = {
|
|
id: Q_StringValue;
|
|
$$createAt$$: Q_DateValue;
|
|
$$seq$$: Q_NumberValue;
|
|
$$updateAt$$: Q_DateValue;
|
|
iState: Q_EnumValue<IState>;
|
|
withdrawId: Q_StringValue;
|
|
withdraw: Withdraw.Filter;
|
|
withdrawAccountId: Q_StringValue;
|
|
withdrawAccount: WithdrawAccount.Filter;
|
|
price: Q_NumberValue;
|
|
loss: Q_NumberValue;
|
|
operatorId: Q_StringValue;
|
|
operator: User.Filter;
|
|
creatorId: Q_StringValue;
|
|
creator: User.Filter;
|
|
externalId: Q_StringValue;
|
|
meta: Object;
|
|
reason: Q_StringValue;
|
|
sysAccountOper$withdrawTransfer: SysAccountOper.Filter & SubQueryPredicateMetadata;
|
|
modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata;
|
|
operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata;
|
|
accountOper$entity: AccountOper.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;
|
|
iState?: number;
|
|
withdrawId?: number;
|
|
withdraw?: Withdraw.Projection;
|
|
withdrawAccountId?: number;
|
|
withdrawAccount?: WithdrawAccount.Projection;
|
|
price?: number;
|
|
loss?: number;
|
|
operatorId?: number;
|
|
operator?: User.Projection;
|
|
creatorId?: number;
|
|
creator?: User.Projection;
|
|
externalId?: number;
|
|
meta?: number | Object;
|
|
reason?: number;
|
|
sysAccountOper$withdrawTransfer?: SysAccountOper.Selection & {
|
|
$entity: "sysAccountOper";
|
|
};
|
|
modiEntity$entity?: ModiEntity.Selection & {
|
|
$entity: "modiEntity";
|
|
};
|
|
operEntity$entity?: OperEntity.Selection & {
|
|
$entity: "operEntity";
|
|
};
|
|
accountOper$entity?: AccountOper.Selection & {
|
|
$entity: "accountOper";
|
|
};
|
|
} & Partial<ExprOp<OpAttr | string>> & {
|
|
[A in SysAccountOper$withdrawTransferAggr]?: SysAccountOper.Aggregation & {
|
|
$entity: "sysAccountOper";
|
|
};
|
|
} & {
|
|
[A in ModiEntity$entityAggr]?: ModiEntity.Aggregation & {
|
|
$entity: "modiEntity";
|
|
};
|
|
} & {
|
|
[A in OperEntity$entityAggr]?: OperEntity.Aggregation & {
|
|
$entity: "operEntity";
|
|
};
|
|
} & {
|
|
[A in AccountOper$entityAggr]?: AccountOper.Aggregation & {
|
|
$entity: "accountOper";
|
|
};
|
|
};
|
|
type WithdrawTransferIdProjection = OneOf<{
|
|
id: number;
|
|
}>;
|
|
type WithdrawIdProjection = OneOf<{
|
|
withdrawId: number;
|
|
}>;
|
|
type WithdrawAccountIdProjection = OneOf<{
|
|
withdrawAccountId: number;
|
|
}>;
|
|
type UserIdProjection = OneOf<{
|
|
operatorId: number;
|
|
creatorId: number;
|
|
}>;
|
|
export type SortAttr = {
|
|
id: number;
|
|
} | {
|
|
$$createAt$$: number;
|
|
} | {
|
|
$$seq$$: number;
|
|
} | {
|
|
$$updateAt$$: number;
|
|
} | {
|
|
iState: number;
|
|
} | {
|
|
withdrawId: number;
|
|
} | {
|
|
withdraw: Withdraw.SortAttr;
|
|
} | {
|
|
withdrawAccountId: number;
|
|
} | {
|
|
withdrawAccount: WithdrawAccount.SortAttr;
|
|
} | {
|
|
price: number;
|
|
} | {
|
|
loss: number;
|
|
} | {
|
|
operatorId: number;
|
|
} | {
|
|
operator: User.SortAttr;
|
|
} | {
|
|
creatorId: number;
|
|
} | {
|
|
creator: User.SortAttr;
|
|
} | {
|
|
externalId: number;
|
|
} | {
|
|
reason: 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, "withdrawId" | "withdrawAccountId" | "operatorId" | "creatorId">> & (({
|
|
withdrawId?: never;
|
|
withdraw: Withdraw.CreateSingleOperation;
|
|
} | {
|
|
withdrawId: ForeignKey<"withdraw">;
|
|
withdraw?: Withdraw.UpdateOperation;
|
|
} | {
|
|
withdraw?: never;
|
|
withdrawId: ForeignKey<"withdraw">;
|
|
}) & ({
|
|
withdrawAccountId?: never;
|
|
withdrawAccount: WithdrawAccount.CreateSingleOperation;
|
|
} | {
|
|
withdrawAccountId: ForeignKey<"withdrawAccount">;
|
|
withdrawAccount?: WithdrawAccount.UpdateOperation;
|
|
} | {
|
|
withdrawAccount?: never;
|
|
withdrawAccountId: ForeignKey<"withdrawAccount">;
|
|
}) & ({
|
|
operatorId?: never;
|
|
operator?: User.CreateSingleOperation;
|
|
} | {
|
|
operatorId: ForeignKey<"operator">;
|
|
operator?: User.UpdateOperation;
|
|
} | {
|
|
operator?: never;
|
|
operatorId?: ForeignKey<"operator">;
|
|
}) & ({
|
|
creatorId?: never;
|
|
creator: User.CreateSingleOperation;
|
|
} | {
|
|
creatorId: ForeignKey<"creator">;
|
|
creator?: User.UpdateOperation;
|
|
} | {
|
|
creator?: never;
|
|
creatorId: ForeignKey<"creator">;
|
|
})) & {
|
|
sysAccountOper$withdrawTransfer?: OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "withdrawTransfer" | "withdrawTransferId">[]> | Array<OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "withdrawTransfer" | "withdrawTransferId">>>;
|
|
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">>>;
|
|
accountOper$entity?: OakOperation<"create", Omit<AccountOper.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<AccountOper.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, "withdrawId" | "withdrawAccountId" | "operatorId" | "creatorId">> & (({
|
|
withdraw?: Withdraw.CreateSingleOperation;
|
|
withdrawId?: never;
|
|
} | {
|
|
withdraw?: Withdraw.UpdateOperation;
|
|
withdrawId?: never;
|
|
} | {
|
|
withdraw?: Withdraw.RemoveOperation;
|
|
withdrawId?: never;
|
|
} | {
|
|
withdraw?: never;
|
|
withdrawId?: ForeignKey<"withdraw">;
|
|
}) & ({
|
|
withdrawAccount?: WithdrawAccount.CreateSingleOperation;
|
|
withdrawAccountId?: never;
|
|
} | {
|
|
withdrawAccount?: WithdrawAccount.UpdateOperation;
|
|
withdrawAccountId?: never;
|
|
} | {
|
|
withdrawAccount?: WithdrawAccount.RemoveOperation;
|
|
withdrawAccountId?: never;
|
|
} | {
|
|
withdrawAccount?: never;
|
|
withdrawAccountId?: ForeignKey<"withdrawAccount">;
|
|
}) & ({
|
|
operator?: User.CreateSingleOperation;
|
|
operatorId?: never;
|
|
} | {
|
|
operator?: User.UpdateOperation;
|
|
operatorId?: never;
|
|
} | {
|
|
operator?: User.RemoveOperation;
|
|
operatorId?: never;
|
|
} | {
|
|
operator?: never;
|
|
operatorId?: ForeignKey<"operator"> | null;
|
|
}) & ({
|
|
creator?: User.CreateSingleOperation;
|
|
creatorId?: never;
|
|
} | {
|
|
creator?: User.UpdateOperation;
|
|
creatorId?: never;
|
|
} | {
|
|
creator?: User.RemoveOperation;
|
|
creatorId?: never;
|
|
} | {
|
|
creator?: never;
|
|
creatorId?: ForeignKey<"creator">;
|
|
})) & {
|
|
[k: string]: any;
|
|
sysAccountOper$withdrawTransfer?: OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "withdrawTransfer" | "withdrawTransferId">[]> | Array<OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "withdrawTransfer" | "withdrawTransferId">>>;
|
|
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">>>;
|
|
accountOper$entity?: OakOperation<"create", Omit<AccountOper.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<AccountOper.CreateOperationData, "entity" | "entityId">>>;
|
|
};
|
|
export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
|
export type RemoveOperationData = {} & (({
|
|
withdraw?: Withdraw.UpdateOperation | Withdraw.RemoveOperation;
|
|
}) & ({
|
|
withdrawAccount?: WithdrawAccount.UpdateOperation | WithdrawAccount.RemoveOperation;
|
|
}) & ({
|
|
operator?: User.UpdateOperation | User.RemoveOperation;
|
|
}) & ({
|
|
creator?: User.UpdateOperation | User.RemoveOperation;
|
|
}));
|
|
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
export type WithdrawIdSubQuery = Selection<WithdrawIdProjection>;
|
|
export type WithdrawAccountIdSubQuery = Selection<WithdrawAccountIdProjection>;
|
|
export type UserIdSubQuery = Selection<UserIdProjection>;
|
|
export type WithdrawTransferIdSubQuery = Selection<WithdrawTransferIdProjection>;
|
|
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 {};
|