-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2a4d98
commit c832861
Showing
24 changed files
with
255 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Batch from '../model/batchModel.js'; | ||
|
||
// import AppError from '../utils/appError.js'; | ||
// import catchAsync from '../utils/catchAsync.js'; | ||
// import factory from './handlerFactory.js'; | ||
import * as factory from './handlerFactory.js'; | ||
// const factory = require('./handlerFactory'); | ||
|
||
export const getAllBatchPost = factory.getAll(Batch); | ||
|
||
export const createBatchPost = factory.createOne(Batch); | ||
export const getBatchPost = factory.getOne(Batch); | ||
export const updateBatchPost = factory.updateOne(Batch); | ||
export const deleteBatchPost = factory.deleteOne(Batch); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
import CourseAllocation from '../model/courseAllocationModel.js' | ||
import * as factory from './handlerFactory.js'; | ||
|
||
|
||
export const createCourseAllocationPost = factory.createOne(CourseAllocation); | ||
export const getAllCourseAllocationPost = factory.getAll(CourseAllocation); | ||
|
||
|
||
// export const createOne = catchAsync(async (req, res, next) => { | ||
// const doc = await CourseAllocation.create(req.body); | ||
// res.status(201).json({ | ||
// status: 'success', | ||
// doc, | ||
// }); | ||
// }); | ||
// export const getAll = catchAsync(async (req, res, next) => { | ||
// const docs = await CourseAllocation.find().sort({ createdAt: -1 }); | ||
// // SEND Response res | ||
// res.status(200).json({ | ||
// status: 'success', | ||
// results: docs.length, | ||
// docs | ||
// }); | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Level from '../model/levelModel.js'; | ||
|
||
// import AppError from '../utils/appError.js'; | ||
// import catchAsync from '../utils/catchAsync.js'; | ||
// import factory from './handlerFactory.js'; | ||
import * as factory from './handlerFactory.js'; | ||
// const factory = require('./handlerFactory'); | ||
|
||
export const getAllLevelPost = factory.getAll(Level); | ||
|
||
export const createLevelPost = factory.createOne(Level); | ||
export const getLevelPost = factory.getOne(Level); | ||
export const updateLevelPost = factory.updateOne(Level); | ||
export const deleteLevelPost = factory.deleteOne(Level); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Section from '../model/sectionModel.js'; | ||
|
||
// import AppError from '../utils/appError.js'; | ||
// import catchAsync from '../utils/catchAsync.js'; | ||
// import factory from './handlerFactory.js'; | ||
import * as factory from './handlerFactory.js'; | ||
// const factory = require('./handlerFactory'); | ||
|
||
export const getAllSectionPost = factory.getAll(Section); | ||
|
||
export const createSectionPost = factory.createOne(Section); | ||
export const getSectionPost = factory.getOne(Section); | ||
export const updateSectionPost = factory.updateOne(Section); | ||
export const deleteSectionPost = factory.deleteOne(Section); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Term from '../model/termModel.js'; | ||
|
||
// import AppError from '../utils/appError.js'; | ||
// import catchAsync from '../utils/catchAsync.js'; | ||
// import factory from './handlerFactory.js'; | ||
import * as factory from './handlerFactory.js'; | ||
// const factory = require('./handlerFactory'); | ||
|
||
export const getAllTermPost = factory.getAll(Term); | ||
|
||
export const createTermPost = factory.createOne(Term); | ||
export const getTermPost = factory.getOne(Term); | ||
export const updateTermPost = factory.updateOne(Term); | ||
export const deleteTermPost = factory.deleteOne(Term); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import mongoose from 'mongoose'; | ||
const batchSchema = new mongoose.Schema({ | ||
batchName : { | ||
type : String, | ||
required : [true,'A courese alllocation have a batch name'] | ||
} | ||
}) | ||
|
||
export default mongoose.model('Batch', batchSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import mongoose from 'mongoose'; | ||
|
||
|
||
const courseAllocationModel = new mongoose.Schema({ | ||
session : { | ||
level: { | ||
type: mongoose.Schema.ObjectId, | ||
ref: 'Level', | ||
}, | ||
term:{ | ||
type: mongoose.Schema.ObjectId, | ||
ref: 'Term', | ||
}, | ||
type: Object | ||
}, | ||
course : { | ||
teacherId:{ | ||
type: mongoose.Schema.ObjectId, | ||
ref: 'Teacher', | ||
}, | ||
section: { | ||
type: mongoose.Schema.ObjectId, | ||
ref: 'Section', | ||
}, | ||
courseId :{ | ||
type: mongoose.Schema.ObjectId, | ||
ref: 'Course', | ||
}, | ||
type: Array | ||
} | ||
}) | ||
|
||
export default mongoose.model('CourseAllocation',courseAllocationModel); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import mongoose from 'mongoose'; | ||
|
||
const levelSchema = new mongoose.Schema({ | ||
level: { | ||
type: String, | ||
required: [true, "A course allocation has a level"] | ||
} | ||
}) | ||
|
||
export default mongoose.model('Level', levelSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import mongoose from 'mongoose'; | ||
const sectionSchema = new mongoose.Schema({ | ||
sectionName: { | ||
type : String, | ||
maxlength: [45, 'A course allocation have a less than or equal 45 students in one section'], | ||
minength: [35, 'A course allocation have a more than or equal 35 students in one section'] | ||
} | ||
}) | ||
|
||
export default mongoose.model('Section',sectionSchema); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,32 @@ | ||
import mongoose from 'mongoose'; | ||
import validator from 'validator' | ||
|
||
const teacherSchema = new mongoose.Schema({ | ||
teacherName : { | ||
type: String, | ||
required: [true, "A course allocation has a teacher name"] | ||
}, | ||
teacherInitial: { | ||
type: String, | ||
required: [true, "A course allocation has a teacher Initial"] | ||
}, | ||
takenCredit: { | ||
type: Number, | ||
required: [true, "A course allocation has a taken Credit"] | ||
required: [true, "A course allocation has a taken Credit"], | ||
maxlength: [15, 'A course allocation have a less than or equal 15 credit he/she taken'], | ||
minlength: [10, 'A course allocation have a more than or equal 10 credit he/she taken'] | ||
}, | ||
courseId: [{ | ||
type:mongoose.Schema.ObjectId, | ||
ref:'Course' | ||
}] | ||
teacherId: { | ||
type: String, | ||
required: [true, "A course allocation has a teacher Id"] | ||
}, | ||
teacherEmail: { | ||
type: String, | ||
required: [true, 'Please Provide your email!'], | ||
unique: true, | ||
lowerCase: true, | ||
validate: [validator.isEmail, 'please Provide a valid email'] | ||
} | ||
}) | ||
|
||
export default mongoose.model('Teacher', teacherSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import mongoose from 'mongoose'; | ||
|
||
const termSchema = new mongoose.Schema({ | ||
term: { | ||
type: String, | ||
required: [true, "A course allocation has a term"] | ||
} | ||
}) | ||
|
||
export default mongoose.model('Term', termSchema) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import express from 'express'; | ||
import * as batchController from '../contollers/batchController.js'; | ||
const router = express.Router(); | ||
|
||
|
||
router.get('/', batchController.getAllBatchPost); | ||
router.post('/create-batch', batchController.createBatchPost); | ||
router.get('/batch-details/:id', batchController.getBatchPost); | ||
router.patch('/update-batch/:id', batchController.updateBatchPost); | ||
router.delete('/delete-batch/:id', batchController.deleteBatchPost); | ||
|
||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import express from 'express'; | ||
import * as courseAllocationController from '../contollers/courseAllocationController.js'; | ||
const router = express.Router(); | ||
|
||
|
||
router.get('/', courseAllocationController.getAllCourseAllocationPost); | ||
router.post('/create-courseAllocation', courseAllocationController.createCourseAllocationPost) | ||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import express from 'express'; | ||
import * as levelController from '../contollers/levelController.js'; | ||
const router = express.Router(); | ||
|
||
|
||
router.get('/', levelController.getAllLevelPost); | ||
router.post('/create-level', levelController.createLevelPost); | ||
router.get('/level-details/:id', levelController.getLevelPost); | ||
router.patch('/update-level/:id', levelController.updateLevelPost); | ||
router.delete('/delete-level/:id', levelController.deleteLevelPost); | ||
|
||
|
||
export default router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import express from 'express'; | ||
import * as sectionController from '../contollers/sectionController.js'; | ||
const router = express.Router(); | ||
|
||
|
||
router.get('/', sectionController.getAllSectionPost); | ||
router.post('/create-section', sectionController.createSectionPost); | ||
router.get('/section-details/:id', sectionController.getSectionPost); | ||
router.patch('/update-section/:id', sectionController.updateSectionPost); | ||
router.delete('/delete-section/:id', sectionController.deleteSectionPost); | ||
|
||
|
||
|
||
export default router; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.