swagger documentation for Api

This commit is contained in:
2025-01-30 12:44:04 +05:30
parent 5984f445f7
commit 465f713624
45 changed files with 5201 additions and 2308 deletions

View File

@@ -1,69 +1,69 @@
import mongoose, { Document, Schema } from "mongoose";
import MainModel from "../connect/mongoose";
export interface User extends Document {
userName: String;
email: String;
password: String;
role: String;
profilePicture: String;
isShare:Boolean,
activeStatus:string
}
const signupschema: Schema = new Schema({
userName: {
type: String,
required: true,
},
email: {
type: String,
unique: true,
required: true,
},
password: {
type: String,
min: 8,
required: true,
},
role: {
type: String,
default: "User",
enum: ["User", "Admin", "Project Manager", "Manager", "Owner"],
},
profilePicture: {
type: String,
// default: "default-profile-picture.jpg"
},
isShare:{
type:Boolean,
default:false
},
activeStatus:{
type:String,
enum: ["online", "offline"],
default: "offline"
}
});
// const userModel = (db: string) => {
// const mongoUrl = process.env.MONGO_URI || "";
// if (!mongoUrl) {
// throw new Error("MONGO_URI environment variable is not set");
// }
// // Connect to the database
// const dbConnection = mongoose.createConnection(mongoUrl, {
// dbName: db, // Specify the database name here
// serverSelectionTimeoutMS: 30000,
// });
// // Return the model
// return dbConnection.model("Users", signupschema, "Users");
// };
// export default userModel;
const userModel = (db:string) => {
return MainModel(db, "Users", signupschema, "Users")
};
import mongoose, { Document, Schema } from "mongoose";
import MainModel from "../connect/mongoose";
export interface User extends Document {
userName: String;
email: String;
password: String;
role: String;
profilePicture: String;
isShare:Boolean,
activeStatus:string
}
const signupschema: Schema = new Schema({
userName: {
type: String,
required: true,
},
email: {
type: String,
unique: true,
required: true,
},
password: {
type: String,
min: 8,
required: true,
},
role: {
type: String,
default: "User",
enum: ["User", "Admin", "Project Manager", "Manager", "Owner"],
},
profilePicture: {
type: String,
// default: "default-profile-picture.jpg"
},
isShare:{
type:Boolean,
default:false
},
activeStatus:{
type:String,
enum: ["online", "offline"],
default: "offline"
}
});
// const userModel = (db: string) => {
// const mongoUrl = process.env.MONGO_URI || "";
// if (!mongoUrl) {
// throw new Error("MONGO_URI environment variable is not set");
// }
// // Connect to the database
// const dbConnection = mongoose.createConnection(mongoUrl, {
// dbName: db, // Specify the database name here
// serverSelectionTimeoutMS: 30000,
// });
// // Return the model
// return dbConnection.model("Users", signupschema, "Users");
// };
// export default userModel;
const userModel = (db:string) => {
return MainModel(db, "Users", signupschema, "Users")
};
export default userModel;