Commit dee2b0c5 authored by Hasitha Samarasekara's avatar Hasitha Samarasekara

Merge branch 'IT18063288' into 'master'

It18063288

See merge request !3
parents 7b5ffa13 a66470bc
ATLAS_URI = mongodb+srv://admin:admin@cluster0.wmb3b.mongodb.net/myFirstDatabase?retryWrites=true&w=majority
\ No newline at end of file
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const userSchema = new Schema({
institute_name:{type:String,required:true},
institute_email: {type:String,required:true},
institute_phones:{type:String,required:true},
institute_address:{type:String,required:true},
institute_city:{type:String,required:true},
institute_password:{type:String,required:true},
institute_registrationNo:{type:String},
institute_image:{type:String},
}, {
timestamps:true,
});
const User = mongoose.model('institute',userSchema);
module.exports = User;
\ No newline at end of file
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const userSchema = new Schema({
student_name:{type:String,required:true},
student_nic:{type:String,required:true},
student_email: {type:String,required:true},
student_phone:{type:String,required:true},
student_address:{type:String,required:true},
student_password:{type:String,required:true},
student_gender:{type:String},
student_image:{type:String},
guardian_name:{type:String},
guardian_email:{type:String},
guardian_relationship:{type:String}
}, {
timestamps:true,
});
const User = mongoose.model('student',userSchema);
module.exports = User;
\ No newline at end of file
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const userSchema = new Schema({
tutor_name:{type:String,required:true},
tutor_nic:{type:String,required:true},
tutor_email: {type:String,required:true},
tutor_phone:{type:String,required:true},
tutor_address:{type:String,required:true},
tutor_password:{type:String,required:true},
tutor_gender:{type:String},
tutor_status:{type:String},
tutor_image:{type:String},
tutor_Stream:{type:String},
tutor_subjects:{type:String},
tutor_class_types:{type:String},
tutor_main_district:{type:String},
tutor_main_city:{type:String},
tutor_medium:{type:String},
tutor_instituteID:{type:String},
}, {
timestamps:true,
});
const User = mongoose.model('tutor',userSchema);
module.exports = User;
\ No newline at end of file
This diff is collapsed.
{
"name": "WebBackEnd",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"mongoose": "^5.12.15"
}
}
const router = require('express').Router();
let institute = require('../models/institute.user.model');
router.route('/').get((req,res) =>{
institute.find()
.then(students => res.json(students))
.catch(err => res.status(400).json('Eroor: '+ err));
});
router.route('/add').post((req,res) =>{
const institute_name = req.body.institute_name;
const institute_email = req.body.institute_email;
const institute_phones = req.body.institute_phones;
const institute_address = req.body.institute_address;
const institute_city = req.body.institute_city;
const institute_password = req.body.institute_password;
const institute_registrationNo = req.body.institute_registrationNo;
const institute_image = req.body.institute_image;
const newInstitute = new institute({
institute_name,
institute_email,
institute_phones,
institute_address,
institute_city,
institute_password,
institute_registrationNo,
institute_image
});
newInstitute.save()
.then(() =>res.json('Institute Successfully Added....'))
.catch(err =>res.status(400).json('Error: '+err));
});
module.exports = router;
const router = require('express').Router();
let student = require('../models/student.user.model');
router.route('/').get((req,res) =>{
student.find()
.then(students => res.json(students))
.catch(err => res.status(400).json('Eroor: '+ err));
});
router.route('/add').post((req,res) =>{
const student_name = req.body.student_name;
const student_nic = req.body.student_nic;
const student_email = req.body.student_email;
const student_phone = req.body.student_phone;
const student_address = req.body.student_address;
const student_password = req.body.student_password;
const student_gender = req.body.student_gender;
const student_image = req.body.student_image;
const guardian_name = req.body.guardian_name;
const guardian_email = req.body.guardian_email;
const guardian_relationship = req.body.guardian_relationship;
const newStudent = new student({
student_name,
student_nic,
student_email,
student_phone,
student_address,
student_password,
student_gender,
student_image,
guardian_name,
guardian_email,
guardian_relationship
});
newStudent.save()
.then(() =>res.json('Student Successfully Added....'))
.catch(err =>res.status(400).json('Error: '+err));
});
module.exports = router;
const router = require('express').Router();
let tutor = require('../models/tutor.user.model');
router.route('/').get((req,res) =>{
tutor.find()
.then(tutors => res.json(tutors))
.catch(err => res.status(400).json('Eroor: '+ err));
});
router.route('/add').post((req,res) =>{
const tutor_name = req.body.tutor_name;
const tutor_nic = req.body.tutor_nic;
const tutor_email = req.body.tutor_email;
const tutor_phone = req.body.tutor_phone;
const tutor_address = req.body.tutor_address;
const tutor_password = req.body.tutor_password;
const tutor_gender = req.body.tutor_gender;
const tutor_status = req.body.tutor_status;
const tutor_image = req.body.tutor_image;
const tutor_Stream = req.body.tutor_Stream;
const tutor_subjects = req.body.tutor_subjects;
const tutor_class_types = req.body.tutor_class_types;
const tutor_main_district = req.body.tutor_main_district;
const tutor_main_city = req.body.tutor_main_city;
const tutor_medium = req.body.tutor_medium;
const tutor_instituteID = req.body.tutor_instituteID;
const newTutor = new tutor({
tutor_name,
tutor_nic,
tutor_email,
tutor_phone,
tutor_address,
tutor_password,
tutor_gender,
tutor_status,
tutor_image,
tutor_Stream,
tutor_subjects,
tutor_class_types,
tutor_main_district,
tutor_main_city,
tutor_medium,
tutor_instituteID
});
newTutor.save()
.then(() =>res.json('Tutor Successfully Added....'))
.catch(err =>res.status(400).json('Error: '+err));
});
module.exports = router;
const express = require('express');
const cors = require('cors');
const mongoose =require('mongoose');
require('dotenv').config();
const app = express();
const port = process.env.PORT || 5000;
app.use(cors());
app.use(express.json());
const uri = process.env.ATLAS_URI;
mongoose.connect(uri,{useNewUrlParser:true, useUnifiedTopology: true, useCreateIndex:true, useFindAndModify: false });
const connection = mongoose.connection;
connection.once('open',() => {
console.log("MongoDB database connection established successfully");
});
const studentRouter = require('./routes/student.route');
const tutorRouter = require('./routes/tutor.route');
const instituteRouter = require('./routes/institute.route');
app.use('/studentSingUp',studentRouter);
app.use('/tutorSingUp',tutorRouter);
app.use('/instituteSingUp',instituteRouter);
app.listen(port, () => {
console.log(`Server is running on Port: ${port}`);
});
\ No newline at end of file
......@@ -3020,6 +3020,15 @@
"resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.1.4.tgz",
"integrity": "sha512-Pdgfv6iP0gNx9ejRGa3zE7Xgkj/iclXqLfe7BnatdZz0QnLZ3jrRHUVH8wNSdN68w05Sk3ShGTb3ydktMTooig=="
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"dev": true,
"requires": {
"follow-redirects": "^1.10.0"
}
},
"axobject-query": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz",
......
......@@ -38,5 +38,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"axios": "^0.21.1"
}
}
......@@ -63,7 +63,8 @@ export default class Login extends Component{
render() {
return (
<div className="container" style={{padding:'10px'}}>
<div style={{width:'30%', margin:'auto', marginTop:'50px', padding:'0px', paddingBottom: '30px', border:'solid', borderColor:'#216E9B'}} >
<div>
<div style={{width:'30%', margin:'auto', marginTop:'7%', padding:'0px', paddingBottom: '30px', border:'solid', borderColor:'#216E9B'}} >
<form onSubmit={this.onSubmit} id="login" name="login" className="login">
<div className="row">
<br/>
......@@ -124,7 +125,7 @@ export default class Login extends Component{
</div>
</form>
</div>
</div>
</div>
)
}
......
......@@ -5,7 +5,8 @@ export default class NavBar extends Component {
render() {
return (
<nav className="navbar navbar-expand-lg" style={{background:'#1E4258'}}>
<nav className="navbar navbar-expand-lg" style={{background:'#1E4258',position: 'fixed',
width:'100%', marginTop: '0%', zIndex:'100'}}>
<button className="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false"
......
const configs = {
BASE_URL: 'http://localhost:5000',
};
module.exports = configs;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment