remove v2 files
This commit is contained in:
1 parent
059408f098
commit
c0ff162ed9
5 files changed
+25
-759
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import mongoose from "mongoose";
|
||||
|
||||
const MONGODB_URI = process.env.MONGODB_URI || "mongodb://localhost:27017/checkmate";
|
||||
|
||||
export const connectDatabase = async (): Promise<boolean> => {
|
||||
try {
|
||||
await mongoose.connect(MONGODB_URI);
|
||||
console.log("Connected to MongoDB");
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error("MongoDB connection error:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
export const disconnectDatabase = async (): Promise<boolean> => {
|
||||
try {
|
||||
await mongoose.disconnect();
|
||||
console.log("Disconnected from MongoDB");
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error("MongoDB disconnection error:", error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -96,12 +96,6 @@ const userSchema = new Schema<IUser>(
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
toJSON: {
|
||||
transform: function (_doc, ret) {
|
||||
delete ret.passwordHash;
|
||||
return ret;
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user