@ruiapp/rapid-core 0.1.57 → 0.1.59
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/index.js
CHANGED
|
@@ -1809,7 +1809,7 @@ function getEntityPropertiesIncludingBase(server, model) {
|
|
|
1809
1809
|
});
|
|
1810
1810
|
let baseProperties = [];
|
|
1811
1811
|
if (baseModel) {
|
|
1812
|
-
baseModel.properties.map((property) => {
|
|
1812
|
+
baseProperties = baseModel.properties.map((property) => {
|
|
1813
1813
|
property = lodash.cloneDeep(property);
|
|
1814
1814
|
property.isBaseProperty = true;
|
|
1815
1815
|
return property;
|
|
@@ -3654,10 +3654,10 @@ async function syncDatabaseSchema(server, applicationConfig) {
|
|
|
3654
3654
|
});
|
|
3655
3655
|
}
|
|
3656
3656
|
const contraintName = `${property.linkTableName}_pk`;
|
|
3657
|
-
columnDDL += `ALTER TABLE ${queryBuilder.quoteTable(
|
|
3657
|
+
columnDDL += `ALTER TABLE ${queryBuilder.quoteTable({
|
|
3658
3658
|
schema: property.linkSchema,
|
|
3659
3659
|
tableName: property.linkTableName,
|
|
3660
|
-
})
|
|
3660
|
+
})} ADD CONSTRAINT ${queryBuilder.quoteObject(contraintName)} PRIMARY KEY (id);`;
|
|
3661
3661
|
}
|
|
3662
3662
|
else {
|
|
3663
3663
|
const targetModel = applicationConfig.models.find((item) => item.singularCode === property.targetSingularCode);
|
|
@@ -3801,6 +3801,7 @@ const pgPropertyTypeColumnMap = {
|
|
|
3801
3801
|
text: "text",
|
|
3802
3802
|
boolean: "bool",
|
|
3803
3803
|
date: "date",
|
|
3804
|
+
time: "time",
|
|
3804
3805
|
datetime: "timestamptz",
|
|
3805
3806
|
json: "jsonb",
|
|
3806
3807
|
option: "text",
|
package/dist/types.d.ts
CHANGED
|
@@ -265,7 +265,7 @@ export interface RpdDataModelProperty {
|
|
|
265
265
|
*/
|
|
266
266
|
linkSchema?: string;
|
|
267
267
|
}
|
|
268
|
-
export type RpdDataPropertyTypes = "integer" | "long" | "float" | "double" | "decimal" | "text" | "boolean" | "date" | "datetime" | "json" | "relation" | "relation[]" | "option";
|
|
268
|
+
export type RpdDataPropertyTypes = "integer" | "long" | "float" | "double" | "decimal" | "text" | "boolean" | "date" | "time" | "datetime" | "json" | "relation" | "relation[]" | "option";
|
|
269
269
|
/**
|
|
270
270
|
* 数据字典
|
|
271
271
|
*/
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ export function getEntityPropertiesIncludingBase(server: IRpdServer, model: RpdD
|
|
|
16
16
|
});
|
|
17
17
|
let baseProperties: RpdDataModelProperty[] = [];
|
|
18
18
|
if (baseModel) {
|
|
19
|
-
baseModel.properties.map((property) => {
|
|
19
|
+
baseProperties = baseModel.properties.map((property) => {
|
|
20
20
|
property = cloneDeep(property);
|
|
21
21
|
property.isBaseProperty = true;
|
|
22
22
|
return property;
|
|
@@ -231,10 +231,10 @@ async function syncDatabaseSchema(server: IRpdServer, applicationConfig: RpdAppl
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
const contraintName = `${property.linkTableName}_pk`;
|
|
234
|
-
columnDDL += `ALTER TABLE ${queryBuilder.quoteTable(
|
|
234
|
+
columnDDL += `ALTER TABLE ${queryBuilder.quoteTable({
|
|
235
235
|
schema: property.linkSchema,
|
|
236
236
|
tableName: property.linkTableName,
|
|
237
|
-
})
|
|
237
|
+
})} ADD CONSTRAINT ${queryBuilder.quoteObject(contraintName)} PRIMARY KEY (id);`;
|
|
238
238
|
} else {
|
|
239
239
|
const targetModel = applicationConfig.models.find((item) => item.singularCode === property.targetSingularCode);
|
|
240
240
|
if (!targetModel) {
|
|
@@ -403,6 +403,7 @@ const pgPropertyTypeColumnMap: Partial<Record<RpdDataPropertyTypes, string>> = {
|
|
|
403
403
|
text: "text",
|
|
404
404
|
boolean: "bool",
|
|
405
405
|
date: "date",
|
|
406
|
+
time: "time",
|
|
406
407
|
datetime: "timestamptz",
|
|
407
408
|
json: "jsonb",
|
|
408
409
|
option: "text",
|
package/src/types.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface IDatabaseConfig {
|
|
|
22
22
|
export type DatabaseQuery = {
|
|
23
23
|
command: string;
|
|
24
24
|
params?: unknown[] | Record<string, unknown>;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
|
|
27
27
|
export interface IDatabaseAccessor {
|
|
28
28
|
queryDatabaseObject: (sql: string, params?: unknown[] | Record<string, unknown>) => Promise<any[]>;
|
|
@@ -162,7 +162,7 @@ export type EmitServerEventOptions<TEventName extends keyof RpdServerEventTypes>
|
|
|
162
162
|
payload: RpdServerEventTypes[TEventName][1];
|
|
163
163
|
sender?: RapidPlugin;
|
|
164
164
|
routeContext?: RouteContext;
|
|
165
|
-
}
|
|
165
|
+
};
|
|
166
166
|
|
|
167
167
|
export interface QuoteTableOptions {
|
|
168
168
|
schema?: string;
|
|
@@ -296,7 +296,7 @@ export interface RpdDataModelProperty {
|
|
|
296
296
|
linkSchema?: string;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
export type RpdDataPropertyTypes = "integer" | "long" | "float" | "double" | "decimal" | "text" | "boolean" | "date" | "datetime" | "json" | "relation" | "relation[]" | "option";
|
|
299
|
+
export type RpdDataPropertyTypes = "integer" | "long" | "float" | "double" | "decimal" | "text" | "boolean" | "date" | "time" | "datetime" | "json" | "relation" | "relation[]" | "option";
|
|
300
300
|
|
|
301
301
|
/**
|
|
302
302
|
* 数据字典
|
|
@@ -514,7 +514,6 @@ export interface RemoveEntityRelationsOptions {
|
|
|
514
514
|
relations: { id?: number; [k: string]: any }[];
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
-
|
|
518
517
|
export type EntityWatcherType = EntityWatcher<"entity.create"> | EntityWatcher<"entity.update"> | EntityWatcher<"entity.delete"> | EntityWatcher<"entity.addRelations"> | EntityWatcher<"entity.removeRelations"> | EntityWatcher<any>;
|
|
519
518
|
|
|
520
519
|
export interface EntityWatcher<TEventName extends keyof RpdServerEventTypes = any> {
|