@aiao/rxdb-test 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entities/FileLarge.d.ts +339 -0
- package/dist/entities/FileLarge.js +77 -0
- package/dist/entities/FileNode.d.ts +335 -0
- package/dist/entities/FileNode.js +77 -0
- package/dist/entities/MenuLarge.d.ts +294 -0
- package/dist/entities/MenuLarge.js +41 -0
- package/dist/entities/MenuSimple.d.ts +290 -0
- package/dist/entities/MenuSimple.js +41 -0
- package/dist/entities/Todo.d.ts +165 -0
- package/dist/entities/Todo.js +34 -0
- package/dist/entities/TypeDemo.d.ts +264 -0
- package/dist/entities/TypeDemo.js +101 -0
- package/dist/entities/index.d.ts +14 -1655
- package/dist/entities/index.js +6 -360
- package/dist/graph/index.d.ts +1 -2
- package/dist/graph/index.js +1 -1
- package/dist/shop/Attribute.d.ts +359 -0
- package/dist/shop/Attribute.js +50 -0
- package/dist/shop/AttributeValue.d.ts +366 -0
- package/dist/shop/AttributeValue.js +51 -0
- package/dist/shop/Category.d.ts +280 -0
- package/dist/shop/Category.js +41 -0
- package/dist/shop/IdCard.d.ts +237 -0
- package/dist/shop/IdCard.js +43 -0
- package/dist/shop/Order.d.ts +270 -0
- package/dist/shop/Order.js +58 -0
- package/dist/shop/OrderItem.d.ts +293 -0
- package/dist/shop/OrderItem.js +64 -0
- package/dist/shop/Product.d.ts +321 -0
- package/dist/shop/Product.js +47 -0
- package/dist/shop/SKU.d.ts +343 -0
- package/dist/shop/SKU.js +63 -0
- package/dist/shop/SKUAttributes.d.ts +306 -0
- package/dist/shop/SKUAttributes.js +56 -0
- package/dist/shop/User.d.ts +269 -0
- package/dist/shop/User.js +74 -0
- package/dist/shop/index.d.ts +22 -2980
- package/dist/shop/index.js +10 -528
- package/dist/system/RxDBBranch.d.ts +396 -0
- package/dist/system/RxDBBranch.js +106 -0
- package/dist/system/RxDBChange.d.ts +361 -0
- package/dist/system/RxDBChange.js +123 -0
- package/dist/system/RxDBMigration.d.ts +167 -0
- package/dist/system/RxDBMigration.js +40 -0
- package/dist/system/RxDBSync.d.ts +339 -0
- package/dist/system/RxDBSync.js +122 -0
- package/dist/system/index.d.ts +9 -1240
- package/dist/system/index.js +4 -384
- package/package.json +3 -3
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { BooleanRules, CountOptions, DateRules, ENTITY_STATIC_TYPES, EntityBase, EntityType, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, IEntity, ITreeEntity, NumberRules, RelationBooleanRules, RelationDateRules, RelationEntitiesObservable, RelationEntityObservable, RelationExistsRules, RelationNumberRules, RelationStringRules, RelationUUIDRules, RuleGroupBase, StringRules, UUID, UUIDRules } from '@aiao/rxdb';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* rule
|
|
6
|
+
*/
|
|
7
|
+
declare type OrderRule = UUIDRules<Order, 'id'>
|
|
8
|
+
| DateRules<Order, 'createdAt'>
|
|
9
|
+
| DateRules<Order, 'updatedAt'>
|
|
10
|
+
| StringRules<Order, 'createdBy'>
|
|
11
|
+
| StringRules<Order, 'updatedBy'>
|
|
12
|
+
| StringRules<Order, 'number'>
|
|
13
|
+
| NumberRules<Order, 'amount'>
|
|
14
|
+
| UUIDRules<Order, 'ownerId'>
|
|
15
|
+
| RelationExistsRules<'owner', UserRuleGroup>
|
|
16
|
+
| RelationUUIDRules<'owner.id', UUID>
|
|
17
|
+
| RelationDateRules<'owner.createdAt', Date>
|
|
18
|
+
| RelationDateRules<'owner.updatedAt', Date>
|
|
19
|
+
| RelationStringRules<'owner.createdBy', string | null>
|
|
20
|
+
| RelationStringRules<'owner.updatedBy', string | null>
|
|
21
|
+
| RelationStringRules<'owner.name', string>
|
|
22
|
+
| RelationBooleanRules<'owner.married', boolean>
|
|
23
|
+
| RelationNumberRules<'owner.age', number>
|
|
24
|
+
| RelationStringRules<'owner.gender', string | null>
|
|
25
|
+
| UUIDRules<User, 'idCardId'>
|
|
26
|
+
| RelationUUIDRules<'owner.idCard.id', UUID>
|
|
27
|
+
| RelationDateRules<'owner.idCard.createdAt', Date>
|
|
28
|
+
| RelationDateRules<'owner.idCard.updatedAt', Date>
|
|
29
|
+
| RelationStringRules<'owner.idCard.createdBy', string | null>
|
|
30
|
+
| RelationStringRules<'owner.idCard.updatedBy', string | null>
|
|
31
|
+
| RelationStringRules<'owner.idCard.code', string>
|
|
32
|
+
| UUIDRules<IdCard, 'ownerId'>
|
|
33
|
+
| RelationUUIDRules<'owner.idCard.owner.id', UUID>
|
|
34
|
+
| RelationDateRules<'owner.idCard.owner.createdAt', Date>
|
|
35
|
+
| RelationDateRules<'owner.idCard.owner.updatedAt', Date>
|
|
36
|
+
| RelationStringRules<'owner.idCard.owner.createdBy', string | null>
|
|
37
|
+
| RelationStringRules<'owner.idCard.owner.updatedBy', string | null>
|
|
38
|
+
| RelationStringRules<'owner.idCard.owner.name', string>
|
|
39
|
+
| RelationBooleanRules<'owner.idCard.owner.married', boolean>
|
|
40
|
+
| RelationNumberRules<'owner.idCard.owner.age', number>
|
|
41
|
+
| RelationStringRules<'owner.idCard.owner.gender', string | null>
|
|
42
|
+
| RelationExistsRules<'items', OrderItemRuleGroup>
|
|
43
|
+
| RelationUUIDRules<'items.id', UUID>
|
|
44
|
+
| RelationDateRules<'items.createdAt', Date>
|
|
45
|
+
| RelationDateRules<'items.updatedAt', Date>
|
|
46
|
+
| RelationStringRules<'items.createdBy', string | null>
|
|
47
|
+
| RelationStringRules<'items.updatedBy', string | null>
|
|
48
|
+
| RelationStringRules<'items.productName', string>
|
|
49
|
+
| RelationNumberRules<'items.quantity', number>
|
|
50
|
+
| RelationNumberRules<'items.price', number>
|
|
51
|
+
| UUIDRules<OrderItem, 'orderId'>
|
|
52
|
+
| RelationUUIDRules<'items.categories.id', UUID>
|
|
53
|
+
| RelationDateRules<'items.categories.createdAt', Date>
|
|
54
|
+
| RelationDateRules<'items.categories.updatedAt', Date>
|
|
55
|
+
| RelationStringRules<'items.categories.createdBy', string | null>
|
|
56
|
+
| RelationStringRules<'items.categories.updatedBy', string | null>
|
|
57
|
+
| RelationStringRules<'items.categories.name', string>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* RuleGroupBase
|
|
61
|
+
*/
|
|
62
|
+
export declare type OrderRuleGroup = RuleGroupBase<typeof Order,
|
|
63
|
+
|'id'
|
|
64
|
+
|'createdAt'
|
|
65
|
+
|'updatedAt'
|
|
66
|
+
|'createdBy'
|
|
67
|
+
|'updatedBy'
|
|
68
|
+
|'number'
|
|
69
|
+
|'amount'
|
|
70
|
+
|'ownerId'
|
|
71
|
+
|'owner'
|
|
72
|
+
|'owner.id'
|
|
73
|
+
|'owner.createdAt'
|
|
74
|
+
|'owner.updatedAt'
|
|
75
|
+
|'owner.createdBy'
|
|
76
|
+
|'owner.updatedBy'
|
|
77
|
+
|'owner.name'
|
|
78
|
+
|'owner.married'
|
|
79
|
+
|'owner.age'
|
|
80
|
+
|'owner.gender'
|
|
81
|
+
|'idCardId'
|
|
82
|
+
|'owner.idCard.id'
|
|
83
|
+
|'owner.idCard.createdAt'
|
|
84
|
+
|'owner.idCard.updatedAt'
|
|
85
|
+
|'owner.idCard.createdBy'
|
|
86
|
+
|'owner.idCard.updatedBy'
|
|
87
|
+
|'owner.idCard.code'
|
|
88
|
+
|'ownerId'
|
|
89
|
+
|'owner.idCard.owner.id'
|
|
90
|
+
|'owner.idCard.owner.createdAt'
|
|
91
|
+
|'owner.idCard.owner.updatedAt'
|
|
92
|
+
|'owner.idCard.owner.createdBy'
|
|
93
|
+
|'owner.idCard.owner.updatedBy'
|
|
94
|
+
|'owner.idCard.owner.name'
|
|
95
|
+
|'owner.idCard.owner.married'
|
|
96
|
+
|'owner.idCard.owner.age'
|
|
97
|
+
|'owner.idCard.owner.gender'
|
|
98
|
+
|'idCardId'
|
|
99
|
+
|'items'
|
|
100
|
+
|'items.id'
|
|
101
|
+
|'items.createdAt'
|
|
102
|
+
|'items.updatedAt'
|
|
103
|
+
|'items.createdBy'
|
|
104
|
+
|'items.updatedBy'
|
|
105
|
+
|'items.productName'
|
|
106
|
+
|'items.quantity'
|
|
107
|
+
|'items.price'
|
|
108
|
+
|'orderId'
|
|
109
|
+
|'items.categories.id'
|
|
110
|
+
|'items.categories.createdAt'
|
|
111
|
+
|'items.categories.updatedAt'
|
|
112
|
+
|'items.categories.createdBy'
|
|
113
|
+
|'items.categories.updatedBy'
|
|
114
|
+
|'items.categories.name',
|
|
115
|
+
OrderRule>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* OrderByField
|
|
119
|
+
*/
|
|
120
|
+
declare type OrderOrderByField = "id" | "createdAt" | "updatedAt" | "createdBy" | "updatedBy" | "number" | "amount";
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 静态类型
|
|
124
|
+
*/
|
|
125
|
+
export interface OrderStaticTypes {
|
|
126
|
+
/**
|
|
127
|
+
* id 类型
|
|
128
|
+
*/
|
|
129
|
+
idType: UUID;
|
|
130
|
+
/**
|
|
131
|
+
* 查询选项
|
|
132
|
+
*/
|
|
133
|
+
getOptions: UUID;
|
|
134
|
+
/**
|
|
135
|
+
* 查询选项
|
|
136
|
+
*/
|
|
137
|
+
findOneOrFailOptions: FindOneOrFailOptions<typeof Order,OrderRuleGroup,OrderOrderByField>;
|
|
138
|
+
/**
|
|
139
|
+
* 查询选项
|
|
140
|
+
*/
|
|
141
|
+
findOptions: FindOptions<typeof Order,OrderRuleGroup,OrderOrderByField>;
|
|
142
|
+
/**
|
|
143
|
+
* 查询选项
|
|
144
|
+
*/
|
|
145
|
+
findOneOptions: FindOneOptions<typeof Order,OrderRuleGroup,OrderOrderByField>;
|
|
146
|
+
/**
|
|
147
|
+
* 查询选项
|
|
148
|
+
*/
|
|
149
|
+
findAllOptions: FindAllOptions<typeof Order,OrderRuleGroup,OrderOrderByField>;
|
|
150
|
+
/**
|
|
151
|
+
* 查询选项
|
|
152
|
+
*/
|
|
153
|
+
findByCursorOptions: FindByCursorOptions<typeof Order,OrderRuleGroup,OrderOrderByField>;
|
|
154
|
+
/**
|
|
155
|
+
* 查询选项
|
|
156
|
+
*/
|
|
157
|
+
countOptions: CountOptions<typeof Order,OrderRuleGroup>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 初始化数据
|
|
162
|
+
*/
|
|
163
|
+
export interface OrderInitData {
|
|
164
|
+
/**
|
|
165
|
+
* 订单号
|
|
166
|
+
*/
|
|
167
|
+
number?: string;
|
|
168
|
+
/**
|
|
169
|
+
* 订单总金额
|
|
170
|
+
*/
|
|
171
|
+
amount?: number;
|
|
172
|
+
/**
|
|
173
|
+
* 所有者 id
|
|
174
|
+
*/
|
|
175
|
+
ownerId?: UUID;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 订单
|
|
180
|
+
*/
|
|
181
|
+
export declare class Order extends EntityBase implements IEntity {
|
|
182
|
+
static [ENTITY_STATIC_TYPES]: OrderStaticTypes;
|
|
183
|
+
/**
|
|
184
|
+
* 订单项
|
|
185
|
+
*/
|
|
186
|
+
readonly items$: RelationEntitiesObservable<OrderItem>;
|
|
187
|
+
/**
|
|
188
|
+
* 所有者
|
|
189
|
+
*/
|
|
190
|
+
readonly owner$: RelationEntityObservable<typeof User>;
|
|
191
|
+
/**
|
|
192
|
+
* 订单总金额
|
|
193
|
+
*/
|
|
194
|
+
amount: number;
|
|
195
|
+
/**
|
|
196
|
+
* 订单号
|
|
197
|
+
*/
|
|
198
|
+
number: string;
|
|
199
|
+
/**
|
|
200
|
+
* 所有者 id
|
|
201
|
+
*/
|
|
202
|
+
ownerId: UUID;
|
|
203
|
+
/**
|
|
204
|
+
* 初始化数据
|
|
205
|
+
* @param initData 初始化数据
|
|
206
|
+
*/
|
|
207
|
+
constructor(initData?: OrderInitData);
|
|
208
|
+
/**
|
|
209
|
+
* 统计实体数量
|
|
210
|
+
* @param options 查询选项
|
|
211
|
+
* @example
|
|
212
|
+
* Order.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));
|
|
213
|
+
*/
|
|
214
|
+
static count(options: CountOptions<typeof Order,OrderRuleGroup>): Observable<number>;
|
|
215
|
+
/**
|
|
216
|
+
* 查询多个实体
|
|
217
|
+
* @param options 查询选项
|
|
218
|
+
* @example
|
|
219
|
+
* Order.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));
|
|
220
|
+
*/
|
|
221
|
+
static find(options: FindOptions<typeof Order,OrderRuleGroup,OrderOrderByField>): Observable<Order[]>;
|
|
222
|
+
/**
|
|
223
|
+
* 查询所有实体
|
|
224
|
+
* @param options 查询选项
|
|
225
|
+
* @example
|
|
226
|
+
* Order.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
|
|
227
|
+
*/
|
|
228
|
+
static findAll(options: FindAllOptions<typeof Order,OrderRuleGroup,OrderOrderByField>): Observable<Order[]>;
|
|
229
|
+
/**
|
|
230
|
+
* 游标分页查询
|
|
231
|
+
* @param options 查询选项
|
|
232
|
+
* @example
|
|
233
|
+
* Order.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
|
|
234
|
+
*/
|
|
235
|
+
static findByCursor(options: FindByCursorOptions<typeof Order,OrderRuleGroup,OrderOrderByField>): Observable<Order[]>;
|
|
236
|
+
/**
|
|
237
|
+
* 查询单个实体,未找到时返回 undefined
|
|
238
|
+
* @param options 查询选项
|
|
239
|
+
* @example
|
|
240
|
+
* Order.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
|
|
241
|
+
*/
|
|
242
|
+
static findOne(options: FindOneOptions<typeof Order,OrderRuleGroup,OrderOrderByField>): Observable<Order | undefined>;
|
|
243
|
+
/**
|
|
244
|
+
* 查询单个实体,未找到时抛出错误
|
|
245
|
+
* @param options 查询选项
|
|
246
|
+
* @example
|
|
247
|
+
* Order.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
|
|
248
|
+
*/
|
|
249
|
+
static findOneOrFail(options: FindOneOrFailOptions<typeof Order,OrderRuleGroup,OrderOrderByField>): Observable<Order>;
|
|
250
|
+
/**
|
|
251
|
+
* 根据 ID 获取单个实体
|
|
252
|
+
* @param options 查询选项
|
|
253
|
+
* @example
|
|
254
|
+
* Order.get('123').subscribe(entity => console.log(entity));
|
|
255
|
+
*/
|
|
256
|
+
static get(options: UUID): Observable<Order>;
|
|
257
|
+
/**
|
|
258
|
+
* 删除
|
|
259
|
+
*/
|
|
260
|
+
remove(): Promise<Order>;
|
|
261
|
+
/**
|
|
262
|
+
* 重置数据
|
|
263
|
+
*/
|
|
264
|
+
reset(): void;
|
|
265
|
+
/**
|
|
266
|
+
* 保存
|
|
267
|
+
*/
|
|
268
|
+
save(): Promise<Order>;
|
|
269
|
+
}
|
|
270
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Entity, EntityBase, PropertyType, RelationKind, __decorateClass } from '@aiao/rxdb';
|
|
2
|
+
let Order = class extends EntityBase {};
|
|
3
|
+
Order = __decorateClass(
|
|
4
|
+
[
|
|
5
|
+
Entity({
|
|
6
|
+
name: "Order",
|
|
7
|
+
tableName: "order",
|
|
8
|
+
displayName: "订单",
|
|
9
|
+
properties: [
|
|
10
|
+
{
|
|
11
|
+
name: "number",
|
|
12
|
+
type: PropertyType.string,
|
|
13
|
+
unique: true,
|
|
14
|
+
displayName: "订单号",
|
|
15
|
+
columnName: "number"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "amount",
|
|
19
|
+
type: PropertyType.number,
|
|
20
|
+
displayName: "订单总金额",
|
|
21
|
+
columnName: "amount"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
relations: [
|
|
25
|
+
{
|
|
26
|
+
name: "owner",
|
|
27
|
+
displayName: "所有者",
|
|
28
|
+
kind: RelationKind.MANY_TO_ONE,
|
|
29
|
+
mappedEntity: "User",
|
|
30
|
+
mappedProperty: "orders",
|
|
31
|
+
mappedNamespace: "public",
|
|
32
|
+
onDelete: "RESTRICT",
|
|
33
|
+
onUpdate: "RESTRICT",
|
|
34
|
+
columnName: "ownerId"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "items",
|
|
38
|
+
displayName: "订单项",
|
|
39
|
+
kind: RelationKind.ONE_TO_MANY,
|
|
40
|
+
mappedEntity: "OrderItem",
|
|
41
|
+
mappedProperty: "order",
|
|
42
|
+
mappedNamespace: "public",
|
|
43
|
+
onDelete: "CASCADE",
|
|
44
|
+
onUpdate: "RESTRICT"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
repository: "Repository",
|
|
48
|
+
namespace: "public",
|
|
49
|
+
indexes: [],
|
|
50
|
+
computedProperties: [],
|
|
51
|
+
extends: [
|
|
52
|
+
"EntityBase"
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
],
|
|
56
|
+
Order
|
|
57
|
+
);
|
|
58
|
+
export { Order };
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { BooleanRules, CountOptions, DateRules, ENTITY_STATIC_TYPES, EntityBase, EntityType, FindAllOptions, FindByCursorOptions, FindOneOptions, FindOneOrFailOptions, FindOptions, IEntity, ITreeEntity, NumberRules, RelationBooleanRules, RelationDateRules, RelationEntitiesObservable, RelationEntityObservable, RelationExistsRules, RelationNumberRules, RelationStringRules, RelationUUIDRules, RuleGroupBase, StringRules, UUID, UUIDRules } from '@aiao/rxdb';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* rule
|
|
6
|
+
*/
|
|
7
|
+
declare type OrderItemRule = UUIDRules<OrderItem, 'id'>
|
|
8
|
+
| DateRules<OrderItem, 'createdAt'>
|
|
9
|
+
| DateRules<OrderItem, 'updatedAt'>
|
|
10
|
+
| StringRules<OrderItem, 'createdBy'>
|
|
11
|
+
| StringRules<OrderItem, 'updatedBy'>
|
|
12
|
+
| StringRules<OrderItem, 'productName'>
|
|
13
|
+
| NumberRules<OrderItem, 'quantity'>
|
|
14
|
+
| NumberRules<OrderItem, 'price'>
|
|
15
|
+
| UUIDRules<OrderItem, 'orderId'>
|
|
16
|
+
| RelationExistsRules<'order', OrderRuleGroup>
|
|
17
|
+
| RelationUUIDRules<'order.id', UUID>
|
|
18
|
+
| RelationDateRules<'order.createdAt', Date>
|
|
19
|
+
| RelationDateRules<'order.updatedAt', Date>
|
|
20
|
+
| RelationStringRules<'order.createdBy', string | null>
|
|
21
|
+
| RelationStringRules<'order.updatedBy', string | null>
|
|
22
|
+
| RelationStringRules<'order.number', string>
|
|
23
|
+
| RelationNumberRules<'order.amount', number>
|
|
24
|
+
| UUIDRules<Order, 'ownerId'>
|
|
25
|
+
| RelationUUIDRules<'order.owner.id', UUID>
|
|
26
|
+
| RelationDateRules<'order.owner.createdAt', Date>
|
|
27
|
+
| RelationDateRules<'order.owner.updatedAt', Date>
|
|
28
|
+
| RelationStringRules<'order.owner.createdBy', string | null>
|
|
29
|
+
| RelationStringRules<'order.owner.updatedBy', string | null>
|
|
30
|
+
| RelationStringRules<'order.owner.name', string>
|
|
31
|
+
| RelationBooleanRules<'order.owner.married', boolean>
|
|
32
|
+
| RelationNumberRules<'order.owner.age', number>
|
|
33
|
+
| RelationStringRules<'order.owner.gender', string | null>
|
|
34
|
+
| UUIDRules<User, 'idCardId'>
|
|
35
|
+
| RelationUUIDRules<'order.owner.idCard.id', UUID>
|
|
36
|
+
| RelationDateRules<'order.owner.idCard.createdAt', Date>
|
|
37
|
+
| RelationDateRules<'order.owner.idCard.updatedAt', Date>
|
|
38
|
+
| RelationStringRules<'order.owner.idCard.createdBy', string | null>
|
|
39
|
+
| RelationStringRules<'order.owner.idCard.updatedBy', string | null>
|
|
40
|
+
| RelationStringRules<'order.owner.idCard.code', string>
|
|
41
|
+
| UUIDRules<IdCard, 'ownerId'>
|
|
42
|
+
| RelationUUIDRules<'order.owner.idCard.owner.id', UUID>
|
|
43
|
+
| RelationDateRules<'order.owner.idCard.owner.createdAt', Date>
|
|
44
|
+
| RelationDateRules<'order.owner.idCard.owner.updatedAt', Date>
|
|
45
|
+
| RelationStringRules<'order.owner.idCard.owner.createdBy', string | null>
|
|
46
|
+
| RelationStringRules<'order.owner.idCard.owner.updatedBy', string | null>
|
|
47
|
+
| RelationStringRules<'order.owner.idCard.owner.name', string>
|
|
48
|
+
| RelationBooleanRules<'order.owner.idCard.owner.married', boolean>
|
|
49
|
+
| RelationNumberRules<'order.owner.idCard.owner.age', number>
|
|
50
|
+
| RelationStringRules<'order.owner.idCard.owner.gender', string | null>
|
|
51
|
+
| RelationUUIDRules<'order.owner.orders.id', UUID>
|
|
52
|
+
| RelationDateRules<'order.owner.orders.createdAt', Date>
|
|
53
|
+
| RelationDateRules<'order.owner.orders.updatedAt', Date>
|
|
54
|
+
| RelationStringRules<'order.owner.orders.createdBy', string | null>
|
|
55
|
+
| RelationStringRules<'order.owner.orders.updatedBy', string | null>
|
|
56
|
+
| RelationStringRules<'order.owner.orders.number', string>
|
|
57
|
+
| RelationNumberRules<'order.owner.orders.amount', number>
|
|
58
|
+
| RelationExistsRules<'categories', CategoryRuleGroup>
|
|
59
|
+
| RelationUUIDRules<'categories.id', UUID>
|
|
60
|
+
| RelationDateRules<'categories.createdAt', Date>
|
|
61
|
+
| RelationDateRules<'categories.updatedAt', Date>
|
|
62
|
+
| RelationStringRules<'categories.createdBy', string | null>
|
|
63
|
+
| RelationStringRules<'categories.updatedBy', string | null>
|
|
64
|
+
| RelationStringRules<'categories.name', string>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* RuleGroupBase
|
|
68
|
+
*/
|
|
69
|
+
export declare type OrderItemRuleGroup = RuleGroupBase<typeof OrderItem,
|
|
70
|
+
|'id'
|
|
71
|
+
|'createdAt'
|
|
72
|
+
|'updatedAt'
|
|
73
|
+
|'createdBy'
|
|
74
|
+
|'updatedBy'
|
|
75
|
+
|'productName'
|
|
76
|
+
|'quantity'
|
|
77
|
+
|'price'
|
|
78
|
+
|'orderId'
|
|
79
|
+
|'order'
|
|
80
|
+
|'order.id'
|
|
81
|
+
|'order.createdAt'
|
|
82
|
+
|'order.updatedAt'
|
|
83
|
+
|'order.createdBy'
|
|
84
|
+
|'order.updatedBy'
|
|
85
|
+
|'order.number'
|
|
86
|
+
|'order.amount'
|
|
87
|
+
|'ownerId'
|
|
88
|
+
|'order.owner.id'
|
|
89
|
+
|'order.owner.createdAt'
|
|
90
|
+
|'order.owner.updatedAt'
|
|
91
|
+
|'order.owner.createdBy'
|
|
92
|
+
|'order.owner.updatedBy'
|
|
93
|
+
|'order.owner.name'
|
|
94
|
+
|'order.owner.married'
|
|
95
|
+
|'order.owner.age'
|
|
96
|
+
|'order.owner.gender'
|
|
97
|
+
|'idCardId'
|
|
98
|
+
|'order.owner.idCard.id'
|
|
99
|
+
|'order.owner.idCard.createdAt'
|
|
100
|
+
|'order.owner.idCard.updatedAt'
|
|
101
|
+
|'order.owner.idCard.createdBy'
|
|
102
|
+
|'order.owner.idCard.updatedBy'
|
|
103
|
+
|'order.owner.idCard.code'
|
|
104
|
+
|'ownerId'
|
|
105
|
+
|'order.owner.idCard.owner.id'
|
|
106
|
+
|'order.owner.idCard.owner.createdAt'
|
|
107
|
+
|'order.owner.idCard.owner.updatedAt'
|
|
108
|
+
|'order.owner.idCard.owner.createdBy'
|
|
109
|
+
|'order.owner.idCard.owner.updatedBy'
|
|
110
|
+
|'order.owner.idCard.owner.name'
|
|
111
|
+
|'order.owner.idCard.owner.married'
|
|
112
|
+
|'order.owner.idCard.owner.age'
|
|
113
|
+
|'order.owner.idCard.owner.gender'
|
|
114
|
+
|'idCardId'
|
|
115
|
+
|'order.owner.orders.id'
|
|
116
|
+
|'order.owner.orders.createdAt'
|
|
117
|
+
|'order.owner.orders.updatedAt'
|
|
118
|
+
|'order.owner.orders.createdBy'
|
|
119
|
+
|'order.owner.orders.updatedBy'
|
|
120
|
+
|'order.owner.orders.number'
|
|
121
|
+
|'order.owner.orders.amount'
|
|
122
|
+
|'ownerId'
|
|
123
|
+
|'categories'
|
|
124
|
+
|'categories.id'
|
|
125
|
+
|'categories.createdAt'
|
|
126
|
+
|'categories.updatedAt'
|
|
127
|
+
|'categories.createdBy'
|
|
128
|
+
|'categories.updatedBy'
|
|
129
|
+
|'categories.name',
|
|
130
|
+
OrderItemRule>;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* OrderByField
|
|
134
|
+
*/
|
|
135
|
+
declare type OrderItemOrderByField = "id" | "createdAt" | "updatedAt" | "createdBy" | "updatedBy" | "productName" | "quantity" | "price";
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 静态类型
|
|
139
|
+
*/
|
|
140
|
+
export interface OrderItemStaticTypes {
|
|
141
|
+
/**
|
|
142
|
+
* id 类型
|
|
143
|
+
*/
|
|
144
|
+
idType: UUID;
|
|
145
|
+
/**
|
|
146
|
+
* 查询选项
|
|
147
|
+
*/
|
|
148
|
+
getOptions: UUID;
|
|
149
|
+
/**
|
|
150
|
+
* 查询选项
|
|
151
|
+
*/
|
|
152
|
+
findOneOrFailOptions: FindOneOrFailOptions<typeof OrderItem,OrderItemRuleGroup,OrderItemOrderByField>;
|
|
153
|
+
/**
|
|
154
|
+
* 查询选项
|
|
155
|
+
*/
|
|
156
|
+
findOptions: FindOptions<typeof OrderItem,OrderItemRuleGroup,OrderItemOrderByField>;
|
|
157
|
+
/**
|
|
158
|
+
* 查询选项
|
|
159
|
+
*/
|
|
160
|
+
findOneOptions: FindOneOptions<typeof OrderItem,OrderItemRuleGroup,OrderItemOrderByField>;
|
|
161
|
+
/**
|
|
162
|
+
* 查询选项
|
|
163
|
+
*/
|
|
164
|
+
findAllOptions: FindAllOptions<typeof OrderItem,OrderItemRuleGroup,OrderItemOrderByField>;
|
|
165
|
+
/**
|
|
166
|
+
* 查询选项
|
|
167
|
+
*/
|
|
168
|
+
findByCursorOptions: FindByCursorOptions<typeof OrderItem,OrderItemRuleGroup,OrderItemOrderByField>;
|
|
169
|
+
/**
|
|
170
|
+
* 查询选项
|
|
171
|
+
*/
|
|
172
|
+
countOptions: CountOptions<typeof OrderItem,OrderItemRuleGroup>;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 初始化数据
|
|
177
|
+
*/
|
|
178
|
+
export interface OrderItemInitData {
|
|
179
|
+
/**
|
|
180
|
+
* 商品名称
|
|
181
|
+
*/
|
|
182
|
+
productName?: string;
|
|
183
|
+
/**
|
|
184
|
+
* 数量
|
|
185
|
+
*/
|
|
186
|
+
quantity?: number;
|
|
187
|
+
/**
|
|
188
|
+
* 单价
|
|
189
|
+
*/
|
|
190
|
+
price?: number;
|
|
191
|
+
/**
|
|
192
|
+
* 所属订单 id
|
|
193
|
+
*/
|
|
194
|
+
orderId?: UUID;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* 订单项目
|
|
199
|
+
*/
|
|
200
|
+
export declare class OrderItem extends EntityBase implements IEntity {
|
|
201
|
+
static [ENTITY_STATIC_TYPES]: OrderItemStaticTypes;
|
|
202
|
+
/**
|
|
203
|
+
* 分类
|
|
204
|
+
*/
|
|
205
|
+
readonly categories$: RelationEntitiesObservable<Category>;
|
|
206
|
+
/**
|
|
207
|
+
* 所属订单
|
|
208
|
+
*/
|
|
209
|
+
readonly order$: RelationEntityObservable<typeof Order>;
|
|
210
|
+
/**
|
|
211
|
+
* 所属订单 id
|
|
212
|
+
*/
|
|
213
|
+
orderId: UUID;
|
|
214
|
+
/**
|
|
215
|
+
* 单价
|
|
216
|
+
*/
|
|
217
|
+
price: number;
|
|
218
|
+
/**
|
|
219
|
+
* 商品名称
|
|
220
|
+
*/
|
|
221
|
+
productName: string;
|
|
222
|
+
/**
|
|
223
|
+
* 数量
|
|
224
|
+
*/
|
|
225
|
+
quantity: number;
|
|
226
|
+
/**
|
|
227
|
+
* 初始化数据
|
|
228
|
+
* @param initData 初始化数据
|
|
229
|
+
*/
|
|
230
|
+
constructor(initData?: OrderItemInitData);
|
|
231
|
+
/**
|
|
232
|
+
* 统计实体数量
|
|
233
|
+
* @param options 查询选项
|
|
234
|
+
* @example
|
|
235
|
+
* OrderItem.count({ where: { combinator: 'and', rules: [] } }).subscribe(total => console.log(total));
|
|
236
|
+
*/
|
|
237
|
+
static count(options: CountOptions<typeof OrderItem,OrderItemRuleGroup>): Observable<number>;
|
|
238
|
+
/**
|
|
239
|
+
* 查询多个实体
|
|
240
|
+
* @param options 查询选项
|
|
241
|
+
* @example
|
|
242
|
+
* OrderItem.find({ where: { combinator: 'and', rules: [] }] }).subscribe(list => console.log(list));
|
|
243
|
+
*/
|
|
244
|
+
static find(options: FindOptions<typeof OrderItem,OrderItemRuleGroup,OrderItemOrderByField>): Observable<OrderItem[]>;
|
|
245
|
+
/**
|
|
246
|
+
* 查询所有实体
|
|
247
|
+
* @param options 查询选项
|
|
248
|
+
* @example
|
|
249
|
+
* OrderItem.findAll({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
|
|
250
|
+
*/
|
|
251
|
+
static findAll(options: FindAllOptions<typeof OrderItem,OrderItemRuleGroup,OrderItemOrderByField>): Observable<OrderItem[]>;
|
|
252
|
+
/**
|
|
253
|
+
* 游标分页查询
|
|
254
|
+
* @param options 查询选项
|
|
255
|
+
* @example
|
|
256
|
+
* OrderItem.findByCursor({ where: { combinator: 'and', rules: [] } }).subscribe(list => console.log(list));
|
|
257
|
+
*/
|
|
258
|
+
static findByCursor(options: FindByCursorOptions<typeof OrderItem,OrderItemRuleGroup,OrderItemOrderByField>): Observable<OrderItem[]>;
|
|
259
|
+
/**
|
|
260
|
+
* 查询单个实体,未找到时返回 undefined
|
|
261
|
+
* @param options 查询选项
|
|
262
|
+
* @example
|
|
263
|
+
* OrderItem.findOne({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
|
|
264
|
+
*/
|
|
265
|
+
static findOne(options: FindOneOptions<typeof OrderItem,OrderItemRuleGroup,OrderItemOrderByField>): Observable<OrderItem | undefined>;
|
|
266
|
+
/**
|
|
267
|
+
* 查询单个实体,未找到时抛出错误
|
|
268
|
+
* @param options 查询选项
|
|
269
|
+
* @example
|
|
270
|
+
* OrderItem.findOneOrFail({ where: { combinator: 'and', rules: [] } }).subscribe(entity => console.log(entity));
|
|
271
|
+
*/
|
|
272
|
+
static findOneOrFail(options: FindOneOrFailOptions<typeof OrderItem,OrderItemRuleGroup,OrderItemOrderByField>): Observable<OrderItem>;
|
|
273
|
+
/**
|
|
274
|
+
* 根据 ID 获取单个实体
|
|
275
|
+
* @param options 查询选项
|
|
276
|
+
* @example
|
|
277
|
+
* OrderItem.get('123').subscribe(entity => console.log(entity));
|
|
278
|
+
*/
|
|
279
|
+
static get(options: UUID): Observable<OrderItem>;
|
|
280
|
+
/**
|
|
281
|
+
* 删除
|
|
282
|
+
*/
|
|
283
|
+
remove(): Promise<OrderItem>;
|
|
284
|
+
/**
|
|
285
|
+
* 重置数据
|
|
286
|
+
*/
|
|
287
|
+
reset(): void;
|
|
288
|
+
/**
|
|
289
|
+
* 保存
|
|
290
|
+
*/
|
|
291
|
+
save(): Promise<OrderItem>;
|
|
292
|
+
}
|
|
293
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Entity, EntityBase, PropertyType, RelationKind, __decorateClass } from '@aiao/rxdb';
|
|
2
|
+
let OrderItem = class extends EntityBase {};
|
|
3
|
+
OrderItem = __decorateClass(
|
|
4
|
+
[
|
|
5
|
+
Entity({
|
|
6
|
+
name: "OrderItem",
|
|
7
|
+
tableName: "order_item",
|
|
8
|
+
displayName: "订单项目",
|
|
9
|
+
properties: [
|
|
10
|
+
{
|
|
11
|
+
name: "productName",
|
|
12
|
+
columnName: "product_name",
|
|
13
|
+
type: PropertyType.string,
|
|
14
|
+
displayName: "商品名称"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "quantity",
|
|
18
|
+
type: PropertyType.number,
|
|
19
|
+
displayName: "数量",
|
|
20
|
+
columnName: "quantity"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "price",
|
|
24
|
+
type: PropertyType.number,
|
|
25
|
+
displayName: "单价",
|
|
26
|
+
columnName: "price"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
relations: [
|
|
30
|
+
{
|
|
31
|
+
name: "order",
|
|
32
|
+
displayName: "所属订单",
|
|
33
|
+
kind: RelationKind.MANY_TO_ONE,
|
|
34
|
+
mappedEntity: "Order",
|
|
35
|
+
mappedProperty: "items",
|
|
36
|
+
mappedNamespace: "public",
|
|
37
|
+
onDelete: "RESTRICT",
|
|
38
|
+
onUpdate: "RESTRICT",
|
|
39
|
+
columnName: "orderId"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "categories",
|
|
43
|
+
displayName: "分类",
|
|
44
|
+
kind: RelationKind.MANY_TO_MANY,
|
|
45
|
+
mappedEntity: "Category",
|
|
46
|
+
mappedProperty: "orderItems",
|
|
47
|
+
mappedNamespace: "public",
|
|
48
|
+
onDelete: "RESTRICT",
|
|
49
|
+
onUpdate: "RESTRICT",
|
|
50
|
+
columnName: "categoriesId"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
repository: "Repository",
|
|
54
|
+
namespace: "public",
|
|
55
|
+
indexes: [],
|
|
56
|
+
computedProperties: [],
|
|
57
|
+
extends: [
|
|
58
|
+
"EntityBase"
|
|
59
|
+
]
|
|
60
|
+
})
|
|
61
|
+
],
|
|
62
|
+
OrderItem
|
|
63
|
+
);
|
|
64
|
+
export { OrderItem };
|