gg-express 1.0.113 → 1.0.115
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/v2/generateStaticRouteFileV2.js +15 -4
- package/dist/v2/output/staticRouteInterface_hotel_v2.d.ts +1 -27
- package/dist/v2/run_v2.test.js +38 -17
- package/package.json +1 -1
- package/src/v2/generateStaticRouteFileV2.ts +18 -5
- package/src/v2/output/staticRouteInterface_hotel_v2.ts +34 -15
- package/src/v2/run_v2.test.ts +37 -17
|
@@ -18,7 +18,7 @@ function extract(allData, prepareRoute) {
|
|
|
18
18
|
requireParams: parentInputToCode(route.requireParams, route.isPartialRequireParam),
|
|
19
19
|
parameter: route.parameter
|
|
20
20
|
? parentInputToCode(route.parameter, false)
|
|
21
|
-
: "
|
|
21
|
+
: "{}",
|
|
22
22
|
responseStructure: parentInputToCode(route.responseStructure, false),
|
|
23
23
|
isPartial: route.isPartialRequireParam,
|
|
24
24
|
};
|
|
@@ -97,15 +97,26 @@ function generateStaticRouteFileV2(appName, data) {
|
|
|
97
97
|
const generateEachUrl = (data) => {
|
|
98
98
|
const keyName = Object.keys(data);
|
|
99
99
|
return keyName
|
|
100
|
-
.map((keyName) =>
|
|
100
|
+
.map((keyName) => {
|
|
101
|
+
const parameterCode = data[keyName].parameter !== "{}"
|
|
102
|
+
? `parameter: ${data[keyName].parameter}`
|
|
103
|
+
: null;
|
|
104
|
+
const requireParamsData = data[keyName].requireParams === "{}"
|
|
105
|
+
? `data: ${data[keyName].requireParams}`
|
|
106
|
+
: null;
|
|
107
|
+
const requireParams = [requireParamsData, parameterCode]
|
|
108
|
+
.filter((row) => row !== null)
|
|
109
|
+
.join(", ");
|
|
110
|
+
return `
|
|
101
111
|
"${keyName}" : {
|
|
102
|
-
requireParams : {
|
|
112
|
+
requireParams : { ${requireParams} },
|
|
103
113
|
responseStructure : {
|
|
104
114
|
data : ${data[keyName].responseStructure},
|
|
105
115
|
status: "SUCCESS" | "ERROR",
|
|
106
116
|
message: string
|
|
107
117
|
}
|
|
108
|
-
}
|
|
118
|
+
}`;
|
|
119
|
+
})
|
|
109
120
|
.join(", ");
|
|
110
121
|
};
|
|
111
122
|
const preparedData = prepareExportInterfaceData(data);
|
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
export interface staticRouteInterface_hotel_v2 {
|
|
2
2
|
get: {
|
|
3
3
|
"/api/v2/hotel/users/id": {
|
|
4
|
-
requireParams: {
|
|
5
|
-
data: {
|
|
6
|
-
id: number;
|
|
7
|
-
bookingGroupID: number;
|
|
8
|
-
checkInDate: string;
|
|
9
|
-
checkOutDate: string;
|
|
10
|
-
checkInTime: string;
|
|
11
|
-
checkOutTime: string;
|
|
12
|
-
roomRate: number;
|
|
13
|
-
extraBedRate: number;
|
|
14
|
-
roomNumber?: string | undefined | null;
|
|
15
|
-
editTime: string;
|
|
16
|
-
createTime: string;
|
|
17
|
-
shiftDate: string;
|
|
18
|
-
shiftName: string | null;
|
|
19
|
-
userName: string;
|
|
20
|
-
bookingStatus: "ACTIVE" | "CLOSE" | "CANCEL" | "NO_SHOW";
|
|
21
|
-
is_specificRoom: number;
|
|
22
|
-
guestCount: number;
|
|
23
|
-
reasonToCancel: string;
|
|
24
|
-
note?: string | undefined | null;
|
|
25
|
-
};
|
|
26
|
-
parameter: {
|
|
27
|
-
xx: boolean;
|
|
28
|
-
data: (string)[];
|
|
29
|
-
};
|
|
30
|
-
};
|
|
4
|
+
requireParams: {};
|
|
31
5
|
responseStructure: {
|
|
32
6
|
data: {
|
|
33
7
|
id: number;
|
package/dist/v2/run_v2.test.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.hotel_model_const_temp = void 0;
|
|
16
16
|
const express_1 = __importDefault(require("express"));
|
|
17
17
|
const GGExpressV2_1 = __importDefault(require("./GGExpressV2"));
|
|
18
|
+
const apiConnector_hotel_v2_1 = require("./output/apiConnector_hotel_v2");
|
|
18
19
|
exports.hotel_model_const_temp = {
|
|
19
20
|
booking: {
|
|
20
21
|
id: "number",
|
|
@@ -43,12 +44,13 @@ function run() {
|
|
|
43
44
|
const ggapp = new GGExpressV2_1.default(app, "hotel", ["./output"]);
|
|
44
45
|
ggapp.get("/api/v2/hotel/users/id", {
|
|
45
46
|
requireParams: {
|
|
46
|
-
data:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
// data: hotel_model_const_temp.booking,
|
|
48
|
+
data: {},
|
|
49
|
+
// nonNullableKey: ["id", "note"],
|
|
50
|
+
// parameter: {
|
|
51
|
+
// xx: "boolean",
|
|
52
|
+
// data: "string[]",
|
|
53
|
+
// },
|
|
52
54
|
// isPartial: true,
|
|
53
55
|
},
|
|
54
56
|
responseStructure: [exports.hotel_model_const_temp.booking],
|
|
@@ -68,14 +70,33 @@ function run() {
|
|
|
68
70
|
}));
|
|
69
71
|
}
|
|
70
72
|
run();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
const x = new apiConnector_hotel_v2_1.GGApi_v2();
|
|
75
|
+
x.get("/api/v2/hotel/users/id", {
|
|
76
|
+
data: {
|
|
77
|
+
id: 0,
|
|
78
|
+
bookingGroupID: 0,
|
|
79
|
+
checkInDate: "",
|
|
80
|
+
checkOutDate: "",
|
|
81
|
+
checkInTime: "",
|
|
82
|
+
checkOutTime: "",
|
|
83
|
+
roomRate: 0,
|
|
84
|
+
extraBedRate: 0,
|
|
85
|
+
editTime: "",
|
|
86
|
+
createTime: "",
|
|
87
|
+
shiftDate: "",
|
|
88
|
+
shiftName: null,
|
|
89
|
+
userName: "",
|
|
90
|
+
bookingStatus: "ACTIVE",
|
|
91
|
+
is_specificRoom: 0,
|
|
92
|
+
guestCount: 0,
|
|
93
|
+
reasonToCancel: "",
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
.then((response) => {
|
|
97
|
+
console.log("response", response);
|
|
98
|
+
})
|
|
99
|
+
.catch((error) => {
|
|
100
|
+
console.error("fetch error", error);
|
|
101
|
+
});
|
|
102
|
+
}, 3000);
|
package/package.json
CHANGED
|
@@ -42,7 +42,7 @@ function extract(
|
|
|
42
42
|
),
|
|
43
43
|
parameter: route.parameter
|
|
44
44
|
? parentInputToCode(route.parameter, false)
|
|
45
|
-
: "
|
|
45
|
+
: "{}",
|
|
46
46
|
responseStructure: parentInputToCode(route.responseStructure, false),
|
|
47
47
|
isPartial: route.isPartialRequireParam,
|
|
48
48
|
}
|
|
@@ -125,17 +125,30 @@ export function generateStaticRouteFileV2(appName: string, data: routeList[]) {
|
|
|
125
125
|
const generateEachUrl = (data: PrepareRouteStructure[Method]) => {
|
|
126
126
|
const keyName = Object.keys(data)
|
|
127
127
|
return keyName
|
|
128
|
-
.map(
|
|
129
|
-
|
|
128
|
+
.map((keyName) => {
|
|
129
|
+
const parameterCode =
|
|
130
|
+
data[keyName].parameter !== "{}"
|
|
131
|
+
? `parameter: ${data[keyName].parameter}`
|
|
132
|
+
: null
|
|
133
|
+
const requireParamsData =
|
|
134
|
+
data[keyName].requireParams === "{}"
|
|
135
|
+
? `data: ${data[keyName].requireParams}`
|
|
136
|
+
: null
|
|
137
|
+
|
|
138
|
+
const requireParams = [requireParamsData, parameterCode]
|
|
139
|
+
.filter((row) => row !== null)
|
|
140
|
+
.join(", ")
|
|
141
|
+
|
|
142
|
+
return `
|
|
130
143
|
"${keyName}" : {
|
|
131
|
-
requireParams : {
|
|
144
|
+
requireParams : { ${requireParams} },
|
|
132
145
|
responseStructure : {
|
|
133
146
|
data : ${data[keyName].responseStructure},
|
|
134
147
|
status: "SUCCESS" | "ERROR",
|
|
135
148
|
message: string
|
|
136
149
|
}
|
|
137
150
|
}`
|
|
138
|
-
)
|
|
151
|
+
})
|
|
139
152
|
.join(", ")
|
|
140
153
|
}
|
|
141
154
|
const preparedData = prepareExportInterfaceData(data)
|
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
export interface staticRouteInterface_hotel_v2 {
|
|
2
|
+
get: {
|
|
3
|
+
"/api/v2/hotel/users/id": {
|
|
4
|
+
requireParams: {}
|
|
5
|
+
responseStructure: {
|
|
6
|
+
data: {
|
|
7
|
+
id: number
|
|
8
|
+
bookingGroupID: number
|
|
9
|
+
checkInDate: string
|
|
10
|
+
checkOutDate: string
|
|
11
|
+
checkInTime: string
|
|
12
|
+
checkOutTime: string
|
|
13
|
+
roomRate: number
|
|
14
|
+
extraBedRate: number
|
|
15
|
+
roomNumber?: string | undefined | null
|
|
16
|
+
editTime: string
|
|
17
|
+
createTime: string
|
|
18
|
+
shiftDate: string
|
|
19
|
+
shiftName: string | null
|
|
20
|
+
userName: string
|
|
21
|
+
bookingStatus: "ACTIVE" | "CLOSE" | "CANCEL" | "NO_SHOW"
|
|
22
|
+
is_specificRoom: number
|
|
23
|
+
guestCount: number
|
|
24
|
+
reasonToCancel: string
|
|
25
|
+
note?: string | undefined | null
|
|
26
|
+
}[]
|
|
27
|
+
status: "SUCCESS" | "ERROR"
|
|
28
|
+
message: string
|
|
29
|
+
}
|
|
30
|
+
}
|
|
15
31
|
}
|
|
16
|
-
|
|
32
|
+
post: {}
|
|
33
|
+
put: {}
|
|
34
|
+
delete: {}
|
|
35
|
+
}
|
package/src/v2/run_v2.test.ts
CHANGED
|
@@ -34,12 +34,13 @@ function run() {
|
|
|
34
34
|
"/api/v2/hotel/users/id",
|
|
35
35
|
{
|
|
36
36
|
requireParams: {
|
|
37
|
-
data: hotel_model_const_temp.booking,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
// data: hotel_model_const_temp.booking,
|
|
38
|
+
data: {},
|
|
39
|
+
// nonNullableKey: ["id", "note"],
|
|
40
|
+
// parameter: {
|
|
41
|
+
// xx: "boolean",
|
|
42
|
+
// data: "string[]",
|
|
43
|
+
// },
|
|
43
44
|
// isPartial: true,
|
|
44
45
|
},
|
|
45
46
|
responseStructure: [hotel_model_const_temp.booking],
|
|
@@ -63,14 +64,33 @@ function run() {
|
|
|
63
64
|
}
|
|
64
65
|
run()
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
const x = new GGApi_v2()
|
|
69
|
+
x.get("/api/v2/hotel/users/id", {
|
|
70
|
+
data: {
|
|
71
|
+
id: 0,
|
|
72
|
+
bookingGroupID: 0,
|
|
73
|
+
checkInDate: "",
|
|
74
|
+
checkOutDate: "",
|
|
75
|
+
checkInTime: "",
|
|
76
|
+
checkOutTime: "",
|
|
77
|
+
roomRate: 0,
|
|
78
|
+
extraBedRate: 0,
|
|
79
|
+
editTime: "",
|
|
80
|
+
createTime: "",
|
|
81
|
+
shiftDate: "",
|
|
82
|
+
shiftName: null,
|
|
83
|
+
userName: "",
|
|
84
|
+
bookingStatus: "ACTIVE",
|
|
85
|
+
is_specificRoom: 0,
|
|
86
|
+
guestCount: 0,
|
|
87
|
+
reasonToCancel: "",
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
.then((response) => {
|
|
91
|
+
console.log("response", response)
|
|
92
|
+
})
|
|
93
|
+
.catch((error) => {
|
|
94
|
+
console.error("fetch error", error)
|
|
95
|
+
})
|
|
96
|
+
}, 3000)
|