gg-express 1.0.102 → 1.0.104
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 +4 -1
- package/dist/v2/output/staticRouteInterface_hotel_v2.d.ts +24 -47
- package/dist/v2/run_v2.test.d.ts +1 -1
- package/dist/v2/run_v2.test.js +28 -95
- package/dist/v2/typeResolver.d.ts +1 -1
- package/package.json +1 -1
- package/src/v2/generateStaticRouteFileV2.ts +3 -2
- package/src/v2/output/staticRouteInterface_hotel_v2.ts +26 -78
- package/src/v2/run_v2.test.ts +29 -100
- package/src/v2/typeResolver.ts +9 -3
|
@@ -47,7 +47,10 @@ function parentInputToCode(data, isPartialRequireParam) {
|
|
|
47
47
|
else
|
|
48
48
|
result;
|
|
49
49
|
if (isUndefinedAble === "undefined")
|
|
50
|
-
|
|
50
|
+
if (isPartialRequireParam)
|
|
51
|
+
return `${parentKeyName}? : ${result}`;
|
|
52
|
+
else
|
|
53
|
+
return `${getParentKeyCode(parentKeyName)}? : ${result}`;
|
|
51
54
|
else
|
|
52
55
|
return `${getParentKeyCode(parentKeyName)} : ${result}`;
|
|
53
56
|
}
|
|
@@ -2,8 +2,7 @@ export interface staticRouteInterface_hotel_v2 {
|
|
|
2
2
|
get: {
|
|
3
3
|
"/api/hotel/users/id": {
|
|
4
4
|
requireParams: {
|
|
5
|
-
|
|
6
|
-
data: {
|
|
5
|
+
booking: {
|
|
7
6
|
id: number;
|
|
8
7
|
bookingGroupID: number;
|
|
9
8
|
checkInDate: string;
|
|
@@ -12,7 +11,7 @@ export interface staticRouteInterface_hotel_v2 {
|
|
|
12
11
|
checkOutTime: string;
|
|
13
12
|
roomRate: number;
|
|
14
13
|
extraBedRate: number;
|
|
15
|
-
roomNumber
|
|
14
|
+
roomNumber?: string | undefined | null;
|
|
16
15
|
editTime: string;
|
|
17
16
|
createTime: string;
|
|
18
17
|
shiftDate: string;
|
|
@@ -24,37 +23,30 @@ export interface staticRouteInterface_hotel_v2 {
|
|
|
24
23
|
reasonToCancel: string;
|
|
25
24
|
note: string;
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
status: "on" | "off";
|
|
29
|
-
};
|
|
26
|
+
}[];
|
|
30
27
|
responseStructure: {
|
|
31
28
|
data: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
actual: number;
|
|
54
|
-
};
|
|
55
|
-
notReturnQty: number;
|
|
56
|
-
}[];
|
|
57
|
-
}[];
|
|
29
|
+
0: {
|
|
30
|
+
id: number;
|
|
31
|
+
bookingGroupID: number;
|
|
32
|
+
checkInDate: string;
|
|
33
|
+
checkOutDate: string;
|
|
34
|
+
checkInTime: string;
|
|
35
|
+
checkOutTime: string;
|
|
36
|
+
roomRate: number;
|
|
37
|
+
extraBedRate: number;
|
|
38
|
+
roomNumber?: string | undefined | null;
|
|
39
|
+
editTime: string;
|
|
40
|
+
createTime: string;
|
|
41
|
+
shiftDate: string;
|
|
42
|
+
shiftName: string;
|
|
43
|
+
userName: string;
|
|
44
|
+
bookingStatus: "ACTIVE" | "CLOSE" | "CANCEL" | "NO_SHOW";
|
|
45
|
+
is_specificRoom: number;
|
|
46
|
+
guestCount: number;
|
|
47
|
+
reasonToCancel: string;
|
|
48
|
+
note: string;
|
|
49
|
+
};
|
|
58
50
|
};
|
|
59
51
|
status: "SUCCESS" | "ERROR";
|
|
60
52
|
message: string;
|
|
@@ -79,21 +71,6 @@ export interface staticRouteInterface_hotel_v2 {
|
|
|
79
71
|
message: string;
|
|
80
72
|
};
|
|
81
73
|
};
|
|
82
|
-
"/api/hotel/testPost": {
|
|
83
|
-
requireParams: {
|
|
84
|
-
id?: number;
|
|
85
|
-
};
|
|
86
|
-
responseStructure: {
|
|
87
|
-
data: {
|
|
88
|
-
bookingData: {
|
|
89
|
-
id: number;
|
|
90
|
-
roomNumber: string;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
status: "SUCCESS" | "ERROR";
|
|
94
|
-
message: string;
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
74
|
};
|
|
98
75
|
put: {};
|
|
99
76
|
delete: {};
|
package/dist/v2/run_v2.test.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const hotel_model_const_temp: {
|
|
|
8
8
|
readonly checkOutTime: "string";
|
|
9
9
|
readonly roomRate: "number";
|
|
10
10
|
readonly extraBedRate: "number";
|
|
11
|
-
readonly roomNumber: "string
|
|
11
|
+
readonly roomNumber: "string?~";
|
|
12
12
|
readonly editTime: "string";
|
|
13
13
|
readonly createTime: "string";
|
|
14
14
|
readonly shiftDate: "string";
|
package/dist/v2/run_v2.test.js
CHANGED
|
@@ -25,7 +25,7 @@ exports.hotel_model_const_temp = {
|
|
|
25
25
|
checkOutTime: "string",
|
|
26
26
|
roomRate: "number",
|
|
27
27
|
extraBedRate: "number",
|
|
28
|
-
roomNumber: "string
|
|
28
|
+
roomNumber: "string?~",
|
|
29
29
|
editTime: "string",
|
|
30
30
|
createTime: "string",
|
|
31
31
|
shiftDate: "string",
|
|
@@ -43,81 +43,36 @@ function run() {
|
|
|
43
43
|
const ggapp = new GGExpressV2_1.default(app, "hotel", ["./output"]);
|
|
44
44
|
ggapp.get("/api/hotel/users/id", {
|
|
45
45
|
requireParams: {
|
|
46
|
-
data:
|
|
47
|
-
id: "number",
|
|
48
|
-
data: exports.hotel_model_const_temp["booking"],
|
|
49
|
-
name: "string",
|
|
50
|
-
status: ["on", "off"],
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
responseStructure: {
|
|
54
|
-
x: "string",
|
|
55
|
-
data: [
|
|
56
|
-
{
|
|
57
|
-
zoneID: "number",
|
|
58
|
-
zoneName: "string",
|
|
59
|
-
data: [
|
|
60
|
-
{
|
|
61
|
-
itemID: "number",
|
|
62
|
-
itemEachHotelID: "number",
|
|
63
|
-
itemName: "string",
|
|
64
|
-
requisitionQty: {
|
|
65
|
-
expected: "number",
|
|
66
|
-
actual: "number",
|
|
67
|
-
},
|
|
68
|
-
zoneStockQty: {
|
|
69
|
-
begin: "number",
|
|
70
|
-
end: "number",
|
|
71
|
-
},
|
|
72
|
-
usedQty: "number",
|
|
73
|
-
lossQty: "number",
|
|
74
|
-
damageQty: "number",
|
|
75
|
-
returnQty: {
|
|
76
|
-
expected: "number",
|
|
77
|
-
actual: "number",
|
|
78
|
-
},
|
|
79
|
-
notReturnQty: "number",
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
],
|
|
46
|
+
data: [exports.hotel_model_const_temp],
|
|
84
47
|
},
|
|
48
|
+
responseStructure: [exports.hotel_model_const_temp.booking],
|
|
85
49
|
}, (req, res, next) => {
|
|
86
50
|
return res.json({
|
|
87
51
|
message: "",
|
|
88
52
|
status: "SUCCESS",
|
|
89
|
-
data:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
expected: 0,
|
|
113
|
-
actual: 0,
|
|
114
|
-
},
|
|
115
|
-
notReturnQty: 0,
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
},
|
|
53
|
+
data: [
|
|
54
|
+
{
|
|
55
|
+
id: 0,
|
|
56
|
+
bookingGroupID: 0,
|
|
57
|
+
checkInDate: "",
|
|
58
|
+
checkOutDate: "",
|
|
59
|
+
checkInTime: "",
|
|
60
|
+
checkOutTime: "",
|
|
61
|
+
roomRate: 0,
|
|
62
|
+
extraBedRate: 0,
|
|
63
|
+
roomNumber: undefined,
|
|
64
|
+
editTime: "",
|
|
65
|
+
createTime: "",
|
|
66
|
+
shiftDate: "",
|
|
67
|
+
shiftName: "",
|
|
68
|
+
userName: "",
|
|
69
|
+
bookingStatus: "ACTIVE",
|
|
70
|
+
is_specificRoom: 0,
|
|
71
|
+
guestCount: 0,
|
|
72
|
+
reasonToCancel: "",
|
|
73
|
+
note: "",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
121
76
|
});
|
|
122
77
|
});
|
|
123
78
|
ggapp.post("/api/hotel/booking/id", {
|
|
@@ -147,26 +102,6 @@ function run() {
|
|
|
147
102
|
},
|
|
148
103
|
});
|
|
149
104
|
});
|
|
150
|
-
ggapp.post("/api/hotel/testPost", {
|
|
151
|
-
requireParams: {
|
|
152
|
-
isPartial: true,
|
|
153
|
-
data: {
|
|
154
|
-
id: "number",
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
responseStructure: {
|
|
158
|
-
bookingData: {
|
|
159
|
-
id: "number",
|
|
160
|
-
roomNumber: "string",
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
}, (req, res, next) => {
|
|
164
|
-
req.body.id;
|
|
165
|
-
return res.json({
|
|
166
|
-
status: "ERROR",
|
|
167
|
-
message: "",
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
105
|
app.listen(3002, () => __awaiter(this, void 0, void 0, function* () {
|
|
171
106
|
yield ggapp.generateAPIFiles();
|
|
172
107
|
console.log("done");
|
|
@@ -177,13 +112,11 @@ run();
|
|
|
177
112
|
// setTimeout(() => {
|
|
178
113
|
// const x = new GGApi_v2()
|
|
179
114
|
// //@ts-ignore
|
|
180
|
-
// x.get("http://localhost:3002/api/hotel/users/id",
|
|
181
|
-
// id: 1,
|
|
182
|
-
// })
|
|
115
|
+
// x.get("http://localhost:3002/api/hotel/users/id", [])
|
|
183
116
|
// .then((response) => {
|
|
184
117
|
// console.log("response", response)
|
|
185
118
|
// })
|
|
186
119
|
// .catch((error) => {
|
|
187
|
-
// console.error("fetch error")
|
|
120
|
+
// console.error("fetch error", error)
|
|
188
121
|
// })
|
|
189
122
|
// }, 3000)
|
|
@@ -4,7 +4,7 @@ type CustomType = BaseType | `${BaseType}?` | `${BaseType}~` | `${BaseType}?~`;
|
|
|
4
4
|
type InputEnum = readonly string[] | readonly number[];
|
|
5
5
|
export type ConstSchemaType = {
|
|
6
6
|
[key in string]: CustomType | ConstSchemaType | ConstSchemaType[] | InputEnum;
|
|
7
|
-
};
|
|
7
|
+
} | ConstSchemaType[];
|
|
8
8
|
type ResolveBase<T extends BaseType> = T extends "string" ? string : T extends "string[]" ? string[] : T extends "number" ? number : T extends "number[]" ? number[] : T extends "boolean" ? boolean : T extends "boolean[]" ? boolean[] : never;
|
|
9
9
|
export declare const toArray: <T>(input: T) => T[];
|
|
10
10
|
type ResolveExtraType<T> = T extends `${infer B}?~` ? ResolveBase<B & BaseType> | null | undefined : T extends `${infer B}?` ? ResolveBase<B & BaseType> | undefined : T extends `${infer B}~` ? ResolveBase<B & BaseType> | null : ResolveBase<T & BaseType>;
|
package/package.json
CHANGED
|
@@ -70,7 +70,8 @@ function parentInputToCode(
|
|
|
70
70
|
if (isArray) result = `(${result})[]`
|
|
71
71
|
else result
|
|
72
72
|
if (isUndefinedAble === "undefined")
|
|
73
|
-
return `${
|
|
73
|
+
if (isPartialRequireParam) return `${parentKeyName}? : ${result}`
|
|
74
|
+
else return `${getParentKeyCode(parentKeyName)}? : ${result}`
|
|
74
75
|
else return `${getParentKeyCode(parentKeyName)} : ${result}`
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -99,7 +100,7 @@ function parentInputToCode(
|
|
|
99
100
|
target[0] === null ||
|
|
100
101
|
target[0] === undefined
|
|
101
102
|
)
|
|
102
|
-
return `${getParentKeyCode(parentKeyName)} : ${
|
|
103
|
+
return `${getParentKeyCode(parentKeyName)} : ${target
|
|
103
104
|
.map((word) => ` "${word}" `)
|
|
104
105
|
.join("|")} `
|
|
105
106
|
// nest or input nest
|
|
@@ -1,79 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
name: string
|
|
28
|
-
status: "on" | "off"
|
|
29
|
-
}
|
|
30
|
-
responseStructure: {
|
|
31
|
-
data: {
|
|
32
|
-
x: string
|
|
33
|
-
data: {
|
|
34
|
-
zoneID: number
|
|
35
|
-
zoneName: string
|
|
36
|
-
data: {
|
|
37
|
-
itemID: number
|
|
38
|
-
itemEachHotelID: number
|
|
39
|
-
itemName: string
|
|
40
|
-
requisitionQty: { expected: number; actual: number }
|
|
41
|
-
zoneStockQty: { begin: number; end: number }
|
|
42
|
-
usedQty: number
|
|
43
|
-
lossQty: number
|
|
44
|
-
damageQty: number
|
|
45
|
-
returnQty: { expected: number; actual: number }
|
|
46
|
-
notReturnQty: number
|
|
47
|
-
}[]
|
|
48
|
-
}[]
|
|
49
|
-
}
|
|
50
|
-
status: "SUCCESS" | "ERROR"
|
|
51
|
-
message: string
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
|
|
2
|
+
export interface staticRouteInterface_hotel_v2 {
|
|
3
|
+
get : {
|
|
4
|
+
"/api/hotel/users/id" : {
|
|
5
|
+
requireParams : {
|
|
6
|
+
booking : { id : number,bookingGroupID : number,checkInDate : string,checkOutDate : string,checkInTime : string,checkOutTime : string,roomRate : number,extraBedRate : number,roomNumber? : string | undefined | null,editTime : string,createTime : string,shiftDate : string,shiftName : string,userName : string,bookingStatus : "ACTIVE" | "CLOSE" | "CANCEL" | "NO_SHOW" ,is_specificRoom : number,guestCount : number,reasonToCancel : string,note : string } } [] ,
|
|
7
|
+
responseStructure : {
|
|
8
|
+
data : {
|
|
9
|
+
0 : { id : number,bookingGroupID : number,checkInDate : string,checkOutDate : string,checkInTime : string,checkOutTime : string,roomRate : number,extraBedRate : number,roomNumber? : string | undefined | null,editTime : string,createTime : string,shiftDate : string,shiftName : string,userName : string,bookingStatus : "ACTIVE" | "CLOSE" | "CANCEL" | "NO_SHOW" ,is_specificRoom : number,guestCount : number,reasonToCancel : string,note : string } } ,
|
|
10
|
+
status: "SUCCESS" | "ERROR",
|
|
11
|
+
message: string
|
|
12
|
+
}
|
|
13
|
+
} },
|
|
14
|
+
post : {
|
|
15
|
+
"/api/hotel/booking/id" : {
|
|
16
|
+
requireParams : { id? : number,id2? : number,name? : string } ,
|
|
17
|
+
responseStructure : {
|
|
18
|
+
data : {
|
|
19
|
+
bookingData : { id : number,roomNumber : string } } ,
|
|
20
|
+
status: "SUCCESS" | "ERROR",
|
|
21
|
+
message: string
|
|
22
|
+
}
|
|
23
|
+
} },
|
|
24
|
+
put : { },
|
|
25
|
+
delete : { },
|
|
54
26
|
}
|
|
55
|
-
|
|
56
|
-
"/api/hotel/booking/id": {
|
|
57
|
-
requireParams: { id?: number; id2?: number; name?: string }
|
|
58
|
-
responseStructure: {
|
|
59
|
-
data: {
|
|
60
|
-
bookingData: { id: number; roomNumber: string }
|
|
61
|
-
}
|
|
62
|
-
status: "SUCCESS" | "ERROR"
|
|
63
|
-
message: string
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
"/api/hotel/testPost": {
|
|
67
|
-
requireParams: { id?: number }
|
|
68
|
-
responseStructure: {
|
|
69
|
-
data: {
|
|
70
|
-
bookingData: { id: number; roomNumber: string }
|
|
71
|
-
}
|
|
72
|
-
status: "SUCCESS" | "ERROR"
|
|
73
|
-
message: string
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
put: {}
|
|
78
|
-
delete: {}
|
|
79
|
-
}
|
|
27
|
+
|
package/src/v2/run_v2.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import express from "express"
|
|
2
2
|
import GGExpressV2 from "./GGExpressV2"
|
|
3
3
|
import { toArray } from "./typeResolver"
|
|
4
|
+
import { GGApi_v2 } from "./output/apiConnector_hotel_v2"
|
|
4
5
|
|
|
5
6
|
export const hotel_model_const_temp = {
|
|
6
7
|
booking: {
|
|
@@ -12,7 +13,7 @@ export const hotel_model_const_temp = {
|
|
|
12
13
|
checkOutTime: "string",
|
|
13
14
|
roomRate: "number",
|
|
14
15
|
extraBedRate: "number",
|
|
15
|
-
roomNumber: "string
|
|
16
|
+
roomNumber: "string?~",
|
|
16
17
|
editTime: "string",
|
|
17
18
|
createTime: "string",
|
|
18
19
|
shiftDate: "string",
|
|
@@ -33,82 +34,37 @@ function run() {
|
|
|
33
34
|
"/api/hotel/users/id",
|
|
34
35
|
{
|
|
35
36
|
requireParams: {
|
|
36
|
-
data:
|
|
37
|
-
id: "number",
|
|
38
|
-
data: hotel_model_const_temp["booking"],
|
|
39
|
-
name: "string",
|
|
40
|
-
status: ["on", "off"],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
responseStructure: {
|
|
44
|
-
x: "string",
|
|
45
|
-
data: [
|
|
46
|
-
{
|
|
47
|
-
zoneID: "number",
|
|
48
|
-
zoneName: "string",
|
|
49
|
-
data: [
|
|
50
|
-
{
|
|
51
|
-
itemID: "number",
|
|
52
|
-
itemEachHotelID: "number",
|
|
53
|
-
itemName: "string",
|
|
54
|
-
requisitionQty: {
|
|
55
|
-
expected: "number",
|
|
56
|
-
actual: "number",
|
|
57
|
-
},
|
|
58
|
-
zoneStockQty: {
|
|
59
|
-
begin: "number",
|
|
60
|
-
end: "number",
|
|
61
|
-
},
|
|
62
|
-
usedQty: "number",
|
|
63
|
-
lossQty: "number",
|
|
64
|
-
damageQty: "number",
|
|
65
|
-
returnQty: {
|
|
66
|
-
expected: "number",
|
|
67
|
-
actual: "number",
|
|
68
|
-
},
|
|
69
|
-
notReturnQty: "number",
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
],
|
|
37
|
+
data: [hotel_model_const_temp],
|
|
74
38
|
},
|
|
39
|
+
responseStructure: [hotel_model_const_temp.booking],
|
|
75
40
|
},
|
|
76
41
|
(req, res, next) => {
|
|
77
42
|
return res.json({
|
|
78
43
|
message: "",
|
|
79
44
|
status: "SUCCESS",
|
|
80
|
-
data:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
expected: 0,
|
|
104
|
-
actual: 0,
|
|
105
|
-
},
|
|
106
|
-
notReturnQty: 0,
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
},
|
|
45
|
+
data: [
|
|
46
|
+
{
|
|
47
|
+
id: 0,
|
|
48
|
+
bookingGroupID: 0,
|
|
49
|
+
checkInDate: "",
|
|
50
|
+
checkOutDate: "",
|
|
51
|
+
checkInTime: "",
|
|
52
|
+
checkOutTime: "",
|
|
53
|
+
roomRate: 0,
|
|
54
|
+
extraBedRate: 0,
|
|
55
|
+
roomNumber: undefined,
|
|
56
|
+
editTime: "",
|
|
57
|
+
createTime: "",
|
|
58
|
+
shiftDate: "",
|
|
59
|
+
shiftName: "",
|
|
60
|
+
userName: "",
|
|
61
|
+
bookingStatus: "ACTIVE",
|
|
62
|
+
is_specificRoom: 0,
|
|
63
|
+
guestCount: 0,
|
|
64
|
+
reasonToCancel: "",
|
|
65
|
+
note: "",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
112
68
|
})
|
|
113
69
|
}
|
|
114
70
|
)
|
|
@@ -144,31 +100,6 @@ function run() {
|
|
|
144
100
|
}
|
|
145
101
|
)
|
|
146
102
|
|
|
147
|
-
ggapp.post(
|
|
148
|
-
"/api/hotel/testPost",
|
|
149
|
-
{
|
|
150
|
-
requireParams: {
|
|
151
|
-
isPartial: true,
|
|
152
|
-
data: {
|
|
153
|
-
id: "number",
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
responseStructure: {
|
|
157
|
-
bookingData: {
|
|
158
|
-
id: "number",
|
|
159
|
-
roomNumber: "string",
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
(req, res, next) => {
|
|
164
|
-
req.body.id
|
|
165
|
-
return res.json({
|
|
166
|
-
status: "ERROR",
|
|
167
|
-
message: "",
|
|
168
|
-
})
|
|
169
|
-
}
|
|
170
|
-
)
|
|
171
|
-
|
|
172
103
|
app.listen(3002, async () => {
|
|
173
104
|
await ggapp.generateAPIFiles()
|
|
174
105
|
console.log("done")
|
|
@@ -180,13 +111,11 @@ run()
|
|
|
180
111
|
// setTimeout(() => {
|
|
181
112
|
// const x = new GGApi_v2()
|
|
182
113
|
// //@ts-ignore
|
|
183
|
-
// x.get("http://localhost:3002/api/hotel/users/id",
|
|
184
|
-
// id: 1,
|
|
185
|
-
// })
|
|
114
|
+
// x.get("http://localhost:3002/api/hotel/users/id", [])
|
|
186
115
|
// .then((response) => {
|
|
187
116
|
// console.log("response", response)
|
|
188
117
|
// })
|
|
189
118
|
// .catch((error) => {
|
|
190
|
-
// console.error("fetch error")
|
|
119
|
+
// console.error("fetch error", error)
|
|
191
120
|
// })
|
|
192
121
|
// }, 3000)
|
package/src/v2/typeResolver.ts
CHANGED
|
@@ -11,9 +11,15 @@ type BaseType =
|
|
|
11
11
|
type CustomType = BaseType | `${BaseType}?` | `${BaseType}~` | `${BaseType}?~`
|
|
12
12
|
type InputEnum = readonly string[] | readonly number[]
|
|
13
13
|
|
|
14
|
-
export type ConstSchemaType =
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export type ConstSchemaType =
|
|
15
|
+
| {
|
|
16
|
+
[key in string]:
|
|
17
|
+
| CustomType
|
|
18
|
+
| ConstSchemaType
|
|
19
|
+
| ConstSchemaType[]
|
|
20
|
+
| InputEnum
|
|
21
|
+
}
|
|
22
|
+
| ConstSchemaType[]
|
|
17
23
|
|
|
18
24
|
type ResolveBase<T extends BaseType> = T extends "string"
|
|
19
25
|
? string
|