add migration for settings doc
This commit is contained in:
1 parent
5f0ad17b34
commit
73ddd54d20
3 files changed
+8
-1
No files matched your search
@@ -15,7 +15,7 @@ const SettingsAbout = () => {
|
|||||||
<Typography component="h1">{t("settingsAbout")}</Typography>
|
<Typography component="h1">{t("settingsAbout")}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography component="h2">Checkmate {2.0}</Typography>
|
<Typography component="h2">Checkmate {2.1}</Typography>
|
||||||
<Typography sx={{ mt: theme.spacing(2), mb: theme.spacing(6), opacity: 0.6 }}>
|
<Typography sx={{ mt: theme.spacing(2), mb: theme.spacing(6), opacity: 0.6 }}>
|
||||||
{t("settingsDevelopedBy")}
|
{t("settingsDevelopedBy")}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ const AppSettingsSchema = mongoose.Schema(
|
|||||||
unique: true,
|
unique: true,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
version: {
|
||||||
|
type: Number,
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
timestamps: true,
|
timestamps: true,
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ class SettingsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getDBSettings() {
|
async getDBSettings() {
|
||||||
|
// Remove any old settings
|
||||||
|
await this.appSettings.deleteMany({ version: { $exists: false } });
|
||||||
|
|
||||||
let settings = await this.appSettings
|
let settings = await this.appSettings
|
||||||
.findOne({ singleton: true })
|
.findOne({ singleton: true })
|
||||||
.select("-__v -_id -createdAt -updatedAt -singleton")
|
.select("-__v -_id -createdAt -updatedAt -singleton")
|
||||||
|
|||||||
Reference in new issue
Block a user