101 lines
3.6 KiB
TypeScript
101 lines
3.6 KiB
TypeScript
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } 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, EntityShape } from "oak-domain/lib/types/Entity";
|
|
import { Action, ParticularAction } from "./Action";
|
|
import { Decimal, Int, Boolean } from "oak-domain/lib/types/DataType";
|
|
export type OpSchema = EntityShape & {
|
|
taxLossRatio: Decimal<4, 2>;
|
|
refundGapDays?: Int<4> | null;
|
|
refundCompensateRatio?: Int<4> | null;
|
|
allowWithdrawTransfer: Boolean;
|
|
withdrawTransferLossRatio?: Decimal<4, 2> | null;
|
|
};
|
|
export type OpAttr = keyof OpSchema;
|
|
export type Schema = OpSchema & {} & {
|
|
[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;
|
|
allowWithdrawTransfer: Q_BooleanValue;
|
|
withdrawTransferLossRatio: Q_NumberValue;
|
|
};
|
|
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;
|
|
allowWithdrawTransfer?: number;
|
|
withdrawTransferLossRatio?: number;
|
|
} & Partial<ExprOp<OpAttr | string>>;
|
|
type AbstractAccountIdProjection = OneOf<{
|
|
id: number;
|
|
}>;
|
|
export type SortAttr = {
|
|
id: number;
|
|
} | {
|
|
$$createAt$$: number;
|
|
} | {
|
|
$$seq$$: number;
|
|
} | {
|
|
$$updateAt$$: number;
|
|
} | {
|
|
taxLossRatio: number;
|
|
} | {
|
|
refundGapDays: number;
|
|
} | {
|
|
refundCompensateRatio: number;
|
|
} | {
|
|
allowWithdrawTransfer: number;
|
|
} | {
|
|
withdrawTransferLossRatio: 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<OpSchema>;
|
|
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
export type UpdateOperationData = FormUpdateData<OpSchema> & {
|
|
[k: string]: any;
|
|
};
|
|
export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
|
export type RemoveOperationData = {};
|
|
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
export type AbstractAccountIdSubQuery = Selection<AbstractAccountIdProjection>;
|
|
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 {};
|