mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-28 19:41:33 +02:00
Merge pull request #21427 from overleaf/jpa-populate-db-on-import
[web] populate db with collections on import, ahead of waitForDb() call GitOrigin-RevId: 7eb4cd61c2052187acd9947d7060f54d9822d314
This commit is contained in:
@@ -1,13 +1,7 @@
|
||||
const minimist = require('minimist')
|
||||
const {
|
||||
db,
|
||||
ObjectId,
|
||||
waitForDb,
|
||||
} = require('../../../app/src/infrastructure/mongodb')
|
||||
const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb')
|
||||
|
||||
async function main() {
|
||||
await waitForDb()
|
||||
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
string: ['user-id', 'compile-timeout'],
|
||||
})
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
const { ObjectId } = require('mongodb-legacy')
|
||||
const { waitForDb, db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const {
|
||||
connectionPromise,
|
||||
db,
|
||||
} = require('../../../app/src/infrastructure/mongodb')
|
||||
const { getMongoClient } = require('../../../app/src/infrastructure/Mongoose')
|
||||
|
||||
const MIN_MONGO_VERSION = [5, 0]
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
await waitForDb()
|
||||
await connectionPromise
|
||||
} catch (err) {
|
||||
console.error('Cannot connect to mongodb')
|
||||
throw err
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const { waitForDb, db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
|
||||
async function readImagesInUse() {
|
||||
await waitForDb()
|
||||
const projectCount = await db.projects.countDocuments()
|
||||
if (projectCount === 0) {
|
||||
return []
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
const minimist = require('minimist')
|
||||
const { db, waitForDb } = require('../../../app/src/infrastructure/mongodb')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const UserRegistrationHandler = require('../../../app/src/Features/User/UserRegistrationHandler')
|
||||
|
||||
async function main() {
|
||||
await waitForDb()
|
||||
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
string: ['email'],
|
||||
boolean: ['admin'],
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
const { waitForDb } = require('../../../app/src/infrastructure/mongodb')
|
||||
const UserGetter = require('../../../app/src/Features/User/UserGetter')
|
||||
const UserDeleter = require('../../../app/src/Features/User/UserDeleter')
|
||||
|
||||
async function main() {
|
||||
await waitForDb()
|
||||
|
||||
const email = (process.argv.slice(2).pop() || '').replace(/^--email=/, '')
|
||||
if (!email) {
|
||||
console.error(`Usage: node ${__filename} --email=joe@example.com`)
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
// another.
|
||||
|
||||
const minimist = require('minimist')
|
||||
const { waitForDb } = require('../../../app/src/infrastructure/mongodb')
|
||||
|
||||
const os = require('os')
|
||||
const fs = require('fs')
|
||||
@@ -182,7 +181,6 @@ async function migrateEmails() {
|
||||
const csvFile = fs.readFileSync(csvFilePath, 'utf8')
|
||||
const rows = csv.parse(csvFile)
|
||||
console.log('Number of users to migrate: ', rows.length)
|
||||
await waitForDb()
|
||||
const emails = filterEmails(rows)
|
||||
const existingUserEmails = await checkEmailsAgainstDb(emails)
|
||||
await doMigration(existingUserEmails)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
const minimist = require('minimist')
|
||||
const { db, waitForDb } = require('../../../app/src/infrastructure/mongodb')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
|
||||
async function main() {
|
||||
await waitForDb()
|
||||
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
string: ['user-id', 'old-name', 'new_name'],
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Settings = require('@overleaf/settings')
|
||||
const logger = require('@overleaf/logger')
|
||||
const { db, waitForDb } = require('../../../app/src/infrastructure/mongodb')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const {
|
||||
mergeFeatures,
|
||||
compareFeatures,
|
||||
@@ -8,8 +8,6 @@ const {
|
||||
const DRY_RUN = !process.argv.includes('--dry-run=false')
|
||||
|
||||
async function main(DRY_RUN, defaultFeatures) {
|
||||
await waitForDb()
|
||||
|
||||
logger.info({ defaultFeatures }, 'default features')
|
||||
|
||||
const cursor = db.users.find(
|
||||
|
||||
Reference in New Issue
Block a user