-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
5,120 additions
and
7,641 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import 'dotenv/config' | ||
import * as env from '../src/config/env.config' | ||
import * as logger from '../src/common/logger' | ||
import * as databaseHelper from '../src/common/databaseHelper' | ||
import Car from '../src/models/Car' | ||
|
||
if ( | ||
await databaseHelper.connect(env.DB_URI, env.DB_SSL, env.DB_DEBUG) | ||
) { | ||
const cars = await Car.find({}) | ||
|
||
for (const car of cars) { | ||
if (car.price) { | ||
car.dailyPrice = car.price | ||
car.discountedDailyPrice = null | ||
car.biWeeklyPrice = null | ||
car.discountedBiWeeklyPrice = null | ||
car.weeklyPrice = null | ||
car.discountedWeeklyPrice = null | ||
car.monthlyPrice = null | ||
car.discountedMonthlyPrice = null | ||
car.price = undefined | ||
await car.save() | ||
console.log(`${car.id} affected`) | ||
} | ||
} | ||
|
||
await databaseHelper.close() | ||
logger.info('MongoDB connection closed') | ||
process.exit(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.