open-api-typescript-request-generator 0.0.1
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/README.md +26 -0
- package/bin/apits-gener +4 -0
- package/es/Generator.d.ts +43 -0
- package/es/Generator.js +892 -0
- package/es/cli.d.ts +19 -0
- package/es/cli.js +547 -0
- package/es/console.d.ts +48 -0
- package/es/console.js +151 -0
- package/es/constants.d.ts +22 -0
- package/es/constants.js +39 -0
- package/es/dependenciesHandler.d.ts +16 -0
- package/es/dependenciesHandler.js +270 -0
- package/es/genIndex.d.ts +23 -0
- package/es/genIndex.js +354 -0
- package/es/genRequest.d.ts +3 -0
- package/es/genRequest.js +216 -0
- package/es/getOutputPath.d.ts +5 -0
- package/es/getOutputPath.js +28 -0
- package/es/helpers.d.ts +63 -0
- package/es/helpers.js +458 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +34 -0
- package/es/requestYapiData.d.ts +157 -0
- package/es/requestYapiData.js +1010 -0
- package/es/responseDataJsonSchemaHandler.d.ts +11 -0
- package/es/responseDataJsonSchemaHandler.js +193 -0
- package/es/server/mock.d.ts +1 -0
- package/es/server/mock.js +7 -0
- package/es/server/swaggerJsonToYApiData.d.ts +10 -0
- package/es/server/swaggerJsonToYApiData.js +614 -0
- package/es/spinner.d.ts +15 -0
- package/es/spinner.js +58 -0
- package/es/types.d.ts +736 -0
- package/es/types.js +143 -0
- package/es/utils.d.ts +97 -0
- package/es/utils.js +783 -0
- package/lib/Generator.d.ts +43 -0
- package/lib/Generator.js +892 -0
- package/lib/cli.d.ts +19 -0
- package/lib/cli.js +547 -0
- package/lib/console.d.ts +48 -0
- package/lib/console.js +151 -0
- package/lib/constants.d.ts +22 -0
- package/lib/constants.js +39 -0
- package/lib/dependenciesHandler.d.ts +16 -0
- package/lib/dependenciesHandler.js +270 -0
- package/lib/genIndex.d.ts +23 -0
- package/lib/genIndex.js +354 -0
- package/lib/genRequest.d.ts +3 -0
- package/lib/genRequest.js +216 -0
- package/lib/getOutputPath.d.ts +5 -0
- package/lib/getOutputPath.js +28 -0
- package/lib/helpers.d.ts +63 -0
- package/lib/helpers.js +458 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +34 -0
- package/lib/requestYapiData.d.ts +157 -0
- package/lib/requestYapiData.js +1010 -0
- package/lib/responseDataJsonSchemaHandler.d.ts +11 -0
- package/lib/responseDataJsonSchemaHandler.js +193 -0
- package/lib/server/mock.d.ts +1 -0
- package/lib/server/mock.js +7 -0
- package/lib/server/swaggerJsonToYApiData.d.ts +10 -0
- package/lib/server/swaggerJsonToYApiData.js +614 -0
- package/lib/spinner.d.ts +15 -0
- package/lib/spinner.js +58 -0
- package/lib/types.d.ts +736 -0
- package/lib/types.js +143 -0
- package/lib/utils.d.ts +97 -0
- package/lib/utils.js +783 -0
- package/package.json +106 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
import { JSONSchema4 } from './types';
|
2
|
+
import { ExtendedInterface } from './types';
|
3
|
+
export declare const jsonSchemeKey: (path: string) => string;
|
4
|
+
export declare const genJsonSchemeConstContent: (path: string, serverUrl: string, info: ExtendedInterface, JSONSchema: JSONSchema4) => string;
|
5
|
+
export declare const typeStr: (data: unknown) => string;
|
6
|
+
export declare const isEmpty: (data: unknown) => boolean;
|
7
|
+
export declare const getDefaultValue: (type: string) => any;
|
8
|
+
export declare const warning: (content: string) => void;
|
9
|
+
export declare const responseDataInspector: (data: any, jsonScheme: JSONSchema4, key?: any[]) => boolean;
|
10
|
+
export declare const runner: (path: string, data: any, jsonSchema: Record<string, JSONSchema4>) => void;
|
11
|
+
export declare const jsonSchemeFileHeader: () => string;
|
@@ -0,0 +1,193 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
+
|
5
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
8
|
+
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
10
|
+
desc = {
|
11
|
+
enumerable: true,
|
12
|
+
get: function get() {
|
13
|
+
return m[k];
|
14
|
+
}
|
15
|
+
};
|
16
|
+
}
|
17
|
+
|
18
|
+
Object.defineProperty(o, k2, desc);
|
19
|
+
} : function (o, m, k, k2) {
|
20
|
+
if (k2 === undefined) k2 = k;
|
21
|
+
o[k2] = m[k];
|
22
|
+
});
|
23
|
+
|
24
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
25
|
+
Object.defineProperty(o, "default", {
|
26
|
+
enumerable: true,
|
27
|
+
value: v
|
28
|
+
});
|
29
|
+
} : function (o, v) {
|
30
|
+
o["default"] = v;
|
31
|
+
});
|
32
|
+
|
33
|
+
var __importStar = this && this.__importStar || function (mod) {
|
34
|
+
if (mod && mod.__esModule) return mod;
|
35
|
+
var result = {};
|
36
|
+
if (mod != null) for (var k in mod) {
|
37
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
38
|
+
}
|
39
|
+
|
40
|
+
__setModuleDefault(result, mod);
|
41
|
+
|
42
|
+
return result;
|
43
|
+
};
|
44
|
+
|
45
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
46
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
47
|
+
if (ar || !(i in from)) {
|
48
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
49
|
+
ar[i] = from[i];
|
50
|
+
}
|
51
|
+
}
|
52
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
53
|
+
};
|
54
|
+
|
55
|
+
Object.defineProperty(exports, "__esModule", {
|
56
|
+
value: true
|
57
|
+
});
|
58
|
+
exports.jsonSchemeFileHeader = exports.runner = exports.responseDataInspector = exports.warning = exports.getDefaultValue = exports.isEmpty = exports.typeStr = exports.genJsonSchemeConstContent = exports.jsonSchemeKey = void 0;
|
59
|
+
|
60
|
+
var changeCase = __importStar(require("change-case"));
|
61
|
+
|
62
|
+
var jsonSchemeKey = function jsonSchemeKey(path) {
|
63
|
+
var deeps = path.split('/');
|
64
|
+
var names = deeps.splice(deeps.length - 4, deeps.length).join('_');
|
65
|
+
return changeCase.camelCase(names);
|
66
|
+
};
|
67
|
+
|
68
|
+
exports.jsonSchemeKey = jsonSchemeKey;
|
69
|
+
|
70
|
+
var genJsonSchemeConstContent = function genJsonSchemeConstContent(path, serverUrl, info, JSONSchema) {
|
71
|
+
var name = (0, exports.jsonSchemeKey)(path);
|
72
|
+
var escapedTitle = String(info.title).replace(/\//g, '\\/');
|
73
|
+
var description = "[".concat(escapedTitle, "\u2197](").concat(serverUrl, "/project/").concat(info.project_id, "/interface/api/").concat(info._id, ")");
|
74
|
+
return "\n /**\n * ".concat(description, "\n */\n export const ").concat(name, " = ").concat(JSON.stringify(JSONSchema), "\n ");
|
75
|
+
};
|
76
|
+
|
77
|
+
exports.genJsonSchemeConstContent = genJsonSchemeConstContent;
|
78
|
+
|
79
|
+
var typeStr = function typeStr(data) {
|
80
|
+
var type = _typeof(data);
|
81
|
+
|
82
|
+
if (type === 'object' && data instanceof Array) {
|
83
|
+
return 'array';
|
84
|
+
}
|
85
|
+
|
86
|
+
if (type === 'object' && data === null) {
|
87
|
+
return 'null';
|
88
|
+
}
|
89
|
+
|
90
|
+
if (type === 'number') {
|
91
|
+
return 'integer';
|
92
|
+
}
|
93
|
+
|
94
|
+
return type;
|
95
|
+
};
|
96
|
+
|
97
|
+
exports.typeStr = typeStr;
|
98
|
+
|
99
|
+
var isEmpty = function isEmpty(data) {
|
100
|
+
return data === undefined || data === null || data === 0;
|
101
|
+
};
|
102
|
+
|
103
|
+
exports.isEmpty = isEmpty;
|
104
|
+
|
105
|
+
var getDefaultValue = function getDefaultValue(type) {
|
106
|
+
switch (type) {
|
107
|
+
case 'string':
|
108
|
+
return '';
|
109
|
+
|
110
|
+
case 'object':
|
111
|
+
return {};
|
112
|
+
|
113
|
+
case 'array':
|
114
|
+
return [];
|
115
|
+
|
116
|
+
case 'integer':
|
117
|
+
return -Infinity;
|
118
|
+
|
119
|
+
default:
|
120
|
+
return undefined;
|
121
|
+
}
|
122
|
+
};
|
123
|
+
|
124
|
+
exports.getDefaultValue = getDefaultValue;
|
125
|
+
|
126
|
+
var warning = function warning(content) {
|
127
|
+
console.warn("->ResponseDataInspector\uFF1A".concat(content));
|
128
|
+
};
|
129
|
+
|
130
|
+
exports.warning = warning;
|
131
|
+
|
132
|
+
var responseDataInspector = function responseDataInspector(data, jsonScheme, key) {
|
133
|
+
if (key === void 0) {
|
134
|
+
key = ['data'];
|
135
|
+
}
|
136
|
+
|
137
|
+
var type = jsonScheme.type,
|
138
|
+
properties = jsonScheme.properties,
|
139
|
+
items = jsonScheme.items;
|
140
|
+
|
141
|
+
if (type !== (0, exports.typeStr)(data)) {
|
142
|
+
(0, exports.warning)("".concat(key.join('.'), "\u4E0E\u7EA6\u5B9A\u7684\u7C7B\u578B\u4E0D\u7B26\uFF0C\u7C7B\u578B\uFF1A").concat(type, "\uFF0C\u8FD4\u56DE\u503C\uFF1A").concat(data));
|
143
|
+
return false;
|
144
|
+
}
|
145
|
+
|
146
|
+
if (type === 'object') {
|
147
|
+
if (!properties || !Object.keys(properties).length) {
|
148
|
+
return true;
|
149
|
+
}
|
150
|
+
|
151
|
+
return Object.keys(properties).every(function (k) {
|
152
|
+
return (0, exports.responseDataInspector)(data[k], properties[k], __spreadArray(__spreadArray([], key, true), [k], false));
|
153
|
+
});
|
154
|
+
}
|
155
|
+
|
156
|
+
if (type === 'array') {
|
157
|
+
if (items === undefined) {
|
158
|
+
// undefined则为接受任意类型
|
159
|
+
return true;
|
160
|
+
}
|
161
|
+
|
162
|
+
if (items instanceof Array) {
|
163
|
+
return data.some(function (v) {
|
164
|
+
return items.every(function (item) {
|
165
|
+
return (0, exports.responseDataInspector)(v, item);
|
166
|
+
});
|
167
|
+
});
|
168
|
+
}
|
169
|
+
|
170
|
+
if (items instanceof Object) {
|
171
|
+
return data.every(function (v, index) {
|
172
|
+
return (0, exports.responseDataInspector)(v, items, __spreadArray(__spreadArray([], key, true), [index], false));
|
173
|
+
});
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
return true;
|
178
|
+
};
|
179
|
+
|
180
|
+
exports.responseDataInspector = responseDataInspector;
|
181
|
+
|
182
|
+
var runner = function runner(path, data, jsonSchema) {
|
183
|
+
var key = (0, exports.jsonSchemeKey)(path);
|
184
|
+
(0, exports.responseDataInspector)(data, jsonSchema[key]);
|
185
|
+
};
|
186
|
+
|
187
|
+
exports.runner = runner;
|
188
|
+
|
189
|
+
var jsonSchemeFileHeader = function jsonSchemeFileHeader() {
|
190
|
+
return "\n import * as changeCase from 'change-case';\n import { JSONSchema4 } from 'api-ts-generator';\n\n /**\n * \u83B7\u53D6scheme\u7684key\n */\n export const jsonSchemeKey = function (path: string): string {\n const deeps = path.split('/');\n const names = deeps.splice(deeps.length - 4, deeps.length).join('_');\n return changeCase.camelCase(names);\n };\n\n export const typeStr = function (data: unknown): string {\n const type = typeof data;\n if (type === 'object' && data instanceof Array) {\n return 'array';\n }\n if (type === 'object' && data === null) {\n return 'null';\n }\n if (type === 'number') {\n return 'integer';\n }\n\n return type;\n };\n\n /**\n * \u68C0\u67E5\u5668\n */\n export const responseDataInspector = function (data: any, jsonScheme: JSONSchema4, key: any[] = ['data']): boolean {\n const { type, properties, items } = jsonScheme;\n\n if (type !== typeStr(data)) {\n console.warn(`->ResponseDataInspector\uFF1A${key.join('.')}\u4E0E\u7EA6\u5B9A\u7684\u7C7B\u578B\u4E0D\u7B26\uFF0C\u7C7B\u578B\uFF1A${type}\uFF0C\u8FD4\u56DE\u503C\uFF1A${data}`);\n return false;\n }\n if (type === 'object') {\n if (!properties || !Object.keys(properties).length) {\n return true;\n }\n return Object.keys(properties).every(k => responseDataInspector(data[k], properties[k], [...key, k]));\n }\n if (type === 'array') {\n if (items === undefined) {\n // undefined\u5219\u4E3A\u63A5\u53D7\u4EFB\u610F\u7C7B\u578B\n return true;\n }\n if (items instanceof Array) {\n return (data as Array<any>).some(v => items.every(item => responseDataInspector(v, item)));\n }\n if (items instanceof Object) {\n return (data as Array<any>).every((v, index) => responseDataInspector(v, items, [...key, index]));\n }\n }\n\n return true;\n };\n\n export const runner = function (path: string, data: any, jsonSchema: Record<string, any>): void {\n const key = jsonSchemeKey(path);\n responseDataInspector(data, jsonSchema[key]);\n };\n ";
|
191
|
+
};
|
192
|
+
|
193
|
+
exports.jsonSchemeFileHeader = jsonSchemeFileHeader;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const mockData = "{\"openapi\":\"3.0.0\",\"paths\":{\"/wechat-works\":{\"post\":{\"operationId\":\"WechatWorkController_create\",\"parameters\":[],\"requestBody\":{\"required\":true,\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/CreateWorkRequestDto\"}}}},\"responses\":{\"201\":{\"description\":\"\"}},\"security\":[{\"bearer\":[]}],\"summary\":\"Wechat\",\"tags\":[\"Work\"]},\"get\":{\"operationId\":\"WechatWorkController_getWorks\",\"parameters\":[{\"name\":\"pageSize\",\"required\":true,\"in\":\"query\",\"description\":\"Page size, the number of items per page\",\"schema\":{\"type\":\"number\"}},{\"name\":\"page\",\"required\":true,\"in\":\"query\",\"description\":\"Page number, starts from 0\",\"schema\":{\"type\":\"number\"}},{\"name\":\"scope\",\"required\":false,\"in\":\"query\",\"schema\":{\"enum\":[\"ALL\",\"TEACHER\",\"STUDENT\"],\"type\":\"string\"}}],\"responses\":{\"default\":{\"description\":\"\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ListWorksResponseDto\"}}}}},\"security\":[{\"bearer\":[]}],\"summary\":\"Wechat\",\"tags\":[\"Work\"]}}},\"info\":{\"title\":\"API Document\",\"description\":\"It's good to see you guys \uD83E\uDD64\",\"version\":\"1.0\",\"contact\":{}},\"tags\":[],\"servers\":[],\"components\":{\"securitySchemes\":{\"cookie\":{\"type\":\"apiKey\",\"in\":\"cookie\",\"name\":\"refreshToken\"},\"bearer\":{\"scheme\":\"bearer\",\"bearerFormat\":\"JWT\",\"type\":\"http\"}},\"schemas\":{\"CreateWorkCommentRequestDto\":{\"type\":\"object\",\"properties\":{\"workId\":{\"type\":\"string\"},\"content\":{\"type\":\"string\"},\"parentId\":{\"type\":\"string\"}},\"required\":[\"workId\",\"content\"]},\"LikeWorkRequestDto\":{\"type\":\"object\",\"properties\":{\"workId\":{\"type\":\"string\"}},\"required\":[\"workId\"]},\"CreateWorkRequestDto\":{\"type\":\"object\",\"properties\":{\"visibility\":{\"type\":\"string\",\"enum\":[\"GUEST_AND_STUDENT_AND_TEACHER\",\"STUDENT_AND_TEACHER\",\"TEACHER\"]},\"name\":{\"type\":\"string\"},\"workType\":{\"type\":\"string\"},\"imageFileId\":{\"type\":\"string\"}},\"required\":[\"visibility\",\"name\",\"workType\"]},\"CommonPagination\":{\"type\":\"object\",\"properties\":{\"countOfCurrentPage\":{\"type\":\"number\",\"description\":\"Number of items in the current page\"},\"countOfTotal\":{\"type\":\"number\",\"description\":\"Total number of items across all pages\"},\"page\":{\"type\":\"number\",\"description\":\"Page number, starts from 0\"},\"pageSize\":{\"type\":\"number\",\"description\":\"Page size, the number of items per page\"}},\"required\":[\"countOfCurrentPage\",\"countOfTotal\",\"page\",\"pageSize\"]},\"WorkVisibility\":{\"type\":\"string\",\"enum\":[\"GUEST_AND_STUDENT_AND_TEACHER\",\"STUDENT_AND_TEACHER\",\"TEACHER\"]},\"UserStatus\":{\"type\":\"string\",\"enum\":[\"ACTIVE\",\"INACTIVE\"]},\"UserRole\":{\"type\":\"string\",\"enum\":[\"ADMIN\",\"TEACHER\",\"STUDENT\",\"GUEST\"]},\"UserGender\":{\"type\":\"string\",\"enum\":[\"MALE\",\"FEMALE\",\"NONBINARY\",\"UNKNOWN\"]},\"MfaMethod\":{\"type\":\"string\",\"enum\":[\"NONE\",\"SMS\",\"TOTP\",\"EMAIL\"]},\"AuditLog\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"number\"},\"event\":{\"type\":\"string\"},\"rawEvent\":{\"type\":\"string\"},\"ipAddress\":{\"type\":\"string\"},\"userAgent\":{\"type\":\"string\"},\"city\":{\"type\":\"string\"},\"region\":{\"type\":\"string\"},\"timezone\":{\"type\":\"string\"},\"countryCode\":{\"type\":\"string\"},\"browser\":{\"type\":\"string\"},\"operatingSystem\":{\"type\":\"string\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"user\":{\"$ref\":\"#/components/schemas/User\"},\"userId\":{\"type\":\"string\"},\"apiKey\":{\"$ref\":\"#/components/schemas/ApiKey\"},\"apiKeyId\":{\"type\":\"number\"}},\"required\":[\"id\",\"event\",\"rawEvent\",\"createdAt\",\"updatedAt\"]},\"ApiKey\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"number\"},\"key\":{\"type\":\"string\"},\"secret\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"ipRestrictions\":{\"type\":\"object\"},\"referrerRestrictions\":{\"type\":\"object\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"auditLogs\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/AuditLog\"}},\"user\":{\"$ref\":\"#/components/schemas/User\"},\"userId\":{\"type\":\"string\"},\"organizationId\":{\"type\":\"string\"}},\"required\":[\"id\",\"key\",\"secret\",\"createdAt\",\"updatedAt\",\"auditLogs\",\"user\",\"userId\"]},\"ApprovedSubnet\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"number\"},\"subnet\":{\"type\":\"string\"},\"city\":{\"type\":\"string\"},\"region\":{\"type\":\"string\"},\"timezone\":{\"type\":\"string\"},\"countryCode\":{\"type\":\"string\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"user\":{\"$ref\":\"#/components/schemas/User\"},\"userId\":{\"type\":\"string\"}},\"required\":[\"id\",\"subnet\",\"createdAt\",\"updatedAt\",\"user\",\"userId\"]},\"Email\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"number\"},\"email\":{\"type\":\"string\"},\"isVerified\":{\"type\":\"boolean\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"user\":{\"$ref\":\"#/components/schemas/User\"},\"userId\":{\"type\":\"string\"}},\"required\":[\"id\",\"email\",\"isVerified\",\"createdAt\",\"updatedAt\",\"user\",\"userId\"]},\"Session\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"number\"},\"accessToken\":{\"type\":\"string\"},\"refreshToken\":{\"type\":\"string\"},\"ipAddress\":{\"type\":\"string\"},\"userAgent\":{\"type\":\"string\"},\"city\":{\"type\":\"string\"},\"region\":{\"type\":\"string\"},\"timezone\":{\"type\":\"string\"},\"countryCode\":{\"type\":\"string\"},\"browser\":{\"type\":\"string\"},\"operatingSystem\":{\"type\":\"string\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"user\":{\"$ref\":\"#/components/schemas/User\"},\"userId\":{\"type\":\"string\"}},\"required\":[\"id\",\"accessToken\",\"refreshToken\",\"ipAddress\",\"createdAt\",\"updatedAt\",\"user\",\"userId\"]},\"WorkLike\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"workId\":{\"type\":\"string\"},\"userId\":{\"type\":\"string\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"work\":{\"$ref\":\"#/components/schemas/Work\"},\"user\":{\"$ref\":\"#/components/schemas/User\"}},\"required\":[\"id\",\"workId\",\"userId\",\"createdAt\",\"updatedAt\",\"work\",\"user\"]},\"User\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"checkLocationOnLogin\":{\"type\":\"boolean\"},\"status\":{\"allOf\":[{\"$ref\":\"#/components/schemas/UserStatus\"}]},\"username\":{\"type\":\"string\"},\"email\":{\"type\":\"string\"},\"phone\":{\"type\":\"string\"},\"password\":{\"type\":\"string\"},\"roles\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/UserRole\"}},\"name\":{\"type\":\"string\"},\"firstName\":{\"type\":\"string\"},\"middleName\":{\"type\":\"string\"},\"lastName\":{\"type\":\"string\"},\"dateOfBirth\":{\"format\":\"date-time\",\"type\":\"string\"},\"gender\":{\"allOf\":[{\"$ref\":\"#/components/schemas/UserGender\"}]},\"avatarFileId\":{\"type\":\"string\"},\"uiAvatarsUrl\":{\"type\":\"string\"},\"timezone\":{\"type\":\"string\"},\"twoFactorMethod\":{\"allOf\":[{\"$ref\":\"#/components/schemas/MfaMethod\"}]},\"twoFactorPhone\":{\"type\":\"string\"},\"twoFactorSecret\":{\"type\":\"string\"},\"lastLoginAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"apiKeys\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/ApiKey\"}},\"approvedSubnets\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/ApprovedSubnet\"}},\"auditLogs\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/AuditLog\"}},\"emails\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/Email\"}},\"sessions\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/Session\"}},\"wechatOpenId\":{\"type\":\"string\"},\"wechatUnionId\":{\"type\":\"string\"},\"wechatSessionKey\":{\"type\":\"string\"},\"works\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/Work\"}},\"workComments\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkComment\"}},\"workLikes\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkLike\"}},\"workInspirations\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkInspiration\"}}},\"required\":[\"id\",\"checkLocationOnLogin\",\"status\",\"roles\",\"timezone\",\"twoFactorMethod\",\"createdAt\",\"updatedAt\",\"apiKeys\",\"approvedSubnets\",\"auditLogs\",\"emails\",\"sessions\",\"works\",\"workComments\",\"workLikes\",\"workInspirations\"]},\"WorkInspiration\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"workId\":{\"type\":\"string\"},\"userId\":{\"type\":\"string\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"work\":{\"$ref\":\"#/components/schemas/Work\"},\"user\":{\"$ref\":\"#/components/schemas/User\"}},\"required\":[\"id\",\"workId\",\"userId\",\"createdAt\",\"updatedAt\",\"work\",\"user\"]},\"Work\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"visibility\":{\"allOf\":[{\"$ref\":\"#/components/schemas/WorkVisibility\"}]},\"name\":{\"type\":\"string\"},\"workType\":{\"type\":\"string\"},\"imageFileId\":{\"type\":\"string\"},\"commentCount\":{\"type\":\"number\"},\"inspirationCount\":{\"type\":\"number\"},\"likeCount\":{\"type\":\"number\"},\"userId\":{\"type\":\"string\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"comments\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkComment\"}},\"inspirations\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkInspiration\"}},\"likes\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkLike\"}},\"user\":{\"$ref\":\"#/components/schemas/User\"}},\"required\":[\"id\",\"visibility\",\"name\",\"workType\",\"imageFileId\",\"userId\",\"createdAt\",\"updatedAt\",\"comments\",\"inspirations\",\"likes\",\"user\"]},\"WorkComment\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"content\":{\"type\":\"string\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"work\":{\"$ref\":\"#/components/schemas/Work\"},\"workId\":{\"type\":\"string\"},\"userId\":{\"type\":\"string\"},\"parent\":{\"$ref\":\"#/components/schemas/Email\"},\"parentId\":{\"type\":\"string\"},\"replies\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkComment\"}},\"user\":{\"$ref\":\"#/components/schemas/User\"}},\"required\":[\"id\",\"content\",\"createdAt\",\"updatedAt\",\"work\",\"workId\",\"userId\",\"replies\",\"user\"]},\"WorkItemDto\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"visibility\":{\"allOf\":[{\"$ref\":\"#/components/schemas/WorkVisibility\"}]},\"name\":{\"type\":\"string\"},\"workType\":{\"type\":\"string\"},\"imageFileId\":{\"type\":\"string\"},\"commentCount\":{\"type\":\"number\"},\"inspirationCount\":{\"type\":\"number\"},\"likeCount\":{\"type\":\"number\"},\"userId\":{\"type\":\"string\"},\"createdAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"updatedAt\":{\"format\":\"date-time\",\"type\":\"string\"},\"comments\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkComment\"}},\"inspirations\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkInspiration\"}},\"likes\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkLike\"}},\"user\":{\"$ref\":\"#/components/schemas/User\"},\"isLiked\":{\"type\":\"boolean\"},\"isInspirated\":{\"type\":\"boolean\"}},\"required\":[\"id\",\"visibility\",\"name\",\"workType\",\"imageFileId\",\"userId\",\"createdAt\",\"updatedAt\",\"comments\",\"inspirations\",\"likes\",\"user\",\"isLiked\",\"isInspirated\"]},\"ListWorksResponseDto\":{\"type\":\"object\",\"properties\":{\"pagination\":{\"description\":\"Pagination information for the response\",\"allOf\":[{\"$ref\":\"#/components/schemas/CommonPagination\"}]},\"records\":{\"description\":\"List of records in the current page\",\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/WorkItemDto\"}}},\"required\":[\"pagination\",\"records\"]},\"GetCurrentUserResponseDto\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"email\":{\"type\":\"string\"},\"phone\":{\"type\":\"string\"},\"roles\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"name\":{\"type\":\"string\"},\"firstName\":{\"type\":\"string\"},\"middleName\":{\"type\":\"string\"},\"lastName\":{\"type\":\"string\"},\"memberships\":{\"type\":\"array\",\"items\":{\"type\":\"object\"}}},\"required\":[\"id\",\"email\",\"phone\",\"roles\",\"name\",\"firstName\",\"middleName\",\"lastName\",\"memberships\"]},\"ChangePasswordDto\":{\"type\":\"object\",\"properties\":{\"userId\":{\"type\":\"string\",\"description\":\"The user ID of the account to change the password for.\"},\"currentPassword\":{\"type\":\"string\",\"description\":\"The current password of the account.\"},\"newPassword\":{\"type\":\"string\",\"description\":\"The new password for the account.\"}},\"required\":[\"userId\",\"currentPassword\",\"newPassword\"]},\"LoginByPasswordRequestDto\":{\"type\":\"object\",\"properties\":{\"account\":{\"type\":\"string\"},\"password\":{\"type\":\"string\"}},\"required\":[\"account\",\"password\"]},\"SignUpDto\":{\"type\":\"object\",\"properties\":{\"username\":{\"type\":\"string\"},\"email\":{\"type\":\"string\"},\"phone\":{\"type\":\"string\"},\"password\":{\"type\":\"string\"},\"roles\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"name\":{\"type\":\"string\"},\"firstName\":{\"type\":\"string\"},\"middleName\":{\"type\":\"string\"},\"lastName\":{\"type\":\"string\"},\"dateOfBirth\":{\"format\":\"date-time\",\"type\":\"string\"},\"gender\":{\"type\":\"string\"},\"avatarFileId\":{\"type\":\"string\"}},\"required\":[\"email\"]},\"WechatOpenIdLoginDto\":{\"type\":\"object\",\"properties\":{}},\"WechatCodeLoginDto\":{\"type\":\"object\",\"properties\":{}},\"CreateApiKeyDto\":{\"type\":\"object\",\"properties\":{}},\"UpdateApiKeyDto\":{\"type\":\"object\",\"properties\":{}},\"ReplaceApiKeyDto\":{\"type\":\"object\",\"properties\":{}},\"expose\":{\"type\":\"object\",\"properties\":{}},\"SessionsListResponseDto\":{\"type\":\"object\",\"properties\":{\"pagination\":{\"description\":\"Pagination information for the response\",\"allOf\":[{\"$ref\":\"#/components/schemas/CommonPagination\"}]},\"records\":{\"description\":\"List of records in the current page\",\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/expose\"}}},\"required\":[\"pagination\",\"records\"]},\"FileEntity\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"size\":{\"type\":\"number\",\"description\":\"The size of the file in bytes, null for folders.\"},\"s3Bucket\":{\"type\":\"string\"},\"s3Key\":{\"type\":\"string\"},\"s3Response\":{\"type\":\"object\"},\"parentId\":{\"type\":\"string\"},\"createdAt\":{\"type\":\"string\"},\"updatedAt\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\",\"type\",\"size\",\"s3Bucket\",\"s3Key\",\"s3Response\",\"parentId\",\"createdAt\",\"updatedAt\"]},\"ListFilesResponseDto\":{\"type\":\"object\",\"properties\":{\"pagination\":{\"description\":\"Pagination information for the response\",\"allOf\":[{\"$ref\":\"#/components/schemas/CommonPagination\"}]},\"records\":{\"description\":\"The last update timestamp.\",\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/FileEntity\"}}},\"required\":[\"pagination\",\"records\"]},\"CreateFolderRequestDto\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The name of the folder to create.\"},\"parentId\":{\"type\":\"string\",\"description\":\"The parent folder ID to create the folder in.\"}},\"required\":[\"name\"]},\"ListFilePathsResDto\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"parentId\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\",\"type\",\"parentId\"]},\"RenameFileRequestDto\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"}},\"required\":[\"name\"]},\"RenameFileResponseDto\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"size\":{\"type\":\"number\"},\"s3Bucket\":{\"type\":\"string\"},\"s3Key\":{\"type\":\"string\"},\"parentId\":{\"type\":\"string\"},\"uploadId\":{\"type\":\"string\"},\"uploadProgress\":{\"type\":\"number\"}},\"required\":[\"id\",\"name\",\"s3Bucket\",\"s3Key\",\"uploadProgress\"]},\"CreateFileRequestDto\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"size\":{\"type\":\"number\"},\"parentId\":{\"type\":\"string\",\"description\":\"The folder ID to create the file in, do not use both `parentId` and `path` at the same time.\"},\"path\":{\"type\":\"string\",\"description\":\"The folder path to upload the file, e.g. \\\"uploads\\\", not including \\\"/\\\" at the end.\"}},\"required\":[\"name\",\"type\",\"size\"]},\"UploadFileRequestDto\":{\"type\":\"object\",\"properties\":{\"parentId\":{\"type\":\"string\",\"description\":\"The parent folder ID to upload the file to, do not use both `parentId` and `path` at the same time.\"},\"path\":{\"type\":\"string\",\"description\":\"The folder path to upload the file, e.g. \\\"uploads\\\", not including \\\"/\\\" at the end.\"},\"overwrite\":{\"type\":\"boolean\",\"description\":\"1. This option will only take effect when 'name' is provided.\\n 2. Default to false, do not overwrite the existing file.\\n 3. If overwrite is true, the existing file with the same name in the same folder will be overwritten.\"}}},\"UploadBase64RequestDto\":{\"type\":\"object\",\"properties\":{\"parentId\":{\"type\":\"string\",\"description\":\"The parent folder ID to upload the file to, do not use both `parentId` and `path` at the same time.\"},\"path\":{\"type\":\"string\",\"description\":\"The folder path to upload the file, e.g. \\\"uploads\\\", not including \\\"/\\\" at the end.\"},\"base64\":{\"type\":\"string\",\"description\":\"Base64 encoded file data.\"},\"name\":{\"type\":\"string\",\"description\":\"If not set, a random name will be generated.\"},\"overwrite\":{\"type\":\"boolean\",\"description\":\"1. This option will only take effect when 'name' is provided.\\n 2. Default to false, do not overwrite the existing file.\\n 3. If overwrite is true, the existing file with the same name in the same folder will be overwritten.\"}},\"required\":[\"base64\"]},\"CreateMultipartUploadRequestDto\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"size\":{\"type\":\"number\"},\"parentId\":{\"type\":\"string\",\"description\":\"The folder ID to create the file in, do not use both `parentId` and `path` at the same time.\"},\"path\":{\"type\":\"string\",\"description\":\"The folder path to upload the file, e.g. \\\"uploads\\\", not including \\\"/\\\" at the end.\"}},\"required\":[\"name\",\"type\",\"size\"]},\"CreateMultipartUploadResponseDto\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"size\":{\"type\":\"number\"},\"s3Bucket\":{\"type\":\"string\"},\"s3Key\":{\"type\":\"string\"},\"parentId\":{\"type\":\"string\"},\"uploadId\":{\"type\":\"string\"},\"uploadProgress\":{\"type\":\"number\"}},\"required\":[\"id\",\"name\",\"s3Bucket\",\"s3Key\",\"uploadProgress\"]},\"UploadPartRequestDto\":{\"type\":\"object\",\"properties\":{\"uploadId\":{\"type\":\"string\"},\"uploadProgress\":{\"type\":\"number\"},\"partNumber\":{\"type\":\"number\"}},\"required\":[\"uploadId\",\"uploadProgress\",\"partNumber\"]},\"UploadPartResponseDto\":{\"type\":\"object\",\"properties\":{\"ETag\":{\"type\":\"string\"},\"PartNumber\":{\"type\":\"number\"}},\"required\":[\"ETag\",\"PartNumber\"]},\"UploadPartInfo\":{\"type\":\"object\",\"properties\":{\"ETag\":{\"type\":\"string\"},\"PartNumber\":{\"type\":\"number\"}},\"required\":[\"ETag\",\"PartNumber\"]},\"CompleteMultipartUploadRequestDto\":{\"type\":\"object\",\"properties\":{\"uploadId\":{\"type\":\"string\"},\"parts\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/UploadPartInfo\"}}},\"required\":[\"uploadId\",\"parts\"]},\"AbortMultipartUploadRequestDto\":{\"type\":\"object\",\"properties\":{\"uploadId\":{\"type\":\"string\"}},\"required\":[\"uploadId\"]},\"CreateMembershipLevelRequestDto\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"requiredPoints\":{\"type\":\"number\"},\"discountRate\":{\"type\":\"number\"}},\"required\":[\"name\",\"requiredPoints\",\"discountRate\"]},\"UpdateMembershipLevelRequestDto\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"requiredPoints\":{\"type\":\"number\"},\"discountRate\":{\"type\":\"number\"}}},\"UpdateMembershipRequestDto\":{\"type\":\"object\",\"properties\":{\"points\":{\"type\":\"number\"},\"levelId\":{\"type\":\"number\"}}},\"CreateSubscriptionPlanRequestDto\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"billingCycle\":{\"type\":\"string\",\"enum\":[\"MONTHLY\",\"QUARTERLY\",\"SEMI_ANNUALLY\",\"ANNUALLY\"]},\"priceInCents\":{\"type\":\"number\"}},\"required\":[\"name\",\"billingCycle\",\"priceInCents\"]},\"UpdateSubscriptionPlanRequestDto\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"priceInCents\":{\"type\":\"number\"},\"billingCycle\":{\"type\":\"string\",\"enum\":[\"MONTHLY\",\"QUARTERLY\",\"SEMI_ANNUALLY\",\"ANNUALLY\"]}}},\"CreateSubscriptionRequestDto\":{\"type\":\"object\",\"properties\":{\"planId\":{\"type\":\"number\"}},\"required\":[\"planId\"]},\"UpdateSubscriptionRequestDto\":{\"type\":\"object\",\"properties\":{\"status\":{\"type\":\"string\",\"enum\":[\"ACTIVE\",\"EXPIRED\",\"CANCELED\",\"PENDING_PAYMENT\"]}},\"required\":[\"status\"]}}}}";
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.mockData = void 0;
|
7
|
+
exports.mockData = '{"openapi":"3.0.0","paths":{"/wechat-works":{"post":{"operationId":"WechatWorkController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkRequestDto"}}}},"responses":{"201":{"description":""}},"security":[{"bearer":[]}],"summary":"Wechat","tags":["Work"]},"get":{"operationId":"WechatWorkController_getWorks","parameters":[{"name":"pageSize","required":true,"in":"query","description":"Page size, the number of items per page","schema":{"type":"number"}},{"name":"page","required":true,"in":"query","description":"Page number, starts from 0","schema":{"type":"number"}},{"name":"scope","required":false,"in":"query","schema":{"enum":["ALL","TEACHER","STUDENT"],"type":"string"}}],"responses":{"default":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListWorksResponseDto"}}}}},"security":[{"bearer":[]}],"summary":"Wechat","tags":["Work"]}}},"info":{"title":"API Document","description":"It\'s good to see you guys 🥤","version":"1.0","contact":{}},"tags":[],"servers":[],"components":{"securitySchemes":{"cookie":{"type":"apiKey","in":"cookie","name":"refreshToken"},"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"CreateWorkCommentRequestDto":{"type":"object","properties":{"workId":{"type":"string"},"content":{"type":"string"},"parentId":{"type":"string"}},"required":["workId","content"]},"LikeWorkRequestDto":{"type":"object","properties":{"workId":{"type":"string"}},"required":["workId"]},"CreateWorkRequestDto":{"type":"object","properties":{"visibility":{"type":"string","enum":["GUEST_AND_STUDENT_AND_TEACHER","STUDENT_AND_TEACHER","TEACHER"]},"name":{"type":"string"},"workType":{"type":"string"},"imageFileId":{"type":"string"}},"required":["visibility","name","workType"]},"CommonPagination":{"type":"object","properties":{"countOfCurrentPage":{"type":"number","description":"Number of items in the current page"},"countOfTotal":{"type":"number","description":"Total number of items across all pages"},"page":{"type":"number","description":"Page number, starts from 0"},"pageSize":{"type":"number","description":"Page size, the number of items per page"}},"required":["countOfCurrentPage","countOfTotal","page","pageSize"]},"WorkVisibility":{"type":"string","enum":["GUEST_AND_STUDENT_AND_TEACHER","STUDENT_AND_TEACHER","TEACHER"]},"UserStatus":{"type":"string","enum":["ACTIVE","INACTIVE"]},"UserRole":{"type":"string","enum":["ADMIN","TEACHER","STUDENT","GUEST"]},"UserGender":{"type":"string","enum":["MALE","FEMALE","NONBINARY","UNKNOWN"]},"MfaMethod":{"type":"string","enum":["NONE","SMS","TOTP","EMAIL"]},"AuditLog":{"type":"object","properties":{"id":{"type":"number"},"event":{"type":"string"},"rawEvent":{"type":"string"},"ipAddress":{"type":"string"},"userAgent":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"timezone":{"type":"string"},"countryCode":{"type":"string"},"browser":{"type":"string"},"operatingSystem":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"user":{"$ref":"#/components/schemas/User"},"userId":{"type":"string"},"apiKey":{"$ref":"#/components/schemas/ApiKey"},"apiKeyId":{"type":"number"}},"required":["id","event","rawEvent","createdAt","updatedAt"]},"ApiKey":{"type":"object","properties":{"id":{"type":"number"},"key":{"type":"string"},"secret":{"type":"string"},"description":{"type":"string"},"ipRestrictions":{"type":"object"},"referrerRestrictions":{"type":"object"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"auditLogs":{"type":"array","items":{"$ref":"#/components/schemas/AuditLog"}},"user":{"$ref":"#/components/schemas/User"},"userId":{"type":"string"},"organizationId":{"type":"string"}},"required":["id","key","secret","createdAt","updatedAt","auditLogs","user","userId"]},"ApprovedSubnet":{"type":"object","properties":{"id":{"type":"number"},"subnet":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"timezone":{"type":"string"},"countryCode":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"user":{"$ref":"#/components/schemas/User"},"userId":{"type":"string"}},"required":["id","subnet","createdAt","updatedAt","user","userId"]},"Email":{"type":"object","properties":{"id":{"type":"number"},"email":{"type":"string"},"isVerified":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"user":{"$ref":"#/components/schemas/User"},"userId":{"type":"string"}},"required":["id","email","isVerified","createdAt","updatedAt","user","userId"]},"Session":{"type":"object","properties":{"id":{"type":"number"},"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"ipAddress":{"type":"string"},"userAgent":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"timezone":{"type":"string"},"countryCode":{"type":"string"},"browser":{"type":"string"},"operatingSystem":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"user":{"$ref":"#/components/schemas/User"},"userId":{"type":"string"}},"required":["id","accessToken","refreshToken","ipAddress","createdAt","updatedAt","user","userId"]},"WorkLike":{"type":"object","properties":{"id":{"type":"string"},"workId":{"type":"string"},"userId":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"work":{"$ref":"#/components/schemas/Work"},"user":{"$ref":"#/components/schemas/User"}},"required":["id","workId","userId","createdAt","updatedAt","work","user"]},"User":{"type":"object","properties":{"id":{"type":"string"},"checkLocationOnLogin":{"type":"boolean"},"status":{"allOf":[{"$ref":"#/components/schemas/UserStatus"}]},"username":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"password":{"type":"string"},"roles":{"type":"array","items":{"$ref":"#/components/schemas/UserRole"}},"name":{"type":"string"},"firstName":{"type":"string"},"middleName":{"type":"string"},"lastName":{"type":"string"},"dateOfBirth":{"format":"date-time","type":"string"},"gender":{"allOf":[{"$ref":"#/components/schemas/UserGender"}]},"avatarFileId":{"type":"string"},"uiAvatarsUrl":{"type":"string"},"timezone":{"type":"string"},"twoFactorMethod":{"allOf":[{"$ref":"#/components/schemas/MfaMethod"}]},"twoFactorPhone":{"type":"string"},"twoFactorSecret":{"type":"string"},"lastLoginAt":{"format":"date-time","type":"string"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"apiKeys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}},"approvedSubnets":{"type":"array","items":{"$ref":"#/components/schemas/ApprovedSubnet"}},"auditLogs":{"type":"array","items":{"$ref":"#/components/schemas/AuditLog"}},"emails":{"type":"array","items":{"$ref":"#/components/schemas/Email"}},"sessions":{"type":"array","items":{"$ref":"#/components/schemas/Session"}},"wechatOpenId":{"type":"string"},"wechatUnionId":{"type":"string"},"wechatSessionKey":{"type":"string"},"works":{"type":"array","items":{"$ref":"#/components/schemas/Work"}},"workComments":{"type":"array","items":{"$ref":"#/components/schemas/WorkComment"}},"workLikes":{"type":"array","items":{"$ref":"#/components/schemas/WorkLike"}},"workInspirations":{"type":"array","items":{"$ref":"#/components/schemas/WorkInspiration"}}},"required":["id","checkLocationOnLogin","status","roles","timezone","twoFactorMethod","createdAt","updatedAt","apiKeys","approvedSubnets","auditLogs","emails","sessions","works","workComments","workLikes","workInspirations"]},"WorkInspiration":{"type":"object","properties":{"id":{"type":"string"},"workId":{"type":"string"},"userId":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"work":{"$ref":"#/components/schemas/Work"},"user":{"$ref":"#/components/schemas/User"}},"required":["id","workId","userId","createdAt","updatedAt","work","user"]},"Work":{"type":"object","properties":{"id":{"type":"string"},"visibility":{"allOf":[{"$ref":"#/components/schemas/WorkVisibility"}]},"name":{"type":"string"},"workType":{"type":"string"},"imageFileId":{"type":"string"},"commentCount":{"type":"number"},"inspirationCount":{"type":"number"},"likeCount":{"type":"number"},"userId":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"comments":{"type":"array","items":{"$ref":"#/components/schemas/WorkComment"}},"inspirations":{"type":"array","items":{"$ref":"#/components/schemas/WorkInspiration"}},"likes":{"type":"array","items":{"$ref":"#/components/schemas/WorkLike"}},"user":{"$ref":"#/components/schemas/User"}},"required":["id","visibility","name","workType","imageFileId","userId","createdAt","updatedAt","comments","inspirations","likes","user"]},"WorkComment":{"type":"object","properties":{"id":{"type":"string"},"content":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"work":{"$ref":"#/components/schemas/Work"},"workId":{"type":"string"},"userId":{"type":"string"},"parent":{"$ref":"#/components/schemas/Email"},"parentId":{"type":"string"},"replies":{"type":"array","items":{"$ref":"#/components/schemas/WorkComment"}},"user":{"$ref":"#/components/schemas/User"}},"required":["id","content","createdAt","updatedAt","work","workId","userId","replies","user"]},"WorkItemDto":{"type":"object","properties":{"id":{"type":"string"},"visibility":{"allOf":[{"$ref":"#/components/schemas/WorkVisibility"}]},"name":{"type":"string"},"workType":{"type":"string"},"imageFileId":{"type":"string"},"commentCount":{"type":"number"},"inspirationCount":{"type":"number"},"likeCount":{"type":"number"},"userId":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"updatedAt":{"format":"date-time","type":"string"},"comments":{"type":"array","items":{"$ref":"#/components/schemas/WorkComment"}},"inspirations":{"type":"array","items":{"$ref":"#/components/schemas/WorkInspiration"}},"likes":{"type":"array","items":{"$ref":"#/components/schemas/WorkLike"}},"user":{"$ref":"#/components/schemas/User"},"isLiked":{"type":"boolean"},"isInspirated":{"type":"boolean"}},"required":["id","visibility","name","workType","imageFileId","userId","createdAt","updatedAt","comments","inspirations","likes","user","isLiked","isInspirated"]},"ListWorksResponseDto":{"type":"object","properties":{"pagination":{"description":"Pagination information for the response","allOf":[{"$ref":"#/components/schemas/CommonPagination"}]},"records":{"description":"List of records in the current page","type":"array","items":{"$ref":"#/components/schemas/WorkItemDto"}}},"required":["pagination","records"]},"GetCurrentUserResponseDto":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}},"name":{"type":"string"},"firstName":{"type":"string"},"middleName":{"type":"string"},"lastName":{"type":"string"},"memberships":{"type":"array","items":{"type":"object"}}},"required":["id","email","phone","roles","name","firstName","middleName","lastName","memberships"]},"ChangePasswordDto":{"type":"object","properties":{"userId":{"type":"string","description":"The user ID of the account to change the password for."},"currentPassword":{"type":"string","description":"The current password of the account."},"newPassword":{"type":"string","description":"The new password for the account."}},"required":["userId","currentPassword","newPassword"]},"LoginByPasswordRequestDto":{"type":"object","properties":{"account":{"type":"string"},"password":{"type":"string"}},"required":["account","password"]},"SignUpDto":{"type":"object","properties":{"username":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"password":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}},"name":{"type":"string"},"firstName":{"type":"string"},"middleName":{"type":"string"},"lastName":{"type":"string"},"dateOfBirth":{"format":"date-time","type":"string"},"gender":{"type":"string"},"avatarFileId":{"type":"string"}},"required":["email"]},"WechatOpenIdLoginDto":{"type":"object","properties":{}},"WechatCodeLoginDto":{"type":"object","properties":{}},"CreateApiKeyDto":{"type":"object","properties":{}},"UpdateApiKeyDto":{"type":"object","properties":{}},"ReplaceApiKeyDto":{"type":"object","properties":{}},"expose":{"type":"object","properties":{}},"SessionsListResponseDto":{"type":"object","properties":{"pagination":{"description":"Pagination information for the response","allOf":[{"$ref":"#/components/schemas/CommonPagination"}]},"records":{"description":"List of records in the current page","type":"array","items":{"$ref":"#/components/schemas/expose"}}},"required":["pagination","records"]},"FileEntity":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"size":{"type":"number","description":"The size of the file in bytes, null for folders."},"s3Bucket":{"type":"string"},"s3Key":{"type":"string"},"s3Response":{"type":"object"},"parentId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","type","size","s3Bucket","s3Key","s3Response","parentId","createdAt","updatedAt"]},"ListFilesResponseDto":{"type":"object","properties":{"pagination":{"description":"Pagination information for the response","allOf":[{"$ref":"#/components/schemas/CommonPagination"}]},"records":{"description":"The last update timestamp.","type":"array","items":{"$ref":"#/components/schemas/FileEntity"}}},"required":["pagination","records"]},"CreateFolderRequestDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the folder to create."},"parentId":{"type":"string","description":"The parent folder ID to create the folder in."}},"required":["name"]},"ListFilePathsResDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"parentId":{"type":"string"}},"required":["id","name","type","parentId"]},"RenameFileRequestDto":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]},"RenameFileResponseDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"size":{"type":"number"},"s3Bucket":{"type":"string"},"s3Key":{"type":"string"},"parentId":{"type":"string"},"uploadId":{"type":"string"},"uploadProgress":{"type":"number"}},"required":["id","name","s3Bucket","s3Key","uploadProgress"]},"CreateFileRequestDto":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"size":{"type":"number"},"parentId":{"type":"string","description":"The folder ID to create the file in, do not use both `parentId` and `path` at the same time."},"path":{"type":"string","description":"The folder path to upload the file, e.g. \\"uploads\\", not including \\"/\\" at the end."}},"required":["name","type","size"]},"UploadFileRequestDto":{"type":"object","properties":{"parentId":{"type":"string","description":"The parent folder ID to upload the file to, do not use both `parentId` and `path` at the same time."},"path":{"type":"string","description":"The folder path to upload the file, e.g. \\"uploads\\", not including \\"/\\" at the end."},"overwrite":{"type":"boolean","description":"1. This option will only take effect when \'name\' is provided.\\n 2. Default to false, do not overwrite the existing file.\\n 3. If overwrite is true, the existing file with the same name in the same folder will be overwritten."}}},"UploadBase64RequestDto":{"type":"object","properties":{"parentId":{"type":"string","description":"The parent folder ID to upload the file to, do not use both `parentId` and `path` at the same time."},"path":{"type":"string","description":"The folder path to upload the file, e.g. \\"uploads\\", not including \\"/\\" at the end."},"base64":{"type":"string","description":"Base64 encoded file data."},"name":{"type":"string","description":"If not set, a random name will be generated."},"overwrite":{"type":"boolean","description":"1. This option will only take effect when \'name\' is provided.\\n 2. Default to false, do not overwrite the existing file.\\n 3. If overwrite is true, the existing file with the same name in the same folder will be overwritten."}},"required":["base64"]},"CreateMultipartUploadRequestDto":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"size":{"type":"number"},"parentId":{"type":"string","description":"The folder ID to create the file in, do not use both `parentId` and `path` at the same time."},"path":{"type":"string","description":"The folder path to upload the file, e.g. \\"uploads\\", not including \\"/\\" at the end."}},"required":["name","type","size"]},"CreateMultipartUploadResponseDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"size":{"type":"number"},"s3Bucket":{"type":"string"},"s3Key":{"type":"string"},"parentId":{"type":"string"},"uploadId":{"type":"string"},"uploadProgress":{"type":"number"}},"required":["id","name","s3Bucket","s3Key","uploadProgress"]},"UploadPartRequestDto":{"type":"object","properties":{"uploadId":{"type":"string"},"uploadProgress":{"type":"number"},"partNumber":{"type":"number"}},"required":["uploadId","uploadProgress","partNumber"]},"UploadPartResponseDto":{"type":"object","properties":{"ETag":{"type":"string"},"PartNumber":{"type":"number"}},"required":["ETag","PartNumber"]},"UploadPartInfo":{"type":"object","properties":{"ETag":{"type":"string"},"PartNumber":{"type":"number"}},"required":["ETag","PartNumber"]},"CompleteMultipartUploadRequestDto":{"type":"object","properties":{"uploadId":{"type":"string"},"parts":{"type":"array","items":{"$ref":"#/components/schemas/UploadPartInfo"}}},"required":["uploadId","parts"]},"AbortMultipartUploadRequestDto":{"type":"object","properties":{"uploadId":{"type":"string"}},"required":["uploadId"]},"CreateMembershipLevelRequestDto":{"type":"object","properties":{"name":{"type":"string"},"requiredPoints":{"type":"number"},"discountRate":{"type":"number"}},"required":["name","requiredPoints","discountRate"]},"UpdateMembershipLevelRequestDto":{"type":"object","properties":{"name":{"type":"string"},"requiredPoints":{"type":"number"},"discountRate":{"type":"number"}}},"UpdateMembershipRequestDto":{"type":"object","properties":{"points":{"type":"number"},"levelId":{"type":"number"}}},"CreateSubscriptionPlanRequestDto":{"type":"object","properties":{"name":{"type":"string"},"billingCycle":{"type":"string","enum":["MONTHLY","QUARTERLY","SEMI_ANNUALLY","ANNUALLY"]},"priceInCents":{"type":"number"}},"required":["name","billingCycle","priceInCents"]},"UpdateSubscriptionPlanRequestDto":{"type":"object","properties":{"name":{"type":"string"},"priceInCents":{"type":"number"},"billingCycle":{"type":"string","enum":["MONTHLY","QUARTERLY","SEMI_ANNUALLY","ANNUALLY"]}}},"CreateSubscriptionRequestDto":{"type":"object","properties":{"planId":{"type":"number"}},"required":["planId"]},"UpdateSubscriptionRequestDto":{"type":"object","properties":{"status":{"type":"string","enum":["ACTIVE","EXPIRED","CANCELED","PENDING_PAYMENT"]}},"required":["status"]}}}}';
|