Preparing for github file persistence

This commit is contained in:
Cássio Zen
2016-07-19 17:11:22 -03:00
parent 6f0f13ad40
commit 18ad041d96
13 changed files with 181 additions and 44 deletions

View File

@ -67,14 +67,21 @@ class Backend {
};
}
persist(collection, entryDraft) {
persistEntry(collection, entryDraft) {
const entryData = entryDraft.getIn(['entry', 'data']).toObject();
const entryObj = {
path: entryDraft.getIn(['entry', 'path']),
slug: entryDraft.getIn(['entry', 'slug']),
raw: this.entryToRaw(collection, entryData)
};
return this.implementation.persist(collection, entryObj, entryDraft.get('mediaFiles').toJS()).then(
const commitMessage = (entryDraft.getIn(['entry', 'newRecord']) ? 'Created ' : 'Updated ') +
collection.get('label') + ' “' +
entryDraft.getIn(['entry', 'data', 'title']) + '”';
return this.implementation.persistEntry(collection, entryObj, entryDraft.get('mediaFiles').toJS(), { commitMessage })
.then(
(response) => ({
persistedEntry: this.entryWithFormat(collection)(response.persistedEntry),
persistedMediaFiles:response.persistedMediaFiles