|
@@ -20,22 +20,100 @@ const router = express.Router();
|
|
|
* components:
|
|
* components:
|
|
|
* schemas:
|
|
* schemas:
|
|
|
* ExportStatus:
|
|
* ExportStatus:
|
|
|
- * description: ExportStatus
|
|
|
|
|
* type: object
|
|
* type: object
|
|
|
* properties:
|
|
* properties:
|
|
|
* zipFileStats:
|
|
* zipFileStats:
|
|
|
* type: array
|
|
* type: array
|
|
|
* items:
|
|
* items:
|
|
|
- * type: object
|
|
|
|
|
- * description: the property of each file
|
|
|
|
|
|
|
+ * $ref: '#/components/schemas/ExportZipFileStat'
|
|
|
|
|
+ * isExporting:
|
|
|
|
|
+ * type: boolean
|
|
|
* progressList:
|
|
* progressList:
|
|
|
|
|
+ * type: [array, null]
|
|
|
|
|
+ * items:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * ExportZipFileStat:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * meta:
|
|
|
|
|
+ * $ref: '#/components/schemas/ExportMeta'
|
|
|
|
|
+ * fileName:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * zipFilePath:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * fileStat:
|
|
|
|
|
+ * $ref: '#/components/schemas/ExportFileStat'
|
|
|
|
|
+ * innerFileStats:
|
|
|
* type: array
|
|
* type: array
|
|
|
* items:
|
|
* items:
|
|
|
- * type: object
|
|
|
|
|
- * description: progress data for each exporting collections
|
|
|
|
|
- * isExporting:
|
|
|
|
|
- * type: boolean
|
|
|
|
|
- * description: whether the current exporting job exists or not
|
|
|
|
|
|
|
+ * $ref: '#/components/schemas/ExportInnerFileStat'
|
|
|
|
|
+ * ExportMeta:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * version:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * url:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * passwordSeed:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * exportedAt:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * format: date-time
|
|
|
|
|
+ * envVars:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * additionalProperties:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * ExportFileStat:
|
|
|
|
|
+ * 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
|
|
|
|
|
+ * ExportInnerFileStat:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * fileName:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * collectionName:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * meta:
|
|
|
|
|
+ * progressList:
|
|
|
|
|
+ * type: array
|
|
|
|
|
+ * items:
|
|
|
|
|
+ * type: object
|
|
|
|
|
+ * description: progress data for each exporting collections
|
|
|
|
|
+ * isExporting:
|
|
|
|
|
+ * type: boolean
|
|
|
|
|
+ * description: whether the current exporting job exists or not
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
module.exports = (crowi) => {
|
|
module.exports = (crowi) => {
|
|
@@ -84,6 +162,9 @@ module.exports = (crowi) => {
|
|
|
* application/json:
|
|
* application/json:
|
|
|
* schema:
|
|
* schema:
|
|
|
* properties:
|
|
* properties:
|
|
|
|
|
+ * ok:
|
|
|
|
|
+ * type: boolean
|
|
|
|
|
+ * description: whether the request is succeeded or not
|
|
|
* status:
|
|
* status:
|
|
|
* $ref: '#/components/schemas/ExportStatus'
|
|
* $ref: '#/components/schemas/ExportStatus'
|
|
|
*/
|
|
*/
|
|
@@ -106,6 +187,17 @@ module.exports = (crowi) => {
|
|
|
* operationId: createExport
|
|
* operationId: createExport
|
|
|
* summary: /export
|
|
* summary: /export
|
|
|
* description: generate zipped jsons for collections
|
|
* description: generate zipped jsons for collections
|
|
|
|
|
+ * requestBody:
|
|
|
|
|
+ * content:
|
|
|
|
|
+ * application/json:
|
|
|
|
|
+ * schema:
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * collections:
|
|
|
|
|
+ * type: array
|
|
|
|
|
+ * items:
|
|
|
|
|
+ * type: string
|
|
|
|
|
+ * description: the collections to export
|
|
|
|
|
+ * example: ["pages", "tags"]
|
|
|
* responses:
|
|
* responses:
|
|
|
* 200:
|
|
* 200:
|
|
|
* description: a zip file is generated
|
|
* description: a zip file is generated
|
|
@@ -113,8 +205,9 @@ module.exports = (crowi) => {
|
|
|
* application/json:
|
|
* application/json:
|
|
|
* schema:
|
|
* schema:
|
|
|
* properties:
|
|
* properties:
|
|
|
- * status:
|
|
|
|
|
- * $ref: '#/components/schemas/ExportStatus'
|
|
|
|
|
|
|
+ * ok:
|
|
|
|
|
+ * type: boolean
|
|
|
|
|
+ * description: whether the request is succeeded
|
|
|
*/
|
|
*/
|
|
|
router.post('/', accessTokenParser, loginRequired, adminRequired, addActivity, async(req, res) => {
|
|
router.post('/', accessTokenParser, loginRequired, adminRequired, addActivity, async(req, res) => {
|
|
|
// TODO: add express validator
|
|
// TODO: add express validator
|
|
@@ -161,6 +254,10 @@ module.exports = (crowi) => {
|
|
|
* application/json:
|
|
* application/json:
|
|
|
* schema:
|
|
* schema:
|
|
|
* type: object
|
|
* type: object
|
|
|
|
|
+ * properties:
|
|
|
|
|
+ * ok:
|
|
|
|
|
+ * type: boolean
|
|
|
|
|
+ * description: whether the request is succeeded
|
|
|
*/
|
|
*/
|
|
|
router.delete('/:fileName', accessTokenParser, loginRequired, adminRequired, validator.deleteFile, apiV3FormValidator, addActivity, async(req, res) => {
|
|
router.delete('/:fileName', accessTokenParser, loginRequired, adminRequired, validator.deleteFile, apiV3FormValidator, addActivity, async(req, res) => {
|
|
|
// TODO: add express validator
|
|
// TODO: add express validator
|