This commit is contained in:
payacom
2026-08-31 20:45:41 +03:30
parent fa9f23c61d
commit 3f416a7a60
367 changed files with 621895 additions and 6443 deletions

28
scripts/seedGeoData.js Normal file
View File

@@ -0,0 +1,28 @@
/**
* Manual/CI trigger for the same geo seed logic that also runs automatically
* on every backend boot (utils/ensureGeoData.js, wired in boot/mongo.js) —
* kept as a single shared implementation so the two paths never drift.
*
* Run from modstagram-back:
* node scripts/seedGeoData.js
*/
require('dotenv').config()
const mongoose = require('mongoose')
const { ensureGeoData } = require('../utils/ensureGeoData')
async function main() {
const uri = process.env.DATABASE_URL
if (!uri) {
console.error('DATABASE_URL is required (check .env)')
process.exit(1)
}
await mongoose.connect(uri, { authSource: 'admin' })
await ensureGeoData(true)
await mongoose.disconnect()
}
main().catch((err) => {
console.error(err)
process.exit(1)
})