FileType doesn't need to be sequenced
This commit is contained in:
parent
b901bc7a26
commit
46e11b051e
@ -6,8 +6,6 @@ import { blobToArrayBuffer } from '../utils/conversion.js';
|
|||||||
export const FileType = PouchDB.registerType({
|
export const FileType = PouchDB.registerType({
|
||||||
name: 'File',
|
name: 'File',
|
||||||
getUniqueID: doc => doc.digest.substr(0, 16),
|
getUniqueID: doc => doc.digest.substr(0, 16),
|
||||||
getSequence: doc =>
|
|
||||||
new Date(doc.modifiedDate ? doc.modifiedDate : new Date().toISOString()).getTime(),
|
|
||||||
// schema: {
|
// schema: {
|
||||||
// name: t.REQUIRED_STRING,
|
// name: t.REQUIRED_STRING,
|
||||||
// mimetype: t.REQUIRED_STRING,
|
// mimetype: t.REQUIRED_STRING,
|
||||||
|
|||||||
@ -60,7 +60,8 @@ export function PouchORM(PouchDB) {
|
|||||||
|
|
||||||
function populateId(doc) {
|
function populateId(doc) {
|
||||||
if (!doc._id) {
|
if (!doc._id) {
|
||||||
doc._id = `${prefix}_${getSequence(doc).toString(36)}_${getUniqueID(doc)}`;
|
const sequence = getSequence ? getSequence(doc).toString(36) : '';
|
||||||
|
doc._id = `${prefix}_${sequence}_${getUniqueID(doc)}`;
|
||||||
}
|
}
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user