移除src-base-domain
This commit is contained in:
parent
6f15fcef7f
commit
ac88cb399a
|
|
@ -1,144 +0,0 @@
|
||||||
import { String, Int, Float, Double, Boolean, Text, Datetime, File, Image, PrimaryKey, ForeignKey } from "../../types/DataType";
|
|
||||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
||||||
import { OneOf, ValueOf } from "../../types/Polyfill";
|
|
||||||
import * as SubQuery from "../_SubQuery";
|
|
||||||
import { FormCreateData, FormUpdateData, Operation as OakOperation } from "../../types/Entity";
|
|
||||||
import { GenericAction } from "../../actions/action";
|
|
||||||
import * as Area from "../Area/Schema";
|
|
||||||
export type OpSchema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
detail: String<32>;
|
|
||||||
areaId: ForeignKey<"area">;
|
|
||||||
phone: String<12>;
|
|
||||||
name: String<32>;
|
|
||||||
default: Boolean;
|
|
||||||
remark: Text;
|
|
||||||
};
|
|
||||||
export type OpAttr = keyof OpSchema;
|
|
||||||
export type Schema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
detail: String<32>;
|
|
||||||
areaId: ForeignKey<"area">;
|
|
||||||
phone: String<12>;
|
|
||||||
name: String<32>;
|
|
||||||
default: Boolean;
|
|
||||||
remark: Text;
|
|
||||||
area: Area.Schema;
|
|
||||||
} & {
|
|
||||||
[A in ExpressionKey]?: any;
|
|
||||||
};
|
|
||||||
type AttrFilter = {
|
|
||||||
id: Q_StringValue | SubQuery.AddressIdSubQuery;
|
|
||||||
$$createAt$$: Q_DateValue;
|
|
||||||
$$updateAt$$: Q_DateValue;
|
|
||||||
detail: Q_StringValue;
|
|
||||||
areaId: Q_StringValue | SubQuery.AreaIdSubQuery;
|
|
||||||
area: Area.Filter;
|
|
||||||
phone: Q_StringValue;
|
|
||||||
name: Q_StringValue;
|
|
||||||
default: Q_BooleanValue;
|
|
||||||
remark: Q_StringValue;
|
|
||||||
};
|
|
||||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr>>;
|
|
||||||
export type Projection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$?: 1;
|
|
||||||
$$updateAt$$?: 1;
|
|
||||||
detail?: 1;
|
|
||||||
areaId?: 1;
|
|
||||||
area?: Area.Projection;
|
|
||||||
phone?: 1;
|
|
||||||
name?: 1;
|
|
||||||
default?: 1;
|
|
||||||
remark?: 1;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
export type ExportProjection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id?: string;
|
|
||||||
$$createAt$$?: string;
|
|
||||||
$$updateAt$$?: string;
|
|
||||||
detail?: string;
|
|
||||||
areaId?: string;
|
|
||||||
area?: Area.ExportProjection;
|
|
||||||
phone?: string;
|
|
||||||
name?: string;
|
|
||||||
default?: string;
|
|
||||||
remark?: string;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
type AddressIdProjection = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
}>;
|
|
||||||
type AreaIdProjection = OneOf<{
|
|
||||||
areaId: 1;
|
|
||||||
}>;
|
|
||||||
export type SortAttr = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$: 1;
|
|
||||||
$$updateAt$$: 1;
|
|
||||||
detail: 1;
|
|
||||||
areaId: 1;
|
|
||||||
area: Area.SortAttr;
|
|
||||||
phone: 1;
|
|
||||||
name: 1;
|
|
||||||
default: 1;
|
|
||||||
remark: 1;
|
|
||||||
} & ExprOp<OpAttr>>;
|
|
||||||
export type SortNode = {
|
|
||||||
$attr: SortAttr;
|
|
||||||
$direction?: "asc" | "desc";
|
|
||||||
};
|
|
||||||
export type Sorter = SortNode[];
|
|
||||||
export type SelectOperation<P = Projection> = OakOperation<"select", P, Filter, Sorter>;
|
|
||||||
export type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
||||||
export type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
||||||
type CreateOperationData = FormCreateData<Omit<OpSchema, "areaId" | "area"> & ({
|
|
||||||
area?: Area.CreateSingleOperation | (Area.UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
areaId?: undefined;
|
|
||||||
} | {
|
|
||||||
area?: undefined;
|
|
||||||
areaId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
}>;
|
|
||||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
||||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
||||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
||||||
type UpdateOperationData = FormUpdateData<Omit<OpSchema, "areaId" | "area">> & ({
|
|
||||||
area?: Area.CreateSingleOperation | Omit<Area.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
areaId?: undefined;
|
|
||||||
} | {
|
|
||||||
area?: undefined;
|
|
||||||
areaId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
};
|
|
||||||
export type UpdateOperation = OakOperation<"update", UpdateOperationData, Filter>;
|
|
||||||
type RemoveOperationData = {} & {
|
|
||||||
area?: Omit<Area.UpdateOperation | Area.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
} & {
|
|
||||||
[k: string]: any;
|
|
||||||
};
|
|
||||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter>;
|
|
||||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
||||||
export type AreaIdSubQuery = Selection<AreaIdProjection>;
|
|
||||||
export type AddressIdSubQuery = Selection<AddressIdProjection>;
|
|
||||||
export type NativeAttr = OpAttr | `area.${Area.NativeAttr}`;
|
|
||||||
export type FullAttr = NativeAttr;
|
|
||||||
export type EntityDef = {
|
|
||||||
Schema: Schema;
|
|
||||||
OpSchema: OpSchema;
|
|
||||||
Action: GenericAction;
|
|
||||||
Selection: Selection;
|
|
||||||
Operation: Operation;
|
|
||||||
};
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
import { StorageDesc } from "../../types/Storage";
|
|
||||||
import { OpSchema } from "./Schema";
|
|
||||||
export const desc: StorageDesc<OpSchema> = {
|
|
||||||
attributes: {
|
|
||||||
detail: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
areaId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "area"
|
|
||||||
},
|
|
||||||
phone: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 12
|
|
||||||
}
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
default: {
|
|
||||||
type: "boolean"
|
|
||||||
},
|
|
||||||
remark: {
|
|
||||||
type: "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,153 +0,0 @@
|
||||||
import { String, Int, Float, Double, Boolean, Text, Datetime, File, Image, PrimaryKey, ForeignKey } from "../../types/DataType";
|
|
||||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
||||||
import { OneOf, ValueOf } from "../../types/Polyfill";
|
|
||||||
import * as SubQuery from "../_SubQuery";
|
|
||||||
import { FormCreateData, FormUpdateData, Operation as OakOperation } from "../../types/Entity";
|
|
||||||
import { GenericAction } from "../../actions/action";
|
|
||||||
import * as System from "../System/Schema";
|
|
||||||
import * as Token from "../Token/Schema";
|
|
||||||
import * as WechatUser from "../WechatUser/Schema";
|
|
||||||
import * as ExtraFile from "../ExtraFile/Schema";
|
|
||||||
export type OpSchema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
name: String<32>;
|
|
||||||
description: Text;
|
|
||||||
type: 'web' | 'wechatPublic' | 'weChatMp';
|
|
||||||
systemId: ForeignKey<"system">;
|
|
||||||
};
|
|
||||||
export type OpAttr = keyof OpSchema;
|
|
||||||
export type Schema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
name: String<32>;
|
|
||||||
description: Text;
|
|
||||||
type: 'web' | 'wechatPublic' | 'weChatMp';
|
|
||||||
systemId: ForeignKey<"system">;
|
|
||||||
system: System.Schema;
|
|
||||||
token$application?: Array<Token.Schema>;
|
|
||||||
wechatUser$application?: Array<WechatUser.Schema>;
|
|
||||||
extraFile$entity?: Array<ExtraFile.Schema>;
|
|
||||||
} & {
|
|
||||||
[A in ExpressionKey]?: any;
|
|
||||||
};
|
|
||||||
type AttrFilter = {
|
|
||||||
id: Q_StringValue | SubQuery.ApplicationIdSubQuery;
|
|
||||||
$$createAt$$: Q_DateValue;
|
|
||||||
$$updateAt$$: Q_DateValue;
|
|
||||||
name: Q_StringValue;
|
|
||||||
description: Q_StringValue;
|
|
||||||
type: Q_EnumValue<'web' | 'wechatPublic' | 'weChatMp'>;
|
|
||||||
systemId: Q_StringValue | SubQuery.SystemIdSubQuery;
|
|
||||||
system: System.Filter;
|
|
||||||
};
|
|
||||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr>>;
|
|
||||||
export type Projection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$?: 1;
|
|
||||||
$$updateAt$$?: 1;
|
|
||||||
name?: 1;
|
|
||||||
description?: 1;
|
|
||||||
type?: 1;
|
|
||||||
systemId?: 1;
|
|
||||||
system?: System.Projection;
|
|
||||||
token$application?: Token.Selection;
|
|
||||||
wechatUser$application?: WechatUser.Selection;
|
|
||||||
extraFile$entity?: ExtraFile.Selection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
export type ExportProjection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id?: string;
|
|
||||||
$$createAt$$?: string;
|
|
||||||
$$updateAt$$?: string;
|
|
||||||
name?: string;
|
|
||||||
description?: string;
|
|
||||||
type?: string;
|
|
||||||
systemId?: string;
|
|
||||||
system?: System.ExportProjection;
|
|
||||||
token$application?: Token.Exportation;
|
|
||||||
wechatUser$application?: WechatUser.Exportation;
|
|
||||||
extraFile$entity?: ExtraFile.Exportation;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
type ApplicationIdProjection = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
}>;
|
|
||||||
type SystemIdProjection = OneOf<{
|
|
||||||
systemId: 1;
|
|
||||||
}>;
|
|
||||||
export type SortAttr = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$: 1;
|
|
||||||
$$updateAt$$: 1;
|
|
||||||
name: 1;
|
|
||||||
description: 1;
|
|
||||||
type: 1;
|
|
||||||
systemId: 1;
|
|
||||||
system: System.SortAttr;
|
|
||||||
} & ExprOp<OpAttr>>;
|
|
||||||
export type SortNode = {
|
|
||||||
$attr: SortAttr;
|
|
||||||
$direction?: "asc" | "desc";
|
|
||||||
};
|
|
||||||
export type Sorter = SortNode[];
|
|
||||||
export type SelectOperation<P = Projection> = OakOperation<"select", P, Filter, Sorter>;
|
|
||||||
export type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
||||||
export type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
||||||
type CreateOperationData = FormCreateData<Omit<OpSchema, "systemId" | "system"> & ({
|
|
||||||
system?: System.CreateSingleOperation | (System.UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
systemId?: undefined;
|
|
||||||
} | {
|
|
||||||
system?: undefined;
|
|
||||||
systemId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
token$application?: Token.CreateOperation | Token.UpdateOperation;
|
|
||||||
wechatUser$application?: WechatUser.CreateOperation | WechatUser.UpdateOperation;
|
|
||||||
extraFile$entity?: ExtraFile.CreateOperation | ExtraFile.UpdateOperation;
|
|
||||||
}>;
|
|
||||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
||||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
||||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
||||||
type UpdateOperationData = FormUpdateData<Omit<OpSchema, "systemId" | "system">> & ({
|
|
||||||
system?: System.CreateSingleOperation | Omit<System.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
systemId?: undefined;
|
|
||||||
} | {
|
|
||||||
system?: undefined;
|
|
||||||
systemId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
tokens$application?: Token.CreateOperation | Omit<Token.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
wechatUsers$application?: WechatUser.CreateOperation | Omit<WechatUser.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
extraFiles$entity?: ExtraFile.CreateOperation | Omit<ExtraFile.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
};
|
|
||||||
export type UpdateOperation = OakOperation<"update", UpdateOperationData, Filter>;
|
|
||||||
type RemoveOperationData = {} & {
|
|
||||||
system?: Omit<System.UpdateOperation | System.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
} & {
|
|
||||||
[k: string]: any;
|
|
||||||
tokens$application?: Omit<Token.UpdateOperation | Token.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
wechatUsers$application?: Omit<WechatUser.UpdateOperation | WechatUser.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
extraFiles$entity?: Omit<ExtraFile.UpdateOperation | ExtraFile.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
};
|
|
||||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter>;
|
|
||||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
||||||
export type SystemIdSubQuery = Selection<SystemIdProjection>;
|
|
||||||
export type ApplicationIdSubQuery = Selection<ApplicationIdProjection>;
|
|
||||||
export type NativeAttr = OpAttr | `system.${System.NativeAttr}`;
|
|
||||||
export type FullAttr = NativeAttr | `tokens$${number}.${Token.NativeAttr}` | `wechatUsers$${number}.${WechatUser.NativeAttr}` | `extraFiles$${number}.${ExtraFile.NativeAttr}`;
|
|
||||||
export type EntityDef = {
|
|
||||||
Schema: Schema;
|
|
||||||
OpSchema: OpSchema;
|
|
||||||
Action: GenericAction;
|
|
||||||
Selection: Selection;
|
|
||||||
Operation: Operation;
|
|
||||||
};
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
import { StorageDesc } from "../../types/Storage";
|
|
||||||
import { OpSchema } from "./Schema";
|
|
||||||
export const desc: StorageDesc<OpSchema> = {
|
|
||||||
attributes: {
|
|
||||||
name: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: "text"
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
systemId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "system"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,141 +0,0 @@
|
||||||
import { String, Int, Float, Double, Boolean, Text, Datetime, File, Image, PrimaryKey, ForeignKey } from "../../types/DataType";
|
|
||||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
||||||
import { OneOf, ValueOf } from "../../types/Polyfill";
|
|
||||||
import * as SubQuery from "../_SubQuery";
|
|
||||||
import { FormCreateData, FormUpdateData, Operation as OakOperation } from "../../types/Entity";
|
|
||||||
import { GenericAction } from "../../actions/action";
|
|
||||||
import * as Address from "../Address/Schema";
|
|
||||||
export type OpSchema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
name: String<32>;
|
|
||||||
level: 'province' | 'city' | 'district' | 'street';
|
|
||||||
parentId: ForeignKey<"area">;
|
|
||||||
code: String<12>;
|
|
||||||
};
|
|
||||||
export type OpAttr = keyof OpSchema;
|
|
||||||
export type Schema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
name: String<32>;
|
|
||||||
level: 'province' | 'city' | 'district' | 'street';
|
|
||||||
parentId: ForeignKey<"area">;
|
|
||||||
code: String<12>;
|
|
||||||
parent: Schema;
|
|
||||||
address$area?: Array<Address.Schema>;
|
|
||||||
area$parent?: Array<Schema>;
|
|
||||||
} & {
|
|
||||||
[A in ExpressionKey]?: any;
|
|
||||||
};
|
|
||||||
type AttrFilter = {
|
|
||||||
id: Q_StringValue | SubQuery.AreaIdSubQuery;
|
|
||||||
$$createAt$$: Q_DateValue;
|
|
||||||
$$updateAt$$: Q_DateValue;
|
|
||||||
name: Q_StringValue;
|
|
||||||
level: Q_EnumValue<'province' | 'city' | 'district' | 'street'>;
|
|
||||||
parentId: Q_StringValue | SubQuery.AreaIdSubQuery;
|
|
||||||
parent: Filter;
|
|
||||||
code: Q_StringValue;
|
|
||||||
};
|
|
||||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr>>;
|
|
||||||
export type Projection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$?: 1;
|
|
||||||
$$updateAt$$?: 1;
|
|
||||||
name?: 1;
|
|
||||||
level?: 1;
|
|
||||||
parentId?: 1;
|
|
||||||
parent?: Projection;
|
|
||||||
code?: 1;
|
|
||||||
address$area?: Address.Selection;
|
|
||||||
area$parent?: Selection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
export type ExportProjection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id?: string;
|
|
||||||
$$createAt$$?: string;
|
|
||||||
$$updateAt$$?: string;
|
|
||||||
name?: string;
|
|
||||||
level?: string;
|
|
||||||
parentId?: string;
|
|
||||||
parent?: ExportProjection;
|
|
||||||
code?: string;
|
|
||||||
address$area?: Address.Exportation;
|
|
||||||
area$parent?: Exportation;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
type AreaIdProjection = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
parentId: 1;
|
|
||||||
}>;
|
|
||||||
export type SortAttr = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$: 1;
|
|
||||||
$$updateAt$$: 1;
|
|
||||||
name: 1;
|
|
||||||
level: 1;
|
|
||||||
parentId: 1;
|
|
||||||
parent: SortAttr;
|
|
||||||
code: 1;
|
|
||||||
} & ExprOp<OpAttr>>;
|
|
||||||
export type SortNode = {
|
|
||||||
$attr: SortAttr;
|
|
||||||
$direction?: "asc" | "desc";
|
|
||||||
};
|
|
||||||
export type Sorter = SortNode[];
|
|
||||||
export type SelectOperation<P = Projection> = OakOperation<"select", P, Filter, Sorter>;
|
|
||||||
export type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
||||||
export type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
||||||
type CreateOperationData = FormCreateData<Omit<OpSchema, "parentId" | "parent"> & ({
|
|
||||||
parent?: CreateSingleOperation | (UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
parentId?: undefined;
|
|
||||||
} | {
|
|
||||||
parent?: undefined;
|
|
||||||
parentId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
address$area?: Address.CreateOperation | Address.UpdateOperation;
|
|
||||||
area$parent?: CreateOperation | UpdateOperation;
|
|
||||||
}>;
|
|
||||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
||||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
||||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
||||||
type UpdateOperationData = FormUpdateData<Omit<OpSchema, "parentId" | "parent">> & ({
|
|
||||||
parent?: CreateSingleOperation | Omit<UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
parentId?: undefined;
|
|
||||||
} | {
|
|
||||||
parent?: undefined;
|
|
||||||
parentId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
addresss$area?: Address.CreateOperation | Omit<Address.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
areas$parent?: CreateOperation | Omit<UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
};
|
|
||||||
export type UpdateOperation = OakOperation<"update", UpdateOperationData, Filter>;
|
|
||||||
type RemoveOperationData = {} & {
|
|
||||||
parent?: Omit<UpdateOperation | RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
} & {
|
|
||||||
[k: string]: any;
|
|
||||||
addresss$area?: Omit<Address.UpdateOperation | Address.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
areas$parent?: Omit<UpdateOperation | RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
};
|
|
||||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter>;
|
|
||||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
||||||
export type AreaIdSubQuery = Selection<AreaIdProjection>;
|
|
||||||
export type NativeAttr = OpAttr | `parent.${OpAttr}` | `parent.parent.${OpAttr}` | `parent.parent.parent.${OpAttr}`;
|
|
||||||
export type FullAttr = NativeAttr | `addresss$${number}.${Address.NativeAttr}` | `areas$${number}.${NativeAttr}`;
|
|
||||||
export type EntityDef = {
|
|
||||||
Schema: Schema;
|
|
||||||
OpSchema: OpSchema;
|
|
||||||
Action: GenericAction;
|
|
||||||
Selection: Selection;
|
|
||||||
Operation: Operation;
|
|
||||||
};
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
import { StorageDesc } from "../../types/Storage";
|
|
||||||
import { OpSchema } from "./Schema";
|
|
||||||
export const desc: StorageDesc<OpSchema> = {
|
|
||||||
attributes: {
|
|
||||||
name: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
level: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
parentId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "area"
|
|
||||||
},
|
|
||||||
code: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 12
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
import { EntityDef as Address } from "./Address/Schema";
|
|
||||||
import { EntityDef as Application } from "./Application/Schema";
|
|
||||||
import { EntityDef as Area } from "./Area/Schema";
|
|
||||||
import { EntityDef as ExtraFile } from "./ExtraFile/Schema";
|
|
||||||
import { EntityDef as Mobile } from "./Mobile/Schema";
|
|
||||||
import { EntityDef as UserSystem } from "./UserSystem/Schema";
|
|
||||||
import { EntityDef as System } from "./System/Schema";
|
|
||||||
import { EntityDef as Token } from "./Token/Schema";
|
|
||||||
import { EntityDef as User } from "./User/Schema";
|
|
||||||
import { EntityDef as WechatUser } from "./WechatUser/Schema";
|
|
||||||
export type EntityDict = {
|
|
||||||
address: Address;
|
|
||||||
application: Application;
|
|
||||||
area: Area;
|
|
||||||
extraFile: ExtraFile;
|
|
||||||
mobile: Mobile;
|
|
||||||
userSystem: UserSystem;
|
|
||||||
system: System;
|
|
||||||
token: Token;
|
|
||||||
user: User;
|
|
||||||
wechatUser: WechatUser;
|
|
||||||
};
|
|
||||||
|
|
@ -1,191 +0,0 @@
|
||||||
import { String, Int, Float, Double, Boolean, Text, Datetime, File, Image, PrimaryKey, ForeignKey } from "../../types/DataType";
|
|
||||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
||||||
import { OneOf, ValueOf } from "../../types/Polyfill";
|
|
||||||
import * as SubQuery from "../_SubQuery";
|
|
||||||
import { FormCreateData, FormUpdateData, Operation as OakOperation } from "../../types/Entity";
|
|
||||||
import { GenericAction } from "../../actions/action";
|
|
||||||
import * as Application from "../Application/Schema";
|
|
||||||
import * as User from "../User/Schema";
|
|
||||||
export type OpSchema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
origin: 'qiniu';
|
|
||||||
type: 'image' | 'pdf' | 'video' | 'audio' | 'file';
|
|
||||||
bucket: String<16>;
|
|
||||||
objectId: String<64>;
|
|
||||||
tag1: String<16>;
|
|
||||||
tag2: String<16>;
|
|
||||||
filename: String<64>;
|
|
||||||
md5: Text;
|
|
||||||
entity: "application" | "user" | string;
|
|
||||||
entityId: String<64>;
|
|
||||||
};
|
|
||||||
export type OpAttr = keyof OpSchema;
|
|
||||||
export type Schema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
origin: 'qiniu';
|
|
||||||
type: 'image' | 'pdf' | 'video' | 'audio' | 'file';
|
|
||||||
bucket: String<16>;
|
|
||||||
objectId: String<64>;
|
|
||||||
tag1: String<16>;
|
|
||||||
tag2: String<16>;
|
|
||||||
filename: String<64>;
|
|
||||||
md5: Text;
|
|
||||||
entity: "application" | "user" | string;
|
|
||||||
entityId: String<64>;
|
|
||||||
application?: Application.Schema;
|
|
||||||
user?: User.Schema;
|
|
||||||
} & {
|
|
||||||
[A in ExpressionKey]?: any;
|
|
||||||
};
|
|
||||||
type AttrFilter<E> = {
|
|
||||||
id: Q_StringValue | SubQuery.ExtraFileIdSubQuery;
|
|
||||||
$$createAt$$: Q_DateValue;
|
|
||||||
$$updateAt$$: Q_DateValue;
|
|
||||||
origin: Q_EnumValue<'qiniu'>;
|
|
||||||
type: Q_EnumValue<'image' | 'pdf' | 'video' | 'audio' | 'file'>;
|
|
||||||
bucket: Q_StringValue;
|
|
||||||
objectId: Q_StringValue;
|
|
||||||
tag1: Q_StringValue;
|
|
||||||
tag2: Q_StringValue;
|
|
||||||
filename: Q_StringValue;
|
|
||||||
md5: Q_StringValue;
|
|
||||||
entity: E;
|
|
||||||
entityId: Q_StringValue;
|
|
||||||
};
|
|
||||||
export type Filter<E = Q_EnumValue<"application" | "user" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr>>;
|
|
||||||
export type Projection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$?: 1;
|
|
||||||
$$updateAt$$?: 1;
|
|
||||||
origin?: 1;
|
|
||||||
type?: 1;
|
|
||||||
bucket?: 1;
|
|
||||||
objectId?: 1;
|
|
||||||
tag1?: 1;
|
|
||||||
tag2?: 1;
|
|
||||||
filename?: 1;
|
|
||||||
md5?: 1;
|
|
||||||
entity?: 1;
|
|
||||||
entityId?: 1;
|
|
||||||
application?: Application.Projection;
|
|
||||||
user?: User.Projection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
export type ExportProjection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id?: string;
|
|
||||||
$$createAt$$?: string;
|
|
||||||
$$updateAt$$?: string;
|
|
||||||
origin?: string;
|
|
||||||
type?: string;
|
|
||||||
bucket?: string;
|
|
||||||
objectId?: string;
|
|
||||||
tag1?: string;
|
|
||||||
tag2?: string;
|
|
||||||
filename?: string;
|
|
||||||
md5?: string;
|
|
||||||
entity?: string;
|
|
||||||
entityId?: string;
|
|
||||||
application?: Application.ExportProjection;
|
|
||||||
user?: User.ExportProjection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
type ExtraFileIdProjection = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
}>;
|
|
||||||
type ApplicationIdProjection = OneOf<{
|
|
||||||
entityId: 1;
|
|
||||||
}>;
|
|
||||||
type UserIdProjection = OneOf<{
|
|
||||||
entityId: 1;
|
|
||||||
}>;
|
|
||||||
export type SortAttr = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$: 1;
|
|
||||||
$$updateAt$$: 1;
|
|
||||||
origin: 1;
|
|
||||||
type: 1;
|
|
||||||
bucket: 1;
|
|
||||||
objectId: 1;
|
|
||||||
tag1: 1;
|
|
||||||
tag2: 1;
|
|
||||||
filename: 1;
|
|
||||||
md5: 1;
|
|
||||||
entity: 1;
|
|
||||||
entityId: 1;
|
|
||||||
application: Application.SortAttr;
|
|
||||||
user: User.SortAttr;
|
|
||||||
[k: string]: any;
|
|
||||||
} & ExprOp<OpAttr>>;
|
|
||||||
export type SortNode = {
|
|
||||||
$attr: SortAttr;
|
|
||||||
$direction?: "asc" | "desc";
|
|
||||||
};
|
|
||||||
export type Sorter = SortNode[];
|
|
||||||
export type SelectOperation<P = Projection> = OakOperation<"select", P, Filter, Sorter>;
|
|
||||||
export type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
||||||
export type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
||||||
type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId"> & ({
|
|
||||||
entity: "application" | "user" | string;
|
|
||||||
entityId: String<64>;
|
|
||||||
} | ({
|
|
||||||
entity?: undefined;
|
|
||||||
entityId?: undefined;
|
|
||||||
} & OneOf<{
|
|
||||||
application: Application.CreateSingleOperation | (Application.UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
user: User.CreateSingleOperation | (User.UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
[K: string]: any;
|
|
||||||
}>)) & {
|
|
||||||
[k: string]: any;
|
|
||||||
}>;
|
|
||||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
||||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
||||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
||||||
type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "entityId">> & ({
|
|
||||||
entity?: "application" | "user" | string;
|
|
||||||
entityId?: String<64>;
|
|
||||||
application?: undefined;
|
|
||||||
user?: undefined;
|
|
||||||
} | ({
|
|
||||||
entity?: undefined;
|
|
||||||
entityId?: undefined;
|
|
||||||
} & OneOf<{
|
|
||||||
application: Application.CreateSingleOperation | Omit<Application.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
user: User.CreateSingleOperation | Omit<User.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
[K: string]: any;
|
|
||||||
}>)) & {
|
|
||||||
[k: string]: any;
|
|
||||||
};
|
|
||||||
export type UpdateOperation = OakOperation<"update", UpdateOperationData, Filter>;
|
|
||||||
type RemoveOperationData = {} & OneOf<{
|
|
||||||
application?: Omit<Application.UpdateOperation | Application.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
user?: Omit<User.UpdateOperation | User.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
[K: string]: any;
|
|
||||||
}> & {
|
|
||||||
[k: string]: any;
|
|
||||||
};
|
|
||||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter>;
|
|
||||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
||||||
export type ApplicationIdSubQuery = Selection<ApplicationIdProjection>;
|
|
||||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
|
||||||
export type ExtraFileIdSubQuery = Selection<ExtraFileIdProjection>;
|
|
||||||
export type NativeAttr = OpAttr | `entity.${Application.NativeAttr}` | `entity.${User.NativeAttr}`;
|
|
||||||
export type FullAttr = NativeAttr;
|
|
||||||
export type EntityDef = {
|
|
||||||
Schema: Schema;
|
|
||||||
OpSchema: OpSchema;
|
|
||||||
Action: GenericAction;
|
|
||||||
Selection: Selection;
|
|
||||||
Operation: Operation;
|
|
||||||
};
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
import { StorageDesc } from "../../types/Storage";
|
|
||||||
import { OpSchema } from "./Schema";
|
|
||||||
export const desc: StorageDesc<OpSchema> = {
|
|
||||||
attributes: {
|
|
||||||
origin: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
bucket: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
objectId: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 64
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tag1: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tag2: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
filename: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 64
|
|
||||||
}
|
|
||||||
},
|
|
||||||
md5: {
|
|
||||||
type: "text"
|
|
||||||
},
|
|
||||||
entity: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
entityId: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 64
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
import { String, Int, Float, Double, Boolean, Text, Datetime, File, Image, PrimaryKey, ForeignKey } from "../../types/DataType";
|
|
||||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
||||||
import { OneOf, ValueOf } from "../../types/Polyfill";
|
|
||||||
import * as SubQuery from "../_SubQuery";
|
|
||||||
import { FormCreateData, FormUpdateData, Operation as OakOperation } from "../../types/Entity";
|
|
||||||
import { GenericAction } from "../../actions/action";
|
|
||||||
import * as User from "../User/Schema";
|
|
||||||
import * as Token from "../Token/Schema";
|
|
||||||
export type OpSchema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
mobile: String<16>;
|
|
||||||
userId: ForeignKey<"user">;
|
|
||||||
};
|
|
||||||
export type OpAttr = keyof OpSchema;
|
|
||||||
export type Schema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
mobile: String<16>;
|
|
||||||
userId: ForeignKey<"user">;
|
|
||||||
user: User.Schema;
|
|
||||||
token$entity?: Array<Token.Schema>;
|
|
||||||
} & {
|
|
||||||
[A in ExpressionKey]?: any;
|
|
||||||
};
|
|
||||||
type AttrFilter = {
|
|
||||||
id: Q_StringValue | SubQuery.MobileIdSubQuery;
|
|
||||||
$$createAt$$: Q_DateValue;
|
|
||||||
$$updateAt$$: Q_DateValue;
|
|
||||||
mobile: Q_StringValue;
|
|
||||||
userId: Q_StringValue | SubQuery.UserIdSubQuery;
|
|
||||||
user: User.Filter;
|
|
||||||
};
|
|
||||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr>>;
|
|
||||||
export type Projection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$?: 1;
|
|
||||||
$$updateAt$$?: 1;
|
|
||||||
mobile?: 1;
|
|
||||||
userId?: 1;
|
|
||||||
user?: User.Projection;
|
|
||||||
token$entity?: Token.Selection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
export type ExportProjection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id?: string;
|
|
||||||
$$createAt$$?: string;
|
|
||||||
$$updateAt$$?: string;
|
|
||||||
mobile?: string;
|
|
||||||
userId?: string;
|
|
||||||
user?: User.ExportProjection;
|
|
||||||
token$entity?: Token.Exportation;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
type MobileIdProjection = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
}>;
|
|
||||||
type UserIdProjection = OneOf<{
|
|
||||||
userId: 1;
|
|
||||||
}>;
|
|
||||||
export type SortAttr = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$: 1;
|
|
||||||
$$updateAt$$: 1;
|
|
||||||
mobile: 1;
|
|
||||||
userId: 1;
|
|
||||||
user: User.SortAttr;
|
|
||||||
} & ExprOp<OpAttr>>;
|
|
||||||
export type SortNode = {
|
|
||||||
$attr: SortAttr;
|
|
||||||
$direction?: "asc" | "desc";
|
|
||||||
};
|
|
||||||
export type Sorter = SortNode[];
|
|
||||||
export type SelectOperation<P = Projection> = OakOperation<"select", P, Filter, Sorter>;
|
|
||||||
export type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
||||||
export type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
||||||
type CreateOperationData = FormCreateData<Omit<OpSchema, "userId" | "user"> & ({
|
|
||||||
user?: User.CreateSingleOperation | (User.UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
userId?: undefined;
|
|
||||||
} | {
|
|
||||||
user?: undefined;
|
|
||||||
userId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
token$entity?: Token.CreateOperation | Token.UpdateOperation;
|
|
||||||
}>;
|
|
||||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
||||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
||||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
||||||
type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId" | "user">> & ({
|
|
||||||
user?: User.CreateSingleOperation | Omit<User.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
userId?: undefined;
|
|
||||||
} | {
|
|
||||||
user?: undefined;
|
|
||||||
userId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
tokens$entity?: Token.CreateOperation | Omit<Token.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
};
|
|
||||||
export type UpdateOperation = OakOperation<"update", UpdateOperationData, Filter>;
|
|
||||||
type RemoveOperationData = {} & {
|
|
||||||
user?: Omit<User.UpdateOperation | User.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
} & {
|
|
||||||
[k: string]: any;
|
|
||||||
tokens$entity?: Omit<Token.UpdateOperation | Token.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
};
|
|
||||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter>;
|
|
||||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
||||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
|
||||||
export type MobileIdSubQuery = Selection<MobileIdProjection>;
|
|
||||||
export type NativeAttr = OpAttr | `user.${User.NativeAttr}`;
|
|
||||||
export type FullAttr = NativeAttr | `tokens$${number}.${Token.NativeAttr}`;
|
|
||||||
export type EntityDef = {
|
|
||||||
Schema: Schema;
|
|
||||||
OpSchema: OpSchema;
|
|
||||||
Action: GenericAction;
|
|
||||||
Selection: Selection;
|
|
||||||
Operation: Operation;
|
|
||||||
};
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
import { StorageDesc } from "../../types/Storage";
|
|
||||||
import { OpSchema } from "./Schema";
|
|
||||||
export const desc: StorageDesc<OpSchema> = {
|
|
||||||
attributes: {
|
|
||||||
mobile: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "user"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
import { StorageSchema } from "../types/Storage";
|
|
||||||
import { EntityDict } from "./EntityDict";
|
|
||||||
import { desc as addressDesc } from "./Address/Storage";
|
|
||||||
import { desc as applicationDesc } from "./Application/Storage";
|
|
||||||
import { desc as areaDesc } from "./Area/Storage";
|
|
||||||
import { desc as extraFileDesc } from "./ExtraFile/Storage";
|
|
||||||
import { desc as mobileDesc } from "./Mobile/Storage";
|
|
||||||
import { desc as userSystemDesc } from "./UserSystem/Storage";
|
|
||||||
import { desc as systemDesc } from "./System/Storage";
|
|
||||||
import { desc as tokenDesc } from "./Token/Storage";
|
|
||||||
import { desc as userDesc } from "./User/Storage";
|
|
||||||
import { desc as wechatUserDesc } from "./WechatUser/Storage";
|
|
||||||
export const storageSchema: StorageSchema<EntityDict> = {
|
|
||||||
address: addressDesc,
|
|
||||||
application: applicationDesc,
|
|
||||||
area: areaDesc,
|
|
||||||
extraFile: extraFileDesc,
|
|
||||||
mobile: mobileDesc,
|
|
||||||
userSystem: userSystemDesc,
|
|
||||||
system: systemDesc,
|
|
||||||
token: tokenDesc,
|
|
||||||
user: userDesc,
|
|
||||||
wechatUser: wechatUserDesc
|
|
||||||
};
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
||||||
import { String, Int, Float, Double, Boolean, Text, Datetime, File, Image, PrimaryKey, ForeignKey } from "../../types/DataType";
|
|
||||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
||||||
import { OneOf, ValueOf } from "../../types/Polyfill";
|
|
||||||
import * as SubQuery from "../_SubQuery";
|
|
||||||
import { FormCreateData, FormUpdateData, Operation as OakOperation } from "../../types/Entity";
|
|
||||||
import { GenericAction } from "../../actions/action";
|
|
||||||
import * as Application from "../Application/Schema";
|
|
||||||
import * as UserSystem from "../UserSystem/Schema";
|
|
||||||
export type OpSchema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
name: String<32>;
|
|
||||||
description: Text;
|
|
||||||
config: Object;
|
|
||||||
};
|
|
||||||
export type OpAttr = keyof OpSchema;
|
|
||||||
export type Schema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
name: String<32>;
|
|
||||||
description: Text;
|
|
||||||
config: Object;
|
|
||||||
application$system?: Array<Application.Schema>;
|
|
||||||
userSystem$system?: Array<UserSystem.Schema>;
|
|
||||||
} & {
|
|
||||||
[A in ExpressionKey]?: any;
|
|
||||||
};
|
|
||||||
type AttrFilter = {
|
|
||||||
id: Q_StringValue | SubQuery.SystemIdSubQuery;
|
|
||||||
$$createAt$$: Q_DateValue;
|
|
||||||
$$updateAt$$: Q_DateValue;
|
|
||||||
name: Q_StringValue;
|
|
||||||
description: Q_StringValue;
|
|
||||||
};
|
|
||||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr>>;
|
|
||||||
export type Projection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$?: 1;
|
|
||||||
$$updateAt$$?: 1;
|
|
||||||
name?: 1;
|
|
||||||
description?: 1;
|
|
||||||
config?: 1;
|
|
||||||
application$system?: Application.Selection;
|
|
||||||
userSystem$system?: UserSystem.Selection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
export type ExportProjection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id?: string;
|
|
||||||
$$createAt$$?: string;
|
|
||||||
$$updateAt$$?: string;
|
|
||||||
name?: string;
|
|
||||||
description?: string;
|
|
||||||
config?: string;
|
|
||||||
application$system?: Application.Exportation;
|
|
||||||
userSystem$system?: UserSystem.Exportation;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
type SystemIdProjection = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
}>;
|
|
||||||
export type SortAttr = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$: 1;
|
|
||||||
$$updateAt$$: 1;
|
|
||||||
name: 1;
|
|
||||||
description: 1;
|
|
||||||
} & ExprOp<OpAttr>>;
|
|
||||||
export type SortNode = {
|
|
||||||
$attr: SortAttr;
|
|
||||||
$direction?: "asc" | "desc";
|
|
||||||
};
|
|
||||||
export type Sorter = SortNode[];
|
|
||||||
export type SelectOperation<P = Projection> = OakOperation<"select", P, Filter, Sorter>;
|
|
||||||
export type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
||||||
export type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
||||||
type CreateOperationData = FormCreateData<OpSchema & {
|
|
||||||
[k: string]: any;
|
|
||||||
application$system?: Application.CreateOperation | Application.UpdateOperation;
|
|
||||||
userSystem$system?: UserSystem.CreateOperation | UserSystem.UpdateOperation;
|
|
||||||
}>;
|
|
||||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
||||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
||||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
||||||
type UpdateOperationData = FormUpdateData<OpSchema> & {
|
|
||||||
[k: string]: any;
|
|
||||||
applications$system?: Application.CreateOperation | Omit<Application.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
userSystems$system?: UserSystem.CreateOperation | Omit<UserSystem.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
};
|
|
||||||
export type UpdateOperation = OakOperation<"update", UpdateOperationData, Filter>;
|
|
||||||
type RemoveOperationData = {} & {
|
|
||||||
[k: string]: any;
|
|
||||||
applications$system?: Omit<Application.UpdateOperation | Application.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
userSystems$system?: Omit<UserSystem.UpdateOperation | UserSystem.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
};
|
|
||||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter>;
|
|
||||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
||||||
export type SystemIdSubQuery = Selection<SystemIdProjection>;
|
|
||||||
export type NativeAttr = OpAttr;
|
|
||||||
export type FullAttr = NativeAttr | `applications$${number}.${Application.NativeAttr}` | `userSystems$${number}.${UserSystem.NativeAttr}`;
|
|
||||||
export type EntityDef = {
|
|
||||||
Schema: Schema;
|
|
||||||
OpSchema: OpSchema;
|
|
||||||
Action: GenericAction;
|
|
||||||
Selection: Selection;
|
|
||||||
Operation: Operation;
|
|
||||||
};
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
import { StorageDesc } from "../../types/Storage";
|
|
||||||
import { OpSchema } from "./Schema";
|
|
||||||
export const desc: StorageDesc<OpSchema> = {
|
|
||||||
attributes: {
|
|
||||||
name: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: "text"
|
|
||||||
},
|
|
||||||
config: {
|
|
||||||
type: "object"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
import { AbleAction } from "../../actions/action";
|
|
||||||
import { ActionDef } from "../../types/Action";
|
|
||||||
import { GenericAction } from "../../actions/action";
|
|
||||||
export type ParticularAction = AbleAction;
|
|
||||||
export type Action = GenericAction | ParticularAction;
|
|
||||||
|
|
@ -1,180 +0,0 @@
|
||||||
import { String, Int, Float, Double, Boolean, Text, Datetime, File, Image, PrimaryKey, ForeignKey } from "../../types/DataType";
|
|
||||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
||||||
import { OneOf, ValueOf } from "../../types/Polyfill";
|
|
||||||
import * as SubQuery from "../_SubQuery";
|
|
||||||
import { FormCreateData, FormUpdateData, Operation as OakOperation } from "../../types/Entity";
|
|
||||||
import { AbleState } from "../../actions/action";
|
|
||||||
import { ParticularAction, Action } from "./Action";
|
|
||||||
import * as Application from "../Application/Schema";
|
|
||||||
import * as User from "../User/Schema";
|
|
||||||
import * as Mobile from "../Mobile/Schema";
|
|
||||||
export type OpSchema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
applicationId: ForeignKey<"application">;
|
|
||||||
entity: "mobile" | string;
|
|
||||||
entityId: String<64>;
|
|
||||||
userId?: ForeignKey<"user">;
|
|
||||||
playerId?: ForeignKey<"user">;
|
|
||||||
ableState?: AbleState;
|
|
||||||
};
|
|
||||||
export type OpAttr = keyof OpSchema;
|
|
||||||
export type Schema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
applicationId: ForeignKey<"application">;
|
|
||||||
entity: "mobile" | string;
|
|
||||||
entityId: String<64>;
|
|
||||||
userId?: ForeignKey<"user">;
|
|
||||||
playerId?: ForeignKey<"user">;
|
|
||||||
ableState?: AbleState;
|
|
||||||
application: Application.Schema;
|
|
||||||
user?: User.Schema;
|
|
||||||
player?: User.Schema;
|
|
||||||
mobile?: Mobile.Schema;
|
|
||||||
} & {
|
|
||||||
[A in ExpressionKey]?: any;
|
|
||||||
};
|
|
||||||
type AttrFilter<E> = {
|
|
||||||
id: Q_StringValue | SubQuery.TokenIdSubQuery;
|
|
||||||
$$createAt$$: Q_DateValue;
|
|
||||||
$$updateAt$$: Q_DateValue;
|
|
||||||
applicationId: Q_StringValue | SubQuery.ApplicationIdSubQuery;
|
|
||||||
application: Application.Filter;
|
|
||||||
entity: E;
|
|
||||||
entityId: Q_StringValue;
|
|
||||||
userId: Q_StringValue | SubQuery.UserIdSubQuery;
|
|
||||||
user: User.Filter;
|
|
||||||
playerId: Q_StringValue | SubQuery.UserIdSubQuery;
|
|
||||||
player: User.Filter;
|
|
||||||
ableState: Q_EnumValue<AbleState>;
|
|
||||||
};
|
|
||||||
export type Filter<E = Q_EnumValue<"mobile" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr>>;
|
|
||||||
export type Projection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$?: 1;
|
|
||||||
$$updateAt$$?: 1;
|
|
||||||
applicationId?: 1;
|
|
||||||
application?: Application.Projection;
|
|
||||||
entity?: 1;
|
|
||||||
entityId?: 1;
|
|
||||||
userId?: 1;
|
|
||||||
user?: User.Projection;
|
|
||||||
playerId?: 1;
|
|
||||||
player?: User.Projection;
|
|
||||||
ableState?: 1;
|
|
||||||
mobile?: Mobile.Projection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
export type ExportProjection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id?: string;
|
|
||||||
$$createAt$$?: string;
|
|
||||||
$$updateAt$$?: string;
|
|
||||||
applicationId?: string;
|
|
||||||
application?: Application.ExportProjection;
|
|
||||||
entity?: string;
|
|
||||||
entityId?: string;
|
|
||||||
userId?: string;
|
|
||||||
user?: User.ExportProjection;
|
|
||||||
playerId?: string;
|
|
||||||
player?: User.ExportProjection;
|
|
||||||
ableState?: string;
|
|
||||||
mobile?: Mobile.ExportProjection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
type TokenIdProjection = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
}>;
|
|
||||||
type ApplicationIdProjection = OneOf<{
|
|
||||||
applicationId: 1;
|
|
||||||
}>;
|
|
||||||
type UserIdProjection = OneOf<{
|
|
||||||
userId: 1;
|
|
||||||
playerId: 1;
|
|
||||||
}>;
|
|
||||||
type MobileIdProjection = OneOf<{
|
|
||||||
entityId: 1;
|
|
||||||
}>;
|
|
||||||
export type SortAttr = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$: 1;
|
|
||||||
$$updateAt$$: 1;
|
|
||||||
applicationId: 1;
|
|
||||||
application: Application.SortAttr;
|
|
||||||
entity: 1;
|
|
||||||
entityId: 1;
|
|
||||||
userId: 1;
|
|
||||||
user: User.SortAttr;
|
|
||||||
playerId: 1;
|
|
||||||
player: User.SortAttr;
|
|
||||||
ableState: 1;
|
|
||||||
mobile: Mobile.SortAttr;
|
|
||||||
[k: string]: any;
|
|
||||||
} & ExprOp<OpAttr>>;
|
|
||||||
export type SortNode = {
|
|
||||||
$attr: SortAttr;
|
|
||||||
$direction?: "asc" | "desc";
|
|
||||||
};
|
|
||||||
export type Sorter = SortNode[];
|
|
||||||
export type SelectOperation<P = Projection> = OakOperation<"select", P, Filter, Sorter>;
|
|
||||||
export type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
||||||
export type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
||||||
type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId"> & ({
|
|
||||||
entity: "mobile" | string;
|
|
||||||
entityId: String<64>;
|
|
||||||
} | ({
|
|
||||||
entity?: undefined;
|
|
||||||
entityId?: undefined;
|
|
||||||
} & OneOf<{
|
|
||||||
mobile: Mobile.CreateSingleOperation | (Mobile.UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
[K: string]: any;
|
|
||||||
}>)) & {
|
|
||||||
[k: string]: any;
|
|
||||||
}>;
|
|
||||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
||||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
||||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
||||||
type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "entityId">> & ({
|
|
||||||
entity?: "mobile" | string;
|
|
||||||
entityId?: String<64>;
|
|
||||||
mobile?: undefined;
|
|
||||||
} | ({
|
|
||||||
entity?: undefined;
|
|
||||||
entityId?: undefined;
|
|
||||||
} & OneOf<{
|
|
||||||
mobile: Mobile.CreateSingleOperation | Omit<Mobile.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
[K: string]: any;
|
|
||||||
}>)) & {
|
|
||||||
[k: string]: any;
|
|
||||||
};
|
|
||||||
export type UpdateOperation = OakOperation<ParticularAction | "update", UpdateOperationData, Filter>;
|
|
||||||
type RemoveOperationData = {} & OneOf<{
|
|
||||||
mobile?: Omit<Mobile.UpdateOperation | Mobile.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
[K: string]: any;
|
|
||||||
}> & {
|
|
||||||
[k: string]: any;
|
|
||||||
};
|
|
||||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter>;
|
|
||||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
||||||
export type ApplicationIdSubQuery = Selection<ApplicationIdProjection>;
|
|
||||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
|
||||||
export type MobileIdSubQuery = Selection<MobileIdProjection>;
|
|
||||||
export type TokenIdSubQuery = Selection<TokenIdProjection>;
|
|
||||||
export type NativeAttr = OpAttr | `application.${Application.NativeAttr}` | `user.${User.NativeAttr}` | `player.${User.NativeAttr}` | `entity.${Mobile.NativeAttr}`;
|
|
||||||
export type FullAttr = NativeAttr;
|
|
||||||
export type EntityDef = {
|
|
||||||
Schema: Schema;
|
|
||||||
OpSchema: OpSchema;
|
|
||||||
Action: Action;
|
|
||||||
Selection: Selection;
|
|
||||||
Operation: Operation;
|
|
||||||
ParticularAction: ParticularAction;
|
|
||||||
};
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
import { StorageDesc } from "../../types/Storage";
|
|
||||||
import { OpSchema } from "./Schema";
|
|
||||||
export const desc: StorageDesc<OpSchema> = {
|
|
||||||
attributes: {
|
|
||||||
applicationId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "application"
|
|
||||||
},
|
|
||||||
entity: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
entityId: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 64
|
|
||||||
}
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "user"
|
|
||||||
},
|
|
||||||
playerId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "user"
|
|
||||||
},
|
|
||||||
ableState: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
import { ActionDef } from "../../types/Action";
|
|
||||||
import { GenericAction } from "../../actions/action";
|
|
||||||
type IdAction = 'verify' | 'accept' | 'reject';
|
|
||||||
export type IdState = 'unverified' | 'verified' | 'verifying';
|
|
||||||
const IdActionDef: ActionDef<IdAction, IdState> = {
|
|
||||||
stm: {
|
|
||||||
verify: ['unverified', 'verifying'],
|
|
||||||
accept: [['unverified', 'verifying'], 'verified'],
|
|
||||||
reject: [['verifying', 'verified'], 'unverified']
|
|
||||||
},
|
|
||||||
is: 'unverified'
|
|
||||||
};
|
|
||||||
type UserAction = 'activate' | 'disable' | 'enable' | 'mergeTo' | 'mergeFrom';
|
|
||||||
export type UserState = 'shadow' | 'normal' | 'disabled' | 'merged';
|
|
||||||
const UserActionDef: ActionDef<UserAction, UserState> = {
|
|
||||||
stm: {
|
|
||||||
activate: ['shadow', 'normal'],
|
|
||||||
disable: [['normal', 'shadow'], 'disabled'],
|
|
||||||
enable: ['disabled', 'normal'],
|
|
||||||
mergeTo: [['normal', 'shadow'], 'merged'],
|
|
||||||
mergeFrom: ['normal', 'normal']
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export type ParticularAction = UserAction | IdAction;
|
|
||||||
export type Action = GenericAction | ParticularAction;
|
|
||||||
|
|
@ -1,218 +0,0 @@
|
||||||
import { String, Int, Float, Double, Boolean, Text, Datetime, File, Image, PrimaryKey, ForeignKey } from "../../types/DataType";
|
|
||||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
||||||
import { OneOf, ValueOf } from "../../types/Polyfill";
|
|
||||||
import * as SubQuery from "../_SubQuery";
|
|
||||||
import { FormCreateData, FormUpdateData, Operation as OakOperation } from "../../types/Entity";
|
|
||||||
import { UserState, IdState, ParticularAction, Action } from "./Action";
|
|
||||||
import * as Mobile from "../Mobile/Schema";
|
|
||||||
import * as UserSystem from "../UserSystem/Schema";
|
|
||||||
import * as Token from "../Token/Schema";
|
|
||||||
import * as WechatUser from "../WechatUser/Schema";
|
|
||||||
import * as ExtraFile from "../ExtraFile/Schema";
|
|
||||||
export type OpSchema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
name: String<16>;
|
|
||||||
nickname?: String<64>;
|
|
||||||
password?: Text;
|
|
||||||
birth?: Datetime;
|
|
||||||
gender?: 'male' | 'female';
|
|
||||||
avatar?: Image;
|
|
||||||
idCardType?: 'ID-Card' | 'passport' | 'Mainland-passport';
|
|
||||||
idNumber?: String<32>;
|
|
||||||
refId?: ForeignKey<"user">;
|
|
||||||
userState?: UserState;
|
|
||||||
idState?: IdState;
|
|
||||||
};
|
|
||||||
export type OpAttr = keyof OpSchema;
|
|
||||||
export type Schema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
name: String<16>;
|
|
||||||
nickname?: String<64>;
|
|
||||||
password?: Text;
|
|
||||||
birth?: Datetime;
|
|
||||||
gender?: 'male' | 'female';
|
|
||||||
avatar?: Image;
|
|
||||||
idCardType?: 'ID-Card' | 'passport' | 'Mainland-passport';
|
|
||||||
idNumber?: String<32>;
|
|
||||||
refId?: ForeignKey<"user">;
|
|
||||||
userState?: UserState;
|
|
||||||
idState?: IdState;
|
|
||||||
ref?: Schema;
|
|
||||||
mobile$user?: Array<Mobile.Schema>;
|
|
||||||
userSystem$user?: Array<UserSystem.Schema>;
|
|
||||||
token$user?: Array<Token.Schema>;
|
|
||||||
token$player?: Array<Token.Schema>;
|
|
||||||
user$ref?: Array<Schema>;
|
|
||||||
wechatUser$user?: Array<WechatUser.Schema>;
|
|
||||||
extraFile$entity?: Array<ExtraFile.Schema>;
|
|
||||||
} & {
|
|
||||||
[A in ExpressionKey]?: any;
|
|
||||||
};
|
|
||||||
type AttrFilter = {
|
|
||||||
id: Q_StringValue | SubQuery.UserIdSubQuery;
|
|
||||||
$$createAt$$: Q_DateValue;
|
|
||||||
$$updateAt$$: Q_DateValue;
|
|
||||||
name: Q_StringValue;
|
|
||||||
nickname: Q_StringValue;
|
|
||||||
password: Q_StringValue;
|
|
||||||
birth: Q_DateValue;
|
|
||||||
gender: Q_EnumValue<'male' | 'female'>;
|
|
||||||
avatar: Q_StringValue;
|
|
||||||
idCardType: Q_EnumValue<'ID-Card' | 'passport' | 'Mainland-passport'>;
|
|
||||||
idNumber: Q_StringValue;
|
|
||||||
refId: Q_StringValue | SubQuery.UserIdSubQuery;
|
|
||||||
ref: Filter;
|
|
||||||
userState: Q_EnumValue<UserState>;
|
|
||||||
idState: Q_EnumValue<IdState>;
|
|
||||||
};
|
|
||||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr> & FulltextFilter>;
|
|
||||||
export type Projection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$?: 1;
|
|
||||||
$$updateAt$$?: 1;
|
|
||||||
name?: 1;
|
|
||||||
nickname?: 1;
|
|
||||||
password?: 1;
|
|
||||||
birth?: 1;
|
|
||||||
gender?: 1;
|
|
||||||
avatar?: 1;
|
|
||||||
idCardType?: 1;
|
|
||||||
idNumber?: 1;
|
|
||||||
refId?: 1;
|
|
||||||
ref?: Projection;
|
|
||||||
userState?: 1;
|
|
||||||
idState?: 1;
|
|
||||||
mobile$user?: Mobile.Selection;
|
|
||||||
userSystem$user?: UserSystem.Selection;
|
|
||||||
token$user?: Token.Selection;
|
|
||||||
token$player?: Token.Selection;
|
|
||||||
user$ref?: Selection;
|
|
||||||
wechatUser$user?: WechatUser.Selection;
|
|
||||||
extraFile$entity?: ExtraFile.Selection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
export type ExportProjection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id?: string;
|
|
||||||
$$createAt$$?: string;
|
|
||||||
$$updateAt$$?: string;
|
|
||||||
name?: string;
|
|
||||||
nickname?: string;
|
|
||||||
password?: string;
|
|
||||||
birth?: string;
|
|
||||||
gender?: string;
|
|
||||||
avatar?: string;
|
|
||||||
idCardType?: string;
|
|
||||||
idNumber?: string;
|
|
||||||
refId?: string;
|
|
||||||
ref?: ExportProjection;
|
|
||||||
userState?: string;
|
|
||||||
idState?: string;
|
|
||||||
mobile$user?: Mobile.Exportation;
|
|
||||||
userSystem$user?: UserSystem.Exportation;
|
|
||||||
token$user?: Token.Exportation;
|
|
||||||
token$player?: Token.Exportation;
|
|
||||||
user$ref?: Exportation;
|
|
||||||
wechatUser$user?: WechatUser.Exportation;
|
|
||||||
extraFile$entity?: ExtraFile.Exportation;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
type UserIdProjection = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
refId: 1;
|
|
||||||
}>;
|
|
||||||
export type SortAttr = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$: 1;
|
|
||||||
$$updateAt$$: 1;
|
|
||||||
name: 1;
|
|
||||||
nickname: 1;
|
|
||||||
password: 1;
|
|
||||||
birth: 1;
|
|
||||||
gender: 1;
|
|
||||||
avatar: 1;
|
|
||||||
idCardType: 1;
|
|
||||||
idNumber: 1;
|
|
||||||
refId: 1;
|
|
||||||
ref: SortAttr;
|
|
||||||
userState: 1;
|
|
||||||
idState: 1;
|
|
||||||
} & ExprOp<OpAttr>>;
|
|
||||||
export type SortNode = {
|
|
||||||
$attr: SortAttr;
|
|
||||||
$direction?: "asc" | "desc";
|
|
||||||
};
|
|
||||||
export type Sorter = SortNode[];
|
|
||||||
export type SelectOperation<P = Projection> = OakOperation<"select", P, Filter, Sorter>;
|
|
||||||
export type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
||||||
export type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
||||||
type CreateOperationData = FormCreateData<Omit<OpSchema, "refId" | "ref"> & ({
|
|
||||||
ref?: CreateSingleOperation | (UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
refId?: undefined;
|
|
||||||
} | {
|
|
||||||
ref?: undefined;
|
|
||||||
refId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
mobile$user?: Mobile.CreateOperation | Mobile.UpdateOperation;
|
|
||||||
userSystem$user?: UserSystem.CreateOperation | UserSystem.UpdateOperation;
|
|
||||||
token$user?: Token.CreateOperation | Token.UpdateOperation;
|
|
||||||
token$player?: Token.CreateOperation | Token.UpdateOperation;
|
|
||||||
user$ref?: CreateOperation | UpdateOperation;
|
|
||||||
wechatUser$user?: WechatUser.CreateOperation | WechatUser.UpdateOperation;
|
|
||||||
extraFile$entity?: ExtraFile.CreateOperation | ExtraFile.UpdateOperation;
|
|
||||||
}>;
|
|
||||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
||||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
||||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
||||||
type UpdateOperationData = FormUpdateData<Omit<OpSchema, "refId" | "ref">> & ({
|
|
||||||
ref?: CreateSingleOperation | Omit<UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
refId?: undefined;
|
|
||||||
} | {
|
|
||||||
ref?: undefined;
|
|
||||||
refId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
mobiles$user?: Mobile.CreateOperation | Omit<Mobile.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
userSystems$user?: UserSystem.CreateOperation | Omit<UserSystem.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
tokens$user?: Token.CreateOperation | Omit<Token.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
tokens$player?: Token.CreateOperation | Omit<Token.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
users$ref?: CreateOperation | Omit<UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
wechatUsers$user?: WechatUser.CreateOperation | Omit<WechatUser.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
extraFiles$entity?: ExtraFile.CreateOperation | Omit<ExtraFile.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
};
|
|
||||||
export type UpdateOperation = OakOperation<ParticularAction | "update", UpdateOperationData, Filter>;
|
|
||||||
type RemoveOperationData = {} & {
|
|
||||||
ref?: Omit<UpdateOperation | RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
} & {
|
|
||||||
[k: string]: any;
|
|
||||||
mobiles$user?: Omit<Mobile.UpdateOperation | Mobile.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
userSystems$user?: Omit<UserSystem.UpdateOperation | UserSystem.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
tokens$user?: Omit<Token.UpdateOperation | Token.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
tokens$player?: Omit<Token.UpdateOperation | Token.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
users$ref?: Omit<UpdateOperation | RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
wechatUsers$user?: Omit<WechatUser.UpdateOperation | WechatUser.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
extraFiles$entity?: Omit<ExtraFile.UpdateOperation | ExtraFile.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
};
|
|
||||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter>;
|
|
||||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
||||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
|
||||||
export type NativeAttr = OpAttr | `ref.${OpAttr}` | `ref.ref.${OpAttr}` | `ref.ref.ref.${OpAttr}`;
|
|
||||||
export type FullAttr = NativeAttr | `mobiles$${number}.${Mobile.NativeAttr}` | `userSystems$${number}.${UserSystem.NativeAttr}` | `tokens$user$${number}.${Token.NativeAttr}` | `tokens$player$${number}.${Token.NativeAttr}` | `users$${number}.${NativeAttr}` | `wechatUsers$${number}.${WechatUser.NativeAttr}` | `extraFiles$${number}.${ExtraFile.NativeAttr}`;
|
|
||||||
export type EntityDef = {
|
|
||||||
Schema: Schema;
|
|
||||||
OpSchema: OpSchema;
|
|
||||||
Action: Action;
|
|
||||||
Selection: Selection;
|
|
||||||
Operation: Operation;
|
|
||||||
ParticularAction: ParticularAction;
|
|
||||||
};
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
import { StorageDesc } from "../../types/Storage";
|
|
||||||
import { OpSchema } from "./Schema";
|
|
||||||
export const desc: StorageDesc<OpSchema> = {
|
|
||||||
attributes: {
|
|
||||||
name: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
nickname: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 64
|
|
||||||
}
|
|
||||||
},
|
|
||||||
password: {
|
|
||||||
type: "text"
|
|
||||||
},
|
|
||||||
birth: {
|
|
||||||
type: "datetime"
|
|
||||||
},
|
|
||||||
gender: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
avatar: {
|
|
||||||
type: "text"
|
|
||||||
},
|
|
||||||
idCardType: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
idNumber: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
refId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "user"
|
|
||||||
},
|
|
||||||
userState: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
idState: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
indexes: [
|
|
||||||
{
|
|
||||||
name: 'index_test2',
|
|
||||||
attributes: [
|
|
||||||
{
|
|
||||||
name: 'birth',
|
|
||||||
direction: 'ASC'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'index_test',
|
|
||||||
attributes: [
|
|
||||||
{
|
|
||||||
name: 'name'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'nickname'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
config: {
|
|
||||||
type: 'fulltext',
|
|
||||||
parser: 'ngram'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
@ -1,151 +0,0 @@
|
||||||
import { String, Int, Float, Double, Boolean, Text, Datetime, File, Image, PrimaryKey, ForeignKey } from "../../types/DataType";
|
|
||||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
||||||
import { OneOf, ValueOf } from "../../types/Polyfill";
|
|
||||||
import * as SubQuery from "../_SubQuery";
|
|
||||||
import { FormCreateData, FormUpdateData, Operation as OakOperation } from "../../types/Entity";
|
|
||||||
import { GenericAction } from "../../actions/action";
|
|
||||||
import * as User from "../User/Schema";
|
|
||||||
import * as System from "../System/Schema";
|
|
||||||
export type OpSchema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
userId: ForeignKey<"user">;
|
|
||||||
systemId: ForeignKey<"system">;
|
|
||||||
relation: 'owner';
|
|
||||||
};
|
|
||||||
export type OpAttr = keyof OpSchema;
|
|
||||||
export type Schema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
userId: ForeignKey<"user">;
|
|
||||||
systemId: ForeignKey<"system">;
|
|
||||||
relation: 'owner';
|
|
||||||
user: User.Schema;
|
|
||||||
system: System.Schema;
|
|
||||||
} & {
|
|
||||||
[A in ExpressionKey]?: any;
|
|
||||||
};
|
|
||||||
type AttrFilter = {
|
|
||||||
id: Q_StringValue | SubQuery.UserSystemIdSubQuery;
|
|
||||||
$$createAt$$: Q_DateValue;
|
|
||||||
$$updateAt$$: Q_DateValue;
|
|
||||||
userId: Q_StringValue | SubQuery.UserIdSubQuery;
|
|
||||||
user: User.Filter;
|
|
||||||
systemId: Q_StringValue | SubQuery.SystemIdSubQuery;
|
|
||||||
system: System.Filter;
|
|
||||||
relation: Q_EnumValue<'owner'>;
|
|
||||||
};
|
|
||||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr>>;
|
|
||||||
export type Projection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$?: 1;
|
|
||||||
$$updateAt$$?: 1;
|
|
||||||
userId?: 1;
|
|
||||||
user?: User.Projection;
|
|
||||||
systemId?: 1;
|
|
||||||
system?: System.Projection;
|
|
||||||
relation?: 1;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
export type ExportProjection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id?: string;
|
|
||||||
$$createAt$$?: string;
|
|
||||||
$$updateAt$$?: string;
|
|
||||||
userId?: string;
|
|
||||||
user?: User.ExportProjection;
|
|
||||||
systemId?: string;
|
|
||||||
system?: System.ExportProjection;
|
|
||||||
relation?: string;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
type UserSystemIdProjection = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
}>;
|
|
||||||
type UserIdProjection = OneOf<{
|
|
||||||
userId: 1;
|
|
||||||
}>;
|
|
||||||
type SystemIdProjection = OneOf<{
|
|
||||||
systemId: 1;
|
|
||||||
}>;
|
|
||||||
export type SortAttr = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$: 1;
|
|
||||||
$$updateAt$$: 1;
|
|
||||||
userId: 1;
|
|
||||||
user: User.SortAttr;
|
|
||||||
systemId: 1;
|
|
||||||
system: System.SortAttr;
|
|
||||||
relation: 1;
|
|
||||||
} & ExprOp<OpAttr>>;
|
|
||||||
export type SortNode = {
|
|
||||||
$attr: SortAttr;
|
|
||||||
$direction?: "asc" | "desc";
|
|
||||||
};
|
|
||||||
export type Sorter = SortNode[];
|
|
||||||
export type SelectOperation<P = Projection> = OakOperation<"select", P, Filter, Sorter>;
|
|
||||||
export type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
||||||
export type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
||||||
type CreateOperationData = FormCreateData<Omit<OpSchema, "userId" | "systemId" | "user" | "system"> & ({
|
|
||||||
user?: User.CreateSingleOperation | (User.UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
userId?: undefined;
|
|
||||||
} | {
|
|
||||||
user?: undefined;
|
|
||||||
userId?: String<64>;
|
|
||||||
}) & ({
|
|
||||||
system?: System.CreateSingleOperation | (System.UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
systemId?: undefined;
|
|
||||||
} | {
|
|
||||||
system?: undefined;
|
|
||||||
systemId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
}>;
|
|
||||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
||||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
||||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
||||||
type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId" | "systemId" | "user" | "system">> & ({
|
|
||||||
user?: User.CreateSingleOperation | Omit<User.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
userId?: undefined;
|
|
||||||
} | {
|
|
||||||
user?: undefined;
|
|
||||||
userId?: String<64>;
|
|
||||||
}) & ({
|
|
||||||
system?: System.CreateSingleOperation | Omit<System.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
systemId?: undefined;
|
|
||||||
} | {
|
|
||||||
system?: undefined;
|
|
||||||
systemId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
};
|
|
||||||
export type UpdateOperation = OakOperation<"update", UpdateOperationData, Filter>;
|
|
||||||
type RemoveOperationData = {} & {
|
|
||||||
user?: Omit<User.UpdateOperation | User.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
system?: Omit<System.UpdateOperation | System.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
} & {
|
|
||||||
[k: string]: any;
|
|
||||||
};
|
|
||||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter>;
|
|
||||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
||||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
|
||||||
export type SystemIdSubQuery = Selection<SystemIdProjection>;
|
|
||||||
export type UserSystemIdSubQuery = Selection<UserSystemIdProjection>;
|
|
||||||
export type NativeAttr = OpAttr | `user.${User.NativeAttr}` | `system.${System.NativeAttr}`;
|
|
||||||
export type FullAttr = NativeAttr;
|
|
||||||
export type EntityDef = {
|
|
||||||
Schema: Schema;
|
|
||||||
OpSchema: OpSchema;
|
|
||||||
Action: GenericAction;
|
|
||||||
Selection: Selection;
|
|
||||||
Operation: Operation;
|
|
||||||
};
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
import { StorageDesc } from "../../types/Storage";
|
|
||||||
import { OpSchema } from "./Schema";
|
|
||||||
export const desc: StorageDesc<OpSchema> = {
|
|
||||||
attributes: {
|
|
||||||
userId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "user"
|
|
||||||
},
|
|
||||||
systemId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "system"
|
|
||||||
},
|
|
||||||
relation: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,193 +0,0 @@
|
||||||
import { String, Int, Float, Double, Boolean, Text, Datetime, File, Image, PrimaryKey, ForeignKey } from "../../types/DataType";
|
|
||||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
||||||
import { OneOf, ValueOf } from "../../types/Polyfill";
|
|
||||||
import * as SubQuery from "../_SubQuery";
|
|
||||||
import { FormCreateData, FormUpdateData, Operation as OakOperation } from "../../types/Entity";
|
|
||||||
import { GenericAction } from "../../actions/action";
|
|
||||||
import * as User from "../User/Schema";
|
|
||||||
import * as Application from "../Application/Schema";
|
|
||||||
export type OpSchema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
origin: 'mp' | 'public';
|
|
||||||
openId?: String<32>;
|
|
||||||
unionId?: String<32>;
|
|
||||||
accessToken: String<32>;
|
|
||||||
sessionKey?: String<64>;
|
|
||||||
subscribed?: Boolean;
|
|
||||||
subscribedAt?: Datetime;
|
|
||||||
unsubscribedAt?: Datetime;
|
|
||||||
userId?: ForeignKey<"user">;
|
|
||||||
applicationId: ForeignKey<"application">;
|
|
||||||
};
|
|
||||||
export type OpAttr = keyof OpSchema;
|
|
||||||
export type Schema = {
|
|
||||||
id: PrimaryKey;
|
|
||||||
$$createAt$$: Datetime;
|
|
||||||
$$updateAt$$: Datetime;
|
|
||||||
$$removeAt$$?: Datetime;
|
|
||||||
origin: 'mp' | 'public';
|
|
||||||
openId?: String<32>;
|
|
||||||
unionId?: String<32>;
|
|
||||||
accessToken: String<32>;
|
|
||||||
sessionKey?: String<64>;
|
|
||||||
subscribed?: Boolean;
|
|
||||||
subscribedAt?: Datetime;
|
|
||||||
unsubscribedAt?: Datetime;
|
|
||||||
userId?: ForeignKey<"user">;
|
|
||||||
applicationId: ForeignKey<"application">;
|
|
||||||
user?: User.Schema;
|
|
||||||
application: Application.Schema;
|
|
||||||
} & {
|
|
||||||
[A in ExpressionKey]?: any;
|
|
||||||
};
|
|
||||||
type AttrFilter = {
|
|
||||||
id: Q_StringValue | SubQuery.WechatUserIdSubQuery;
|
|
||||||
$$createAt$$: Q_DateValue;
|
|
||||||
$$updateAt$$: Q_DateValue;
|
|
||||||
origin: Q_EnumValue<'mp' | 'public'>;
|
|
||||||
openId: Q_StringValue;
|
|
||||||
unionId: Q_StringValue;
|
|
||||||
accessToken: Q_StringValue;
|
|
||||||
sessionKey: Q_StringValue;
|
|
||||||
subscribed: Q_BooleanValue;
|
|
||||||
subscribedAt: Q_DateValue;
|
|
||||||
unsubscribedAt: Q_DateValue;
|
|
||||||
userId: Q_StringValue | SubQuery.UserIdSubQuery;
|
|
||||||
user: User.Filter;
|
|
||||||
applicationId: Q_StringValue | SubQuery.ApplicationIdSubQuery;
|
|
||||||
application: Application.Filter;
|
|
||||||
};
|
|
||||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr>>;
|
|
||||||
export type Projection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$?: 1;
|
|
||||||
$$updateAt$$?: 1;
|
|
||||||
origin?: 1;
|
|
||||||
openId?: 1;
|
|
||||||
unionId?: 1;
|
|
||||||
accessToken?: 1;
|
|
||||||
sessionKey?: 1;
|
|
||||||
subscribed?: 1;
|
|
||||||
subscribedAt?: 1;
|
|
||||||
unsubscribedAt?: 1;
|
|
||||||
userId?: 1;
|
|
||||||
user?: User.Projection;
|
|
||||||
applicationId?: 1;
|
|
||||||
application?: Application.Projection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
export type ExportProjection = {
|
|
||||||
"#id"?: NodeId;
|
|
||||||
[k: string]: any;
|
|
||||||
id?: string;
|
|
||||||
$$createAt$$?: string;
|
|
||||||
$$updateAt$$?: string;
|
|
||||||
origin?: string;
|
|
||||||
openId?: string;
|
|
||||||
unionId?: string;
|
|
||||||
accessToken?: string;
|
|
||||||
sessionKey?: string;
|
|
||||||
subscribed?: string;
|
|
||||||
subscribedAt?: string;
|
|
||||||
unsubscribedAt?: string;
|
|
||||||
userId?: string;
|
|
||||||
user?: User.ExportProjection;
|
|
||||||
applicationId?: string;
|
|
||||||
application?: Application.ExportProjection;
|
|
||||||
} & Partial<ExprOp<OpAttr>>;
|
|
||||||
type WechatUserIdProjection = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
}>;
|
|
||||||
type UserIdProjection = OneOf<{
|
|
||||||
userId: 1;
|
|
||||||
}>;
|
|
||||||
type ApplicationIdProjection = OneOf<{
|
|
||||||
applicationId: 1;
|
|
||||||
}>;
|
|
||||||
export type SortAttr = OneOf<{
|
|
||||||
id: 1;
|
|
||||||
$$createAt$$: 1;
|
|
||||||
$$updateAt$$: 1;
|
|
||||||
origin: 1;
|
|
||||||
openId: 1;
|
|
||||||
unionId: 1;
|
|
||||||
accessToken: 1;
|
|
||||||
sessionKey: 1;
|
|
||||||
subscribed: 1;
|
|
||||||
subscribedAt: 1;
|
|
||||||
unsubscribedAt: 1;
|
|
||||||
userId: 1;
|
|
||||||
user: User.SortAttr;
|
|
||||||
applicationId: 1;
|
|
||||||
application: Application.SortAttr;
|
|
||||||
} & ExprOp<OpAttr>>;
|
|
||||||
export type SortNode = {
|
|
||||||
$attr: SortAttr;
|
|
||||||
$direction?: "asc" | "desc";
|
|
||||||
};
|
|
||||||
export type Sorter = SortNode[];
|
|
||||||
export type SelectOperation<P = Projection> = OakOperation<"select", P, Filter, Sorter>;
|
|
||||||
export type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
||||||
export type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
||||||
type CreateOperationData = FormCreateData<Omit<OpSchema, "userId" | "applicationId" | "user" | "application"> & ({
|
|
||||||
user?: User.CreateSingleOperation | (User.UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
userId?: undefined;
|
|
||||||
} | {
|
|
||||||
user?: undefined;
|
|
||||||
userId?: String<64>;
|
|
||||||
}) & ({
|
|
||||||
application?: Application.CreateSingleOperation | (Application.UpdateOperation & {
|
|
||||||
id: String<64>;
|
|
||||||
});
|
|
||||||
applicationId?: undefined;
|
|
||||||
} | {
|
|
||||||
application?: undefined;
|
|
||||||
applicationId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
}>;
|
|
||||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
||||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
||||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
||||||
type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId" | "applicationId" | "user" | "application">> & ({
|
|
||||||
user?: User.CreateSingleOperation | Omit<User.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
userId?: undefined;
|
|
||||||
} | {
|
|
||||||
user?: undefined;
|
|
||||||
userId?: String<64>;
|
|
||||||
}) & ({
|
|
||||||
application?: Application.CreateSingleOperation | Omit<Application.UpdateOperation, "id" | "ids" | "filter">;
|
|
||||||
applicationId?: undefined;
|
|
||||||
} | {
|
|
||||||
application?: undefined;
|
|
||||||
applicationId?: String<64>;
|
|
||||||
}) & {
|
|
||||||
[k: string]: any;
|
|
||||||
};
|
|
||||||
export type UpdateOperation = OakOperation<"update", UpdateOperationData, Filter>;
|
|
||||||
type RemoveOperationData = {} & {
|
|
||||||
user?: Omit<User.UpdateOperation | User.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
application?: Omit<Application.UpdateOperation | Application.RemoveOperation, "id" | "ids" | "filter">;
|
|
||||||
} & {
|
|
||||||
[k: string]: any;
|
|
||||||
};
|
|
||||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter>;
|
|
||||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
||||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
|
||||||
export type ApplicationIdSubQuery = Selection<ApplicationIdProjection>;
|
|
||||||
export type WechatUserIdSubQuery = Selection<WechatUserIdProjection>;
|
|
||||||
export type NativeAttr = OpAttr | `user.${User.NativeAttr}` | `application.${Application.NativeAttr}`;
|
|
||||||
export type FullAttr = NativeAttr;
|
|
||||||
export type EntityDef = {
|
|
||||||
Schema: Schema;
|
|
||||||
OpSchema: OpSchema;
|
|
||||||
Action: GenericAction;
|
|
||||||
Selection: Selection;
|
|
||||||
Operation: Operation;
|
|
||||||
};
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
import { StorageDesc } from "../../types/Storage";
|
|
||||||
import { OpSchema } from "./Schema";
|
|
||||||
export const desc: StorageDesc<OpSchema> = {
|
|
||||||
attributes: {
|
|
||||||
origin: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
length: 16
|
|
||||||
}
|
|
||||||
},
|
|
||||||
openId: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
unionId: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
accessToken: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 32
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sessionKey: {
|
|
||||||
type: "varchar",
|
|
||||||
params: {
|
|
||||||
width: 64
|
|
||||||
}
|
|
||||||
},
|
|
||||||
subscribed: {
|
|
||||||
type: "boolean"
|
|
||||||
},
|
|
||||||
subscribedAt: {
|
|
||||||
type: "datetime"
|
|
||||||
},
|
|
||||||
unsubscribedAt: {
|
|
||||||
type: "datetime"
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "user"
|
|
||||||
},
|
|
||||||
applicationId: {
|
|
||||||
type: "ref",
|
|
||||||
ref: "application"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
import { Selection } from "../types/Entity";
|
|
||||||
import * as Address from "./Address/Schema";
|
|
||||||
import * as Application from "./Application/Schema";
|
|
||||||
import * as Area from "./Area/Schema";
|
|
||||||
import * as ExtraFile from "./ExtraFile/Schema";
|
|
||||||
import * as Mobile from "./Mobile/Schema";
|
|
||||||
import * as UserSystem from "./UserSystem/Schema";
|
|
||||||
import * as System from "./System/Schema";
|
|
||||||
import * as Token from "./Token/Schema";
|
|
||||||
import * as User from "./User/Schema";
|
|
||||||
import * as WechatUser from "./WechatUser/Schema";
|
|
||||||
export type AddressIdSubQuery = {
|
|
||||||
[K in "$in" | "$nin"]?: (Address.AddressIdSubQuery & {
|
|
||||||
entity: "address";
|
|
||||||
}) | any;
|
|
||||||
};
|
|
||||||
export type ApplicationIdSubQuery = {
|
|
||||||
[K in "$in" | "$nin"]?: (Token.ApplicationIdSubQuery & {
|
|
||||||
entity: "token";
|
|
||||||
}) | (WechatUser.ApplicationIdSubQuery & {
|
|
||||||
entity: "wechatUser";
|
|
||||||
}) | (Application.ApplicationIdSubQuery & {
|
|
||||||
entity: "application";
|
|
||||||
}) | any;
|
|
||||||
};
|
|
||||||
export type AreaIdSubQuery = {
|
|
||||||
[K in "$in" | "$nin"]?: (Address.AreaIdSubQuery & {
|
|
||||||
entity: "address";
|
|
||||||
}) | (Area.AreaIdSubQuery & {
|
|
||||||
entity: "area";
|
|
||||||
}) | (Area.AreaIdSubQuery & {
|
|
||||||
entity: "area";
|
|
||||||
}) | any;
|
|
||||||
};
|
|
||||||
export type ExtraFileIdSubQuery = {
|
|
||||||
[K in "$in" | "$nin"]?: (ExtraFile.ExtraFileIdSubQuery & {
|
|
||||||
entity: "extraFile";
|
|
||||||
}) | any;
|
|
||||||
};
|
|
||||||
export type MobileIdSubQuery = {
|
|
||||||
[K in "$in" | "$nin"]?: (Mobile.MobileIdSubQuery & {
|
|
||||||
entity: "mobile";
|
|
||||||
}) | any;
|
|
||||||
};
|
|
||||||
export type UserSystemIdSubQuery = {
|
|
||||||
[K in "$in" | "$nin"]?: (UserSystem.UserSystemIdSubQuery & {
|
|
||||||
entity: "userSystem";
|
|
||||||
}) | any;
|
|
||||||
};
|
|
||||||
export type SystemIdSubQuery = {
|
|
||||||
[K in "$in" | "$nin"]?: (Application.SystemIdSubQuery & {
|
|
||||||
entity: "application";
|
|
||||||
}) | (UserSystem.SystemIdSubQuery & {
|
|
||||||
entity: "userSystem";
|
|
||||||
}) | (System.SystemIdSubQuery & {
|
|
||||||
entity: "system";
|
|
||||||
}) | any;
|
|
||||||
};
|
|
||||||
export type TokenIdSubQuery = {
|
|
||||||
[K in "$in" | "$nin"]?: (Token.TokenIdSubQuery & {
|
|
||||||
entity: "token";
|
|
||||||
}) | any;
|
|
||||||
};
|
|
||||||
export type UserIdSubQuery = {
|
|
||||||
[K in "$in" | "$nin"]?: (Mobile.UserIdSubQuery & {
|
|
||||||
entity: "mobile";
|
|
||||||
}) | (UserSystem.UserIdSubQuery & {
|
|
||||||
entity: "userSystem";
|
|
||||||
}) | (Token.UserIdSubQuery & {
|
|
||||||
entity: "token";
|
|
||||||
}) | (User.UserIdSubQuery & {
|
|
||||||
entity: "user";
|
|
||||||
}) | (WechatUser.UserIdSubQuery & {
|
|
||||||
entity: "wechatUser";
|
|
||||||
}) | (User.UserIdSubQuery & {
|
|
||||||
entity: "user";
|
|
||||||
}) | any;
|
|
||||||
};
|
|
||||||
export type WechatUserIdSubQuery = {
|
|
||||||
[K in "$in" | "$nin"]?: (WechatUser.WechatUserIdSubQuery & {
|
|
||||||
entity: "wechatUser";
|
|
||||||
}) | any;
|
|
||||||
};
|
|
||||||
Loading…
Reference in New Issue