feat(db): init mongo and passing komga conf

This commit is contained in:
Julien Froidefond
2025-02-14 14:23:30 +01:00
parent 08f6e6a264
commit 1f881ade26
11 changed files with 1047 additions and 446 deletions

View File

@@ -0,0 +1,35 @@
import mongoose from "mongoose";
const configSchema = new mongoose.Schema(
{
userId: {
type: String,
required: true,
unique: true,
},
url: {
type: String,
required: true,
},
username: {
type: String,
required: true,
},
password: {
type: String,
required: true,
},
},
{
timestamps: true,
}
);
// Middleware pour mettre à jour le champ updatedAt avant la sauvegarde
configSchema.pre("save", function (next) {
this.updatedAt = new Date();
next();
});
export const KomgaConfig =
mongoose.models.KomgaConfig || mongoose.model("KomgaConfig", configSchema);