313 lines
12 KiB
TypeScript
313 lines
12 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;
|
|
export type Schema = 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;
|
|
withdraw: Withdraw.Schema;
|
|
withdrawAccount: WithdrawAccount.Schema;
|
|
operator?: User.Schema | null;
|
|
creator: User.Schema;
|
|
sysAccountOper$withdrawTransfer?: Array<SysAccountOper.Schema>;
|
|
sysAccountOper$withdrawTransfer$$aggr?: AggregationResult<SysAccountOper.Schema>;
|
|
modiEntity$entity?: Array<ModiEntity.Schema>;
|
|
modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
|
|
operEntity$entity?: Array<OperEntity.Schema>;
|
|
operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
|
|
accountOper$entity?: Array<AccountOper.Schema>;
|
|
accountOper$entity$$aggr?: AggregationResult<AccountOper.Schema>;
|
|
} & {
|
|
[A in ExpressionKey]?: any;
|
|
};
|
|
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";
|
|
};
|
|
sysAccountOper$withdrawTransfer$$aggr?: SysAccountOper.Aggregation & {
|
|
$entity: "sysAccountOper";
|
|
};
|
|
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";
|
|
};
|
|
accountOper$entity?: AccountOper.Selection & {
|
|
$entity: "accountOper";
|
|
};
|
|
accountOper$entity$$aggr?: AccountOper.Aggregation & {
|
|
$entity: "accountOper";
|
|
};
|
|
} & Partial<ExprOp<OpAttr | string>>;
|
|
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 {};
|