Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue39 solved #87

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions backend/config/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//impoting all the necessary dependencies and functions
import mongoose, { connect } from "mongoose";

//making the connect database function
const connectDB = async () => {
try {
await mongoose.connect(
//using the mongodb uri
"mongodb+srv://openlake:[email protected]/"
);
console.log("MongoDB database is connected successfully");
} catch (error) {
console.log(error);
}
};

export default connectDB;
59 changes: 59 additions & 0 deletions backend/models/jobPosting.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//importing the dependencies
import mongoose from "mongoose";

//making the schema
const jobPostingSchema = new mongoose.Schema(
{
jobTitle: {
type: String,
required: true,
},
jobDescription: {
type: String,
required: true,
},
company: {
type: String,
required: true,
},
requiredSkills: {
type: String,
required: true,
},
type: {
type: String,
required: true,
},
batch: {
type: String,
required: true,
},
deadline: {
type: String,
required: true,
},
applicationLink: {
type: String,
required: true,
},
expiry: {
type: String,
required: true,
},
author: {
type: mongoose.Schema.Types.ObjectId,
ref: "User",
required: true,
},
relevanceScore: {
type: String,
required: true,
},
},
{ timestamps: true }
);

//making the model
const jobPosting = mongoose.model("JobPosting", jobPostingSchema);

export default jobPosting;
Empty file added backend/models/student.model.js
Empty file.
29 changes: 29 additions & 0 deletions backend/models/user.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//imorting all necessaries dependencies
import mongoose from "mongoose";

// define the student model schema
const UserSchema = new mongoose.Schema({
name: {
type: String,
required: true,
unique: true,
},
email: {
type: String,
unique: true,
required: true,
},
password: {
type: String,
required: true,
},
Role: {
type: String,
enum: ["student", "ccps staff"],
required: true,
},
});

//exporting model
const User = mongoose.model("User", UserSchema);
export default User;
Loading