mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 02:51:57 +02:00
Merge pull request #9212 from overleaf/jpa-record-dropbox-file-id
[third-party-datastore] start recording dropbox id for docs/files GitOrigin-RevId: 699fe63994848b65aa4d9cbc7966b867de56eabf
This commit is contained in:
@@ -23,6 +23,8 @@ async function addDoc(options) {
|
||||
`/doc/${options.doc_id}`,
|
||||
'/raw'
|
||||
)
|
||||
options.entity_id = options.doc_id
|
||||
options.entity_type = 'doc'
|
||||
|
||||
return addEntity(options)
|
||||
}
|
||||
@@ -34,6 +36,8 @@ async function addEntity(options) {
|
||||
const job = {
|
||||
method: 'post',
|
||||
headers: {
|
||||
sl_entity_id: options.entity_id,
|
||||
sl_entity_type: options.entity_type,
|
||||
sl_entity_rev: options.rev,
|
||||
sl_project_id: options.project_id,
|
||||
sl_all_user_ids: JSON.stringify([userId]),
|
||||
@@ -54,6 +58,8 @@ async function addFile(options) {
|
||||
options.streamOrigin =
|
||||
settings.apis.filestore.url +
|
||||
path.join(`/project/${options.project_id}`, `/file/${options.file_id}`)
|
||||
options.entity_id = options.file_id
|
||||
options.entity_type = 'file'
|
||||
|
||||
return addEntity(options)
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ async function setupDb() {
|
||||
db.deletedProjects = internalDb.collection('deletedProjects')
|
||||
db.deletedSubscriptions = internalDb.collection('deletedSubscriptions')
|
||||
db.deletedUsers = internalDb.collection('deletedUsers')
|
||||
db.dropboxEntities = internalDb.collection('dropboxEntities')
|
||||
db.docHistory = internalDb.collection('docHistory')
|
||||
db.docHistoryIndex = internalDb.collection('docHistoryIndex')
|
||||
db.docOps = internalDb.collection('docOps')
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
const Helpers = require('./lib/helpers')
|
||||
|
||||
exports.tags = ['saas']
|
||||
|
||||
const indexes = [
|
||||
{
|
||||
key: {
|
||||
entityId: 1,
|
||||
},
|
||||
name: 'entityId_1',
|
||||
},
|
||||
]
|
||||
|
||||
exports.migrate = async client => {
|
||||
const { db } = client
|
||||
await Helpers.addIndexesToCollection(db.dropboxEntities, indexes)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
const { db } = client
|
||||
await Helpers.dropIndexesFromCollection(db.dropboxEntities, indexes)
|
||||
}
|
||||
Reference in New Issue
Block a user