persistence draft

Persisting individual media file objects
This commit is contained in:
Cássio Zen
2016-06-06 21:53:22 -03:00
parent a0be4e0ae8
commit 83d03c63ec
10 changed files with 162 additions and 36 deletions

View File

@ -66,6 +66,22 @@ class Backend {
return entry;
};
}
persist(collection, entry, mediaFiles) {
const entryData = entry.get('data').toJS();
const entryObj = {
path: entry.get('path'),
slug: entry.get('slug'),
raw: this.entryToRaw(collection, entryData)
};
return this.implementation.persist(collection, entryObj, mediaFiles.toJS());
}
entryToRaw(collection, entry) {
const format = resolveFormat(collection, entry);
return format && format.toFile(entry);
}
}
export function resolveBackend(config) {