|
@@ -31,17 +31,13 @@ const router = express.Router();
|
|
|
* description: Import mode
|
|
* description: Import mode
|
|
|
* type: string
|
|
* type: string
|
|
|
* enum: [insert, upsert, flushAndInsert]
|
|
* enum: [insert, upsert, flushAndInsert]
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * @swagger
|
|
|
|
|
- *
|
|
|
|
|
- * components:
|
|
|
|
|
- * schemas:
|
|
|
|
|
* ImportStatus:
|
|
* ImportStatus:
|
|
|
* description: ImportStatus
|
|
* description: ImportStatus
|
|
|
* type: object
|
|
* type: object
|
|
|
* properties:
|
|
* properties:
|
|
|
|
|
+ * isTheSameVersion:
|
|
|
|
|
+ * type: boolean
|
|
|
|
|
+ * description: whether the version of the uploaded data is the same as the current GROWI version
|
|
|
* zipFileStat:
|
|
* zipFileStat:
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: the property object
|
|
* description: the property object
|
|
@@ -53,6 +49,77 @@ const router = express.Router();
|
|
|
* isImporting:
|
|
* isImporting:
|
|
|
* type: boolean
|
|
* type: boolean
|
|
|
* description: whether the current importing job exists or not
|
|
* description: whether the current importing job exists or not
|
|
|
|
|
+ * FileImportResponse:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * meta:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * version:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * url:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * passwordSeed:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * exportedAt:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * format: date-time
|
|
|
|
|
+ * envVars:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * ELASTICSEARCH_URI:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * fileName:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * zipFilePath:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * fileStat:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * dev:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * mode:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * nlink:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * uid:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * gid:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * rdev:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * blksize:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * ino:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * size:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * blocks:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * atime:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * format: date-time
|
|
|
|
|
+ * mtime:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * format: date-time
|
|
|
|
|
+ * ctime:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * format: date-time
|
|
|
|
|
+ * birthtime:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * format: date-time
|
|
|
|
|
+ * innerFileStats:
|
|
|
|
|
+ * type: array
|
|
|
|
|
+ * items:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * fileName:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * collectionName:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * size:
|
|
|
|
|
+ * type: integer
|
|
|
|
|
+ * nullable: true
|
|
|
*/
|
|
*/
|
|
|
/** @param {import('~/server/crowi').default} crowi Crowi instance */
|
|
/** @param {import('~/server/crowi').default} crowi Crowi instance */
|
|
|
export default function route(crowi) {
|
|
export default function route(crowi) {
|
|
@@ -101,6 +168,8 @@ export default function route(crowi) {
|
|
|
* /import:
|
|
* /import:
|
|
|
* get:
|
|
* get:
|
|
|
* tags: [Import]
|
|
* tags: [Import]
|
|
|
|
|
+ * security:
|
|
|
|
|
+ * - api_key: []
|
|
|
* operationId: getImportSettingsParams
|
|
* operationId: getImportSettingsParams
|
|
|
* summary: /import
|
|
* summary: /import
|
|
|
* description: Get import settings params
|
|
* description: Get import settings params
|
|
@@ -114,6 +183,19 @@ export default function route(crowi) {
|
|
|
* importSettingsParams:
|
|
* importSettingsParams:
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: import settings params
|
|
* description: import settings params
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * esaTeamName:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * description: the team name of esa.io
|
|
|
|
|
+ * esaAccessToken:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * description: the access token of esa.io
|
|
|
|
|
+ * qiitaTeamName:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * description: the team name of qiita.com
|
|
|
|
|
+ * qiitaAccessToken:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * description: the access token of qiita.com
|
|
|
*/
|
|
*/
|
|
|
router.get('/', accessTokenParser, loginRequired, adminRequired, async(req, res) => {
|
|
router.get('/', accessTokenParser, loginRequired, adminRequired, async(req, res) => {
|
|
|
try {
|
|
try {
|
|
@@ -138,6 +220,8 @@ export default function route(crowi) {
|
|
|
* /import/status:
|
|
* /import/status:
|
|
|
* get:
|
|
* get:
|
|
|
* tags: [Import]
|
|
* tags: [Import]
|
|
|
|
|
+ * security:
|
|
|
|
|
+ * - api_key: []
|
|
|
* operationId: getImportStatus
|
|
* operationId: getImportStatus
|
|
|
* summary: /import/status
|
|
* summary: /import/status
|
|
|
* description: Get properties of stored zip files for import
|
|
* description: Get properties of stored zip files for import
|
|
@@ -167,6 +251,8 @@ export default function route(crowi) {
|
|
|
* /import:
|
|
* /import:
|
|
|
* post:
|
|
* post:
|
|
|
* tags: [Import]
|
|
* tags: [Import]
|
|
|
|
|
+ * security:
|
|
|
|
|
+ * - api_key: []
|
|
|
* operationId: executeImport
|
|
* operationId: executeImport
|
|
|
* summary: /import
|
|
* summary: /import
|
|
|
* description: import a collection from a zipped json
|
|
* description: import a collection from a zipped json
|
|
@@ -297,27 +383,26 @@ export default function route(crowi) {
|
|
|
* /import/upload:
|
|
* /import/upload:
|
|
|
* post:
|
|
* post:
|
|
|
* tags: [Import]
|
|
* tags: [Import]
|
|
|
|
|
+ * security:
|
|
|
|
|
+ * - api_key: []
|
|
|
* operationId: uploadImport
|
|
* operationId: uploadImport
|
|
|
* summary: /import/upload
|
|
* summary: /import/upload
|
|
|
* description: upload a zip file
|
|
* description: upload a zip file
|
|
|
|
|
+ * requestBody:
|
|
|
|
|
+ * content:
|
|
|
|
|
+ * multipart/form-data:
|
|
|
|
|
+ * schema:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * file:
|
|
|
|
|
+ * format: binary
|
|
|
* responses:
|
|
* responses:
|
|
|
* 200:
|
|
* 200:
|
|
|
* description: the file is uploaded
|
|
* description: the file is uploaded
|
|
|
* content:
|
|
* content:
|
|
|
* application/json:
|
|
* application/json:
|
|
|
* schema:
|
|
* schema:
|
|
|
- * properties:
|
|
|
|
|
- * meta:
|
|
|
|
|
- * type: object
|
|
|
|
|
- * description: the meta data of the uploaded file
|
|
|
|
|
- * fileName:
|
|
|
|
|
- * type: string
|
|
|
|
|
- * description: the base name of the uploaded file
|
|
|
|
|
- * fileStats:
|
|
|
|
|
- * type: array
|
|
|
|
|
- * items:
|
|
|
|
|
- * type: object
|
|
|
|
|
- * description: the property of each extracted file
|
|
|
|
|
|
|
+ * $ref: '#/components/schemas/FileImportResponse'
|
|
|
*/
|
|
*/
|
|
|
router.post('/upload', accessTokenParser, loginRequired, adminRequired, uploads.single('file'), addActivity, async(req, res) => {
|
|
router.post('/upload', accessTokenParser, loginRequired, adminRequired, uploads.single('file'), addActivity, async(req, res) => {
|
|
|
const { file } = req;
|
|
const { file } = req;
|
|
@@ -354,6 +439,8 @@ export default function route(crowi) {
|
|
|
* /import/all:
|
|
* /import/all:
|
|
|
* delete:
|
|
* delete:
|
|
|
* tags: [Import]
|
|
* tags: [Import]
|
|
|
|
|
+ * security:
|
|
|
|
|
+ * - api_key: []
|
|
|
* operationId: deleteImportAll
|
|
* operationId: deleteImportAll
|
|
|
* summary: /import/all
|
|
* summary: /import/all
|
|
|
* description: Delete all zip files
|
|
* description: Delete all zip files
|