From 62026cedd2b31f509f83673f3c1d8fca6d60ce7f Mon Sep 17 00:00:00 2001 From: juetan Date: Thu, 19 Oct 2023 21:27:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0monaco=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 266 +--- scripts/openapi/12.json | 2886 ++++++++++++++++-------------------- scripts/openapi/e.ts | 156 +- src/dd.json | 1530 +++++++++++++++++++ src/pages/my/dev.vue | 88 ++ src/pages/my/editor.vue | 59 + src/pages/my/page.ejs | 101 ++ src/types/auto-router.d.ts | 2 + 9 files changed, 3215 insertions(+), 1874 deletions(-) create mode 100644 src/dd.json create mode 100644 src/pages/my/dev.vue create mode 100644 src/pages/my/editor.vue create mode 100644 src/pages/my/page.ejs diff --git a/package.json b/package.json index a428560..e95f6e8 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "ejs": "^3.1.9", "less": "^4.2.0", "lodash-es": "^4.17.21", + "monaco-editor": "^0.44.0", "nprogress": "^0.2.0", "numeral": "^2.0.6", "pinia": "^2.1.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3ae0673..401803f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3,7 +3,7 @@ lockfileVersion: '6.0' devDependencies: '@apidevtools/swagger-parser': specifier: ^10.1.0 - version: 10.1.0(openapi-types@12.1.3) + version: 10.1.0 '@arco-design/web-vue': specifier: ^2.51.1 version: 2.51.1(vue@3.3.4) @@ -46,6 +46,9 @@ devDependencies: lodash-es: specifier: ^4.17.21 version: 4.17.21 + monaco-editor: + specifier: ^0.44.0 + version: 0.44.0 nprogress: specifier: ^0.2.0 version: 0.2.0 @@ -90,7 +93,7 @@ devDependencies: version: 4.4.9(less@4.2.0) vite-plugin-mock: specifier: ^3.0.0 - version: 3.0.0(esbuild@0.19.2)(mockjs@1.1.0)(vite@4.4.9) + version: 3.0.0(vite@4.4.9) vite-plugin-pages: specifier: ^0.28.0 version: 0.28.0(vite@4.4.9) @@ -148,7 +151,7 @@ packages: resolution: {integrity: sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==} dev: true - /@apidevtools/swagger-parser@10.1.0(openapi-types@12.1.3): + /@apidevtools/swagger-parser@10.1.0: resolution: {integrity: sha512-9Kt7EuS/7WbMAUv2gSziqjvxwDbFSg3Xeyfuj5laUODX8o/k/CpsAKiQ8W7/R88eXFTMbJYg6+7uAmOWNKmwnw==} peerDependencies: openapi-types: '>=7' @@ -160,7 +163,6 @@ packages: ajv: 8.12.0 ajv-draft-04: 1.0.0(ajv@8.12.0) call-me-maybe: 1.0.2 - openapi-types: 12.1.3 dev: true /@arco-design/color@0.4.0: @@ -507,15 +509,6 @@ packages: dev: true optional: true - /@esbuild/android-arm64@0.19.2: - resolution: {integrity: sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - /@esbuild/android-arm@0.18.20: resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} engines: {node: '>=12'} @@ -525,15 +518,6 @@ packages: dev: true optional: true - /@esbuild/android-arm@0.19.2: - resolution: {integrity: sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q==} - engines: {node: '>=12'} - cpu: [arm] - os: [android] - requiresBuild: true - dev: true - optional: true - /@esbuild/android-x64@0.18.20: resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} engines: {node: '>=12'} @@ -543,15 +527,6 @@ packages: dev: true optional: true - /@esbuild/android-x64@0.19.2: - resolution: {integrity: sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - requiresBuild: true - dev: true - optional: true - /@esbuild/darwin-arm64@0.18.20: resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} engines: {node: '>=12'} @@ -561,15 +536,6 @@ packages: dev: true optional: true - /@esbuild/darwin-arm64@0.19.2: - resolution: {integrity: sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - /@esbuild/darwin-x64@0.18.20: resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} engines: {node: '>=12'} @@ -579,15 +545,6 @@ packages: dev: true optional: true - /@esbuild/darwin-x64@0.19.2: - resolution: {integrity: sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - /@esbuild/freebsd-arm64@0.18.20: resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} engines: {node: '>=12'} @@ -597,15 +554,6 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64@0.19.2: - resolution: {integrity: sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/freebsd-x64@0.18.20: resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} engines: {node: '>=12'} @@ -615,15 +563,6 @@ packages: dev: true optional: true - /@esbuild/freebsd-x64@0.19.2: - resolution: {integrity: sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-arm64@0.18.20: resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} engines: {node: '>=12'} @@ -633,15 +572,6 @@ packages: dev: true optional: true - /@esbuild/linux-arm64@0.19.2: - resolution: {integrity: sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-arm@0.18.20: resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} engines: {node: '>=12'} @@ -651,15 +581,6 @@ packages: dev: true optional: true - /@esbuild/linux-arm@0.19.2: - resolution: {integrity: sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-ia32@0.18.20: resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} engines: {node: '>=12'} @@ -669,15 +590,6 @@ packages: dev: true optional: true - /@esbuild/linux-ia32@0.19.2: - resolution: {integrity: sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-loong64@0.18.20: resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} engines: {node: '>=12'} @@ -687,15 +599,6 @@ packages: dev: true optional: true - /@esbuild/linux-loong64@0.19.2: - resolution: {integrity: sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw==} - engines: {node: '>=12'} - cpu: [loong64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-mips64el@0.18.20: resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} engines: {node: '>=12'} @@ -705,15 +608,6 @@ packages: dev: true optional: true - /@esbuild/linux-mips64el@0.19.2: - resolution: {integrity: sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-ppc64@0.18.20: resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} engines: {node: '>=12'} @@ -723,15 +617,6 @@ packages: dev: true optional: true - /@esbuild/linux-ppc64@0.19.2: - resolution: {integrity: sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-riscv64@0.18.20: resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} engines: {node: '>=12'} @@ -741,15 +626,6 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64@0.19.2: - resolution: {integrity: sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-s390x@0.18.20: resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} engines: {node: '>=12'} @@ -759,15 +635,6 @@ packages: dev: true optional: true - /@esbuild/linux-s390x@0.19.2: - resolution: {integrity: sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-x64@0.18.20: resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} engines: {node: '>=12'} @@ -777,15 +644,6 @@ packages: dev: true optional: true - /@esbuild/linux-x64@0.19.2: - resolution: {integrity: sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/netbsd-x64@0.18.20: resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} engines: {node: '>=12'} @@ -795,15 +653,6 @@ packages: dev: true optional: true - /@esbuild/netbsd-x64@0.19.2: - resolution: {integrity: sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/openbsd-x64@0.18.20: resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} engines: {node: '>=12'} @@ -813,15 +662,6 @@ packages: dev: true optional: true - /@esbuild/openbsd-x64@0.19.2: - resolution: {integrity: sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/sunos-x64@0.18.20: resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} engines: {node: '>=12'} @@ -831,15 +671,6 @@ packages: dev: true optional: true - /@esbuild/sunos-x64@0.19.2: - resolution: {integrity: sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true - optional: true - /@esbuild/win32-arm64@0.18.20: resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} engines: {node: '>=12'} @@ -849,15 +680,6 @@ packages: dev: true optional: true - /@esbuild/win32-arm64@0.19.2: - resolution: {integrity: sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@esbuild/win32-ia32@0.18.20: resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} engines: {node: '>=12'} @@ -867,15 +689,6 @@ packages: dev: true optional: true - /@esbuild/win32-ia32@0.19.2: - resolution: {integrity: sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@esbuild/win32-x64@0.18.20: resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} engines: {node: '>=12'} @@ -885,15 +698,6 @@ packages: dev: true optional: true - /@esbuild/win32-x64@0.19.2: - resolution: {integrity: sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@exodus/schemasafe@1.3.0: resolution: {integrity: sha512-5Aap/GaRupgNx/feGBwLLTVv8OQFfv3pq2lPRzPg9R+IOBnDgghTGW7l7EuVXOvg5cc/xSAlRW8rBrjIC3Nvqw==} dev: true @@ -2088,13 +1892,12 @@ packages: run-applescript: 5.0.0 dev: true - /bundle-require@4.0.1(esbuild@0.19.2): + /bundle-require@4.0.1: resolution: {integrity: sha512-9NQkRHlNdNpDBGmLpngF3EFDcwodhMUuLz9PaWYciVcQF9SE4LFjM2DB/xV1Li5JiuDMv7ZUWuC3rGbqR0MAXQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} peerDependencies: esbuild: '>=0.17' dependencies: - esbuild: 0.19.2 load-tsconfig: 0.2.5 dev: true @@ -2378,11 +2181,6 @@ packages: delayed-stream: 1.0.0 dev: true - /commander@11.0.0: - resolution: {integrity: sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==} - engines: {node: '>=16'} - dev: true - /compare-func@2.0.0: resolution: {integrity: sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==} dependencies: @@ -3100,36 +2898,6 @@ packages: '@esbuild/win32-x64': 0.18.20 dev: true - /esbuild@0.19.2: - resolution: {integrity: sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg==} - engines: {node: '>=12'} - hasBin: true - requiresBuild: true - optionalDependencies: - '@esbuild/android-arm': 0.19.2 - '@esbuild/android-arm64': 0.19.2 - '@esbuild/android-x64': 0.19.2 - '@esbuild/darwin-arm64': 0.19.2 - '@esbuild/darwin-x64': 0.19.2 - '@esbuild/freebsd-arm64': 0.19.2 - '@esbuild/freebsd-x64': 0.19.2 - '@esbuild/linux-arm': 0.19.2 - '@esbuild/linux-arm64': 0.19.2 - '@esbuild/linux-ia32': 0.19.2 - '@esbuild/linux-loong64': 0.19.2 - '@esbuild/linux-mips64el': 0.19.2 - '@esbuild/linux-ppc64': 0.19.2 - '@esbuild/linux-riscv64': 0.19.2 - '@esbuild/linux-s390x': 0.19.2 - '@esbuild/linux-x64': 0.19.2 - '@esbuild/netbsd-x64': 0.19.2 - '@esbuild/openbsd-x64': 0.19.2 - '@esbuild/sunos-x64': 0.19.2 - '@esbuild/win32-arm64': 0.19.2 - '@esbuild/win32-ia32': 0.19.2 - '@esbuild/win32-x64': 0.19.2 - dev: true - /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -4949,18 +4717,15 @@ packages: ufo: 1.3.0 dev: true - /mockjs@1.1.0: - resolution: {integrity: sha512-eQsKcWzIaZzEZ07NuEyO4Nw65g0hdWAyurVol1IPl1gahRwY+svqzfgfey8U8dahLwG44d6/RwEzuK52rSa/JQ==} - hasBin: true - dependencies: - commander: 11.0.0 - dev: true - /modify-values@1.0.1: resolution: {integrity: sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==} engines: {node: '>=0.10.0'} dev: true + /monaco-editor@0.44.0: + resolution: {integrity: sha512-5SmjNStN6bSuSE5WPT2ZV+iYn1/yI9sd4Igtk23ChvqB7kDk9lZbB9F5frsuvpB+2njdIeGGFf2G4gbE6rCC9Q==} + dev: true + /mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} @@ -5325,10 +5090,6 @@ packages: is-wsl: 2.2.0 dev: true - /openapi-types@12.1.3: - resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==} - dev: true - /optionator@0.8.3: resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==} engines: {node: '>= 0.8.0'} @@ -7105,7 +6866,7 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-plugin-mock@3.0.0(esbuild@0.19.2)(mockjs@1.1.0)(vite@4.4.9): + /vite-plugin-mock@3.0.0(vite@4.4.9): resolution: {integrity: sha512-Ibwlga2CSgkoFHFtPW3T/l0fwsGVz9Ss5i7HauBQDyDFfMKgbQXh9wKDLksLZHyai9rkDanxJtIcxbD0bUHCfw==} engines: {node: '>=16.0.0'} peerDependencies: @@ -7113,12 +6874,11 @@ packages: vite: '>=4.0.0' dependencies: '@types/mockjs': 1.0.7 - bundle-require: 4.0.1(esbuild@0.19.2) + bundle-require: 4.0.1 chokidar: 3.5.3 connect: 3.7.0 debug: 4.3.4 fast-glob: 3.3.1 - mockjs: 1.1.0 path-to-regexp: 6.2.1 picocolors: 1.0.0 vite: 4.4.9(less@4.2.0) diff --git a/scripts/openapi/12.json b/scripts/openapi/12.json index aa1595f..d68853e 100644 --- a/scripts/openapi/12.json +++ b/scripts/openapi/12.json @@ -1,117 +1,154 @@ -[ - { - "method": "post", - "path": "/api/v1/users", - "tag": "user", - "summary": "", - "operationId": "addUser", - "description": "新增用户", - "pathParams": [], - "queryParams": [], - "bodyParams": { - "username": { - "type": "string", - "description": "登录账号", - "example": "juetan", - "name": "username", - "required": true - }, - "nickname": { - "type": "string", - "description": "用户昵称", - "example": "绝弹", - "name": "nickname", - "required": true - }, - "password": { - "type": "string", - "description": "用户密码", - "example": "password", - "name": "password", - "required": false - }, - "avatarId": { - "type": "number", - "description": "头像ID", - "example": 1, - "name": "avatarId", - "required": false - }, - "roleIds": { - "description": "角色ID列表", - "example": [ - 1, - 2, - 3 - ], - "type": "array", - "items": { - "type": "number" +{ + "routes": [ + { + "method": "post", + "path": "/api/v1/users", + "tag": "user", + "operationId": "addUser", + "description": "新增用户", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "username", + "type": "string", + "required": true, + "description": "登录账号" }, - "name": "roleIds", - "required": false + { + "name": "nickname", + "type": "string", + "required": true, + "description": "用户昵称" + }, + { + "name": "password", + "type": "string", + "required": false, + "description": "用户密码" + }, + { + "name": "avatarId", + "type": "number", + "required": false, + "description": "头像ID" + }, + { + "name": "roleIds", + "type": "array", + "required": false, + "description": "角色ID列表" + } + ], + "bodyReturn": { + "type": "number" } }, - "resBody": {} - }, - { - "method": "get", - "path": "/api/v1/users", - "tag": "user", - "summary": "", - "operationId": "getUsers", - "description": "分页/条件查询用户", - "pathParams": [], - "queryParams": [ - { - "name": "nickname", - "required": false, - "in": "query", - "description": "用户昵称", - "example": "绝弹", - "schema": { - "type": "string" + { + "method": "get", + "path": "/api/v1/users", + "tag": "user", + "operationId": "getUsers", + "description": "分页/条件查询用户", + "pathParams": [], + "quryParams": [ + { + "name": "nickname", + "type": "string", + "description": "用户昵称", + "required": false + }, + { + "name": "sort", + "type": "string", + "description": "排序规则", + "required": false + }, + { + "name": "page", + "type": "number", + "description": "页码", + "required": false + }, + { + "name": "size", + "type": "number", + "description": "每页条数", + "required": false } - }, - { - "name": "sort", - "required": false, - "in": "query", - "description": "排序规则", - "example": "id:desc", - "schema": { - "pattern": "/^(\\w+:\\w+,)*\\w+:\\w+$/", - "default": "id:desc", - "type": "string" - } - }, - { - "name": "page", - "required": false, - "in": "query", - "description": "页码", - "example": 1, - "schema": { - "minimum": 1, - "type": "number" - } - }, - { - "name": "size", - "required": false, - "in": "query", - "description": "每页条数", - "example": 10, - "schema": { - "minimum": 0, - "type": "number" + ], + "bodyParams": [], + "bodyReturn": { + "type": "array", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "登录账号", + "example": "juetan" + }, + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "用户介绍", + "example": "这个人很懒, 什么也没有留下!" + }, + "avatar": { + "type": "string", + "description": "用户头像(URL)", + "example": "./assets/222421415123.png " + }, + "password": { + "type": "string", + "description": "用户密码", + "example": "password" + }, + "email": { + "type": "string", + "description": "用户邮箱", + "example": "example@mail.com" + }, + "roleIds": { + "description": "用户角色ID", + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": [ + "username", + "nickname", + "description", + "avatar", + "password", + "email", + "roleIds" + ] } } - ], - "bodyParams": {}, - "resBody": { - "type": "array", - "items": { + }, + { + "method": "get", + "path": "/api/v1/users/{id}", + "tag": "user", + "operationId": "getUser", + "description": "根据ID查询用户", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { "type": "object", "properties": { "username": { @@ -162,327 +199,364 @@ "roleIds" ] } - } - }, - { - "method": "get", - "path": "/api/v1/users/{id}", - "tag": "user", - "summary": "", - "operationId": "getUser", - "description": "根据ID查询用户", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" + }, + { + "method": "patch", + "path": "/api/v1/users/{id}", + "tag": "user", + "operationId": "updateUser", + "description": "根据ID更新用户", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true } - } - ], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "object", - "properties": { - "username": { - "type": "string", - "description": "登录账号", - "example": "juetan" + ], + "quryParams": [], + "bodyParams": [ + { + "name": "id", + "type": "number", + "required": true }, - "nickname": { + { + "name": "username", "type": "string", - "description": "用户昵称", - "example": "绝弹" + "required": false, + "description": "登录账号" }, - "description": { + { + "name": "nickname", "type": "string", - "description": "用户介绍", - "example": "这个人很懒, 什么也没有留下!" + "required": false, + "description": "用户昵称" }, - "avatar": { + { + "name": "password", "type": "string", - "description": "用户头像(URL)", - "example": "./assets/222421415123.png " + "required": false, + "description": "用户密码" }, - "password": { - "type": "string", - "description": "用户密码", - "example": "password" + { + "name": "avatarId", + "type": "number", + "required": false, + "description": "头像ID" }, - "email": { - "type": "string", - "description": "用户邮箱", - "example": "example@mail.com" - }, - "roleIds": { - "description": "用户角色ID", + { + "name": "roleIds", "type": "array", - "items": { - "type": "number" - } + "required": false, + "description": "角色ID列表" } - }, - "required": [ - "username", - "nickname", - "description", - "avatar", - "password", - "email", - "roleIds" ] - } - }, - { - "method": "patch", - "path": "/api/v1/users/{id}", - "tag": "user", - "summary": "", - "operationId": "updateUser", - "description": "根据ID更新用户", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" + }, + { + "method": "delete", + "path": "/api/v1/users/{id}", + "tag": "user", + "operationId": "delUser", + "description": "根据ID删除用户", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true } + ], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "post", + "path": "/api/v1/auth/login", + "tag": "auth", + "operationId": "login", + "description": "账号登陆", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "username", + "type": "string", + "required": true, + "description": "用户名" + }, + { + "name": "password", + "type": "string", + "required": true, + "description": "用户密码" + } + ], + "bodyReturn": { + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "用户ID" + }, + "token": { + "type": "string", + "description": "访问令牌", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjIsInVzZXJuYW1lIjoianVldGFuIiwiaWF0IjoxNjkxMTM5MjI3LCJleHAiOjE2OTExOTkyMjd9.6z7f-xfsHABbsyg401o2boKeqNQ1epPDYfEdavIcfYc" + }, + "username": { + "type": "string", + "description": "登录账号", + "example": "juetan" + }, + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "用户介绍", + "example": "这个人很懒, 什么也没有留下!" + }, + "avatar": { + "type": "string", + "description": "用户头像(URL)", + "example": "./assets/222421415123.png " + }, + "email": { + "type": "string", + "description": "用户邮箱", + "example": "example@mail.com" + }, + "roleIds": { + "description": "用户角色ID", + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": [ + "id", + "token", + "username", + "nickname", + "description", + "avatar", + "email", + "roleIds" + ] } - ], - "queryParams": [], - "bodyParams": { - "id": { - "type": "number", - "name": "id", - "required": true - }, - "username": { - "type": "string", - "description": "登录账号", - "example": "juetan", - "name": "username", - "required": false - }, - "nickname": { - "type": "string", - "description": "用户昵称", - "example": "绝弹", - "name": "nickname", - "required": false - }, - "password": { - "type": "string", - "description": "用户密码", - "example": "password", - "name": "password", - "required": false - }, - "avatarId": { - "type": "number", - "description": "头像ID", - "example": 1, - "name": "avatarId", - "required": false - }, - "roleIds": { - "description": "角色ID列表", - "example": [ - 1, - 2, - 3 - ], + }, + { + "method": "post", + "path": "/api/v1/logs", + "tag": "log", + "operationId": "addLog", + "description": "新增日志管理", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "demo", + "type": "string", + "required": true, + "description": "字段描述(Swagger用途)" + } + ], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/logs", + "tag": "log", + "operationId": "getLogs", + "description": "根据分页/过滤参数查询日志管理", + "pathParams": [], + "quryParams": [ + { + "name": "nickname", + "type": "string", + "description": "用户名", + "required": false + }, + { + "name": "sort", + "type": "string", + "description": "排序规则", + "required": false + }, + { + "name": "page", + "type": "number", + "description": "页码", + "required": false + }, + { + "name": "size", + "type": "number", + "description": "每页条数", + "required": false + } + ], + "bodyParams": [], + "bodyReturn": { "type": "array", "items": { - "type": "number" - }, - "name": "roleIds", - "required": false - } - } - }, - { - "method": "delete", - "path": "/api/v1/users/{id}", - "tag": "user", - "summary": "", - "operationId": "delUser", - "description": "根据ID删除用户", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" + "type": "object", + "properties": { + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "操作描述", + "example": "1" + }, + "status": { + "type": "boolean", + "description": "操作状态", + "example": true + }, + "ip": { + "type": "string", + "description": "登陆IP", + "example": "127.0.0.1" + }, + "addr": { + "type": "string", + "description": "登陆地址", + "example": "广东省深圳市" + }, + "browser": { + "type": "string", + "description": "浏览器", + "example": "chrome" + }, + "os": { + "type": "string", + "description": "操作系统", + "example": "windows 10" + } + }, + "required": [ + "nickname", + "description", + "status", + "ip", + "addr", + "browser", + "os" + ] } } - ], - "queryParams": [], - "bodyParams": {} - }, - { - "method": "post", - "path": "/api/v1/auth/login", - "tag": "auth", - "summary": "", - "operationId": "login", - "description": "账号登陆", - "pathParams": [], - "queryParams": [], - "bodyParams": { - "username": { - "type": "string", - "description": "用户名", - "example": "admin", - "name": "username", - "required": true - }, - "password": { - "type": "string", - "description": "用户密码", - "example": "123456", - "name": "password", - "required": true - } }, - "resBody": { - "type": "object", - "properties": { - "id": { + { + "method": "get", + "path": "/api/v1/logs/login", + "tag": "log", + "operationId": "getLoginLogs", + "description": "分页查询登陆日志", + "pathParams": [], + "quryParams": [ + { + "name": "nickname", + "type": "string", + "description": "用户名", + "required": false + }, + { + "name": "sort", + "type": "string", + "description": "排序规则", + "required": false + }, + { + "name": "page", "type": "number", - "description": "用户ID" + "description": "页码", + "required": false }, - "token": { - "type": "string", - "description": "访问令牌", - "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjIsInVzZXJuYW1lIjoianVldGFuIiwiaWF0IjoxNjkxMTM5MjI3LCJleHAiOjE2OTExOTkyMjd9.6z7f-xfsHABbsyg401o2boKeqNQ1epPDYfEdavIcfYc" - }, - "username": { - "type": "string", - "description": "登录账号", - "example": "juetan" - }, - "nickname": { - "type": "string", - "description": "用户昵称", - "example": "绝弹" - }, - "description": { - "type": "string", - "description": "用户介绍", - "example": "这个人很懒, 什么也没有留下!" - }, - "avatar": { - "type": "string", - "description": "用户头像(URL)", - "example": "./assets/222421415123.png " - }, - "email": { - "type": "string", - "description": "用户邮箱", - "example": "example@mail.com" - }, - "roleIds": { - "description": "用户角色ID", - "type": "array", - "items": { - "type": "number" - } + { + "name": "size", + "type": "number", + "description": "每页条数", + "required": false + } + ], + "bodyParams": [], + "bodyReturn": { + "type": "array", + "items": { + "type": "object", + "properties": { + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "操作描述", + "example": "1" + }, + "status": { + "type": "boolean", + "description": "操作状态", + "example": true + }, + "ip": { + "type": "string", + "description": "登陆IP", + "example": "127.0.0.1" + }, + "addr": { + "type": "string", + "description": "登陆地址", + "example": "广东省深圳市" + }, + "browser": { + "type": "string", + "description": "浏览器", + "example": "chrome" + }, + "os": { + "type": "string", + "description": "操作系统", + "example": "windows 10" + } + }, + "required": [ + "nickname", + "description", + "status", + "ip", + "addr", + "browser", + "os" + ] } - }, - "required": [ - "id", - "token", - "username", - "nickname", - "description", - "avatar", - "email", - "roleIds" - ] - } - }, - { - "method": "post", - "path": "/api/v1/logs", - "tag": "log", - "summary": "", - "operationId": "addLog", - "description": "新增日志管理", - "pathParams": [], - "queryParams": [], - "bodyParams": { - "demo": { - "type": "string", - "description": "字段描述(Swagger用途)", - "example": "demo", - "name": "demo", - "required": true } }, - "resBody": {} - }, - { - "method": "get", - "path": "/api/v1/logs", - "tag": "log", - "summary": "", - "operationId": "getLogs", - "description": "根据分页/过滤参数查询日志管理", - "pathParams": [], - "queryParams": [ - { - "name": "nickname", - "required": false, - "in": "query", - "description": "用户名", - "example": "绝弹", - "schema": { - "type": "string" + { + "method": "get", + "path": "/api/v1/logs/{id}", + "tag": "log", + "operationId": "getLog", + "description": "根据ID查询日志管理", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true } - }, - { - "name": "sort", - "required": false, - "in": "query", - "description": "排序规则", - "example": "id:desc", - "schema": { - "pattern": "/^(\\w+:\\w+,)*\\w+:\\w+$/", - "default": "id:desc", - "type": "string" - } - }, - { - "name": "page", - "required": false, - "in": "query", - "description": "页码", - "example": 1, - "schema": { - "minimum": 1, - "type": "number" - } - }, - { - "name": "size", - "required": false, - "in": "query", - "description": "每页条数", - "example": 10, - "schema": { - "minimum": 0, - "type": "number" - } - } - ], - "bodyParams": {}, - "resBody": { - "type": "array", - "items": { + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { "type": "object", "properties": { "nickname": { @@ -531,1091 +605,789 @@ "os" ] } - } - }, - { - "method": "get", - "path": "/api/v1/logs/login", - "tag": "log", - "summary": "", - "operationId": "getLoginLogs", - "description": "分页查询登陆日志", - "pathParams": [], - "queryParams": [ - { - "name": "nickname", - "required": false, - "in": "query", - "description": "用户名", - "example": "绝弹", - "schema": { - "type": "string" + }, + { + "method": "patch", + "path": "/api/v1/logs/{id}", + "tag": "log", + "operationId": "updateLog", + "description": "根据ID更新日志管理", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true } - }, - { - "name": "sort", - "required": false, - "in": "query", - "description": "排序规则", - "example": "id:desc", - "schema": { - "pattern": "/^(\\w+:\\w+,)*\\w+:\\w+$/", - "default": "id:desc", - "type": "string" + ], + "quryParams": [], + "bodyParams": [ + { + "name": "demo", + "type": "string", + "required": false, + "description": "字段描述(Swagger用途)" } - }, - { - "name": "page", - "required": false, - "in": "query", - "description": "页码", - "example": 1, - "schema": { - "minimum": 1, - "type": "number" + ] + }, + { + "method": "delete", + "path": "/api/v1/logs/{id}", + "tag": "log", + "operationId": "delLog", + "description": "根据ID删除日志管理", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true } - }, - { - "name": "size", - "required": false, - "in": "query", - "description": "每页条数", - "example": 10, - "schema": { - "minimum": 0, - "type": "number" + ], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "post", + "path": "/api/v1/roles", + "tag": "role", + "operationId": "addRole", + "description": "创建角色", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "name", + "type": "string", + "required": true + }, + { + "name": "slug", + "type": "string", + "required": true + }, + { + "name": "description", + "type": "string", + "required": false + }, + { + "name": "permissions", + "type": "array", + "required": false } + ], + "bodyReturn": { + "type": "number" } - ], - "bodyParams": {}, - "resBody": { - "type": "array", - "items": { + }, + { + "method": "get", + "path": "/api/v1/roles", + "tag": "role", + "operationId": "getRoles", + "description": "批量查询角色", + "pathParams": [], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/roles/{id}", + "tag": "role", + "operationId": "getRole", + "description": "查询角色", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "string" + } + }, + { + "method": "patch", + "path": "/api/v1/roles/{id}", + "tag": "role", + "operationId": "updateRole", + "description": "更新角色", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [ + { + "name": "permissionIds", + "type": "array", + "required": false + }, + { + "name": "name", + "type": "string", + "required": false + }, + { + "name": "slug", + "type": "string", + "required": false + }, + { + "name": "description", + "type": "string", + "required": false + }, + { + "name": "permissions", + "type": "array", + "required": false + } + ] + }, + { + "method": "delete", + "path": "/api/v1/roles/{id}", + "tag": "role", + "operationId": "delRole", + "description": "删除角色", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "string" + } + }, + { + "method": "post", + "path": "/api/v1/permissions", + "tag": "permission", + "operationId": "addPermission", + "description": "创建权限", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "name", + "type": "string", + "required": true, + "description": "权限名称" + }, + { + "name": "slug", + "type": "string", + "required": true, + "description": "权限标识" + }, + { + "name": "description", + "type": "string", + "required": false, + "description": "权限描述" + } + ], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/permissions", + "tag": "permission", + "operationId": "getPermissions", + "description": "批量查询权限", + "pathParams": [], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/permissions/{id}", + "tag": "permission", + "operationId": "getPermission", + "description": "查询权限", + "pathParams": [ + { + "name": "id", + "type": "string", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "string" + } + }, + { + "method": "patch", + "path": "/api/v1/permissions/{id}", + "tag": "permission", + "operationId": "setPermission", + "description": "更新权限", + "pathParams": [ + { + "name": "id", + "type": "string", + "required": true + } + ], + "quryParams": [], + "bodyParams": [ + { + "name": "id", + "type": "number", + "required": true + }, + { + "name": "name", + "type": "string", + "required": false, + "description": "权限名称" + }, + { + "name": "slug", + "type": "string", + "required": false, + "description": "权限标识" + }, + { + "name": "description", + "type": "string", + "required": false, + "description": "权限描述" + } + ] + }, + { + "method": "delete", + "path": "/api/v1/permissions/{id}", + "tag": "permission", + "operationId": "delPermission", + "description": "删除权限", + "pathParams": [ + { + "name": "id", + "type": "string", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "string" + } + }, + { + "method": "post", + "path": "/api/v1/file", + "tag": "file", + "operationId": "addFile", + "description": "上传文件", + "pathParams": [], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/file", + "tag": "file", + "operationId": "getFiles", + "description": "批量查询", + "pathParams": [], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/file/{id}", + "tag": "file", + "operationId": "getFile", + "description": "查询", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { "type": "object", "properties": { - "nickname": { + "name": { "type": "string", - "description": "用户昵称", - "example": "绝弹" + "description": "文件名", + "example": "xxx.jpg" }, - "description": { + "size": { + "type": "number", + "description": "文件大小", + "example": 1024 + }, + "mimetype": { "type": "string", - "description": "操作描述", - "example": "1" + "description": "文件类型", + "example": "image/jpeg" }, - "status": { - "type": "boolean", - "description": "操作状态", - "example": true - }, - "ip": { + "path": { "type": "string", - "description": "登陆IP", - "example": "127.0.0.1" + "description": "文件路径", + "example": "/upload/2021/10/01/xxx.jpg" }, - "addr": { + "hash": { "type": "string", - "description": "登陆地址", - "example": "广东省深圳市" + "description": "文件哈希", + "example": "2afb1f8b83ef0cc564f227d75d0b6914" }, - "browser": { + "extension": { "type": "string", - "description": "浏览器", - "example": "chrome" - }, - "os": { - "type": "string", - "description": "操作系统", - "example": "windows 10" + "description": "文件后缀", + "example": ".jpg" } }, "required": [ - "nickname", - "description", - "status", - "ip", - "addr", - "browser", - "os" + "name", + "size", + "mimetype", + "path", + "hash", + "extension" ] } - } - }, - { - "method": "get", - "path": "/api/v1/logs/{id}", - "tag": "log", - "summary": "", - "operationId": "getLog", - "description": "根据ID查询日志管理", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "object", - "properties": { - "nickname": { - "type": "string", - "description": "用户昵称", - "example": "绝弹" - }, - "description": { - "type": "string", - "description": "操作描述", - "example": "1" - }, - "status": { - "type": "boolean", - "description": "操作状态", - "example": true - }, - "ip": { - "type": "string", - "description": "登陆IP", - "example": "127.0.0.1" - }, - "addr": { - "type": "string", - "description": "登陆地址", - "example": "广东省深圳市" - }, - "browser": { - "type": "string", - "description": "浏览器", - "example": "chrome" - }, - "os": { - "type": "string", - "description": "操作系统", - "example": "windows 10" - } - }, - "required": [ - "nickname", - "description", - "status", - "ip", - "addr", - "browser", - "os" - ] - } - }, - { - "method": "patch", - "path": "/api/v1/logs/{id}", - "tag": "log", - "summary": "", - "operationId": "updateLog", - "description": "根据ID更新日志管理", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "queryParams": [], - "bodyParams": { - "demo": { - "type": "string", - "description": "字段描述(Swagger用途)", - "example": "demo", - "name": "demo", - "required": false - } - } - }, - { - "method": "delete", - "path": "/api/v1/logs/{id}", - "tag": "log", - "summary": "", - "operationId": "delLog", - "description": "根据ID删除日志管理", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "queryParams": [], - "bodyParams": {} - }, - { - "method": "post", - "path": "/api/v1/roles", - "tag": "role", - "summary": "", - "operationId": "addRole", - "description": "创建角色", - "pathParams": [], - "queryParams": [], - "bodyParams": { - "name": { - "type": "string", - "name": "name", - "required": true - }, - "slug": { - "type": "string", - "name": "slug", - "required": true - }, - "description": { - "type": "string", - "name": "description", - "required": false - }, - "permissions": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "权限名称", - "example": "文章列表" - }, - "slug": { - "type": "string", - "description": "权限标识", - "example": "post:list" - }, - "type": { - "type": "string", - "description": "权限类型", - "example": "menu", - "enum": [ - "menu", - "api" - ] - }, - "description": { - "type": "string", - "description": "权限描述", - "example": "文章列表" - } - }, - "required": [ - "name", - "slug", - "type", - "description" - ] - }, - "name": "permissions", - "required": false + }, + { + "method": "patch", + "path": "/api/v1/file/{id}", + "tag": "file", + "operationId": "setFile", + "description": "更新", + "pathParams": [], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "string" } }, - "resBody": {} - }, - { - "method": "get", - "path": "/api/v1/roles", - "tag": "role", - "summary": "", - "operationId": "getRoles", - "description": "批量查询角色", - "pathParams": [], - "queryParams": [], - "bodyParams": {} - }, - { - "method": "get", - "path": "/api/v1/roles/{id}", - "tag": "role", - "summary": "", - "operationId": "getRole", - "description": "查询角色", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "string" - } - }, - { - "method": "patch", - "path": "/api/v1/roles/{id}", - "tag": "role", - "summary": "", - "operationId": "updateRole", - "description": "更新角色", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "queryParams": [], - "bodyParams": { - "permissionIds": { - "type": "array", - "items": { - "type": "number" - }, - "name": "permissionIds", - "required": false - }, - "name": { - "type": "string", - "name": "name", - "required": false - }, - "slug": { - "type": "string", - "name": "slug", - "required": false - }, - "description": { - "type": "string", - "name": "description", - "required": false - }, - "permissions": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "权限名称", - "example": "文章列表" - }, - "slug": { - "type": "string", - "description": "权限标识", - "example": "post:list" - }, - "type": { - "type": "string", - "description": "权限类型", - "example": "menu", - "enum": [ - "menu", - "api" - ] - }, - "description": { - "type": "string", - "description": "权限描述", - "example": "文章列表" - } - }, - "required": [ - "name", - "slug", - "type", - "description" - ] - }, - "name": "permissions", - "required": false - } - } - }, - { - "method": "delete", - "path": "/api/v1/roles/{id}", - "tag": "role", - "summary": "", - "operationId": "delRole", - "description": "删除角色", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "string" - } - }, - { - "method": "post", - "path": "/api/v1/permissions", - "tag": "permission", - "summary": "", - "operationId": "addPermission", - "description": "创建权限", - "pathParams": [], - "queryParams": [], - "bodyParams": { - "name": { - "type": "string", - "description": "权限名称", - "example": "权限名称", - "name": "name", - "required": true - }, - "slug": { - "type": "string", - "description": "权限标识", - "example": "permission:permission", - "name": "slug", - "required": true - }, - "description": { - "type": "string", - "description": "权限描述", - "name": "description", - "required": false - } - }, - "resBody": {} - }, - { - "method": "get", - "path": "/api/v1/permissions", - "tag": "permission", - "summary": "", - "operationId": "getPermissions", - "description": "批量查询权限", - "pathParams": [], - "queryParams": [], - "bodyParams": {} - }, - { - "method": "get", - "path": "/api/v1/permissions/{id}", - "tag": "permission", - "summary": "", - "operationId": "getPermission", - "description": "查询权限", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "string" - } - }, - { - "method": "patch", - "path": "/api/v1/permissions/{id}", - "tag": "permission", - "summary": "", - "operationId": "setPermission", - "description": "更新权限", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "queryParams": [], - "bodyParams": { - "id": { - "type": "number", - "name": "id", - "required": true - }, - "name": { - "type": "string", - "description": "权限名称", - "example": "权限名称", - "name": "name", - "required": false - }, - "slug": { - "type": "string", - "description": "权限标识", - "example": "permission:permission", - "name": "slug", - "required": false - }, - "description": { - "type": "string", - "description": "权限描述", - "name": "description", - "required": false - } - } - }, - { - "method": "delete", - "path": "/api/v1/permissions/{id}", - "tag": "permission", - "summary": "", - "operationId": "delPermission", - "description": "删除权限", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "string" - } - }, - { - "method": "post", - "path": "/api/v1/file", - "tag": "file", - "summary": "", - "operationId": "addFile", - "description": "上传文件", - "pathParams": [], - "queryParams": [], - "bodyParams": {}, - "resBody": {} - }, - { - "method": "get", - "path": "/api/v1/file", - "tag": "file", - "summary": "", - "operationId": "getFiles", - "description": "批量查询", - "pathParams": [], - "queryParams": [], - "bodyParams": {} - }, - { - "method": "get", - "path": "/api/v1/file/{id}", - "tag": "file", - "summary": "", - "operationId": "getFile", - "description": "查询", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "文件名", - "example": "xxx.jpg" - }, - "size": { + { + "method": "delete", + "path": "/api/v1/file/{id}", + "tag": "file", + "operationId": "delFile", + "description": "删除", + "pathParams": [ + { + "name": "id", "type": "number", - "description": "文件大小", - "example": 1024 - }, - "mimetype": { - "type": "string", - "description": "文件类型", - "example": "image/jpeg" - }, - "path": { - "type": "string", - "description": "文件路径", - "example": "/upload/2021/10/01/xxx.jpg" - }, - "hash": { - "type": "string", - "description": "文件哈希", - "example": "2afb1f8b83ef0cc564f227d75d0b6914" - }, - "extension": { - "type": "string", - "description": "文件后缀", - "example": ".jpg" + "required": true } - }, - "required": [ - "name", - "size", - "mimetype", - "path", - "hash", - "extension" - ] - } - }, - { - "method": "patch", - "path": "/api/v1/file/{id}", - "tag": "file", - "summary": "", - "operationId": "setFile", - "description": "更新", - "pathParams": [], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "string" - } - }, - { - "method": "delete", - "path": "/api/v1/file/{id}", - "tag": "file", - "summary": "", - "operationId": "delFile", - "description": "删除", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" + ], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/file/hash/{hash}", + "tag": "file", + "operationId": "getFileByHash", + "description": "查询文件是否已存在", + "pathParams": [ + { + "name": "hash", + "type": "string", + "required": true } - } - ], - "queryParams": [], - "bodyParams": {} - }, - { - "method": "get", - "path": "/api/v1/file/hash/{hash}", - "tag": "file", - "summary": "", - "operationId": "getFileByHash", - "description": "查询文件是否已存在", - "pathParams": [ - { - "name": "hash", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "boolean" - } - }, - { - "method": "post", - "path": "/api/v1/posts", - "tag": "post", - "summary": "", - "operationId": "addPost", - "description": "创建文章", - "pathParams": [], - "queryParams": [], - "bodyParams": { - "title": { - "type": "string", - "description": "文章标题", - "name": "title", - "required": true - }, - "description": { - "type": "string", - "description": "文章描述", - "name": "description", - "required": true - }, - "content": { - "type": "string", - "description": "文章内容", - "name": "content", - "required": true + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "boolean" } }, - "resBody": {} - }, - { - "method": "get", - "path": "/api/v1/posts", - "tag": "post", - "summary": "", - "operationId": "getPosts", - "description": "批量查询文章", - "pathParams": [], - "queryParams": [ - { - "name": "sort", - "required": false, - "in": "query", - "description": "排序规则", - "example": "id:desc", - "schema": { - "pattern": "/^(\\w+:\\w+,)*\\w+:\\w+$/", - "default": "id:desc", - "type": "string" - } - }, - { - "name": "page", - "required": false, - "in": "query", - "description": "页码", - "example": 1, - "schema": { - "minimum": 1, - "type": "number" - } - }, - { - "name": "size", - "required": false, - "in": "query", - "description": "每页条数", - "example": 10, - "schema": { - "minimum": 0, - "type": "number" + { + "method": "post", + "path": "/api/v1/posts", + "tag": "post", + "operationId": "addPost", + "description": "创建文章", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "title", + "type": "string", + "required": true, + "description": "文章标题" + }, + { + "name": "description", + "type": "string", + "required": true, + "description": "文章描述" + }, + { + "name": "content", + "type": "string", + "required": true, + "description": "文章内容" } + ], + "bodyReturn": { + "type": "number" } - ], - "bodyParams": {} - }, - { - "method": "get", - "path": "/api/v1/posts/template.xlsx", - "tag": "post", - "summary": "", - "operationId": "getPostTemplate", - "description": "获取文章下载模板", - "pathParams": [], - "queryParams": [], - "bodyParams": {} - }, - { - "method": "get", - "path": "/api/v1/posts/{id}", - "tag": "post", - "summary": "", - "operationId": "getPost", - "description": "查询文章", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" + }, + { + "method": "get", + "path": "/api/v1/posts", + "tag": "post", + "operationId": "getPosts", + "description": "批量查询文章", + "pathParams": [], + "quryParams": [ + { + "name": "sort", + "type": "string", + "description": "排序规则", + "required": false + }, + { + "name": "page", + "type": "number", + "description": "页码", + "required": false + }, + { + "name": "size", + "type": "number", + "description": "每页条数", + "required": false } - } - ], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "object", - "properties": { - "title": { - "type": "string", - "description": "文章标题", - "example": "文章标题" - }, - "description": { - "type": "string", - "description": "文章描述", - "example": "文章描述" - }, - "content": { - "type": "string", - "description": "文章内容", - "example": "文章内容" - }, - "author": { - "description": "文章作者", - "example": "文章作者", - "allOf": [ - { - "type": "object", - "properties": { - "username": { - "type": "string", - "description": "登录账号", - "example": "juetan" - }, - "nickname": { - "type": "string", - "description": "用户昵称", - "example": "绝弹" - }, - "description": { - "type": "string", - "description": "用户介绍", - "example": "这个人很懒, 什么也没有留下!" - }, - "avatar": { - "type": "string", - "description": "用户头像(URL)", - "example": "./assets/222421415123.png " - }, - "password": { - "type": "string", - "description": "用户密码", - "example": "password" - }, - "email": { - "type": "string", - "description": "用户邮箱", - "example": "example@mail.com" - }, - "roleIds": { - "description": "用户角色ID", - "type": "array", - "items": { - "type": "number" + ], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/posts/template.xlsx", + "tag": "post", + "operationId": "getPostTemplate", + "description": "获取文章下载模板", + "pathParams": [], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/posts/{id}", + "tag": "post", + "operationId": "getPost", + "description": "查询文章", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "文章标题", + "example": "文章标题" + }, + "description": { + "type": "string", + "description": "文章描述", + "example": "文章描述" + }, + "content": { + "type": "string", + "description": "文章内容", + "example": "文章内容" + }, + "author": { + "description": "文章作者", + "example": "文章作者", + "allOf": [ + { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "登录账号", + "example": "juetan" + }, + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "用户介绍", + "example": "这个人很懒, 什么也没有留下!" + }, + "avatar": { + "type": "string", + "description": "用户头像(URL)", + "example": "./assets/222421415123.png " + }, + "password": { + "type": "string", + "description": "用户密码", + "example": "password" + }, + "email": { + "type": "string", + "description": "用户邮箱", + "example": "example@mail.com" + }, + "roleIds": { + "description": "用户角色ID", + "type": "array", + "items": { + "type": "number" + } } - } - }, - "required": [ - "username", - "nickname", - "description", - "avatar", - "password", - "email", - "roleIds" - ] - } - ] - } - }, - "required": [ - "title", - "description", - "content", - "author" - ] - } - }, - { - "method": "patch", - "path": "/api/v1/posts/{id}", - "tag": "post", - "summary": "", - "operationId": "updatePost", - "description": "更新文章", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "queryParams": [], - "bodyParams": { - "title": { - "type": "string", - "description": "文章标题", - "name": "title", - "required": false - }, - "description": { - "type": "string", - "description": "文章描述", - "name": "description", - "required": false - }, - "content": { - "type": "string", - "description": "文章内容", - "name": "content", - "required": false - } - } - }, - { - "method": "delete", - "path": "/api/v1/posts/{id}", - "tag": "post", - "summary": "", - "operationId": "delPost", - "description": "删除文章", - "pathParams": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "number" - } - } - ], - "queryParams": [], - "bodyParams": {} - }, - { - "method": "post", - "path": "/api/v1/categories", - "tag": "category", - "summary": "", - "operationId": "addCategory", - "description": "添加分类", - "pathParams": [], - "queryParams": [], - "bodyParams": { - "title": { - "type": "string", - "description": "分类名称", - "example": "待分类", - "name": "title", - "required": true - }, - "slug": { - "type": "string", - "description": "分类别名", - "example": "default", - "name": "slug", - "required": true - }, - "description": { - "type": "string", - "description": "分类描述", - "example": "默认分类", - "name": "description", - "required": false - }, - "icon": { - "type": "string", - "description": "分类图标", - "example": "default", - "name": "icon", - "required": false - }, - "sort": { - "type": "number", - "description": "分类排序", - "example": 0, - "name": "sort", - "required": false - }, - "type": { - "type": "object", - "description": "分类类型", - "example": "category", - "name": "type", - "required": true - }, - "parentId": { - "type": "number", - "description": "父级分类ID", - "example": 0, - "name": "parentId", - "required": false + }, + "required": [ + "username", + "nickname", + "description", + "avatar", + "password", + "email", + "roleIds" + ] + } + ] + } + }, + "required": [ + "title", + "description", + "content", + "author" + ] } }, - "resBody": {} - }, - { - "method": "get", - "path": "/api/v1/categories", - "tag": "category", - "summary": "", - "operationId": "getCategories", - "description": "分页获取分类", - "pathParams": [], - "queryParams": [ - { - "name": "demo", - "required": false, - "in": "query", - "description": "字段描述(Swagger用途)", - "example": "示例值", - "schema": { - "type": "string" + { + "method": "patch", + "path": "/api/v1/posts/{id}", + "tag": "post", + "operationId": "updatePost", + "description": "更新文章", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true } - }, - { - "name": "sort", - "required": false, - "in": "query", - "description": "排序规则", - "example": "id:desc", - "schema": { - "pattern": "/^(\\w+:\\w+,)*\\w+:\\w+$/", - "default": "id:desc", - "type": "string" + ], + "quryParams": [], + "bodyParams": [ + { + "name": "title", + "type": "string", + "required": false, + "description": "文章标题" + }, + { + "name": "description", + "type": "string", + "required": false, + "description": "文章描述" + }, + { + "name": "content", + "type": "string", + "required": false, + "description": "文章内容" } - }, - { - "name": "page", - "required": false, - "in": "query", - "description": "页码", - "example": 1, - "schema": { - "minimum": 1, - "type": "number" + ] + }, + { + "method": "delete", + "path": "/api/v1/posts/{id}", + "tag": "post", + "operationId": "delPost", + "description": "删除文章", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true } - }, - { - "name": "size", - "required": false, - "in": "query", - "description": "每页条数", - "example": 10, - "schema": { - "minimum": 0, - "type": "number" + ], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "post", + "path": "/api/v1/categories", + "tag": "category", + "operationId": "addCategory", + "description": "添加分类", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "title", + "type": "string", + "required": true, + "description": "分类名称" + }, + { + "name": "slug", + "type": "string", + "required": true, + "description": "分类别名" + }, + { + "name": "description", + "type": "string", + "required": false, + "description": "分类描述" + }, + { + "name": "icon", + "type": "string", + "required": false, + "description": "分类图标" + }, + { + "name": "sort", + "type": "number", + "required": false, + "description": "分类排序" + }, + { + "name": "type", + "type": "object", + "required": true, + "description": "分类类型" + }, + { + "name": "parentId", + "type": "number", + "required": false, + "description": "父级分类ID" + } + ], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/categories", + "tag": "category", + "operationId": "getCategories", + "description": "分页获取分类", + "pathParams": [], + "quryParams": [ + { + "name": "demo", + "type": "string", + "description": "字段描述(Swagger用途)", + "required": false + }, + { + "name": "sort", + "type": "string", + "description": "排序规则", + "required": false + }, + { + "name": "page", + "type": "number", + "description": "页码", + "required": false + }, + { + "name": "size", + "type": "number", + "description": "每页条数", + "required": false + } + ], + "bodyParams": [], + "bodyReturn": { + "type": "array", + "items": { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "分类名称", + "example": "待分类" + }, + "slug": { + "type": "string", + "description": "分类别名", + "example": "default" + }, + "description": { + "type": "string", + "description": "分类描述", + "example": "默认分类" + }, + "icon": { + "type": "string", + "description": "分类图标", + "example": "default" + }, + "sort": { + "type": "number", + "description": "分类排序", + "example": 0 + }, + "type": { + "type": "object", + "description": "分类类型", + "example": "category" + }, + "parentId": { + "type": "number", + "description": "父级分类ID", + "example": 0 + } + }, + "required": [ + "title", + "slug" + ] } } - ], - "bodyParams": {}, - "resBody": { - "type": "array", - "items": { + }, + { + "method": "get", + "path": "/api/v1/categories/{id}", + "tag": "category", + "operationId": "getCategory", + "description": "添加分类", + "pathParams": [], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { "type": "object", "properties": { "title": { @@ -1659,138 +1431,100 @@ "slug" ] } - } - }, - { - "method": "get", - "path": "/api/v1/categories/{id}", - "tag": "category", - "summary": "", - "operationId": "getCategory", - "description": "添加分类", - "pathParams": [], - "queryParams": [], - "bodyParams": {}, - "resBody": { - "type": "object", - "properties": { - "title": { - "type": "string", - "description": "分类名称", - "example": "待分类" - }, - "slug": { - "type": "string", - "description": "分类别名", - "example": "default" - }, - "description": { - "type": "string", - "description": "分类描述", - "example": "默认分类" - }, - "icon": { - "type": "string", - "description": "分类图标", - "example": "default" - }, - "sort": { + }, + { + "method": "patch", + "path": "/api/v1/categories/{id}", + "tag": "category", + "operationId": "setCategory", + "description": "更新分类", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "id", "type": "number", - "description": "分类排序", - "example": 0 + "required": true }, - "type": { + { + "name": "title", + "type": "string", + "required": false, + "description": "分类名称" + }, + { + "name": "slug", + "type": "string", + "required": false, + "description": "分类别名" + }, + { + "name": "description", + "type": "string", + "required": false, + "description": "分类描述" + }, + { + "name": "icon", + "type": "string", + "required": false, + "description": "分类图标" + }, + { + "name": "sort", + "type": "number", + "required": false, + "description": "分类排序" + }, + { + "name": "type", "type": "object", - "description": "分类类型", - "example": "category" + "required": false, + "description": "分类类型" }, - "parentId": { + { + "name": "parentId", "type": "number", - "description": "父级分类ID", - "example": 0 + "required": false, + "description": "父级分类ID" } - }, - "required": [ - "title", - "slug" ] + }, + { + "method": "delete", + "path": "/api/v1/categories/{id}", + "tag": "category", + "operationId": "delCategory", + "description": "删除分类", + "pathParams": [], + "quryParams": [], + "bodyParams": [] } - }, - { - "method": "patch", - "path": "/api/v1/categories/{id}", - "tag": "category", - "summary": "", - "operationId": "setCategory", - "description": "更新分类", - "pathParams": [], - "queryParams": [], - "bodyParams": { - "id": { - "type": "number", - "name": "id", - "required": true - }, - "title": { - "type": "string", - "description": "分类名称", - "example": "待分类", - "name": "title", - "required": false - }, - "slug": { - "type": "string", - "description": "分类别名", - "example": "default", - "name": "slug", - "required": false - }, - "description": { - "type": "string", - "description": "分类描述", - "example": "默认分类", - "name": "description", - "required": false - }, - "icon": { - "type": "string", - "description": "分类图标", - "example": "default", - "name": "icon", - "required": false - }, - "sort": { - "type": "number", - "description": "分类排序", - "example": 0, - "name": "sort", - "required": false - }, - "type": { - "type": "object", - "description": "分类类型", - "example": "category", - "name": "type", - "required": false - }, - "parentId": { - "type": "number", - "description": "父级分类ID", - "example": 0, - "name": "parentId", - "required": false - } + ], + "tags": [ + { + "name": "user", + "description": "用户管理" + }, + { + "name": "auth", + "description": "认证管理" + }, + { + "name": "role", + "description": "角色管理" + }, + { + "name": "permission", + "description": "权限管理" + }, + { + "name": "post", + "description": "文章管理" + }, + { + "name": "upload", + "description": "文件上传" } - }, - { - "method": "delete", - "path": "/api/v1/categories/{id}", - "tag": "category", - "summary": "", - "operationId": "delCategory", - "description": "删除分类", - "pathParams": [], - "queryParams": [], - "bodyParams": {} - } -] \ No newline at end of file + ] +} \ No newline at end of file diff --git a/scripts/openapi/e.ts b/scripts/openapi/e.ts index a5a34a5..ea48002 100644 --- a/scripts/openapi/e.ts +++ b/scripts/openapi/e.ts @@ -1,18 +1,42 @@ -import fs from 'fs' -import doc from './openapi1.json'; +import fs from "fs"; +import doc from "./openapi1.json"; -interface Param { +interface BaseParam { name: string; required: boolean; description: string; - example: string; - schema: { - type: string; - [key: string]: any; - } } -interface JsonParam { +interface NumberParam { + type: "number"; + min?: number; + max?: number; +} + +interface StringParam { + type: "string"; + pattern?: string; +} + +interface BooleanParam { + type: "boolean"; +} + +interface ObjectParam { + type: "object"; + properties: { + [key: string]: Param; + }; +} + +interface ArrayParam { + type: "array"; + items: Param; +} + +type Param = BaseParam & (NumberParam | StringParam | BooleanParam | ObjectParam | ArrayParam); + +interface BodyParam { name: string; type: string; required: boolean; @@ -20,56 +44,98 @@ interface JsonParam { example: string; } -const run = () => { - const { paths } = doc - const routes: any[] = [] - for(const [path, obj] of Object.entries(paths)) { - for(const [method, obj1] of Object.entries(obj)) { - const { tags, summary, operationId, description, parameters, requestBody, responses } = obj1 +interface Route { + method: string; + path: string; + tag: string; + operationId: string; + description: string; + pathParams: Param[]; + quryParams: Param[]; + bodyParams: any; + bodyReturn: any; +} - const { content = {} } = requestBody || {} - const { schema = {} } = content['application/json'] || {} - const { properties = {}, required: requireds = [] } = schema - const bodyParams = {} - for(const [id, obj2 = {}] of Object.entries(properties)) { - const { type, description, example } = obj2 as any; - const required = requireds.includes(id) - const param: JsonParam = { - ...(obj2 as any), +interface Tag { + name: string; + description: string; +} + +const run = () => { + const routes: Route[] = []; + const tags: Tag[] = doc.tags; + + for (const [path, obj] of Object.entries(doc.paths)) { + for (const [method, obj1] of Object.entries(obj)) { + const { tags, operationId, description, parameters, responses } = obj1; + const tag = tags?.[0]; + + const { content = {} } = obj1.requestBody || {}; + const { schema = {} } = content["application/json"] || {}; + const { properties = {}, required: requireds = [] } = schema; + const bodyParams: any = []; + for (const [id, obj2 = {}] of Object.entries(properties)) { + const { type, description } = obj2 as any; + const required = requireds.includes(id); + const param: Param = { name: id, type, required, description, - example, + }; + bodyParams.push(param); + } + + const { content: content1 = {} } = responses["200"] || responses["201"] || {}; + const { schema: schema1 = {} } = content1["application/json"] || {}; + let bodyReturn = {}; + if (schema1.type === "object") { + bodyReturn = schema1.properties?.data; + } + + const pathParams: Param[] = []; + const quryParams: Param[] = []; + + for (const param of parameters) { + const { name, schema, description, required, items, properties } = param; + const type = schema.type; + const item: Param = { + name, + type, + description, + required, + }; + if (type === "array") { + (item as unknown as ArrayParam).items = items; + } + if (type === "object") { + (item as unknown as ObjectParam).properties = properties; + } + if (param.in === "path") { + pathParams.push(item); + } + if (param.in === "query") { + quryParams.push(item); } - bodyParams[id] = param } - const { content: content1 = {} } = responses['200'] || {} - const { schema: schema1 = {} } = content1['application/json'] || {} - let resBody = {} - if(schema1.type === 'object') { - resBody = schema1.properties?.data; - } - - const pathParams = parameters.filter((i: any) => i.in === 'path') - const queryParams = parameters.filter((i: any) => i.in === 'query') - const route = { + routes.push({ method, path, - tag: tags?.[0], - summary, + tag, operationId, description, pathParams, - queryParams, + quryParams, bodyParams, - resBody, - } - routes.push(route) + bodyReturn, + }); } } - fs.writeFileSync('12.json', JSON.stringify(routes, null, 2)); -} -run(); \ No newline at end of file + const obj = { routes, tags }; + const pat = '../../src/dd.json' + fs.writeFileSync(pat, JSON.stringify(obj, null, 2)); +}; + +run(); diff --git a/src/dd.json b/src/dd.json new file mode 100644 index 0000000..d68853e --- /dev/null +++ b/src/dd.json @@ -0,0 +1,1530 @@ +{ + "routes": [ + { + "method": "post", + "path": "/api/v1/users", + "tag": "user", + "operationId": "addUser", + "description": "新增用户", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "username", + "type": "string", + "required": true, + "description": "登录账号" + }, + { + "name": "nickname", + "type": "string", + "required": true, + "description": "用户昵称" + }, + { + "name": "password", + "type": "string", + "required": false, + "description": "用户密码" + }, + { + "name": "avatarId", + "type": "number", + "required": false, + "description": "头像ID" + }, + { + "name": "roleIds", + "type": "array", + "required": false, + "description": "角色ID列表" + } + ], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/users", + "tag": "user", + "operationId": "getUsers", + "description": "分页/条件查询用户", + "pathParams": [], + "quryParams": [ + { + "name": "nickname", + "type": "string", + "description": "用户昵称", + "required": false + }, + { + "name": "sort", + "type": "string", + "description": "排序规则", + "required": false + }, + { + "name": "page", + "type": "number", + "description": "页码", + "required": false + }, + { + "name": "size", + "type": "number", + "description": "每页条数", + "required": false + } + ], + "bodyParams": [], + "bodyReturn": { + "type": "array", + "items": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "登录账号", + "example": "juetan" + }, + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "用户介绍", + "example": "这个人很懒, 什么也没有留下!" + }, + "avatar": { + "type": "string", + "description": "用户头像(URL)", + "example": "./assets/222421415123.png " + }, + "password": { + "type": "string", + "description": "用户密码", + "example": "password" + }, + "email": { + "type": "string", + "description": "用户邮箱", + "example": "example@mail.com" + }, + "roleIds": { + "description": "用户角色ID", + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": [ + "username", + "nickname", + "description", + "avatar", + "password", + "email", + "roleIds" + ] + } + } + }, + { + "method": "get", + "path": "/api/v1/users/{id}", + "tag": "user", + "operationId": "getUser", + "description": "根据ID查询用户", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "登录账号", + "example": "juetan" + }, + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "用户介绍", + "example": "这个人很懒, 什么也没有留下!" + }, + "avatar": { + "type": "string", + "description": "用户头像(URL)", + "example": "./assets/222421415123.png " + }, + "password": { + "type": "string", + "description": "用户密码", + "example": "password" + }, + "email": { + "type": "string", + "description": "用户邮箱", + "example": "example@mail.com" + }, + "roleIds": { + "description": "用户角色ID", + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": [ + "username", + "nickname", + "description", + "avatar", + "password", + "email", + "roleIds" + ] + } + }, + { + "method": "patch", + "path": "/api/v1/users/{id}", + "tag": "user", + "operationId": "updateUser", + "description": "根据ID更新用户", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [ + { + "name": "id", + "type": "number", + "required": true + }, + { + "name": "username", + "type": "string", + "required": false, + "description": "登录账号" + }, + { + "name": "nickname", + "type": "string", + "required": false, + "description": "用户昵称" + }, + { + "name": "password", + "type": "string", + "required": false, + "description": "用户密码" + }, + { + "name": "avatarId", + "type": "number", + "required": false, + "description": "头像ID" + }, + { + "name": "roleIds", + "type": "array", + "required": false, + "description": "角色ID列表" + } + ] + }, + { + "method": "delete", + "path": "/api/v1/users/{id}", + "tag": "user", + "operationId": "delUser", + "description": "根据ID删除用户", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "post", + "path": "/api/v1/auth/login", + "tag": "auth", + "operationId": "login", + "description": "账号登陆", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "username", + "type": "string", + "required": true, + "description": "用户名" + }, + { + "name": "password", + "type": "string", + "required": true, + "description": "用户密码" + } + ], + "bodyReturn": { + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "用户ID" + }, + "token": { + "type": "string", + "description": "访问令牌", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MjIsInVzZXJuYW1lIjoianVldGFuIiwiaWF0IjoxNjkxMTM5MjI3LCJleHAiOjE2OTExOTkyMjd9.6z7f-xfsHABbsyg401o2boKeqNQ1epPDYfEdavIcfYc" + }, + "username": { + "type": "string", + "description": "登录账号", + "example": "juetan" + }, + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "用户介绍", + "example": "这个人很懒, 什么也没有留下!" + }, + "avatar": { + "type": "string", + "description": "用户头像(URL)", + "example": "./assets/222421415123.png " + }, + "email": { + "type": "string", + "description": "用户邮箱", + "example": "example@mail.com" + }, + "roleIds": { + "description": "用户角色ID", + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": [ + "id", + "token", + "username", + "nickname", + "description", + "avatar", + "email", + "roleIds" + ] + } + }, + { + "method": "post", + "path": "/api/v1/logs", + "tag": "log", + "operationId": "addLog", + "description": "新增日志管理", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "demo", + "type": "string", + "required": true, + "description": "字段描述(Swagger用途)" + } + ], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/logs", + "tag": "log", + "operationId": "getLogs", + "description": "根据分页/过滤参数查询日志管理", + "pathParams": [], + "quryParams": [ + { + "name": "nickname", + "type": "string", + "description": "用户名", + "required": false + }, + { + "name": "sort", + "type": "string", + "description": "排序规则", + "required": false + }, + { + "name": "page", + "type": "number", + "description": "页码", + "required": false + }, + { + "name": "size", + "type": "number", + "description": "每页条数", + "required": false + } + ], + "bodyParams": [], + "bodyReturn": { + "type": "array", + "items": { + "type": "object", + "properties": { + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "操作描述", + "example": "1" + }, + "status": { + "type": "boolean", + "description": "操作状态", + "example": true + }, + "ip": { + "type": "string", + "description": "登陆IP", + "example": "127.0.0.1" + }, + "addr": { + "type": "string", + "description": "登陆地址", + "example": "广东省深圳市" + }, + "browser": { + "type": "string", + "description": "浏览器", + "example": "chrome" + }, + "os": { + "type": "string", + "description": "操作系统", + "example": "windows 10" + } + }, + "required": [ + "nickname", + "description", + "status", + "ip", + "addr", + "browser", + "os" + ] + } + } + }, + { + "method": "get", + "path": "/api/v1/logs/login", + "tag": "log", + "operationId": "getLoginLogs", + "description": "分页查询登陆日志", + "pathParams": [], + "quryParams": [ + { + "name": "nickname", + "type": "string", + "description": "用户名", + "required": false + }, + { + "name": "sort", + "type": "string", + "description": "排序规则", + "required": false + }, + { + "name": "page", + "type": "number", + "description": "页码", + "required": false + }, + { + "name": "size", + "type": "number", + "description": "每页条数", + "required": false + } + ], + "bodyParams": [], + "bodyReturn": { + "type": "array", + "items": { + "type": "object", + "properties": { + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "操作描述", + "example": "1" + }, + "status": { + "type": "boolean", + "description": "操作状态", + "example": true + }, + "ip": { + "type": "string", + "description": "登陆IP", + "example": "127.0.0.1" + }, + "addr": { + "type": "string", + "description": "登陆地址", + "example": "广东省深圳市" + }, + "browser": { + "type": "string", + "description": "浏览器", + "example": "chrome" + }, + "os": { + "type": "string", + "description": "操作系统", + "example": "windows 10" + } + }, + "required": [ + "nickname", + "description", + "status", + "ip", + "addr", + "browser", + "os" + ] + } + } + }, + { + "method": "get", + "path": "/api/v1/logs/{id}", + "tag": "log", + "operationId": "getLog", + "description": "根据ID查询日志管理", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "object", + "properties": { + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "操作描述", + "example": "1" + }, + "status": { + "type": "boolean", + "description": "操作状态", + "example": true + }, + "ip": { + "type": "string", + "description": "登陆IP", + "example": "127.0.0.1" + }, + "addr": { + "type": "string", + "description": "登陆地址", + "example": "广东省深圳市" + }, + "browser": { + "type": "string", + "description": "浏览器", + "example": "chrome" + }, + "os": { + "type": "string", + "description": "操作系统", + "example": "windows 10" + } + }, + "required": [ + "nickname", + "description", + "status", + "ip", + "addr", + "browser", + "os" + ] + } + }, + { + "method": "patch", + "path": "/api/v1/logs/{id}", + "tag": "log", + "operationId": "updateLog", + "description": "根据ID更新日志管理", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [ + { + "name": "demo", + "type": "string", + "required": false, + "description": "字段描述(Swagger用途)" + } + ] + }, + { + "method": "delete", + "path": "/api/v1/logs/{id}", + "tag": "log", + "operationId": "delLog", + "description": "根据ID删除日志管理", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "post", + "path": "/api/v1/roles", + "tag": "role", + "operationId": "addRole", + "description": "创建角色", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "name", + "type": "string", + "required": true + }, + { + "name": "slug", + "type": "string", + "required": true + }, + { + "name": "description", + "type": "string", + "required": false + }, + { + "name": "permissions", + "type": "array", + "required": false + } + ], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/roles", + "tag": "role", + "operationId": "getRoles", + "description": "批量查询角色", + "pathParams": [], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/roles/{id}", + "tag": "role", + "operationId": "getRole", + "description": "查询角色", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "string" + } + }, + { + "method": "patch", + "path": "/api/v1/roles/{id}", + "tag": "role", + "operationId": "updateRole", + "description": "更新角色", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [ + { + "name": "permissionIds", + "type": "array", + "required": false + }, + { + "name": "name", + "type": "string", + "required": false + }, + { + "name": "slug", + "type": "string", + "required": false + }, + { + "name": "description", + "type": "string", + "required": false + }, + { + "name": "permissions", + "type": "array", + "required": false + } + ] + }, + { + "method": "delete", + "path": "/api/v1/roles/{id}", + "tag": "role", + "operationId": "delRole", + "description": "删除角色", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "string" + } + }, + { + "method": "post", + "path": "/api/v1/permissions", + "tag": "permission", + "operationId": "addPermission", + "description": "创建权限", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "name", + "type": "string", + "required": true, + "description": "权限名称" + }, + { + "name": "slug", + "type": "string", + "required": true, + "description": "权限标识" + }, + { + "name": "description", + "type": "string", + "required": false, + "description": "权限描述" + } + ], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/permissions", + "tag": "permission", + "operationId": "getPermissions", + "description": "批量查询权限", + "pathParams": [], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/permissions/{id}", + "tag": "permission", + "operationId": "getPermission", + "description": "查询权限", + "pathParams": [ + { + "name": "id", + "type": "string", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "string" + } + }, + { + "method": "patch", + "path": "/api/v1/permissions/{id}", + "tag": "permission", + "operationId": "setPermission", + "description": "更新权限", + "pathParams": [ + { + "name": "id", + "type": "string", + "required": true + } + ], + "quryParams": [], + "bodyParams": [ + { + "name": "id", + "type": "number", + "required": true + }, + { + "name": "name", + "type": "string", + "required": false, + "description": "权限名称" + }, + { + "name": "slug", + "type": "string", + "required": false, + "description": "权限标识" + }, + { + "name": "description", + "type": "string", + "required": false, + "description": "权限描述" + } + ] + }, + { + "method": "delete", + "path": "/api/v1/permissions/{id}", + "tag": "permission", + "operationId": "delPermission", + "description": "删除权限", + "pathParams": [ + { + "name": "id", + "type": "string", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "string" + } + }, + { + "method": "post", + "path": "/api/v1/file", + "tag": "file", + "operationId": "addFile", + "description": "上传文件", + "pathParams": [], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/file", + "tag": "file", + "operationId": "getFiles", + "description": "批量查询", + "pathParams": [], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/file/{id}", + "tag": "file", + "operationId": "getFile", + "description": "查询", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "文件名", + "example": "xxx.jpg" + }, + "size": { + "type": "number", + "description": "文件大小", + "example": 1024 + }, + "mimetype": { + "type": "string", + "description": "文件类型", + "example": "image/jpeg" + }, + "path": { + "type": "string", + "description": "文件路径", + "example": "/upload/2021/10/01/xxx.jpg" + }, + "hash": { + "type": "string", + "description": "文件哈希", + "example": "2afb1f8b83ef0cc564f227d75d0b6914" + }, + "extension": { + "type": "string", + "description": "文件后缀", + "example": ".jpg" + } + }, + "required": [ + "name", + "size", + "mimetype", + "path", + "hash", + "extension" + ] + } + }, + { + "method": "patch", + "path": "/api/v1/file/{id}", + "tag": "file", + "operationId": "setFile", + "description": "更新", + "pathParams": [], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "string" + } + }, + { + "method": "delete", + "path": "/api/v1/file/{id}", + "tag": "file", + "operationId": "delFile", + "description": "删除", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/file/hash/{hash}", + "tag": "file", + "operationId": "getFileByHash", + "description": "查询文件是否已存在", + "pathParams": [ + { + "name": "hash", + "type": "string", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "boolean" + } + }, + { + "method": "post", + "path": "/api/v1/posts", + "tag": "post", + "operationId": "addPost", + "description": "创建文章", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "title", + "type": "string", + "required": true, + "description": "文章标题" + }, + { + "name": "description", + "type": "string", + "required": true, + "description": "文章描述" + }, + { + "name": "content", + "type": "string", + "required": true, + "description": "文章内容" + } + ], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/posts", + "tag": "post", + "operationId": "getPosts", + "description": "批量查询文章", + "pathParams": [], + "quryParams": [ + { + "name": "sort", + "type": "string", + "description": "排序规则", + "required": false + }, + { + "name": "page", + "type": "number", + "description": "页码", + "required": false + }, + { + "name": "size", + "type": "number", + "description": "每页条数", + "required": false + } + ], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/posts/template.xlsx", + "tag": "post", + "operationId": "getPostTemplate", + "description": "获取文章下载模板", + "pathParams": [], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "get", + "path": "/api/v1/posts/{id}", + "tag": "post", + "operationId": "getPost", + "description": "查询文章", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "文章标题", + "example": "文章标题" + }, + "description": { + "type": "string", + "description": "文章描述", + "example": "文章描述" + }, + "content": { + "type": "string", + "description": "文章内容", + "example": "文章内容" + }, + "author": { + "description": "文章作者", + "example": "文章作者", + "allOf": [ + { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "登录账号", + "example": "juetan" + }, + "nickname": { + "type": "string", + "description": "用户昵称", + "example": "绝弹" + }, + "description": { + "type": "string", + "description": "用户介绍", + "example": "这个人很懒, 什么也没有留下!" + }, + "avatar": { + "type": "string", + "description": "用户头像(URL)", + "example": "./assets/222421415123.png " + }, + "password": { + "type": "string", + "description": "用户密码", + "example": "password" + }, + "email": { + "type": "string", + "description": "用户邮箱", + "example": "example@mail.com" + }, + "roleIds": { + "description": "用户角色ID", + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": [ + "username", + "nickname", + "description", + "avatar", + "password", + "email", + "roleIds" + ] + } + ] + } + }, + "required": [ + "title", + "description", + "content", + "author" + ] + } + }, + { + "method": "patch", + "path": "/api/v1/posts/{id}", + "tag": "post", + "operationId": "updatePost", + "description": "更新文章", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [ + { + "name": "title", + "type": "string", + "required": false, + "description": "文章标题" + }, + { + "name": "description", + "type": "string", + "required": false, + "description": "文章描述" + }, + { + "name": "content", + "type": "string", + "required": false, + "description": "文章内容" + } + ] + }, + { + "method": "delete", + "path": "/api/v1/posts/{id}", + "tag": "post", + "operationId": "delPost", + "description": "删除文章", + "pathParams": [ + { + "name": "id", + "type": "number", + "required": true + } + ], + "quryParams": [], + "bodyParams": [] + }, + { + "method": "post", + "path": "/api/v1/categories", + "tag": "category", + "operationId": "addCategory", + "description": "添加分类", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "title", + "type": "string", + "required": true, + "description": "分类名称" + }, + { + "name": "slug", + "type": "string", + "required": true, + "description": "分类别名" + }, + { + "name": "description", + "type": "string", + "required": false, + "description": "分类描述" + }, + { + "name": "icon", + "type": "string", + "required": false, + "description": "分类图标" + }, + { + "name": "sort", + "type": "number", + "required": false, + "description": "分类排序" + }, + { + "name": "type", + "type": "object", + "required": true, + "description": "分类类型" + }, + { + "name": "parentId", + "type": "number", + "required": false, + "description": "父级分类ID" + } + ], + "bodyReturn": { + "type": "number" + } + }, + { + "method": "get", + "path": "/api/v1/categories", + "tag": "category", + "operationId": "getCategories", + "description": "分页获取分类", + "pathParams": [], + "quryParams": [ + { + "name": "demo", + "type": "string", + "description": "字段描述(Swagger用途)", + "required": false + }, + { + "name": "sort", + "type": "string", + "description": "排序规则", + "required": false + }, + { + "name": "page", + "type": "number", + "description": "页码", + "required": false + }, + { + "name": "size", + "type": "number", + "description": "每页条数", + "required": false + } + ], + "bodyParams": [], + "bodyReturn": { + "type": "array", + "items": { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "分类名称", + "example": "待分类" + }, + "slug": { + "type": "string", + "description": "分类别名", + "example": "default" + }, + "description": { + "type": "string", + "description": "分类描述", + "example": "默认分类" + }, + "icon": { + "type": "string", + "description": "分类图标", + "example": "default" + }, + "sort": { + "type": "number", + "description": "分类排序", + "example": 0 + }, + "type": { + "type": "object", + "description": "分类类型", + "example": "category" + }, + "parentId": { + "type": "number", + "description": "父级分类ID", + "example": 0 + } + }, + "required": [ + "title", + "slug" + ] + } + } + }, + { + "method": "get", + "path": "/api/v1/categories/{id}", + "tag": "category", + "operationId": "getCategory", + "description": "添加分类", + "pathParams": [], + "quryParams": [], + "bodyParams": [], + "bodyReturn": { + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "分类名称", + "example": "待分类" + }, + "slug": { + "type": "string", + "description": "分类别名", + "example": "default" + }, + "description": { + "type": "string", + "description": "分类描述", + "example": "默认分类" + }, + "icon": { + "type": "string", + "description": "分类图标", + "example": "default" + }, + "sort": { + "type": "number", + "description": "分类排序", + "example": 0 + }, + "type": { + "type": "object", + "description": "分类类型", + "example": "category" + }, + "parentId": { + "type": "number", + "description": "父级分类ID", + "example": 0 + } + }, + "required": [ + "title", + "slug" + ] + } + }, + { + "method": "patch", + "path": "/api/v1/categories/{id}", + "tag": "category", + "operationId": "setCategory", + "description": "更新分类", + "pathParams": [], + "quryParams": [], + "bodyParams": [ + { + "name": "id", + "type": "number", + "required": true + }, + { + "name": "title", + "type": "string", + "required": false, + "description": "分类名称" + }, + { + "name": "slug", + "type": "string", + "required": false, + "description": "分类别名" + }, + { + "name": "description", + "type": "string", + "required": false, + "description": "分类描述" + }, + { + "name": "icon", + "type": "string", + "required": false, + "description": "分类图标" + }, + { + "name": "sort", + "type": "number", + "required": false, + "description": "分类排序" + }, + { + "name": "type", + "type": "object", + "required": false, + "description": "分类类型" + }, + { + "name": "parentId", + "type": "number", + "required": false, + "description": "父级分类ID" + } + ] + }, + { + "method": "delete", + "path": "/api/v1/categories/{id}", + "tag": "category", + "operationId": "delCategory", + "description": "删除分类", + "pathParams": [], + "quryParams": [], + "bodyParams": [] + } + ], + "tags": [ + { + "name": "user", + "description": "用户管理" + }, + { + "name": "auth", + "description": "认证管理" + }, + { + "name": "role", + "description": "角色管理" + }, + { + "name": "permission", + "description": "权限管理" + }, + { + "name": "post", + "description": "文章管理" + }, + { + "name": "upload", + "description": "文件上传" + } + ] +} \ No newline at end of file diff --git a/src/pages/my/dev.vue b/src/pages/my/dev.vue new file mode 100644 index 0000000..cec537e --- /dev/null +++ b/src/pages/my/dev.vue @@ -0,0 +1,88 @@ + + + + + + + +{ + "meta": { + "sort": 20010, + "title": "接口生成", + "icon": "icon-park-outline-code" + } +} + diff --git a/src/pages/my/editor.vue b/src/pages/my/editor.vue new file mode 100644 index 0000000..0876cb9 --- /dev/null +++ b/src/pages/my/editor.vue @@ -0,0 +1,59 @@ + + + + + diff --git a/src/pages/my/page.ejs b/src/pages/my/page.ejs new file mode 100644 index 0000000..cd2c72b --- /dev/null +++ b/src/pages/my/page.ejs @@ -0,0 +1,101 @@ + + + + + + +<%_ if(false) { _%> + +{ + "meta": { + "sort": 10301, + "title": "用户管理", + "icon": "icon-park-outline-user" + } +} + +<%_ } _%> diff --git a/src/types/auto-router.d.ts b/src/types/auto-router.d.ts index e3d2cda..d50ae1f 100644 --- a/src/types/auto-router.d.ts +++ b/src/types/auto-router.d.ts @@ -47,6 +47,8 @@ declare module 'vue-router/auto/routes' { '/home/home': RouteRecordInfo<'/home/home', '/home/home', Record, Record>, '/home/test': RouteRecordInfo<'/home/test', '/home/test', Record, Record>, '/my/': RouteRecordInfo<'/my/', '/my', Record, Record>, + '/my/dev': RouteRecordInfo<'/my/dev', '/my/dev', Record, Record>, + '/my/editor': RouteRecordInfo<'/my/editor', '/my/editor', Record, Record>, '/post/': RouteRecordInfo<'/post/', '/post', Record, Record>, '/post/category/': RouteRecordInfo<'/post/category/', '/post/category', Record, Record>, '/post/comment/': RouteRecordInfo<'/post/comment/', '/post/comment', Record, Record>,