oak-general-business/lib/general-app-domain/UserEntityGrant/Schema.d.ts

293 lines
10 KiB
TypeScript

import { String, Int, Boolean, Text, Datetime, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, JsonFilter } from "oak-domain/lib/types/Demand";
import { OneOf } from "oak-domain/lib/types/Polyfill";
import * as SubQuery from "../_SubQuery";
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "oak-domain/lib/types/Entity";
import { Action, ParticularAction } from "./Action";
import { QrCodeType } from "../../types/Config";
import * as Relation from "../Relation/Schema";
import * as User from "../User/Schema";
import * as ModiEntity from "../ModiEntity/Schema";
import * as OperEntity from "../OperEntity/Schema";
import * as WechatQrCode from "../WechatQrCode/Schema";
export declare type RedirectToProps = {
pathname: string;
props?: Record<string, any>;
state?: Record<string, any>;
isTabBar?: boolean;
};
export declare type OpSchema = EntityShape & {
entity: String<32>;
entityId: String<64>;
relationId: ForeignKey<"relation">;
type: 'grant' | 'transfer';
number: Int<2>;
confirmed: Int<2>;
remark?: Text | null;
granterId: ForeignKey<"user">;
granteeId?: ForeignKey<"user"> | null;
qrCodeType: QrCodeType;
expiresAt?: Datetime | null;
expired?: Boolean | null;
redirectTo?: RedirectToProps | null;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
entity: String<32>;
entityId: String<64>;
relationId: ForeignKey<"relation">;
type: 'grant' | 'transfer';
number: Int<2>;
confirmed: Int<2>;
remark?: Text | null;
granterId: ForeignKey<"user">;
granteeId?: ForeignKey<"user"> | null;
qrCodeType: QrCodeType;
expiresAt?: Datetime | null;
expired?: Boolean | null;
redirectTo?: RedirectToProps | null;
relation: Relation.Schema;
granter: User.Schema;
grantee?: User.Schema | null;
modiEntity$entity?: Array<ModiEntity.Schema>;
modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
operEntity$entity?: Array<OperEntity.Schema>;
operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
wechatQrCode$entity?: Array<WechatQrCode.Schema>;
wechatQrCode$entity$$aggr?: AggregationResult<WechatQrCode.Schema>;
} & {
[A in ExpressionKey]?: any;
};
declare type AttrFilter = {
id: Q_StringValue | SubQuery.UserEntityGrantIdSubQuery;
$$createAt$$: Q_DateValue;
$$seq$$: Q_StringValue;
$$updateAt$$: Q_DateValue;
entity: Q_StringValue;
entityId: Q_StringValue;
relationId: Q_StringValue | SubQuery.RelationIdSubQuery;
relation: Relation.Filter;
type: Q_EnumValue<'grant' | 'transfer'>;
number: Q_NumberValue;
confirmed: Q_NumberValue;
remark: Q_StringValue;
granterId: Q_StringValue | SubQuery.UserIdSubQuery;
granter: User.Filter;
granteeId: Q_StringValue | SubQuery.UserIdSubQuery;
grantee: User.Filter;
qrCodeType: Q_EnumValue<QrCodeType>;
expiresAt: Q_DateValue;
expired: Q_BooleanValue;
redirectTo: JsonFilter<RedirectToProps>;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
export declare type Projection = {
"#id"?: NodeId;
[k: string]: any;
id?: number;
$$createAt$$?: number;
$$updateAt$$?: number;
$$seq$$?: number;
entity?: number;
entityId?: number;
relationId?: number;
relation?: Relation.Projection;
type?: number;
number?: number;
confirmed?: number;
remark?: number;
granterId?: number;
granter?: User.Projection;
granteeId?: number;
grantee?: User.Projection;
qrCodeType?: number;
expiresAt?: number;
expired?: number;
redirectTo?: number | JsonProjection<RedirectToProps>;
modiEntity$entity?: ModiEntity.Selection & {
$entity: "modiEntity";
};
modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
$entity: "modiEntity";
};
operEntity$entity?: OperEntity.Selection & {
$entity: "operEntity";
};
operEntity$entity$$aggr?: OperEntity.Aggregation & {
$entity: "operEntity";
};
wechatQrCode$entity?: WechatQrCode.Selection & {
$entity: "wechatQrCode";
};
wechatQrCode$entity$$aggr?: WechatQrCode.Aggregation & {
$entity: "wechatQrCode";
};
} & Partial<ExprOp<OpAttr | string>>;
declare type UserEntityGrantIdProjection = OneOf<{
id: number;
}>;
declare type RelationIdProjection = OneOf<{
relationId: number;
}>;
declare type UserIdProjection = OneOf<{
granterId: number;
granteeId: number;
}>;
export declare type SortAttr = {
id: number;
} | {
$$createAt$$: number;
} | {
$$seq$$: number;
} | {
$$updateAt$$: number;
} | {
entity: number;
} | {
entityId: number;
} | {
relationId: number;
} | {
relation: Relation.SortAttr;
} | {
type: number;
} | {
number: number;
} | {
confirmed: number;
} | {
remark: number;
} | {
granterId: number;
} | {
granter: User.SortAttr;
} | {
granteeId: number;
} | {
grantee: User.SortAttr;
} | {
qrCodeType: number;
} | {
expiresAt: number;
} | {
expired: number;
} | {
redirectTo: number;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;
export declare type SortNode = {
$attr: SortAttr;
$direction?: "asc" | "desc";
};
export declare type Sorter = SortNode[];
export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "relationId" | "granterId" | "granteeId">> & (({
relationId?: never;
relation: Relation.CreateSingleOperation;
} | {
relationId: String<64>;
relation?: Relation.UpdateOperation;
} | {
relationId: String<64>;
}) & ({
granterId?: never;
granter: User.CreateSingleOperation;
} | {
granterId: String<64>;
granter?: User.UpdateOperation;
} | {
granterId: String<64>;
}) & ({
granteeId?: never;
grantee?: User.CreateSingleOperation;
} | {
granteeId: String<64>;
grantee?: User.UpdateOperation;
} | {
granteeId?: String<64>;
})) & ({
entity?: string;
entityId?: string;
[K: string]: any;
}) & {
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
wechatQrCode$entity?: OakOperation<WechatQrCode.UpdateOperation["action"], Omit<WechatQrCode.UpdateOperationData, "entity" | "entityId">, WechatQrCode.Filter> | OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "entity" | "entityId">> | OakOperation<WechatQrCode.UpdateOperation["action"], Omit<WechatQrCode.UpdateOperationData, "entity" | "entityId">, WechatQrCode.Filter>>;
};
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "relationId" | "granterId" | "granteeId">> & (({
relation: Relation.CreateSingleOperation;
relationId?: never;
} | {
relation: Relation.UpdateOperation;
relationId?: never;
} | {
relation: Relation.RemoveOperation;
relationId?: never;
} | {
relation?: never;
relationId?: String<64> | null;
}) & ({
granter: User.CreateSingleOperation;
granterId?: never;
} | {
granter: User.UpdateOperation;
granterId?: never;
} | {
granter: User.RemoveOperation;
granterId?: never;
} | {
granter?: never;
granterId?: String<64> | null;
}) & ({
grantee: User.CreateSingleOperation;
granteeId?: never;
} | {
grantee: User.UpdateOperation;
granteeId?: never;
} | {
grantee: User.RemoveOperation;
granteeId?: never;
} | {
grantee?: never;
granteeId?: String<64> | null;
})) & {
[k: string]: any;
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
wechatQrCode$entity?: WechatQrCode.UpdateOperation | WechatQrCode.RemoveOperation | OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "entity" | "entityId">> | WechatQrCode.UpdateOperation | WechatQrCode.RemoveOperation>;
};
export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
export declare type RemoveOperationData = {} & (({
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
}) & ({
granter?: User.UpdateOperation | User.RemoveOperation;
}) & ({
grantee?: User.UpdateOperation | User.RemoveOperation;
}));
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
export declare type RelationIdSubQuery = Selection<RelationIdProjection>;
export declare type UserIdSubQuery = Selection<UserIdProjection>;
export declare type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
export declare type EntityDef = {
Schema: Schema;
OpSchema: OpSchema;
Action: OakMakeAction<Action> | string;
Selection: Selection;
Aggregation: Aggregation;
Operation: Operation;
Create: CreateOperation;
Update: UpdateOperation;
Remove: RemoveOperation;
CreateSingle: CreateSingleOperation;
CreateMulti: CreateMultipleOperation;
ParticularAction: ParticularAction;
};
export {};