|
|
@@ -49,25 +49,6 @@ class ImportService {
|
|
|
this.convertMap[model.collection.collectionName][key] = this.keepOriginal;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // each key accepts either function or hardcoded value
|
|
|
- // 1. to keep the value => unlist the key
|
|
|
- // 2. to filter out an attribute, explicitly set it to undefined. e.g. "[key]: undefined"
|
|
|
- this.convertMap = {
|
|
|
- pages: Object.assign(this.convertMap.pages, {
|
|
|
- status: 'published', // FIXME when importing users and user groups
|
|
|
- grant: 1, // FIXME when importing users and user groups
|
|
|
- grantedUsers: [], // FIXME when importing users and user groups
|
|
|
- grantedGroup: null, // FIXME when importing users and user groups
|
|
|
- liker: [], // FIXME when importing users
|
|
|
- seenUsers: [], // FIXME when importing users
|
|
|
- commentCount: 0, // FIXME when importing comments
|
|
|
- extended: {}, // FIXME when ?
|
|
|
- pageIdOnHackmd: undefined, // FIXME when importing hackmd?
|
|
|
- revisionHackmdSynced: undefined, // FIXME when importing hackmd?
|
|
|
- hasDraftOnHackmd: undefined, // FIXME when importing hackmd?
|
|
|
- }),
|
|
|
- };
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -91,6 +72,31 @@ class ImportService {
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
+ getConvertMap(collectionName) {
|
|
|
+ const convertMap = {};
|
|
|
+
|
|
|
+ // each key accepts either function or hardcoded value
|
|
|
+ // 1. to keep the same value => unlist the key
|
|
|
+ // 2. to filter out an attribute, explicitly set it to undefined. e.g. "[key]: undefined"
|
|
|
+ if (collectionName === 'pages') {
|
|
|
+ Object.assign(convertMap, {
|
|
|
+ status: 'published', // FIXME when importing users and user groups
|
|
|
+ grant: 1, // FIXME when importing users and user groups
|
|
|
+ grantedUsers: [], // FIXME when importing users and user groups
|
|
|
+ grantedGroup: null, // FIXME when importing users and user groups
|
|
|
+ liker: [], // FIXME when importing users
|
|
|
+ seenUsers: [], // FIXME when importing users
|
|
|
+ commentCount: 0, // FIXME when importing comments
|
|
|
+ extended: {}, // FIXME when ?
|
|
|
+ pageIdOnHackmd: undefined, // FIXME when importing hackmd?
|
|
|
+ revisionHackmdSynced: undefined, // FIXME when importing hackmd?
|
|
|
+ hasDraftOnHackmd: undefined, // FIXME when importing hackmd?
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return convertMap;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* import a collection from json
|
|
|
*
|