184 lines
6.7 KiB
TypeScript
184 lines
6.7 KiB
TypeScript
import { ForeignKey } from "oak-domain/lib/types/DataType";
|
|
import { Q_DateValue, 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 { AppendOnlyAction } from "oak-domain/lib/actions/action";
|
|
import { Price, String, Text } from "oak-domain/lib/types/DataType";
|
|
import * as User from "../User/Schema";
|
|
import * as System from "../System/Schema";
|
|
import * as SysAccountOper from "../SysAccountOper/Schema";
|
|
export type OpSchema = EntityShape & {
|
|
price: Price;
|
|
externalId: String<64>;
|
|
operatorId: ForeignKey<"user">;
|
|
remark?: Text | null;
|
|
systemId: ForeignKey<"system">;
|
|
};
|
|
export type OpAttr = keyof OpSchema;
|
|
type SysAccountOper$sysAccountMoveAggr = "sysAccountOper$sysAccountMove$$aggr" | "sysAccountOper$sysAccountMove$$0$$aggr" | "sysAccountOper$sysAccountMove$$1$$aggr" | "sysAccountOper$sysAccountMove$$2$$aggr" | "sysAccountOper$sysAccountMove$$3$$aggr" | "sysAccountOper$sysAccountMove$$4$$aggr" | "sysAccountOper$sysAccountMove$$5$$aggr" | "sysAccountOper$sysAccountMove$$6$$aggr" | "sysAccountOper$sysAccountMove$$7$$aggr" | "sysAccountOper$sysAccountMove$$8$$aggr" | "sysAccountOper$sysAccountMove$$9$$aggr";
|
|
export type Schema = OpSchema & {
|
|
operator: User.Schema;
|
|
system: System.Schema;
|
|
sysAccountOper$sysAccountMove?: Array<SysAccountOper.Schema>;
|
|
} & {
|
|
[A in ExpressionKey]?: any;
|
|
} & {
|
|
[A in SysAccountOper$sysAccountMoveAggr]?: AggregationResult<SysAccountOper.Schema>;
|
|
};
|
|
type AttrFilter = {
|
|
id: Q_StringValue;
|
|
$$createAt$$: Q_DateValue;
|
|
$$seq$$: Q_NumberValue;
|
|
$$updateAt$$: Q_DateValue;
|
|
price: Q_NumberValue;
|
|
externalId: Q_StringValue;
|
|
operatorId: Q_StringValue;
|
|
operator: User.Filter;
|
|
remark: Q_StringValue;
|
|
systemId: Q_StringValue;
|
|
system: System.Filter;
|
|
sysAccountOper$sysAccountMove: 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;
|
|
price?: number;
|
|
externalId?: number;
|
|
operatorId?: number;
|
|
operator?: User.Projection;
|
|
remark?: number;
|
|
systemId?: number;
|
|
system?: System.Projection;
|
|
sysAccountOper$sysAccountMove?: SysAccountOper.Selection & {
|
|
$entity: "sysAccountOper";
|
|
};
|
|
} & Partial<ExprOp<OpAttr | string>> & {
|
|
[A in SysAccountOper$sysAccountMoveAggr]?: SysAccountOper.Aggregation & {
|
|
$entity: "sysAccountOper";
|
|
};
|
|
};
|
|
type SysAccountMoveIdProjection = OneOf<{
|
|
id: number;
|
|
}>;
|
|
type UserIdProjection = OneOf<{
|
|
operatorId: number;
|
|
}>;
|
|
type SystemIdProjection = OneOf<{
|
|
systemId: number;
|
|
}>;
|
|
export type SortAttr = {
|
|
id: number;
|
|
} | {
|
|
$$createAt$$: number;
|
|
} | {
|
|
$$seq$$: number;
|
|
} | {
|
|
$$updateAt$$: number;
|
|
} | {
|
|
price: number;
|
|
} | {
|
|
externalId: number;
|
|
} | {
|
|
operatorId: number;
|
|
} | {
|
|
operator: User.SortAttr;
|
|
} | {
|
|
remark: number;
|
|
} | {
|
|
systemId: number;
|
|
} | {
|
|
system: System.SortAttr;
|
|
} | {
|
|
[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, "operatorId" | "systemId">> & (({
|
|
operatorId?: never;
|
|
operator: User.CreateSingleOperation;
|
|
} | {
|
|
operatorId: ForeignKey<"operator">;
|
|
operator?: User.UpdateOperation;
|
|
} | {
|
|
operator?: never;
|
|
operatorId: ForeignKey<"operator">;
|
|
}) & ({
|
|
systemId?: never;
|
|
system: System.CreateSingleOperation;
|
|
} | {
|
|
systemId: ForeignKey<"system">;
|
|
system?: System.UpdateOperation;
|
|
} | {
|
|
system?: never;
|
|
systemId: ForeignKey<"system">;
|
|
})) & {
|
|
sysAccountOper$sysAccountMove?: OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "sysAccountMove" | "sysAccountMoveId">[]> | Array<OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "sysAccountMove" | "sysAccountMoveId">>>;
|
|
};
|
|
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "operatorId" | "systemId">> & (({
|
|
operator?: User.CreateSingleOperation;
|
|
operatorId?: never;
|
|
} | {
|
|
operator?: User.UpdateOperation;
|
|
operatorId?: never;
|
|
} | {
|
|
operator?: User.RemoveOperation;
|
|
operatorId?: never;
|
|
} | {
|
|
operator?: never;
|
|
operatorId?: ForeignKey<"operator">;
|
|
}) & ({
|
|
system?: System.CreateSingleOperation;
|
|
systemId?: never;
|
|
} | {
|
|
system?: System.UpdateOperation;
|
|
systemId?: never;
|
|
} | {
|
|
system?: System.RemoveOperation;
|
|
systemId?: never;
|
|
} | {
|
|
system?: never;
|
|
systemId?: ForeignKey<"system">;
|
|
})) & {
|
|
[k: string]: any;
|
|
sysAccountOper$sysAccountMove?: OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "sysAccountMove" | "sysAccountMoveId">[]> | Array<OakOperation<"create", Omit<SysAccountOper.CreateOperationData, "sysAccountMove" | "sysAccountMoveId">>>;
|
|
};
|
|
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
|
export type RemoveOperationData = {} & (({
|
|
operator?: User.UpdateOperation | User.RemoveOperation;
|
|
}) & ({
|
|
system?: System.UpdateOperation | System.RemoveOperation;
|
|
}));
|
|
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
export type UserIdSubQuery = Selection<UserIdProjection>;
|
|
export type SystemIdSubQuery = Selection<SystemIdProjection>;
|
|
export type SysAccountMoveIdSubQuery = Selection<SysAccountMoveIdProjection>;
|
|
export type EntityDef = {
|
|
Schema: Schema;
|
|
OpSchema: OpSchema;
|
|
Action: OakMakeAction<AppendOnlyAction> | string;
|
|
Selection: Selection;
|
|
Aggregation: Aggregation;
|
|
Operation: Operation;
|
|
Create: CreateOperation;
|
|
Update: UpdateOperation;
|
|
Remove: RemoveOperation;
|
|
CreateSingle: CreateSingleOperation;
|
|
CreateMulti: CreateMultipleOperation;
|
|
};
|
|
export {};
|