├── server.ts ├── src ├── app │ ├── middlewares │ │ ├── handleZodError.ts │ │ ├── validateRequest.ts │ │ └── auth.ts │ ├── modules │ │ ├── user │ │ │ ├── user.constant.ts │ │ │ ├── user.interface.ts │ │ │ ├── user.route.ts │ │ │ └── user.controller.ts │ │ ├── users │ │ │ ├── users.interface.ts │ │ │ ├── users.route.ts │ │ │ ├── users.utils.ts │ │ │ ├── users.model.ts │ │ │ ├── users.controller.ts │ │ │ └── users.service.ts │ │ ├── academicSemester │ │ │ ├── academicSemester.interface.ts │ │ │ ├── academicSemeter.contants.ts │ │ │ ├── academicSemster.validation.ts │ │ │ ├── academicSemester.constant.ts │ │ │ ├── academicSemester.routes.ts │ │ │ ├── academicSemester.model.ts │ │ │ ├── academicSemester.route.ts │ │ │ └── acdemicSemester.validation.ts │ │ ├── building │ │ │ ├── building.interface.ts │ │ │ ├── building.constants.ts │ │ │ ├── building.validations.ts │ │ │ └── building.routes.ts │ │ ├── room │ │ │ ├── room.interface.ts │ │ │ ├── room.constants.ts │ │ │ ├── room.validations.ts │ │ │ └── room.routes.ts │ │ ├── academicFaculty │ │ │ ├── academicFaculty.interface.ts │ │ │ ├── academicFaculty.constants.ts │ │ │ ├── academicFaculty.interfaces.ts │ │ │ ├── academicFaculty.validation.ts │ │ │ ├── academicFaculty.validations.ts │ │ │ ├── academicFaculty.model.ts │ │ │ ├── academicFaculty.routes.ts │ │ │ └── academicFaculty.route.ts │ │ ├── offeredCourseSection │ │ │ ├── offeredCourseSection.interface.ts │ │ │ ├── offeredCourseSection.validation.ts │ │ │ ├── offeredCourseSection.constants.ts │ │ │ └── offeredCourseSection.routes.ts │ │ ├── course │ │ │ ├── course.constants.ts │ │ │ ├── corse.interface.ts │ │ │ ├── course.validations.ts │ │ │ └── course.routes.ts │ │ ├── managementDepartment │ │ │ ├── managementDepartment.constant.ts │ │ │ ├── managementDepartment.inerface.ts │ │ │ ├── managementDepartment.validation.ts │ │ │ ├── managementDepartment.model.ts │ │ │ └── managementDepartment.route.ts │ │ ├── semesterRegistration │ │ │ ├── semesterRegistration.interface.ts │ │ │ ├── semesterRegistration.constants.ts │ │ │ ├── semesterRegistration.routes.ts │ │ │ └── semesterRegistration.validations.ts │ │ ├── academicDepartment │ │ │ ├── academicDepartment.interface.ts │ │ │ ├── academicDepartment.constants.ts │ │ │ ├── academicDepartment.contants.ts │ │ │ ├── academicDepartment.interfaces.ts │ │ │ ├── academicDepartment.validations.ts │ │ │ ├── academicDepartment.model.ts │ │ │ └── academicDepartment.routes.ts │ │ ├── faculty │ │ │ ├── faculty.interface.ts │ │ │ ├── faculty.constant.ts │ │ │ ├── faculty.constants.ts │ │ │ ├── faculty.route.ts │ │ │ ├── faculty.routes.ts │ │ │ └── faculty.model.ts │ │ ├── offeredCourse │ │ │ ├── offeredCourse.interface.ts │ │ │ ├── offeredCourse.constants.ts │ │ │ ├── offeredCourse.validation.ts │ │ │ └── offeredCourse.routes.ts │ │ ├── admin │ │ │ ├── admin.constant.ts │ │ │ ├── admin.validation.ts │ │ │ ├── admin.route.ts │ │ │ ├── admin.interface.ts │ │ │ └── admin.model.ts │ │ ├── student │ │ │ ├── student.constant.ts │ │ │ ├── student.constants.ts │ │ │ ├── student.routes.ts │ │ │ ├── student.route.ts │ │ │ ├── student.validation.ts │ │ │ ├── student.interface.ts │ │ │ └── student.validations.ts │ │ └── auth │ │ │ ├── auth.interface.ts │ │ │ ├── auth.validation.ts │ │ │ ├── auth.route.ts │ │ │ └── auth.controller.ts │ └── routes │ │ └── index.ts ├── constants │ └── pagination.ts ├── interfaces │ ├── error.ts │ ├── pagination.ts │ ├── index.d.ts │ └── common.ts ├── shared │ ├── prisma.ts │ ├── utils.ts │ ├── catchAsync.ts │ ├── pick.ts │ ├── sendResponse.ts │ └── logger.ts ├── enums │ └── user.ts ├── errors │ ├── ApiError.ts │ ├── handleCastError.ts │ ├── handleValidationError.ts │ ├── handleZodError.ts │ └── handleClientError.ts ├── helpers │ ├── jwtHelpers.ts │ └── paginationHelper.ts ├── config │ └── index.ts ├── server.ts └── app.ts ├── .gitignore ├── logs └── winston │ ├── errors │ ├── phu-2023-04-06-07-error.log │ ├── phu-2023-04-06-17-error.log │ ├── phu-2023-04-06-20-error.log │ ├── phu-2023-04-06-23-error.log │ ├── phu-2023-05-06-21-error.log │ ├── phu-2023-05-06-22-error.log │ ├── phu-2023-05-06-23-error.log │ ├── phu-2023-06-06-00-error.log │ ├── phu-2023-06-06-02-error.log │ ├── phu-2023-08-06-03-error.log │ ├── phu-2023-08-06-04-error.log │ ├── phu-2023-08-06-05-error.log │ ├── phu-2023-08-06-06-error.log │ ├── phu-2023-08-06-07-error.log │ ├── phu-2023-08-06-08-error.log │ ├── phu-2023-08-06-09-error.log │ ├── phu-2023-08-06-10-error.log │ ├── phu-2023-08-06-11-error.log │ ├── phu-2023-08-06-14-error.log │ ├── phu-2023-08-06-15-error.log │ ├── phu-2023-08-06-17-error.log │ ├── phu-2023-08-06-18-error.log │ ├── phu-2023-08-06-19-error.log │ ├── phu-2023-08-06-20-error.log │ ├── phu-2023-08-06-22-error.log │ ├── phu-2023-08-06-23-error.log │ ├── phu-2023-09-06-00-error.log │ ├── phu-2023-09-06-01-error.log │ ├── phu-2023-09-08-20-error.log │ ├── phu-2023-09-08-21-error.log │ ├── phu-2023-09-08-22-error.log │ ├── phu-2023-10-06-02-error.log │ ├── phu-2023-10-06-05-error.log │ ├── phu-2023-10-06-06-error.log │ ├── phu-2023-10-06-08-error.log │ ├── phu-2023-10-06-11-error.log │ ├── phu-2023-10-06-14-error.log │ ├── phu-2023-10-06-15-error.log │ ├── phu-2023-12-07-01-error.log │ ├── phu-2023-12-08-18-error.log │ ├── phu-2023-12-08-19-error.log │ ├── phu-2023-12-08-20-error.log │ ├── phu-2023-12-08-21-error.log │ ├── phu-2023-12-08-22-error.log │ ├── phu-2023-12-08-23-error.log │ ├── phu-2023-13-08-21-error.log │ ├── phu-2023-14-06-14-error.log │ ├── phu-2023-14-06-19-error.log │ ├── phu-2023-14-08-19-error.log │ ├── phu-2023-14-08-20-error.log │ ├── phu-2023-14-08-21-error.log │ ├── phu-2023-14-08-22-error.log │ ├── phu-2023-15-06-15-error.log │ ├── phu-2023-16-06-11-error.log │ ├── phu-2023-16-06-12-error.log │ ├── phu-2023-16-06-21-error.log │ ├── phu-2023-16-08-21-error.log │ ├── phu-2023-16-08-22-error.log │ ├── phu-2023-16-08-23-error.log │ ├── phu-2023-17-06-02-error.log │ ├── phu-2023-17-06-09-error.log │ ├── phu-2023-17-06-20-error.log │ ├── phu-2023-18-06-00-error.log │ ├── phu-2023-18-06-02-error.log │ ├── phu-2023-18-06-03-error.log │ ├── phu-2023-18-08-18-error.log │ ├── phu-2023-18-08-19-error.log │ ├── phu-2023-19-06-03-error.log │ ├── phu-2023-19-06-04-error.log │ ├── phu-2023-19-06-05-error.log │ ├── phu-2023-19-06-06-error.log │ ├── phu-2023-19-06-07-error.log │ ├── phu-2023-19-06-08-error.log │ ├── phu-2023-19-06-09-error.log │ ├── phu-2023-19-06-10-error.log │ ├── phu-2023-19-06-11-error.log │ ├── phu-2023-19-06-19-error.log │ ├── phu-2023-19-06-22-error.log │ ├── phu-2023-19-08-19-error.log │ ├── phu-2023-19-08-20-error.log │ ├── phu-2023-19-08-21-error.log │ ├── phu-2023-20-06-09-error.log │ ├── phu-2023-20-06-10-error.log │ ├── phu-2023-20-06-11-error.log │ ├── phu-2023-22-08-13-error.log │ ├── phu-2023-22-08-14-error.log │ ├── phu-2023-22-08-17-error.log │ ├── phu-2023-22-08-18-error.log │ ├── phu-2023-22-08-19-error.log │ ├── phu-2023-22-08-21-error.log │ ├── phu-2023-22-08-22-error.log │ ├── phu-2023-22-08-23-error.log │ ├── phu-2023-23-06-11-error.log │ ├── phu-2023-24-06-11-error.log │ ├── phu-2023-24-06-12-error.log │ ├── phu-2023-24-06-13-error.log │ ├── phu-2023-24-06-15-error.log │ ├── phu-2023-24-06-16-error.log │ ├── phu-2023-25-06-09-error.log │ ├── phu-2023-25-06-10-error.log │ ├── phu-2023-25-06-11-error.log │ ├── phu-2023-25-06-13-error.log │ ├── phu-2023-25-06-14-error.log │ ├── phu-2023-25-06-15-error.log │ ├── phu-2023-25-06-16-error.log │ ├── phu-2023-25-06-17-error.log │ ├── phu-2023-25-06-18-error.log │ ├── phu-2023-25-06-19-error.log │ ├── phu-2023-25-06-20-error.log │ ├── phu-2023-28-08-22-error.log │ ├── phu-2023-04-06-04-error.log │ ├── phu-2023-17-06-12-error.log │ ├── phu-2023-19-06-21-error.log │ ├── phu-2023-04-06-05-error.log.gz │ ├── phu-2023-08-06-16-error.log │ ├── phu-2023-17-06-10-error.log │ ├── phu-2023-23-06-16-error.log │ ├── phu-2023-23-06-17-error.log │ ├── phu-2023-15-06-03-error.log │ ├── phu-2023-10-06-03-error.log │ ├── phu-2023-20-06-01-error.log │ ├── phu-2023-20-06-02-error.log │ ├── phu-2023-19-06-23-error.log │ ├── .de2db7e7464c84f46b16bb52d1bfe261f595a49e-audit.json │ └── .76750a6901d5790a50478ccc377565522e3028bf-audit.json │ ├── successes │ ├── phu-2023-01-06-14-error.log │ ├── phu-2023-01-06-15-error.log │ ├── phu-2023-01-06-16-error.log │ ├── phu-2023-01-06-17-error.log │ ├── phu-2023-24-06-11-success.log │ ├── phu-2023-24-06-12-success.log │ ├── phu-2023-24-06-13-success.log │ ├── phu-2023-24-06-15-success.log │ ├── phu-2023-24-06-16-success.log │ ├── phu-2023-25-06-09-success.log │ ├── phu-2023-25-06-10-success.log │ ├── phu-2023-25-06-11-success.log │ ├── phu-2023-25-06-13-success.log │ ├── phu-2023-25-06-14-success.log │ ├── phu-2023-25-06-15-success.log │ ├── phu-2023-25-06-16-success.log │ ├── phu-2023-25-06-17-success.log │ ├── phu-2023-25-06-18-success.log │ ├── phu-2023-25-06-19-success.log │ ├── phu-2023-25-06-20-success.log │ ├── phu-2023-04-06-03-error.log │ ├── phu-2023-04-06-04-error.log │ ├── phu-2023-12-08-18-success.log │ ├── phu-2023-18-08-18-success.log │ ├── phu-2023-28-08-22-success.log │ ├── phu-2023-17-06-12-success.log │ ├── phu-2023-01-06-11-error.log │ ├── phu-2023-12-08-23-success.log │ ├── phu-2023-16-08-23-success.log │ ├── phu-2023-08-06-09-success.log.gz │ ├── phu-2023-08-08-20-success.log.gz │ ├── phu-2023-09-08-20-success.log.gz │ ├── phu-2023-12-08-20-success.log.gz │ ├── phu-2023-12-08-21-success.log.gz │ ├── phu-2023-12-08-22-success.log.gz │ ├── phu-2023-14-08-20-success.log.gz │ ├── phu-2023-14-08-21-success.log.gz │ ├── phu-2023-16-08-21-success.log.gz │ ├── phu-2023-16-08-22-success.log.gz │ ├── phu-2023-19-08-19-success.log.gz │ ├── phu-2023-22-08-17-success.log.gz │ ├── phu-2023-22-08-18-success.log.gz │ ├── phu-2023-22-08-21-success.log.gz │ ├── phu-2023-22-08-22-success.log.gz │ ├── phu-2023-12-07-01-success.log │ ├── phu-2023-01-06-09-success.log │ ├── phu-2023-06-06-02-success.log │ ├── phu-2023-18-06-00-success.log │ ├── phu-2023-10-06-05-success.log │ ├── phu-2023-10-06-06-success.log │ ├── phu-2023-10-06-11-success.log │ ├── phu-2023-14-06-19-success.log │ ├── phu-2023-16-06-11-success.log │ ├── phu-2023-16-06-12-success.log │ ├── phu-2023-16-06-21-success.log │ ├── phu-2023-17-06-09-success.log │ ├── phu-2023-17-06-20-success.log │ ├── phu-2023-19-06-10-success.log │ ├── phu-2023-19-06-19-success.log │ ├── phu-2023-23-06-11-success.log │ ├── phu-2023-23-06-16-success.log │ ├── phu-2023-22-08-13-success.log │ ├── phu-2023-22-08-14-success.log │ ├── phu-2023-01-06-09-error.log │ ├── phu-2023-06-06-00-success.log │ ├── phu-2023-10-06-02-success.log │ ├── phu-2023-10-06-08-success.log │ ├── phu-2023-19-06-09-success.log │ ├── phu-2023-08-06-15-success.log │ ├── phu-2023-14-06-14-success.log │ ├── phu-2023-15-06-03-success.log │ ├── phu-2023-14-08-22-success.log │ ├── phu-2023-13-08-21-success.log │ ├── phu-2023-04-06-05-success.log │ ├── phu-2023-08-06-03-success.log │ ├── phu-2023-08-06-05-success.log │ ├── phu-2023-10-06-15-success.log │ ├── phu-2023-19-06-07-success.log │ ├── phu-2023-20-06-09-success.log │ ├── phu-2023-20-06-10-success.log │ ├── phu-2023-20-06-11-success.log │ ├── phu-2023-23-06-17-success.log │ ├── phu-2023-19-08-21-success.log │ ├── phu-2023-08-06-04-success.log │ ├── phu-2023-10-06-14-success.log │ ├── phu-2023-08-06-14-success.log │ ├── phu-2023-15-06-15-success.log │ ├── phu-2023-19-08-20-success.log │ ├── .44f209706f2e09cf8114c2157a0abcd7abc5f60d-audit.json │ ├── phu-2023-22-08-19-success.log │ ├── phu-2023-08-06-23-success.log │ ├── .6d79f2d384d48528ea2ca7d333076265546635cf-audit.json │ ├── phu-2023-12-08-19-success.log │ ├── phu-2023-01-06-17-success.log │ ├── phu-2023-08-06-10-success.log │ ├── phu-2023-19-06-03-success.log │ ├── phu-2023-05-06-21-success.log │ ├── phu-2023-04-06-17-success.log │ ├── phu-2023-19-06-11-success.log │ ├── phu-2023-22-08-23-success.log │ ├── phu-2023-14-08-19-success.log │ ├── phu-2023-04-06-20-success.log │ ├── phu-2023-08-06-20-success.log │ ├── phu-2023-17-06-10-success.log │ ├── phu-2023-08-06-07-success.log │ ├── phu-2023-19-06-08-success.log │ ├── phu-2023-08-06-06-success.log │ ├── phu-2023-01-06-11-success.log │ ├── phu-2023-08-06-16-success.log │ ├── phu-2023-08-06-22-success.log │ ├── phu-2023-08-06-11-success.log │ ├── phu-2023-18-06-02-success.log │ ├── phu-2023-05-06-23-success.log │ ├── phu-2023-17-06-02-success.log │ ├── phu-2023-04-06-07-success.log │ ├── phu-2023-19-06-05-success.log │ ├── phu-2023-08-06-19-success.log │ ├── phu-2023-18-08-19-success.log │ └── phu-2023-09-06-01-success.log │ └── success │ ├── phu-2023-04-06-04-error.log │ └── .ea22347223db3e574f71c0381f34d42d20a5a070-audit.json ├── .eslintignore ├── .husky └── pre-commit ├── .prettierrc ├── .env.example ├── prisma └── migrations │ ├── 20230819150230_status │ └── migration.sql │ ├── migration_lock.toml │ ├── 20230808131306_init │ └── migration.sql │ ├── 20230808143213_init │ └── migration.sql │ ├── 20230822153207_remove │ └── migration.sql │ ├── 20230818130946_course_faculty │ └── migration.sql │ ├── 20230812154158_buildingandroom │ └── migration.sql │ ├── 20230819144058_semester_reg │ └── migration.sql │ ├── 20230822165213_offered_course_section │ └── migration.sql │ ├── 20230813162821_course │ └── migration.sql │ ├── 20230822152644_offered_couse │ └── migration.sql │ └── 20230822154129_add_offered_course │ └── migration.sql ├── .vscode └── settings.json ├── .eslintrc ├── Readme.md ├── LICENCE └── package.json /server.ts: -------------------------------------------------------------------------------- 1 | // server ts 2 | -------------------------------------------------------------------------------- /src/app/middlewares/handleZodError.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/modules/user/user.constant.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | # gitignore -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-04-06-07-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-04-06-17-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-04-06-20-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-04-06-23-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-05-06-21-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-05-06-22-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-05-06-23-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-06-06-00-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-06-06-02-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-03-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-04-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-05-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-06-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-07-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-08-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-09-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-10-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-11-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-14-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-15-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-17-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-18-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-19-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-20-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-22-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-23-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-09-06-00-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-09-06-01-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-09-08-20-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-09-08-21-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-09-08-22-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-10-06-02-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-10-06-05-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-10-06-06-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-10-06-08-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-10-06-11-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-10-06-14-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-10-06-15-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-12-07-01-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-12-08-18-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-12-08-19-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-12-08-20-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-12-08-21-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-12-08-22-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-12-08-23-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-13-08-21-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-14-06-14-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-14-06-19-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-14-08-19-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-14-08-20-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-14-08-21-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-14-08-22-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-15-06-15-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-16-06-11-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-16-06-12-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-16-06-21-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-16-08-21-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-16-08-22-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-16-08-23-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-17-06-02-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-17-06-09-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-17-06-20-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-18-06-00-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-18-06-02-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-18-06-03-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-18-08-18-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-18-08-19-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-03-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-04-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-05-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-06-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-07-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-08-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-09-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-10-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-11-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-19-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-22-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-08-19-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-08-20-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-08-21-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-20-06-09-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-20-06-10-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-20-06-11-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-22-08-13-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-22-08-14-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-22-08-17-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-22-08-18-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-22-08-19-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-22-08-21-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-22-08-22-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-22-08-23-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-23-06-11-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-24-06-11-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-24-06-12-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-24-06-13-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-24-06-15-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-24-06-16-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-09-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-10-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-11-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-13-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-14-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-15-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-16-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-17-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-18-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-19-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-25-06-20-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-28-08-22-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-01-06-14-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-01-06-15-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-01-06-16-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-01-06-17-error.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-24-06-11-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-24-06-12-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-24-06-13-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-24-06-15-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-24-06-16-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-09-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-10-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-11-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-13-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-14-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-15-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-16-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-17-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-18-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-19-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-25-06-20-success.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | .env 4 | # eslintignore -------------------------------------------------------------------------------- /src/constants/pagination.ts: -------------------------------------------------------------------------------- 1 | export const paginationFields = ['page', 'limit', 'sortBy', 'sortOrder']; 2 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | # .husky 4 | yarn lint-staged 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "arrowParens": "avoid" 5 | } 6 | 7 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-04-06-04-error.log: -------------------------------------------------------------------------------- 1 | Sun Jun 04 2023 4:54:32 } [PH] error: Testing Error logger 2 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-04-06-03-error.log: -------------------------------------------------------------------------------- 1 | Sun Jun 04 2023 3:41:47 } [PH] error: noExist is not defined 2 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-04-06-04-error.log: -------------------------------------------------------------------------------- 1 | Sun Jun 04 2023 4:24:20 } [PH] error: noExist is not defined 2 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-12-08-18-success.log: -------------------------------------------------------------------------------- 1 | Sat Aug 12 2023 18:46:32 } [PH] info: Server running on port 5001 2 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-18-08-18-success.log: -------------------------------------------------------------------------------- 1 | Fri Aug 18 2023 18:59:28 } [PH] info: Server running on port 5001 2 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-28-08-22-success.log: -------------------------------------------------------------------------------- 1 | Mon Aug 28 2023 22:1:52 } [PH] info: Server running on port undefined 2 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-17-06-12-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 17 2023 12:6:28 } [PH] info: 🛢 Database is connected successfully 2 | -------------------------------------------------------------------------------- /src/app/modules/users/users.interface.ts: -------------------------------------------------------------------------------- 1 | export type IUser = { 2 | id: string 3 | role: string 4 | password: string 5 | } 6 | -------------------------------------------------------------------------------- /logs/winston/success/phu-2023-04-06-04-error.log: -------------------------------------------------------------------------------- 1 | Sun Jun 04 2023 4:45:22 } [PH] error: 🐱‍🏍 globalErrorHandler ~~ x is not defined 2 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-17-06-12-error.log: -------------------------------------------------------------------------------- 1 | Sat Jun 17 2023 12:6:29 } [PH] error: listen EADDRINUSE: address already in use :::5000 2 | -------------------------------------------------------------------------------- /src/app/modules/academicSemester/academicSemester.interface.ts: -------------------------------------------------------------------------------- 1 | export type IAcademicSemeterFilterRequest = { 2 | searchTerm?: string 3 | } -------------------------------------------------------------------------------- /src/app/modules/building/building.interface.ts: -------------------------------------------------------------------------------- 1 | export type IBuildingFilterRequest = { 2 | searchTerm?: string 3 | } 4 | // building interface -------------------------------------------------------------------------------- /src/interfaces/error.ts: -------------------------------------------------------------------------------- 1 | export type IGenericErrorMessage = { 2 | path: string | number; 3 | message: string; 4 | }; 5 | 6 | // Error ts 7 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | NODE_ENV=development 2 | PORT=5000 3 | DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=SCHEMA" 4 | # database Postgress sql -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-21-error.log: -------------------------------------------------------------------------------- 1 | Mon Jun 19 2023 21:2:9 } [PH] error: Failed to connect database Server selection timed out after 30000 ms 2 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-01-06-11-error.log: -------------------------------------------------------------------------------- 1 | Thu Jun 01 2023 11:31:29 } [PH] error: Failed to connect database bad auth : Authentication failed. 2 | -------------------------------------------------------------------------------- /prisma/migrations/20230819150230_status/migration.sql: -------------------------------------------------------------------------------- 1 | -- AlterTable 2 | ALTER TABLE "semester_registrations" ALTER COLUMN "status" SET DEFAULT 'UPCOMING'; 3 | -------------------------------------------------------------------------------- /src/app/modules/room/room.interface.ts: -------------------------------------------------------------------------------- 1 | export type IRoomFilterRequest = { 2 | searchTerm?: string | undefined; 3 | buildingId?: string | undefined; 4 | } -------------------------------------------------------------------------------- /src/app/modules/academicFaculty/academicFaculty.interface.ts: -------------------------------------------------------------------------------- 1 | export type IAcademicFacultyFilterRequest = { 2 | searchTerm?: string; 3 | } 4 | // Faculty Inteface -------------------------------------------------------------------------------- /prisma/migrations/migration_lock.toml: -------------------------------------------------------------------------------- 1 | # Please do not edit this file manually 2 | # It should be added in your version-control system (i.e. Git) 3 | provider = "postgresql" -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-04-06-05-error.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/errors/phu-2023-04-06-05-error.log.gz -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-08-06-16-error.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 16:16:10 } [PH] error: Failed to connect database querySrv ETIMEOUT _mongodb._tcp.cluster0.awbitmm.mongodb.net 2 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-17-06-10-error.log: -------------------------------------------------------------------------------- 1 | Sat Jun 17 2023 10:6:34 } [PH] error: Attempted illegal state transition from [TRANSACTION_ABORTED] to [TRANSACTION_COMMITTED] 2 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-23-06-16-error.log: -------------------------------------------------------------------------------- 1 | Fri Jun 23 2023 16:29:32 } [PH] error: Attempted illegal state transition from [TRANSACTION_ABORTED] to [TRANSACTION_COMMITTED] 2 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-23-06-17-error.log: -------------------------------------------------------------------------------- 1 | Fri Jun 23 2023 17:39:53 } [PH] error: Attempted illegal state transition from [TRANSACTION_ABORTED] to [TRANSACTION_COMMITTED] 2 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-12-08-23-success.log: -------------------------------------------------------------------------------- 1 | Sat Aug 12 2023 23:0:16 } [PH] info: SIGTERM received 2 | Sat Aug 12 2023 23:0:19 } [PH] info: Server running on port 5001 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-16-08-23-success.log: -------------------------------------------------------------------------------- 1 | Wed Aug 16 2023 23:9:21 } [PH] info: SIGTERM received 2 | Wed Aug 16 2023 23:9:21 } [PH] info: Server running on port 5001 3 | -------------------------------------------------------------------------------- /src/app/modules/building/building.constants.ts: -------------------------------------------------------------------------------- 1 | export const buildingFilterableFields = ['searchTerm'] 2 | // building constant 3 | export const buildingSearchableFields = ['title']; -------------------------------------------------------------------------------- /src/shared/prisma.ts: -------------------------------------------------------------------------------- 1 | import { PrismaClient } from "@prisma/client"; 2 | 3 | const prisma = new PrismaClient({ 4 | errorFormat: 'minimal' 5 | }) 6 | 7 | export default prisma; -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-09-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-08-06-09-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-08-20-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-08-08-20-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-09-08-20-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-09-08-20-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-12-08-20-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-12-08-20-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-12-08-21-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-12-08-21-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-12-08-22-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-12-08-22-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-14-08-20-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-14-08-20-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-14-08-21-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-14-08-21-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-16-08-21-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-16-08-21-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-16-08-22-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-16-08-22-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-08-19-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-19-08-19-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-22-08-17-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-22-08-17-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-22-08-18-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-22-08-18-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-22-08-21-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-22-08-21-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-22-08-22-success.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hazrat-Ali9/University-Management-Backend/HEAD/logs/winston/successes/phu-2023-22-08-22-success.log.gz -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-12-07-01-success.log: -------------------------------------------------------------------------------- 1 | Wed Jul 12 2023 1:3:18 } [PH] info: Server running on port undefined 2 | Wed Jul 12 2023 1:4:46 } [PH] info: Server running on port 5000 3 | -------------------------------------------------------------------------------- /src/interfaces/pagination.ts: -------------------------------------------------------------------------------- 1 | export type IPaginationOptions = { 2 | page?: number; 3 | limit?: number; 4 | sortBy?: string; 5 | sortOrder?: 'asc' | 'desc'; 6 | }; 7 | 8 | // Pagination 9 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-01-06-09-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 01 2023 9:44:5 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 01 2023 9:44:5 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-06-06-02-success.log: -------------------------------------------------------------------------------- 1 | Tue Jun 06 2023 2:3:7 } [PH] info: 🛢 Database is connected successfully 2 | Tue Jun 06 2023 2:3:7 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-18-06-00-success.log: -------------------------------------------------------------------------------- 1 | Sun Jun 18 2023 0:57:2 } [PH] info: 🛢 Database is connected successfully 2 | Sun Jun 18 2023 0:57:2 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /src/enums/user.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-unused-vars */ 2 | export enum ENUM_USER_ROLE { 3 | SUPER_ADMIN = 'super_admin', 4 | ADMIN = 'admin', 5 | STUDENT = 'student', 6 | FACULTY = 'faculty', 7 | } 8 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.codeActionsOnSave": { 3 | "source.fixAll.eslint": "explicit", 4 | "source.fixAll.tslint": "explicit", 5 | "source.organizeImports": "explicit" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-10-06-05-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 10 2023 5:41:33 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 10 2023 5:41:33 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-10-06-06-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 10 2023 6:25:34 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 10 2023 6:25:34 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-10-06-11-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 10 2023 11:47:41 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 10 2023 11:47:41 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-14-06-19-success.log: -------------------------------------------------------------------------------- 1 | Wed Jun 14 2023 19:3:43 } [PH] info: 🛢 Database is connected successfully 2 | Wed Jun 14 2023 19:3:43 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-16-06-11-success.log: -------------------------------------------------------------------------------- 1 | Fri Jun 16 2023 11:7:16 } [PH] info: 🛢 Database is connected successfully 2 | Fri Jun 16 2023 11:7:16 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-16-06-12-success.log: -------------------------------------------------------------------------------- 1 | Fri Jun 16 2023 12:1:29 } [PH] info: 🛢 Database is connected successfully 2 | Fri Jun 16 2023 12:1:29 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-16-06-21-success.log: -------------------------------------------------------------------------------- 1 | Fri Jun 16 2023 21:34:57 } [PH] info: 🛢 Database is connected successfully 2 | Fri Jun 16 2023 21:34:57 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-17-06-09-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 17 2023 9:58:24 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 17 2023 9:58:24 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-17-06-20-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 17 2023 20:11:44 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 17 2023 20:11:44 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-06-10-success.log: -------------------------------------------------------------------------------- 1 | Mon Jun 19 2023 10:19:28 } [PH] info: 🛢 Database is connected successfully 2 | Mon Jun 19 2023 10:19:28 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-06-19-success.log: -------------------------------------------------------------------------------- 1 | Mon Jun 19 2023 19:6:45 } [PH] info: 🛢 Database is connected successfully 2 | Mon Jun 19 2023 19:6:45 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-23-06-11-success.log: -------------------------------------------------------------------------------- 1 | Fri Jun 23 2023 11:54:8 } [PH] info: 🛢 Database is connected successfully 2 | Fri Jun 23 2023 11:54:8 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-23-06-16-success.log: -------------------------------------------------------------------------------- 1 | Fri Jun 23 2023 16:26:39 } [PH] info: 🛢 Database is connected successfully 2 | Fri Jun 23 2023 16:26:39 } [PH] info: Application listening on port 5000 3 | -------------------------------------------------------------------------------- /src/app/modules/offeredCourseSection/offeredCourseSection.interface.ts: -------------------------------------------------------------------------------- 1 | export type IOfferedCourseSectionFilterRequest = { 2 | searchTerm?: string | undefined; 3 | offeredCourseId?: string | undefined; 4 | } -------------------------------------------------------------------------------- /prisma/migrations/20230808131306_init/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "User" ( 3 | "id" TEXT NOT NULL, 4 | "name" TEXT NOT NULL, 5 | 6 | CONSTRAINT "User_pkey" PRIMARY KEY ("id") 7 | ); 8 | -------------------------------------------------------------------------------- /src/app/modules/course/course.constants.ts: -------------------------------------------------------------------------------- 1 | export const courseFilterableFields: string[] = ['searchTerm', 'id', 'code']; 2 | // course constants 3 | export const courseSearchableFields: string[] = ['title', 'code']; -------------------------------------------------------------------------------- /src/app/modules/managementDepartment/managementDepartment.constant.ts: -------------------------------------------------------------------------------- 1 | export const managementDepartmentFilterableFields = ['searchTerm', 'title']; 2 | 3 | export const managementDepartmentSearchableFields = ['title']; 4 | -------------------------------------------------------------------------------- /src/app/modules/semesterRegistration/semesterRegistration.interface.ts: -------------------------------------------------------------------------------- 1 | export type ISemesterRegistrationFilterRequest = { 2 | searchTerm?: string | undefined; 3 | academicSemesterId?: string | undefined; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/modules/academicDepartment/academicDepartment.interface.ts: -------------------------------------------------------------------------------- 1 | export type IAcademicDepartmentFilterRequest = { 2 | searchTerm?: string | undefined; 3 | academicFacultyId?: string | undefined; 4 | } 5 | // interface -------------------------------------------------------------------------------- /src/app/modules/academicFaculty/academicFaculty.constants.ts: -------------------------------------------------------------------------------- 1 | export const academicFacultyFilterableFields: string[] = ['searchTerm', 'id']; 2 | // Faculty 3 | export const academicFacultySearchableFields: string[] = ['title']; -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-15-06-03-error.log: -------------------------------------------------------------------------------- 1 | Thu Jun 15 2023 3:13:22 } [PH] error: listen EADDRINUSE: address already in use :::5000 2 | Thu Jun 15 2023 3:28:21 } [PH] error: listen EADDRINUSE: address already in use :::5000 3 | -------------------------------------------------------------------------------- /src/app/modules/academicDepartment/academicDepartment.constants.ts: -------------------------------------------------------------------------------- 1 | export const academicDepartmentFilterableFields = ['searchTerm', 'title']; 2 | // Academic Department 3 | export const academicDepartmentSearchableFields = ['title']; 4 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-10-06-03-error.log: -------------------------------------------------------------------------------- 1 | Sat Jun 10 2023 3:12:57 } [PH] error: Cannot read properties of undefined (reading 'substring') 2 | Sat Jun 10 2023 3:14:58 } [PH] error: Cannot read properties of undefined (reading 'substring') 3 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-22-08-13-success.log: -------------------------------------------------------------------------------- 1 | Tue Aug 22 2023 13:31:39 } [PH] info: Server running on port 5001 2 | Tue Aug 22 2023 13:46:24 } [PH] info: SIGTERM received 3 | Tue Aug 22 2023 13:46:25 } [PH] info: Server running on port 5001 4 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-22-08-14-success.log: -------------------------------------------------------------------------------- 1 | Tue Aug 22 2023 14:26:29 } [PH] info: Server running on port 5001 2 | Tue Aug 22 2023 14:29:52 } [PH] info: SIGTERM received 3 | Tue Aug 22 2023 14:29:52 } [PH] info: Server running on port 5001 4 | -------------------------------------------------------------------------------- /src/app/modules/users/users.route.ts: -------------------------------------------------------------------------------- 1 | import express from 'express' 2 | import usersController from './users.controller' 3 | const router = express.Router() 4 | 5 | router.post('/create-user', usersController.createUser) 6 | 7 | export default router 8 | -------------------------------------------------------------------------------- /src/app/modules/academicSemester/academicSemeter.contants.ts: -------------------------------------------------------------------------------- 1 | export const AcademicSemesterSearchAbleFields = ['title', 'code', 'startMonth', 'endMonth']; 2 | 3 | export const AcademicSemesterFilterAbleFileds = ['searchTerm', 'code', 'startMonth', 'endMonth']; -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-01-06-09-error.log: -------------------------------------------------------------------------------- 1 | Thu Jun 01 2023 9:45:13 } [right meow!] error: Failed to connect database bad auth : Authentication failed. 2 | Thu Jun 01 2023 9:46:12 } [PH] error: Failed to connect database bad auth : Authentication failed. 3 | -------------------------------------------------------------------------------- /src/interfaces/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/consistent-type-definitions */ 2 | import { JwtPayload } from 'jsonwebtoken'; 3 | 4 | declare global { 5 | namespace Express { 6 | interface Request { 7 | user: JwtPayload | null; 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-20-06-01-error.log: -------------------------------------------------------------------------------- 1 | Tue Jun 20 2023 1:52:16 } [PH] error: Attempted illegal state transition from [TRANSACTION_ABORTED] to [TRANSACTION_COMMITTED] 2 | Tue Jun 20 2023 1:54:24 } [PH] error: Attempted illegal state transition from [TRANSACTION_COMMITTED] to [TRANSACTION_ABORTED] 3 | -------------------------------------------------------------------------------- /src/shared/utils.ts: -------------------------------------------------------------------------------- 1 | export const asyncForEach = async (array: any[], callback: any) => { 2 | if (!Array.isArray(array)) { 3 | throw new Error("Expected an array"); 4 | } 5 | for (let index = 0; index < array.length; index++) { 6 | await callback(array[index], index, array) 7 | } 8 | } -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-06-06-00-success.log: -------------------------------------------------------------------------------- 1 | Tue Jun 06 2023 0:31:58 } [PH] info: 🛢 Database is connected successfully 2 | Tue Jun 06 2023 0:31:58 } [PH] info: Application listening on port 5000 3 | Tue Jun 06 2023 0:32:54 } [PH] info: 🛢 Database is connected successfully 4 | Tue Jun 06 2023 0:32:54 } [PH] info: Application listening on port 5000 5 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-10-06-02-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 10 2023 2:31:22 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 10 2023 2:31:22 } [PH] info: Application listening on port 5000 3 | Sat Jun 10 2023 2:44:52 } [PH] info: 🛢 Database is connected successfully 4 | Sat Jun 10 2023 2:44:52 } [PH] info: Application listening on port 5000 5 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-10-06-08-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 10 2023 8:49:11 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 10 2023 8:49:11 } [PH] info: Application listening on port 5000 3 | Sat Jun 10 2023 8:49:43 } [PH] info: 🛢 Database is connected successfully 4 | Sat Jun 10 2023 8:49:43 } [PH] info: Application listening on port 5000 5 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-06-09-success.log: -------------------------------------------------------------------------------- 1 | Mon Jun 19 2023 9:47:53 } [PH] info: 🛢 Database is connected successfully 2 | Mon Jun 19 2023 9:47:53 } [PH] info: Application listening on port 5000 3 | Mon Jun 19 2023 9:48:35 } [PH] info: 🛢 Database is connected successfully 4 | Mon Jun 19 2023 9:48:35 } [PH] info: Application listening on port 5000 5 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-15-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 15:17:36 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 15:17:36 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 15:21:52 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 15:21:52 } [PH] info: Application listening on port 5000 5 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-14-06-14-success.log: -------------------------------------------------------------------------------- 1 | Wed Jun 14 2023 14:16:18 } [PH] info: 🛢 Database is connected successfully 2 | Wed Jun 14 2023 14:16:18 } [PH] info: Application listening on port 5000 3 | Wed Jun 14 2023 14:23:9 } [PH] info: 🛢 Database is connected successfully 4 | Wed Jun 14 2023 14:23:9 } [PH] info: Application listening on port 5000 5 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-15-06-03-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 15 2023 3:13:22 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 15 2023 3:28:21 } [PH] info: 🛢 Database is connected successfully 3 | Thu Jun 15 2023 3:28:21 } [PH] info: Application listening on port 5000 4 | Thu Jun 15 2023 3:28:21 } [PH] info: 🛢 Database is connected successfully 5 | -------------------------------------------------------------------------------- /src/app/modules/academicFaculty/academicFaculty.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { Model } from 'mongoose'; 2 | 3 | export type IAcademicFaculty = { 4 | title: string; 5 | }; 6 | 7 | export type AcademicFacultyModel = Model< 8 | IAcademicFaculty, 9 | Record 10 | >; 11 | 12 | export type IAcademicFacultyFilters = { 13 | searchTerm?: string; 14 | }; 15 | -------------------------------------------------------------------------------- /src/app/modules/room/room.constants.ts: -------------------------------------------------------------------------------- 1 | export const roomFilterableFields: string[] = ['searchTerm', 'id', 'buildingId']; 2 | 3 | export const roomSearchableFields: string[] = ['roomNumber', 'floor']; 4 | 5 | export const roomRelationalFields: string[] = ['buildingId']; 6 | export const roomRelationalFieldsMapper: { [key: string]: string } = { 7 | buildingId: 'building' 8 | }; -------------------------------------------------------------------------------- /src/app/modules/managementDepartment/managementDepartment.inerface.ts: -------------------------------------------------------------------------------- 1 | import { Model } from 'mongoose'; 2 | 3 | export type IManagementDepartment = { 4 | title: string; 5 | }; 6 | 7 | export type ManagementDepartmentModel = Model< 8 | IManagementDepartment, 9 | Record 10 | >; 11 | 12 | export type IManagementDepartmentFilters = { 13 | searchTerm?: string; 14 | }; 15 | -------------------------------------------------------------------------------- /src/interfaces/common.ts: -------------------------------------------------------------------------------- 1 | import { IGenericErrorMessage } from './error'; 2 | // common ts 3 | export type IGenericResponse = { 4 | meta: { 5 | page: number; 6 | limit: number; 7 | total: number; 8 | }; 9 | data: T; 10 | }; 11 | 12 | export type IGenericErrorResponse = { 13 | statusCode: number; 14 | message: string; 15 | errorMessages: IGenericErrorMessage[]; 16 | }; 17 | -------------------------------------------------------------------------------- /src/shared/catchAsync.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, RequestHandler, Response } from 'express'; 2 | 3 | const catchAsync = 4 | (fn: RequestHandler) => 5 | async (req: Request, res: Response, next: NextFunction): Promise => { 6 | try { 7 | await fn(req, res, next); 8 | } catch (error) { 9 | next(error); 10 | } 11 | }; 12 | 13 | export default catchAsync; 14 | -------------------------------------------------------------------------------- /src/errors/ApiError.ts: -------------------------------------------------------------------------------- 1 | class ApiError extends Error { 2 | statusCode: number; 3 | 4 | constructor(statusCode: number, message: string | undefined, stack = '') { 5 | super(message); 6 | this.statusCode = statusCode; 7 | if (stack) { 8 | this.stack = stack; 9 | } else { 10 | Error.captureStackTrace(this, this.constructor); 11 | } 12 | } 13 | } 14 | 15 | export default ApiError; 16 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-20-06-02-error.log: -------------------------------------------------------------------------------- 1 | Tue Jun 20 2023 2:29:45 } [PH] error: Attempted illegal state transition from [TRANSACTION_ABORTED] to [TRANSACTION_COMMITTED] 2 | Tue Jun 20 2023 2:31:0 } [PH] error: Attempted illegal state transition from [TRANSACTION_COMMITTED] to [TRANSACTION_ABORTED] 3 | Tue Jun 20 2023 2:33:9 } [PH] error: Attempted illegal state transition from [TRANSACTION_ABORTED] to [TRANSACTION_COMMITTED] 4 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-14-08-22-success.log: -------------------------------------------------------------------------------- 1 | Mon Aug 14 2023 22:7:11 } [PH] info: SIGTERM received 2 | Mon Aug 14 2023 22:7:12 } [PH] info: Server running on port 5001 3 | Mon Aug 14 2023 22:10:30 } [PH] info: SIGTERM received 4 | Mon Aug 14 2023 22:10:30 } [PH] info: Server running on port 5001 5 | Mon Aug 14 2023 22:12:37 } [PH] info: SIGTERM received 6 | Mon Aug 14 2023 22:12:37 } [PH] info: Server running on port 5001 7 | -------------------------------------------------------------------------------- /src/app/modules/faculty/faculty.interface.ts: -------------------------------------------------------------------------------- 1 | 2 | export type IFacultyFilterRequest = { 3 | searchTerm?: string | undefined; 4 | academicFacultyId?: string | undefined; 5 | academicDepartmentId?: string | undefined; 6 | studentId?: string | undefined; 7 | email?: string | undefined; 8 | contactNo?: string | undefined; 9 | gender?: string | undefined; 10 | bloodGroup?: string | undefined; 11 | } 12 | -------------------------------------------------------------------------------- /src/app/modules/course/corse.interface.ts: -------------------------------------------------------------------------------- 1 | export type ICourseCreateData = { 2 | title: string, 3 | code: string, 4 | credits: number, 5 | preRequisiteCourses: IPrerequisiteCourseRequest[] 6 | } 7 | // course interface 8 | export type IPrerequisiteCourseRequest = { 9 | courseId: string, 10 | isDeleted?: null 11 | } 12 | 13 | export type ICourseFilterRequest = { 14 | searchTerm?: string | undefined; 15 | } -------------------------------------------------------------------------------- /src/app/modules/offeredCourse/offeredCourse.interface.ts: -------------------------------------------------------------------------------- 1 | export type ICreateOfferedCourse = { 2 | academicDepartmentId: string, 3 | semesterRegistrationId: string, 4 | courseIds: string[] 5 | } 6 | 7 | export type IOfferedCourseFilterRequest = { 8 | searchTerm?: string | undefined; 9 | semesterRegistrationId?: string | undefined; 10 | courseId?: string | undefined; 11 | academicDepartmentId?: string | undefined; 12 | } -------------------------------------------------------------------------------- /src/shared/pick.ts: -------------------------------------------------------------------------------- 1 | //['page','limit','sortBy','sortOrder'] 2 | 3 | const pick = , k extends keyof T>( 4 | obj: T, 5 | keys: k[] 6 | ): Partial => { 7 | const finalObj: Partial = {}; 8 | 9 | for (const key of keys) { 10 | if (obj && Object.hasOwnProperty.call(obj, key)) { 11 | finalObj[key] = obj[key]; 12 | } 13 | } 14 | return finalObj; 15 | }; 16 | 17 | export default pick; 18 | -------------------------------------------------------------------------------- /src/app/modules/admin/admin.constant.ts: -------------------------------------------------------------------------------- 1 | export const adminFilterableFields = [ 2 | 'searchTerm', 3 | 'id', 4 | 'gender', 5 | 'bloodGroup', 6 | 'email', 7 | 'contactNo', 8 | 'emergencyContactNo', 9 | 'managementDepartment', 10 | 'designation', 11 | ]; 12 | 13 | export const adminSearchableFields = [ 14 | 'email', 15 | 'contactNo', 16 | 'emergencyContactNo', 17 | 'name.firstName', 18 | 'name.lastName', 19 | 'name.middleName', 20 | ]; 21 | // admin constant -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-13-08-21-success.log: -------------------------------------------------------------------------------- 1 | Sun Aug 13 2023 21:12:15 } [PH] info: Server running on port 5001 2 | Sun Aug 13 2023 21:15:59 } [PH] info: SIGTERM received 3 | Sun Aug 13 2023 21:15:59 } [PH] info: Server running on port 5001 4 | Sun Aug 13 2023 21:17:32 } [PH] info: SIGTERM received 5 | Sun Aug 13 2023 21:17:32 } [PH] info: Server running on port 5001 6 | Sun Aug 13 2023 21:31:29 } [PH] info: SIGTERM received 7 | Sun Aug 13 2023 21:31:29 } [PH] info: Server running on port 5001 8 | -------------------------------------------------------------------------------- /src/app/modules/faculty/faculty.constant.ts: -------------------------------------------------------------------------------- 1 | export const facultyFilterableFields = [ 2 | 'searchTerm', 3 | 'id', 4 | 'gender', 5 | 'bloodGroup', 6 | 'email', 7 | 'contactNo', 8 | 'emergencyContactNo', 9 | 'academicFaculty', 10 | 'academicDepartment', 11 | 'designation', 12 | ]; 13 | 14 | export const facultySearchableFields = [ 15 | 'email', 16 | 'contactNo', 17 | 'emergencyContactNo', 18 | 'name.firstName', 19 | 'name.lastName', 20 | 'name.middleName', 21 | ]; 22 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-04-06-05-success.log: -------------------------------------------------------------------------------- 1 | Sun Jun 04 2023 5:29:33 } [PH] info: 🛢 Database is connected successfully 2 | Sun Jun 04 2023 5:29:33 } [PH] info: Application listening on port 5000 3 | Sun Jun 04 2023 5:31:29 } [PH] info: 🛢 Database is connected successfully 4 | Sun Jun 04 2023 5:31:29 } [PH] info: Application listening on port 5000 5 | Sun Jun 04 2023 5:37:22 } [PH] info: 🛢 Database is connected successfully 6 | Sun Jun 04 2023 5:37:22 } [PH] info: Application listening on port 5000 7 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-03-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 3:47:6 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 3:47:6 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 3:48:21 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 3:48:21 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 3:48:33 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 3:48:33 } [PH] info: Application listening on port 5000 7 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-05-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 5:34:6 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 5:34:6 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 5:35:50 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 5:35:50 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 5:39:35 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 5:39:35 } [PH] info: Application listening on port 5000 7 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-10-06-15-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 10 2023 15:1:33 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 10 2023 15:1:33 } [PH] info: Application listening on port 5000 3 | Sat Jun 10 2023 15:2:14 } [PH] info: 🛢 Database is connected successfully 4 | Sat Jun 10 2023 15:2:14 } [PH] info: Application listening on port 5000 5 | Sat Jun 10 2023 15:3:56 } [PH] info: 🛢 Database is connected successfully 6 | Sat Jun 10 2023 15:3:57 } [PH] info: Application listening on port 5000 7 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-06-07-success.log: -------------------------------------------------------------------------------- 1 | Mon Jun 19 2023 7:44:17 } [PH] info: 🛢 Database is connected successfully 2 | Mon Jun 19 2023 7:44:17 } [PH] info: Application listening on port 5000 3 | Mon Jun 19 2023 7:45:22 } [PH] info: 🛢 Database is connected successfully 4 | Mon Jun 19 2023 7:45:22 } [PH] info: Application listening on port 5000 5 | Mon Jun 19 2023 7:49:54 } [PH] info: 🛢 Database is connected successfully 6 | Mon Jun 19 2023 7:49:54 } [PH] info: Application listening on port 5000 7 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-20-06-09-success.log: -------------------------------------------------------------------------------- 1 | Tue Jun 20 2023 9:15:7 } [PH] info: 🛢 Database is connected successfully 2 | Tue Jun 20 2023 9:15:7 } [PH] info: Application listening on port 5000 3 | Tue Jun 20 2023 9:19:56 } [PH] info: 🛢 Database is connected successfully 4 | Tue Jun 20 2023 9:19:56 } [PH] info: Application listening on port 5000 5 | Tue Jun 20 2023 9:32:48 } [PH] info: 🛢 Database is connected successfully 6 | Tue Jun 20 2023 9:32:48 } [PH] info: Application listening on port 5000 7 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-20-06-10-success.log: -------------------------------------------------------------------------------- 1 | Tue Jun 20 2023 10:56:14 } [PH] info: 🛢 Database is connected successfully 2 | Tue Jun 20 2023 10:56:14 } [PH] info: Application listening on port 5000 3 | Tue Jun 20 2023 10:58:39 } [PH] info: 🛢 Database is connected successfully 4 | Tue Jun 20 2023 10:58:39 } [PH] info: Application listening on port 5000 5 | Tue Jun 20 2023 10:59:10 } [PH] info: 🛢 Database is connected successfully 6 | Tue Jun 20 2023 10:59:10 } [PH] info: Application listening on port 5000 7 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-20-06-11-success.log: -------------------------------------------------------------------------------- 1 | Tue Jun 20 2023 11:9:53 } [PH] info: 🛢 Database is connected successfully 2 | Tue Jun 20 2023 11:9:53 } [PH] info: Application listening on port 5000 3 | Tue Jun 20 2023 11:10:15 } [PH] info: 🛢 Database is connected successfully 4 | Tue Jun 20 2023 11:10:15 } [PH] info: Application listening on port 5000 5 | Tue Jun 20 2023 11:11:17 } [PH] info: 🛢 Database is connected successfully 6 | Tue Jun 20 2023 11:11:17 } [PH] info: Application listening on port 5000 7 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-23-06-17-success.log: -------------------------------------------------------------------------------- 1 | Fri Jun 23 2023 17:36:11 } [PH] info: 🛢 Database is connected successfully 2 | Fri Jun 23 2023 17:36:11 } [PH] info: Application listening on port 5000 3 | Fri Jun 23 2023 17:38:11 } [PH] info: 🛢 Database is connected successfully 4 | Fri Jun 23 2023 17:38:11 } [PH] info: Application listening on port 5000 5 | Fri Jun 23 2023 17:40:7 } [PH] info: 🛢 Database is connected successfully 6 | Fri Jun 23 2023 17:40:7 } [PH] info: Application listening on port 5000 7 | -------------------------------------------------------------------------------- /src/app/modules/semesterRegistration/semesterRegistration.constants.ts: -------------------------------------------------------------------------------- 1 | export const semesterRegistrationFilterableFields: string[] = [ 2 | 'searchTerm', 3 | 'id', 4 | 'academicSemesterId' 5 | ]; 6 | 7 | export const semesterRegistrationSearchableFields: string[] = []; 8 | 9 | export const semesterRegistrationRelationalFields: string[] = ['academicSemesterId']; 10 | export const semesterRegistrationRelationalFieldsMapper: { [key: string]: string } = { 11 | academicSemesterId: 'academicSemester' 12 | }; -------------------------------------------------------------------------------- /src/app/modules/student/student.constant.ts: -------------------------------------------------------------------------------- 1 | export const gender = ['male', 'female']; 2 | export const bloodGroup = ['A+', 'A-', 'B+', 'B-', 'AB+', 'AB-', 'O+', 'O-']; 3 | 4 | export const studentSearchableFields = [ 5 | 'id', 6 | 'email', 7 | 'contactNo', 8 | 'name.fisrtName', 9 | 'name.middleName', 10 | 'name.lastName', 11 | ]; 12 | 13 | export const studentFilterableFields = [ 14 | 'searchTerm', 15 | 'id', 16 | 'bloodGroup', 17 | 'email', 18 | 'contactNo', 19 | 'emergencyContactNo', 20 | ]; 21 | -------------------------------------------------------------------------------- /src/app/modules/building/building.validations.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | 3 | const create = z.object({ 4 | body: z.object({ 5 | title: z.string({ 6 | required_error: "Title is required" 7 | }) 8 | }) 9 | }) 10 | // Building Validations 11 | const update = z.object({ 12 | body: z.object({ 13 | title: z.string({ 14 | required_error: 'Title is required' 15 | }) 16 | }) 17 | }); 18 | 19 | export const BuildingValidations = { 20 | create, 21 | update 22 | } -------------------------------------------------------------------------------- /src/errors/handleCastError.ts: -------------------------------------------------------------------------------- 1 | import mongoose from 'mongoose'; 2 | import { IGenericErrorMessage } from '../interfaces/error'; 3 | 4 | const handleCastError = (error: mongoose.Error.CastError) => { 5 | const errors: IGenericErrorMessage[] = [ 6 | { 7 | path: error.path, 8 | message: 'Invalid Id', 9 | }, 10 | ]; 11 | 12 | const statusCode = 400; 13 | return { 14 | statusCode, 15 | message: 'Cast Error', 16 | errorMessages: errors, 17 | }; 18 | }; 19 | 20 | export default handleCastError; 21 | -------------------------------------------------------------------------------- /src/helpers/jwtHelpers.ts: -------------------------------------------------------------------------------- 1 | import jwt, { JwtPayload, Secret } from 'jsonwebtoken'; 2 | 3 | const createToken = ( 4 | payload: Record, 5 | secret: Secret, 6 | expireTime: string 7 | ): string => { 8 | return jwt.sign(payload, secret, { 9 | expiresIn: expireTime, 10 | }); 11 | }; 12 | 13 | const verifyToken = (token: string, secret: Secret): JwtPayload => { 14 | return jwt.verify(token, secret) as JwtPayload; 15 | }; 16 | 17 | export const jwtHelpers = { 18 | createToken, 19 | verifyToken, 20 | }; 21 | -------------------------------------------------------------------------------- /src/app/modules/academicDepartment/academicDepartment.contants.ts: -------------------------------------------------------------------------------- 1 | export const academicDepartmentFilterableFields: string[] = [ 2 | 'searchTerm', 3 | 'id', 4 | 'academicFacultyId' 5 | ]; 6 | // academic department constans 7 | export const academicDepartmentSearchableFields: string[] = ['title']; 8 | 9 | export const academicDepartmentRelationalFields: string[] = ['academicFacultyId']; 10 | export const academicDepartmentRelationalFieldsMapper: { [key: string]: string } = { 11 | academicFacultyId: 'academicFaculty' 12 | }; 13 | -------------------------------------------------------------------------------- /src/errors/handleValidationError.ts: -------------------------------------------------------------------------------- 1 | import { Prisma } from '@prisma/client'; 2 | import { IGenericErrorResponse } from '../interfaces/common'; 3 | 4 | const handleValidationError = ( 5 | error: Prisma.PrismaClientValidationError 6 | ): IGenericErrorResponse => { 7 | const errors = [{ 8 | path: "", 9 | message: error.message, 10 | }] 11 | const statusCode = 400; 12 | return { 13 | statusCode, 14 | message: 'Validation Error', 15 | errorMessages: errors, 16 | }; 17 | }; 18 | 19 | export default handleValidationError; 20 | -------------------------------------------------------------------------------- /logs/winston/errors/phu-2023-19-06-23-error.log: -------------------------------------------------------------------------------- 1 | Mon Jun 19 2023 23:3:14 } [PH] error: Attempted illegal state transition from [TRANSACTION_ABORTED] to [TRANSACTION_COMMITTED] 2 | Mon Jun 19 2023 23:22:52 } [PH] error: Attempted illegal state transition from [TRANSACTION_ABORTED] to [TRANSACTION_COMMITTED] 3 | Mon Jun 19 2023 23:27:32 } [PH] error: Attempted illegal state transition from [TRANSACTION_ABORTED] to [TRANSACTION_COMMITTED] 4 | Mon Jun 19 2023 23:37:46 } [PH] error: Attempted illegal state transition from [TRANSACTION_ABORTED] to [TRANSACTION_COMMITTED] 5 | -------------------------------------------------------------------------------- /src/app/modules/academicFaculty/academicFaculty.validation.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | 3 | const create = z.object({ 4 | body: z.object({ 5 | title: z.string({ 6 | required_error: 'Title is required' 7 | }) 8 | }) 9 | }); 10 | // academic faculty valid 11 | const update = z.object({ 12 | body: z.object({ 13 | title: z.string({ 14 | required_error: 'Title is required' 15 | }) 16 | }) 17 | }); 18 | 19 | export const AcademicFacultyValidation = { 20 | create, 21 | update 22 | }; -------------------------------------------------------------------------------- /src/app/modules/academicFaculty/academicFaculty.validations.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | 3 | const createFacultyZodSchema = z.object({ 4 | body: z.object({ 5 | title: z.string({ 6 | required_error: 'Title is required', 7 | }), 8 | }), 9 | }); 10 | 11 | const updatefacultyZodSchema = z.object({ 12 | body: z.object({ 13 | title: z.string({ 14 | required_error: 'Title is required', 15 | }), 16 | }), 17 | }); 18 | 19 | export const AcademicFacultyValidation = { 20 | createFacultyZodSchema, 21 | updatefacultyZodSchema, 22 | }; 23 | -------------------------------------------------------------------------------- /src/app/modules/academicDepartment/academicDepartment.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { Model, Types } from 'mongoose'; 2 | import { IAcademicFaculty } from '../academicFaculty/academicFaculty.interfaces'; 3 | 4 | export type IAcademicDepartment = { 5 | title: string; 6 | academicFaculty: Types.ObjectId | IAcademicFaculty; 7 | }; 8 | 9 | export type AcademicDepartmentModel = Model< 10 | IAcademicDepartment, 11 | Record 12 | >; 13 | 14 | export type IAcademicDepartmentFilters = { 15 | searchTerm?: string; 16 | academicFaculty?: Types.ObjectId; 17 | }; 18 | -------------------------------------------------------------------------------- /src/app/modules/users/users.utils.ts: -------------------------------------------------------------------------------- 1 | import { User } from './users.model' 2 | 3 | export const findLastUserId = async () => { 4 | const lastUser = await User.findOne({}, { id: 1, _id: 0 }) 5 | .sort({ 6 | createdAt: -1, 7 | }) 8 | .lean() 9 | 10 | return lastUser?.id 11 | } 12 | 13 | export const generateUserId = async () => { 14 | const currentId = (await findLastUserId()) || (0).toString().padStart(5, '0') //00000 15 | //increment by 1 16 | const incrementedId = (parseInt(currentId) + 1).toString().padStart(5, '0') 17 | return incrementedId 18 | } 19 | -------------------------------------------------------------------------------- /prisma/migrations/20230808143213_init/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - Changed the type of `year` on the `academic_semesters` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 5 | 6 | */ 7 | -- AlterTable 8 | ALTER TABLE "academic_semesters" DROP COLUMN "year", 9 | ADD COLUMN "year" INTEGER NOT NULL; 10 | 11 | -- AlterTable 12 | ALTER TABLE "faculties" ALTER COLUMN "contactNo" SET DATA TYPE TEXT; 13 | 14 | -- AlterTable 15 | ALTER TABLE "students" ALTER COLUMN "contactNo" SET DATA TYPE TEXT; 16 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-08-21-success.log: -------------------------------------------------------------------------------- 1 | Sat Aug 19 2023 21:0:40 } [PH] info: Server running on port 5001 2 | Sat Aug 19 2023 21:8:10 } [PH] info: SIGTERM received 3 | Sat Aug 19 2023 21:8:12 } [PH] info: Server running on port 5001 4 | Sat Aug 19 2023 21:8:19 } [PH] info: SIGTERM received 5 | Sat Aug 19 2023 21:8:22 } [PH] info: Server running on port 5001 6 | Sat Aug 19 2023 21:10:21 } [PH] info: SIGTERM received 7 | Sat Aug 19 2023 21:10:21 } [PH] info: Server running on port 5001 8 | Sat Aug 19 2023 21:15:17 } [PH] info: SIGTERM received 9 | Sat Aug 19 2023 21:15:20 } [PH] info: Server running on port 5001 10 | -------------------------------------------------------------------------------- /prisma/migrations/20230822153207_remove/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - You are about to drop the `offered_courses` table. If the table is not empty, all the data it contains will be lost. 5 | 6 | */ 7 | -- DropForeignKey 8 | ALTER TABLE "offered_courses" DROP CONSTRAINT "offered_courses_academicDepartmentId_fkey"; 9 | 10 | -- DropForeignKey 11 | ALTER TABLE "offered_courses" DROP CONSTRAINT "offered_courses_courseId_fkey"; 12 | 13 | -- DropForeignKey 14 | ALTER TABLE "offered_courses" DROP CONSTRAINT "offered_courses_semesterRegistrationId_fkey"; 15 | 16 | -- DropTable 17 | DROP TABLE "offered_courses"; 18 | -------------------------------------------------------------------------------- /src/app/modules/users/users.model.ts: -------------------------------------------------------------------------------- 1 | import { Model, Schema, model } from 'mongoose' 2 | import { IUser } from './users.interface' 3 | 4 | type UserModel = Model 5 | 6 | const userSchema = new Schema( 7 | { 8 | id: { 9 | type: String, 10 | required: true, 11 | unique: true, 12 | }, 13 | role: { 14 | type: String, 15 | required: true, 16 | }, 17 | password: { 18 | type: String, 19 | required: true, 20 | }, 21 | }, 22 | { 23 | timestamps: true, 24 | } 25 | ) 26 | export const User = model('User', userSchema) 27 | -------------------------------------------------------------------------------- /src/app/modules/auth/auth.interface.ts: -------------------------------------------------------------------------------- 1 | import { ENUM_USER_ROLE } from '../../../enums/user'; 2 | 3 | export type ILoginUser = { 4 | id: string; 5 | password: string; 6 | }; 7 | //auth interface 8 | export type ILoginUserResponse = { 9 | accessToken: string; 10 | refreshToken?: string; 11 | needsPasswordChange: boolean; 12 | }; 13 | 14 | export type IRefreshTokenResponse = { 15 | accessToken: string; 16 | }; 17 | 18 | export type IVerifiedLoginUser = { 19 | userId: string; 20 | role: ENUM_USER_ROLE; 21 | }; 22 | 23 | export type IChangePassword = { 24 | oldPassword: string; 25 | newPassword: string; 26 | }; 27 | -------------------------------------------------------------------------------- /src/app/modules/managementDepartment/managementDepartment.validation.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | 3 | const createManagementDepartmentZodSchema = z.object({ 4 | body: z.object({ 5 | title: z.string({ 6 | required_error: 'Title is required', 7 | }), 8 | }), 9 | }); 10 | 11 | const updateManagementDepartmentZodSchema = z.object({ 12 | body: z.object({ 13 | title: z.string({ 14 | required_error: 'Title is required', 15 | }), 16 | }), 17 | }); 18 | 19 | export const ManagementDepartmentValidation = { 20 | createManagementDepartmentZodSchema, 21 | updateManagementDepartmentZodSchema, 22 | }; 23 | -------------------------------------------------------------------------------- /logs/winston/success/.ea22347223db3e574f71c0381f34d42d20a5a070-audit.json: -------------------------------------------------------------------------------- 1 | { 2 | "keep": { 3 | "days": true, 4 | "amount": 14 5 | }, 6 | "auditLog": "H:\\next-level-development\\university-management-auth-service\\logs\\winston\\success\\.ea22347223db3e574f71c0381f34d42d20a5a070-audit.json", 7 | "files": [ 8 | { 9 | "date": 1685831372836, 10 | "name": "H:\\next-level-development\\university-management-auth-service\\logs\\winston\\success\\phu-2023-04-06-04-error.log", 11 | "hash": "71127edb780547f4998537cb4b95e530ba3016d580f79147ad1553723cc27804" 12 | } 13 | ], 14 | "hashType": "sha256" 15 | } 16 | -------------------------------------------------------------------------------- /src/app/modules/users/users.controller.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from 'express' 2 | import usersService from './users.service' 3 | 4 | const createUser = async (req: Request, res: Response) => { 5 | try { 6 | const { user } = req.body 7 | const result = await usersService.createUser(user) 8 | res.status(200).json({ 9 | success: true, 10 | message: 'user created successfully!', 11 | data: result, 12 | }) 13 | } catch (err) { 14 | res.status(400).json({ 15 | sucess: false, 16 | message: 'Failed to create user', 17 | }) 18 | } 19 | } 20 | 21 | export default { 22 | createUser, 23 | } 24 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-04-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 4:10:26 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 4:10:26 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 4:16:42 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 4:16:42 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 4:17:53 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 4:17:53 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 4:18:5 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 4:18:5 } [PH] info: Application listening on port 5000 9 | -------------------------------------------------------------------------------- /src/app/modules/academicDepartment/academicDepartment.validations.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | 3 | const create = z.object({ 4 | body: z.object({ 5 | title: z.string({ 6 | required_error: 'Title is required' 7 | }), 8 | academicFacultyId: z.string({ 9 | required_error: 'Academic faculty id is required' 10 | }) 11 | }) 12 | }); 13 | 14 | const update = z.object({ 15 | body: z.object({ 16 | title: z.string().optional(), 17 | academicFacultyId: z.string().optional() 18 | }) 19 | }); 20 | 21 | export const AcademicDepartmentValidation = { 22 | create, 23 | update 24 | }; -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-10-06-14-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 10 2023 14:8:9 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 10 2023 14:8:9 } [PH] info: Application listening on port 5000 3 | Sat Jun 10 2023 14:10:31 } [PH] info: 🛢 Database is connected successfully 4 | Sat Jun 10 2023 14:10:31 } [PH] info: Application listening on port 5000 5 | Sat Jun 10 2023 14:13:58 } [PH] info: 🛢 Database is connected successfully 6 | Sat Jun 10 2023 14:13:58 } [PH] info: Application listening on port 5000 7 | Sat Jun 10 2023 14:14:17 } [PH] info: 🛢 Database is connected successfully 8 | Sat Jun 10 2023 14:14:17 } [PH] info: Application listening on port 5000 9 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-14-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 14:30:15 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 14:30:15 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 14:37:26 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 14:37:26 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 14:41:10 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 14:41:10 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 14:51:12 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 14:51:12 } [PH] info: Application listening on port 5000 9 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-15-06-15-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 15 2023 15:27:12 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 15 2023 15:27:12 } [PH] info: Application listening on port 5000 3 | Thu Jun 15 2023 15:47:1 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 15 2023 15:47:1 } [PH] info: Application listening on port 5000 5 | Thu Jun 15 2023 15:48:27 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 15 2023 15:48:27 } [PH] info: Application listening on port 5000 7 | Thu Jun 15 2023 15:50:37 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 15 2023 15:50:37 } [PH] info: Application listening on port 5000 9 | -------------------------------------------------------------------------------- /src/app/middlewares/validateRequest.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, Response } from 'express'; 2 | import { AnyZodObject, ZodEffects } from 'zod'; 3 | // Validate Request 4 | const validateRequest = 5 | (schema: AnyZodObject | ZodEffects) => 6 | async (req: Request, res: Response, next: NextFunction): Promise => { 7 | try { 8 | await schema.parseAsync({ 9 | body: req.body, 10 | query: req.query, 11 | params: req.params, 12 | cookies: req.cookies, 13 | }); 14 | return next(); 15 | } catch (error) { 16 | next(error); 17 | } 18 | }; 19 | 20 | export default validateRequest; 21 | -------------------------------------------------------------------------------- /prisma/migrations/20230818130946_course_faculty/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "course_faculties" ( 3 | "courseId" TEXT NOT NULL, 4 | "facultyId" TEXT NOT NULL, 5 | 6 | CONSTRAINT "course_faculties_pkey" PRIMARY KEY ("courseId","facultyId") 7 | ); 8 | 9 | -- AddForeignKey 10 | ALTER TABLE "course_faculties" ADD CONSTRAINT "course_faculties_courseId_fkey" FOREIGN KEY ("courseId") REFERENCES "courses"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 11 | 12 | -- AddForeignKey 13 | ALTER TABLE "course_faculties" ADD CONSTRAINT "course_faculties_facultyId_fkey" FOREIGN KEY ("facultyId") REFERENCES "faculties"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 14 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-08-20-success.log: -------------------------------------------------------------------------------- 1 | Sat Aug 19 2023 20:5:36 } [PH] info: SIGTERM received 2 | Sat Aug 19 2023 20:5:37 } [PH] info: Server running on port 5001 3 | Sat Aug 19 2023 20:9:4 } [PH] info: SIGTERM received 4 | Sat Aug 19 2023 20:9:4 } [PH] info: Server running on port 5001 5 | Sat Aug 19 2023 20:10:2 } [PH] info: SIGTERM received 6 | Sat Aug 19 2023 20:10:2 } [PH] info: Server running on port 5001 7 | Sat Aug 19 2023 20:11:43 } [PH] info: SIGTERM received 8 | Sat Aug 19 2023 20:11:43 } [PH] info: Server running on port 5001 9 | Sat Aug 19 2023 20:12:37 } [PH] info: SIGTERM received 10 | Sat Aug 19 2023 20:12:38 } [PH] info: Server running on port 5001 11 | -------------------------------------------------------------------------------- /src/app/modules/offeredCourse/offeredCourse.constants.ts: -------------------------------------------------------------------------------- 1 | export const offeredCourseFilterableFields: string[] = [ 2 | 'searchTerm', 3 | 'id', 4 | 'semesterRegistrationId', 5 | 'courseId', 6 | 'academicDepartmentId' 7 | ]; 8 | 9 | export const offeredCourseSearchableFields: string[] = []; 10 | 11 | export const offeredCourseRelationalFields: string[] = [ 12 | 'semesterRegistrationId', 13 | 'courseId', 14 | 'academicDepartmentId' 15 | ]; 16 | export const offeredCourseRelationalFieldsMapper: { [key: string]: string } = { 17 | semesterRegistrationId: 'semesterRegistration', 18 | courseId: 'course', 19 | academicDepartmentId: 'academicDepartment' 20 | }; -------------------------------------------------------------------------------- /logs/winston/errors/.de2db7e7464c84f46b16bb52d1bfe261f595a49e-audit.json: -------------------------------------------------------------------------------- 1 | { 2 | "keep": { 3 | "days": true, 4 | "amount": 14 5 | }, 6 | "auditLog": "E:\\MERN-Web Development 2.0\\MileStone-3\\University-Management-Project\\logs\\winston\\errors\\.de2db7e7464c84f46b16bb52d1bfe261f595a49e-audit.json", 7 | "files": [ 8 | { 9 | "date": 1693238511019, 10 | "name": "E:\\MERN-Web Development 2.0\\MileStone-3\\University-Management-Project\\logs\\winston\\errors\\phu-2023-28-08-22-error.log", 11 | "hash": "fd8dfa6565eafc515436bf5c0601e7a0ee460c9dcb2f1ba1d2a0f7344a3de688" 12 | } 13 | ], 14 | "hashType": "sha256" 15 | } -------------------------------------------------------------------------------- /src/errors/handleZodError.ts: -------------------------------------------------------------------------------- 1 | import { ZodError, ZodIssue } from 'zod'; 2 | import { IGenericErrorResponse } from '../interfaces/common'; 3 | import { IGenericErrorMessage } from '../interfaces/error'; 4 | 5 | const handleZodError = (error: ZodError): IGenericErrorResponse => { 6 | const errors: IGenericErrorMessage[] = error.issues.map((issue: ZodIssue) => { 7 | return { 8 | path: issue?.path[issue.path.length - 1], 9 | message: issue?.message, 10 | }; 11 | }); 12 | 13 | const statusCode = 400; 14 | 15 | return { 16 | statusCode, 17 | message: 'Validation Error', 18 | errorMessages: errors, 19 | }; 20 | }; 21 | 22 | export default handleZodError; 23 | -------------------------------------------------------------------------------- /logs/winston/successes/.44f209706f2e09cf8114c2157a0abcd7abc5f60d-audit.json: -------------------------------------------------------------------------------- 1 | { 2 | "keep": { 3 | "days": true, 4 | "amount": 14 5 | }, 6 | "auditLog": "E:\\MERN-Web Development 2.0\\MileStone-3\\University-Management-Project\\logs\\winston\\successes\\.44f209706f2e09cf8114c2157a0abcd7abc5f60d-audit.json", 7 | "files": [ 8 | { 9 | "date": 1693238511017, 10 | "name": "E:\\MERN-Web Development 2.0\\MileStone-3\\University-Management-Project\\logs\\winston\\successes\\phu-2023-28-08-22-success.log", 11 | "hash": "5eeb0cc80ff7c71e597b775ad29c513a785b3597b3ace93648c7b136e1c123bc" 12 | } 13 | ], 14 | "hashType": "sha256" 15 | } -------------------------------------------------------------------------------- /src/app/modules/academicFaculty/academicFaculty.model.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model } from 'mongoose'; 2 | import { 3 | IAcademicFaculty, 4 | AcademicFacultyModel, 5 | } from './academicFaculty.interfaces'; 6 | // academic Department Model 7 | const AcademicFacultySchema = new Schema< 8 | IAcademicFaculty, 9 | AcademicFacultyModel 10 | >( 11 | { 12 | title: { 13 | type: String, 14 | required: true, 15 | unique: true, 16 | }, 17 | }, 18 | { 19 | timestamps: true, 20 | toJSON: { 21 | virtuals: true, 22 | }, 23 | } 24 | ); 25 | 26 | export const AcademicFaculty = model( 27 | 'AcademicFaculty', 28 | AcademicFacultySchema 29 | ); 30 | -------------------------------------------------------------------------------- /src/app/modules/users/users.service.ts: -------------------------------------------------------------------------------- 1 | import config from '../../../config/index' 2 | import { IUser } from './users.interface' 3 | import { User } from './users.model' 4 | import { generateUserId } from './users.utils' 5 | 6 | const createUser = async (user: IUser): Promise => { 7 | // auto generated incremental id 8 | const id = await generateUserId() 9 | user.id = id 10 | // default password 11 | if (!user.password) { 12 | user.password = config.default_user_pass as string 13 | } 14 | 15 | const createdUser = await User.create(user) 16 | 17 | if (!createUser) { 18 | throw new Error('Failed to create user!') 19 | } 20 | return createdUser 21 | } 22 | 23 | export default { 24 | createUser, 25 | } 26 | -------------------------------------------------------------------------------- /src/shared/sendResponse.ts: -------------------------------------------------------------------------------- 1 | import { Response } from 'express'; 2 | 3 | type IApiReponse = { 4 | statusCode: number; 5 | success: boolean; 6 | message?: string | null; 7 | meta?: { 8 | page: number; 9 | limit: number; 10 | total: number; 11 | }; 12 | data?: T | null; 13 | }; 14 | 15 | const sendResponse = (res: Response, data: IApiReponse): void => { 16 | const responseData: IApiReponse = { 17 | statusCode: data.statusCode, 18 | success: data.success, 19 | message: data.message || null, 20 | meta: data.meta || null || undefined, 21 | data: data.data || null || undefined, 22 | }; 23 | 24 | res.status(data.statusCode).json(responseData); 25 | }; 26 | 27 | export default sendResponse; 28 | -------------------------------------------------------------------------------- /src/app/modules/managementDepartment/managementDepartment.model.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model } from 'mongoose'; 2 | import { 3 | IManagementDepartment, 4 | ManagementDepartmentModel, 5 | } from './managementDepartment.inerface'; 6 | 7 | const ManagementDepartmentSchema = new Schema< 8 | IManagementDepartment, 9 | ManagementDepartmentModel 10 | >( 11 | { 12 | title: { 13 | type: String, 14 | required: true, 15 | unique: true, 16 | }, 17 | }, 18 | { 19 | timestamps: true, 20 | toJSON: { 21 | virtuals: true, 22 | }, 23 | } 24 | ); 25 | 26 | export const ManagementDepartment = model< 27 | IManagementDepartment, 28 | ManagementDepartmentModel 29 | >('ManagementDepartment', ManagementDepartmentSchema); 30 | -------------------------------------------------------------------------------- /src/app/modules/room/room.validations.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | 3 | const create = z.object({ 4 | body: z.object({ 5 | roomNumber: z.string({ 6 | required_error: 'Room number is required' 7 | }), 8 | floor: z.string({ 9 | required_error: 'Floor is required' 10 | }), 11 | buildingId: z.string({ 12 | required_error: 'Building id is required' 13 | }) 14 | }) 15 | }); 16 | 17 | const update = z.object({ 18 | body: z.object({ 19 | roomNumber: z.string().optional(), 20 | floor: z.string().optional(), 21 | buildingId: z.string().optional() 22 | }) 23 | }); 24 | 25 | export const RoomValidation = { 26 | create, 27 | update 28 | }; -------------------------------------------------------------------------------- /src/app/modules/offeredCourseSection/offeredCourseSection.validation.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | 3 | const create = z.object({ 4 | body: z.object({ 5 | offeredCourseId: z.string({ 6 | required_error: 'Offered course id is required' 7 | }), 8 | maxCapacity: z.number({ 9 | required_error: 'Max capacity is required' 10 | }), 11 | title: z.string({ 12 | required_error: 'Title is required' 13 | }) 14 | }) 15 | }); 16 | 17 | const update = z.object({ 18 | body: z.object({ 19 | maxCapacity: z.number().optional(), 20 | title: z.string().optional() 21 | }) 22 | }); 23 | 24 | export const OfferedCourseSectionValidation = { 25 | create, 26 | update 27 | }; -------------------------------------------------------------------------------- /src/config/index.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import dotenv from 'dotenv'; 3 | import path from 'path'; 4 | 5 | dotenv.config({ path: path.join(process.cwd(), '.env') }); 6 | 7 | export default { 8 | env: process.env.NODE_ENV, 9 | port: process.env.PORT, 10 | database_url: process.env.DATABASE_URL, 11 | default_student_pass: process.env.DEFAULT_STUDENT_PASS, 12 | default_faculty_pass: process.env.DEFAULT_FACULTY_PASS, 13 | default_admin_pass: process.env.DEFAULT_ADMIN_PASS, 14 | bycrypt_salt_rounds: process.env.BCRYPT_SALT_ROUNDS, 15 | jwt: { 16 | secret: process.env.JWT_SECRET, 17 | refresh_secret: process.env.JWT_REFRESH_SECRET, 18 | expires_in: process.env.JWT_EXPIRES_IN, 19 | refresh_expires_in: process.env.JWT_REFRESH_EXPIRES_IN, 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-22-08-19-success.log: -------------------------------------------------------------------------------- 1 | Tue Aug 22 2023 19:16:29 } [PH] info: SIGTERM received 2 | Tue Aug 22 2023 19:16:29 } [PH] info: Server running on port 5001 3 | Tue Aug 22 2023 19:18:10 } [PH] info: SIGTERM received 4 | Tue Aug 22 2023 19:18:12 } [PH] info: Server running on port 5001 5 | Tue Aug 22 2023 19:18:40 } [PH] info: SIGTERM received 6 | Tue Aug 22 2023 19:18:42 } [PH] info: Server running on port 5001 7 | Tue Aug 22 2023 19:19:55 } [PH] info: SIGTERM received 8 | Tue Aug 22 2023 19:19:55 } [PH] info: Server running on port 5001 9 | Tue Aug 22 2023 19:29:6 } [PH] info: SIGTERM received 10 | Tue Aug 22 2023 19:29:7 } [PH] info: Server running on port 5001 11 | Tue Aug 22 2023 19:32:19 } [PH] info: SIGTERM received 12 | Tue Aug 22 2023 19:32:21 } [PH] info: Server running on port 5001 13 | -------------------------------------------------------------------------------- /src/app/modules/faculty/faculty.constants.ts: -------------------------------------------------------------------------------- 1 | export const facultyFilterableFields: string[] = [ 2 | 'searchTerm', 3 | 'facultyId', 4 | 'email', 5 | 'contactNo', 6 | 'gender', 7 | 'bloodGroup', 8 | 'gender', 9 | 'designation', 10 | 'academicFacultyId', 11 | 'academicDepartmentId' 12 | ]; 13 | 14 | export const facultySearchableFields: string[] = [ 15 | 'firstName', 16 | 'lastName', 17 | 'middleName', 18 | 'email', 19 | 'contactNo', 20 | 'facultyId', 21 | 'designation' 22 | ]; 23 | 24 | export const facultyRelationalFields: string[] = ['academicFacultyId', 'academicDepartmentId']; 25 | export const facultyRelationalFieldsMapper: { [key: string]: string } = { 26 | academicFacultyId: 'academicFaculty', 27 | academicDepartmentId: 'academicDepartment' 28 | }; -------------------------------------------------------------------------------- /src/app/modules/offeredCourseSection/offeredCourseSection.constants.ts: -------------------------------------------------------------------------------- 1 | export const offeredCourseSectionFilterableFields: string[] = [ 2 | 'searchTerm', 3 | 'id', 4 | 'offeredCourseId', 5 | 'semesterRegistrationId' 6 | ]; 7 | 8 | export const offeredCourseSectionSearchableFields: string[] = []; 9 | 10 | export const offeredCourseSectionRelationalFields: string[] = [ 11 | 'offeredCourseId', 12 | 'semesterRegistrationId' 13 | ]; 14 | export const offeredCourseSectionRelationalFieldsMapper: { [key: string]: string } = { 15 | offeredCourseId: 'offeredCourse', 16 | semesterRegistrationId: 'semesterRegistration' 17 | }; 18 | 19 | export const daysInWeek = [ 20 | 'SATURDAY', 21 | 'SUNDAY', 22 | 'MONDAY', 23 | 'TUESDAY', 24 | 'WEDNESDAY', 25 | 'THURSDAY', 26 | 'FRIDAY' 27 | ]; -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "parserOptions": { 4 | "ecmaVersion": 12, 5 | "sourceType": "module" 6 | }, 7 | "plugins": ["@typescript-eslint"], 8 | "extends": [ 9 | "eslint:recommended", 10 | "plugin:@typescript-eslint/recommended", 11 | "prettier" 12 | ], 13 | "rules": { 14 | "no-unused-vars": "error", 15 | "prefer-const": "error", 16 | "no-unused-expressions": "error", 17 | "no-undef": "error", 18 | "no-console": "off", 19 | "@typescript-eslint/consistent-type-definitions": ["error", "type"], 20 | "@typescript-eslint/explicit-module-boundary-types": "off" 21 | }, 22 | "env": { 23 | "browser": true, 24 | "es2021": true, 25 | "node":true 26 | }, 27 | "globals": { 28 | "process":"readonly" 29 | } 30 | } 31 | // eslintrc -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-23-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 23:35:8 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 23:35:8 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 23:37:5 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 23:37:5 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 23:38:54 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 23:38:54 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 23:42:56 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 23:42:56 } [PH] info: Application listening on port 5000 9 | Thu Jun 08 2023 23:53:52 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 08 2023 23:53:52 } [PH] info: Application listening on port 5000 11 | -------------------------------------------------------------------------------- /src/helpers/paginationHelper.ts: -------------------------------------------------------------------------------- 1 | type IOptions = { 2 | page?: number; 3 | limit?: number; 4 | sortBy?: string; 5 | sortOrder?: string; 6 | }; 7 | // Pagination Helpers 8 | type IOptionsResult = { 9 | page: number; 10 | limit: number; 11 | skip: number; 12 | sortBy: string; 13 | sortOrder: string; 14 | }; 15 | 16 | const calculatePagination = (options: IOptions): IOptionsResult => { 17 | const page = Number(options.page || 1); 18 | const limit = Number(options.limit || 10); 19 | const skip = (page - 1) * limit; 20 | 21 | const sortBy = options.sortBy || 'createdAt'; 22 | const sortOrder = options.sortOrder || 'desc'; 23 | 24 | return { 25 | page, 26 | limit, 27 | skip, 28 | sortBy, 29 | sortOrder, 30 | }; 31 | }; 32 | 33 | export const paginationHelpers = { 34 | calculatePagination, 35 | }; 36 | -------------------------------------------------------------------------------- /logs/winston/errors/.76750a6901d5790a50478ccc377565522e3028bf-audit.json: -------------------------------------------------------------------------------- 1 | { 2 | "keep": { 3 | "days": true, 4 | "amount": 14 5 | }, 6 | "auditLog": "D:\\Apollo\\umcs-starter\\logs\\winston\\errors\\.76750a6901d5790a50478ccc377565522e3028bf-audit.json", 7 | "files": [ 8 | { 9 | "date": 1689101976765, 10 | "name": "D:\\Apollo\\umcs-starter\\logs\\winston\\errors\\phu-2023-12-07-00-error.log", 11 | "hash": "baff6d4590e096b087470e5e022801d933734636468df57d672f59773e6c74d7" 12 | }, 13 | { 14 | "date": 1689102144751, 15 | "name": "D:\\Apollo\\umcs-starter\\logs\\winston\\errors\\phu-2023-12-07-01-error.log", 16 | "hash": "f4f8f61a05cf76727edee53c766927eaa8a2664b62967de4b64d3488dab25fb5" 17 | } 18 | ], 19 | "hashType": "sha256" 20 | } -------------------------------------------------------------------------------- /logs/winston/successes/.6d79f2d384d48528ea2ca7d333076265546635cf-audit.json: -------------------------------------------------------------------------------- 1 | { 2 | "keep": { 3 | "days": true, 4 | "amount": 14 5 | }, 6 | "auditLog": "D:\\Apollo\\umcs-starter\\logs\\winston\\successes\\.6d79f2d384d48528ea2ca7d333076265546635cf-audit.json", 7 | "files": [ 8 | { 9 | "date": 1689101976757, 10 | "name": "D:\\Apollo\\umcs-starter\\logs\\winston\\successes\\phu-2023-12-07-00-success.log", 11 | "hash": "876679e560d3a2409328b523f24f6361497ae0bce1202f51197ea6353a303070" 12 | }, 13 | { 14 | "date": 1689102144739, 15 | "name": "D:\\Apollo\\umcs-starter\\logs\\winston\\successes\\phu-2023-12-07-01-success.log", 16 | "hash": "f7f9e19b95bb660b9369560075bc985afa20fbcb283085c31bd4fbd6f8032356" 17 | } 18 | ], 19 | "hashType": "sha256" 20 | } -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-12-08-19-success.log: -------------------------------------------------------------------------------- 1 | Sat Aug 12 2023 19:5:16 } [PH] info: Server running on port 5001 2 | Sat Aug 12 2023 19:9:30 } [PH] info: SIGTERM received 3 | Sat Aug 12 2023 19:11:21 } [PH] info: Server running on port 5001 4 | Sat Aug 12 2023 19:11:28 } [PH] info: SIGTERM received 5 | Sat Aug 12 2023 19:11:28 } [PH] info: Server running on port 5001 6 | Sat Aug 12 2023 19:23:28 } [PH] info: SIGTERM received 7 | Sat Aug 12 2023 19:23:28 } [PH] info: Server running on port 5001 8 | Sat Aug 12 2023 19:38:40 } [PH] info: SIGTERM received 9 | Sat Aug 12 2023 19:38:41 } [PH] info: Server running on port 5001 10 | Sat Aug 12 2023 19:39:9 } [PH] info: SIGTERM received 11 | Sat Aug 12 2023 19:39:9 } [PH] info: Server running on port 5001 12 | Sat Aug 12 2023 19:52:58 } [PH] info: SIGTERM received 13 | Sat Aug 12 2023 19:52:58 } [PH] info: Server running on port 5001 14 | -------------------------------------------------------------------------------- /src/app/modules/user/user.interface.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-unused-vars */ 2 | import { Model, Types } from 'mongoose'; 3 | import { IAdmin } from '../admin/admin.interface'; 4 | import { IFaculty } from '../faculty/faculty.interface'; 5 | import { IStudent } from '../student/student.interface'; 6 | 7 | export type IUser = { 8 | id: string; 9 | role: string; 10 | password: string; 11 | needsPasswordChange: boolean; 12 | passwordChangedAt?: Date; 13 | student?: Types.ObjectId | IStudent; 14 | faculty?: Types.ObjectId | IFaculty; 15 | admin?: Types.ObjectId | IAdmin; 16 | }; 17 | 18 | export type UserModel = { 19 | isUserExist( 20 | id: string 21 | ): Promise>; 22 | isPasswordMatched( 23 | givenPassword: string, 24 | savedPassword: string 25 | ): Promise; 26 | } & Model; 27 | -------------------------------------------------------------------------------- /prisma/migrations/20230812154158_buildingandroom/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "buildings" ( 3 | "id" TEXT NOT NULL, 4 | "title" TEXT NOT NULL, 5 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 6 | "updatedAt" TIMESTAMP(3) NOT NULL, 7 | 8 | CONSTRAINT "buildings_pkey" PRIMARY KEY ("id") 9 | ); 10 | 11 | -- CreateTable 12 | CREATE TABLE "rooms" ( 13 | "id" TEXT NOT NULL, 14 | "roomNumber" TEXT NOT NULL, 15 | "floor" TEXT NOT NULL, 16 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 17 | "updatedAt" TIMESTAMP(3) NOT NULL, 18 | "buildingId" TEXT NOT NULL, 19 | 20 | CONSTRAINT "rooms_pkey" PRIMARY KEY ("id") 21 | ); 22 | 23 | -- AddForeignKey 24 | ALTER TABLE "rooms" ADD CONSTRAINT "rooms_buildingId_fkey" FOREIGN KEY ("buildingId") REFERENCES "buildings"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 25 | -------------------------------------------------------------------------------- /src/app/modules/academicDepartment/academicDepartment.model.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model } from 'mongoose'; 2 | import { 3 | AcademicDepartmentModel, 4 | IAcademicDepartment, 5 | } from './academicDepartment.interfaces'; 6 | // academic department model 7 | const AcademicDepartmentSchema = new Schema< 8 | IAcademicDepartment, 9 | AcademicDepartmentModel 10 | >( 11 | { 12 | title: { 13 | type: String, 14 | required: true, 15 | unique: true, 16 | }, 17 | academicFaculty: { 18 | type: Schema.Types.ObjectId, 19 | ref: 'AcademicFaculty', 20 | required: true, 21 | }, 22 | }, 23 | { 24 | timestamps: true, 25 | toJSON: { 26 | virtuals: true, 27 | }, 28 | } 29 | ); 30 | 31 | export const AcademicDepartment = model< 32 | IAcademicDepartment, 33 | AcademicDepartmentModel 34 | >('AcademicDepartment', AcademicDepartmentSchema); 35 | -------------------------------------------------------------------------------- /src/app/modules/student/student.constants.ts: -------------------------------------------------------------------------------- 1 | export const studentFilterableFields: string[] = [ 2 | 'searchTerm', 3 | 'studentId', 4 | 'email', 5 | 'contactNo', 6 | 'gender', 7 | 'bloodGroup', 8 | 'gender', 9 | 'academicFacultyId', 10 | 'academicDepartmentId', 11 | 'academicSemesterId' 12 | ]; 13 | 14 | export const studentSearchableFields: string[] = [ 15 | 'firstName', 16 | 'lastName', 17 | 'middleName', 18 | 'email', 19 | 'contactNo', 20 | 'studentId' 21 | ]; 22 | 23 | export const studentRelationalFields: string[] = [ 24 | 'academicFacultyId', 25 | 'academicDepartmentId', 26 | 'academicSemesterId' 27 | ]; 28 | export const studentRelationalFieldsMapper: { [key: string]: string } = { 29 | academicFacultyId: 'academicFaculty', 30 | academicDepartmentId: 'academicDepartment', 31 | academicSemesterId: 'academicSemester' 32 | }; 33 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # 💒 Hazrat Ali 2 | 3 | # Programmer || Software Engineering 4 | 5 | # University Management Core Service 6 | 7 | ## Resources 8 | 9 | ## Module-35: 10 | ### Stater Repository: 11 | [University Management Core Service Starter](https://github.com/Apollo-Level2-Web-Dev/university-management-core-service-starter) 12 | 13 | ### ER Diagram 14 | ER Diagram 15 | 16 | ## Module-36: 17 | ER Diagram 18 | 19 | ## Module-37 20 | ER Diagram 21 | 22 | ## Module-38 23 | ER Diagram 24 | 25 | 26 | - [API Documentation](https://documenter.getpostman.com/view/26694209/2s9Xy5NrFU) 27 | 28 | 29 | -------------------------------------------------------------------------------- /prisma/migrations/20230819144058_semester_reg/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateEnum 2 | CREATE TYPE "SemesterRegistrationStatus" AS ENUM ('UPCOMING', 'ONGOING', 'ENDED'); 3 | 4 | -- CreateTable 5 | CREATE TABLE "semester_registrations" ( 6 | "id" TEXT NOT NULL, 7 | "startDate" TIMESTAMP(3) NOT NULL, 8 | "endDate" TIMESTAMP(3) NOT NULL, 9 | "status" "SemesterRegistrationStatus", 10 | "minCredit" INTEGER NOT NULL DEFAULT 0, 11 | "maxCredit" INTEGER NOT NULL DEFAULT 0, 12 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 13 | "updatedAt" TIMESTAMP(3) NOT NULL, 14 | "academicSemesterId" TEXT NOT NULL, 15 | 16 | CONSTRAINT "semester_registrations_pkey" PRIMARY KEY ("id") 17 | ); 18 | 19 | -- AddForeignKey 20 | ALTER TABLE "semester_registrations" ADD CONSTRAINT "semester_registrations_academicSemesterId_fkey" FOREIGN KEY ("academicSemesterId") REFERENCES "academic_semesters"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 21 | -------------------------------------------------------------------------------- /src/app/modules/admin/admin.validation.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | // admin Validation 3 | const updateAdmin = z.object({ 4 | body: z.object({ 5 | name: z.object({ 6 | firstName: z.string().optional(), 7 | lastName: z.string().optional(), 8 | middleName: z.string().optional(), 9 | }), 10 | 11 | dateOfBirth: z.string().optional(), 12 | 13 | gender: z.string().optional(), 14 | 15 | bloodGroup: z.string().optional(), 16 | 17 | email: z.string().email().optional(), 18 | 19 | contactNo: z.string().optional(), 20 | 21 | emergencyContactNo: z.string().optional(), 22 | 23 | presentAddress: z.string().optional(), 24 | 25 | permanentAddress: z.string().optional(), 26 | 27 | department: z.string().optional(), 28 | 29 | designation: z.string().optional(), 30 | 31 | profileImage: z.string().optional(), 32 | }), 33 | }); 34 | 35 | export const AdminValidation = { 36 | updateAdmin, 37 | }; 38 | -------------------------------------------------------------------------------- /src/app/modules/auth/auth.validation.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | // auth validation 3 | const loginZodSchema = z.object({ 4 | body: z.object({ 5 | id: z.string({ 6 | required_error: 'ID is required', 7 | }), 8 | password: z.string({ 9 | required_error: 'Password is required', 10 | }), 11 | }), 12 | }); 13 | 14 | const refreshTokenZodSchema = z.object({ 15 | cookies: z.object({ 16 | refreshToken: z.string({ 17 | required_error: 'Refresh Token is required', 18 | }), 19 | }), 20 | }); 21 | 22 | const changePasswordZodSchema = z.object({ 23 | body: z.object({ 24 | oldPassword: z.string({ 25 | required_error: 'Old password is required', 26 | }), 27 | newPassword: z.string({ 28 | required_error: 'New password is required', 29 | }), 30 | }), 31 | }); 32 | 33 | export const AuthValidation = { 34 | loginZodSchema, 35 | refreshTokenZodSchema, 36 | changePasswordZodSchema, 37 | }; 38 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-01-06-17-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 01 2023 17:1:27 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 01 2023 17:1:27 } [PH] info: Application listening on port 5000 3 | Thu Jun 01 2023 17:2:34 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 01 2023 17:2:34 } [PH] info: Application listening on port 5000 5 | Thu Jun 01 2023 17:4:20 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 01 2023 17:4:20 } [PH] info: Application listening on port 5000 7 | Thu Jun 01 2023 17:5:4 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 01 2023 17:5:4 } [PH] info: Application listening on port 5000 9 | Thu Jun 01 2023 17:9:38 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 01 2023 17:9:38 } [PH] info: Application listening on port 5000 11 | Thu Jun 01 2023 17:55:49 } [PH] info: 🛢 Database is connected successfully 12 | Thu Jun 01 2023 17:55:49 } [PH] info: Application listening on port 5000 13 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-10-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 10:0:0 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 10:0:0 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 10:0:37 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 10:0:37 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 10:3:12 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 10:3:12 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 10:4:5 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 10:4:5 } [PH] info: Application listening on port 5000 9 | Thu Jun 08 2023 10:6:26 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 08 2023 10:6:26 } [PH] info: Application listening on port 5000 11 | Thu Jun 08 2023 10:6:47 } [PH] info: 🛢 Database is connected successfully 12 | Thu Jun 08 2023 10:6:47 } [PH] info: Application listening on port 5000 13 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-06-03-success.log: -------------------------------------------------------------------------------- 1 | Mon Jun 19 2023 3:32:37 } [PH] info: 🛢 Database is connected successfully 2 | Mon Jun 19 2023 3:32:37 } [PH] info: Application listening on port 5000 3 | Mon Jun 19 2023 3:36:9 } [PH] info: 🛢 Database is connected successfully 4 | Mon Jun 19 2023 3:36:9 } [PH] info: Application listening on port 5000 5 | Mon Jun 19 2023 3:37:55 } [PH] info: 🛢 Database is connected successfully 6 | Mon Jun 19 2023 3:37:55 } [PH] info: Application listening on port 5000 7 | Mon Jun 19 2023 3:38:20 } [PH] info: 🛢 Database is connected successfully 8 | Mon Jun 19 2023 3:38:20 } [PH] info: Application listening on port 5000 9 | Mon Jun 19 2023 3:42:28 } [PH] info: 🛢 Database is connected successfully 10 | Mon Jun 19 2023 3:42:28 } [PH] info: Application listening on port 5000 11 | Mon Jun 19 2023 3:50:47 } [PH] info: 🛢 Database is connected successfully 12 | Mon Jun 19 2023 3:50:47 } [PH] info: Application listening on port 5000 13 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-05-06-21-success.log: -------------------------------------------------------------------------------- 1 | Mon Jun 05 2023 21:38:8 } [PH] info: 🛢 Database is connected successfully 2 | Mon Jun 05 2023 21:38:8 } [PH] info: Application listening on port 5000 3 | Mon Jun 05 2023 21:43:36 } [PH] info: 🛢 Database is connected successfully 4 | Mon Jun 05 2023 21:43:36 } [PH] info: Application listening on port 5000 5 | Mon Jun 05 2023 21:47:18 } [PH] info: 🛢 Database is connected successfully 6 | Mon Jun 05 2023 21:47:18 } [PH] info: Application listening on port 5000 7 | Mon Jun 05 2023 21:47:44 } [PH] info: 🛢 Database is connected successfully 8 | Mon Jun 05 2023 21:47:44 } [PH] info: Application listening on port 5000 9 | Mon Jun 05 2023 21:48:16 } [PH] info: 🛢 Database is connected successfully 10 | Mon Jun 05 2023 21:48:16 } [PH] info: Application listening on port 5000 11 | Mon Jun 05 2023 21:48:25 } [PH] info: 🛢 Database is connected successfully 12 | Mon Jun 05 2023 21:48:25 } [PH] info: Application listening on port 5000 13 | -------------------------------------------------------------------------------- /src/app/modules/offeredCourse/offeredCourse.validation.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | 3 | const create = z.object({ 4 | body: z.object({ 5 | academicDepartmentId: z.string({ 6 | required_error: "Academic Department Id is required" 7 | }), 8 | semesterRegistrationId: z.string({ 9 | required_error: "Semester Reg. is required" 10 | }), 11 | courseIds: z.array( 12 | z.string({ 13 | required_error: "Course Id is required" 14 | }), 15 | { 16 | required_error: "Course Ids are required" 17 | } 18 | ) 19 | }) 20 | }) 21 | 22 | const update = z.object({ 23 | body: z.object({ 24 | semesterRegistrationId: z.string().optional(), 25 | courseId: z.string().optional(), 26 | academicDepartmentId: z.string().optional() 27 | }) 28 | }); 29 | 30 | export const OfferedCourseValidations = { 31 | create, 32 | update 33 | } -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-04-06-17-success.log: -------------------------------------------------------------------------------- 1 | Sun Jun 04 2023 17:39:32 } [PH] info: 🛢 Database is connected successfully 2 | Sun Jun 04 2023 17:39:32 } [PH] info: Application listening on port 5000 3 | Sun Jun 04 2023 17:40:21 } [PH] info: 🛢 Database is connected successfully 4 | Sun Jun 04 2023 17:40:21 } [PH] info: Application listening on port 5000 5 | Sun Jun 04 2023 17:41:45 } [PH] info: 🛢 Database is connected successfully 6 | Sun Jun 04 2023 17:41:45 } [PH] info: Application listening on port 5000 7 | Sun Jun 04 2023 17:42:16 } [PH] info: 🛢 Database is connected successfully 8 | Sun Jun 04 2023 17:42:16 } [PH] info: Application listening on port 5000 9 | Sun Jun 04 2023 17:56:39 } [PH] info: 🛢 Database is connected successfully 10 | Sun Jun 04 2023 17:56:39 } [PH] info: Application listening on port 5000 11 | Sun Jun 04 2023 17:57:29 } [PH] info: 🛢 Database is connected successfully 12 | Sun Jun 04 2023 17:57:29 } [PH] info: Application listening on port 5000 13 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-06-11-success.log: -------------------------------------------------------------------------------- 1 | Mon Jun 19 2023 11:10:43 } [PH] info: 🛢 Database is connected successfully 2 | Mon Jun 19 2023 11:10:43 } [PH] info: Application listening on port 5000 3 | Mon Jun 19 2023 11:11:21 } [PH] info: 🛢 Database is connected successfully 4 | Mon Jun 19 2023 11:11:21 } [PH] info: Application listening on port 5000 5 | Mon Jun 19 2023 11:13:11 } [PH] info: 🛢 Database is connected successfully 6 | Mon Jun 19 2023 11:13:11 } [PH] info: Application listening on port 5000 7 | Mon Jun 19 2023 11:13:37 } [PH] info: 🛢 Database is connected successfully 8 | Mon Jun 19 2023 11:13:37 } [PH] info: Application listening on port 5000 9 | Mon Jun 19 2023 11:15:10 } [PH] info: 🛢 Database is connected successfully 10 | Mon Jun 19 2023 11:15:10 } [PH] info: Application listening on port 5000 11 | Mon Jun 19 2023 11:15:57 } [PH] info: 🛢 Database is connected successfully 12 | Mon Jun 19 2023 11:15:57 } [PH] info: Application listening on port 5000 13 | -------------------------------------------------------------------------------- /src/server.ts: -------------------------------------------------------------------------------- 1 | import { Server } from 'http'; 2 | import app from './app'; 3 | import config from './config'; 4 | import { errorlogger, logger } from './shared/logger'; 5 | 6 | // Server ts 7 | async function bootstrap() { 8 | 9 | const server: Server = app.listen(config.port, () => { 10 | logger.info(`Server running on port ${config.port}`); 11 | }); 12 | 13 | const exitHandler = () => { 14 | 15 | if (server) { 16 | server.close(() => { 17 | logger.info('Server closed'); 18 | }); 19 | } 20 | process.exit(1); 21 | }; 22 | 23 | const unexpectedErrorHandler = (error: unknown) => { 24 | errorlogger.error(error); 25 | exitHandler(); 26 | }; 27 | 28 | process.on('uncaughtException', unexpectedErrorHandler); 29 | process.on('unhandledRejection', unexpectedErrorHandler); 30 | 31 | process.on('SIGTERM', () => { 32 | logger.info('SIGTERM received'); 33 | if (server) { 34 | server.close(); 35 | } 36 | }); 37 | } 38 | 39 | bootstrap(); -------------------------------------------------------------------------------- /src/app/modules/auth/auth.route.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { AuthController } from './auth.controller'; 6 | import { AuthValidation } from './auth.validation'; 7 | const router = express.Router(); 8 | // Auth Route 9 | router.post( 10 | '/login', 11 | validateRequest(AuthValidation.loginZodSchema), 12 | AuthController.loginUser 13 | ); 14 | 15 | router.post( 16 | '/refresh-token', 17 | validateRequest(AuthValidation.refreshTokenZodSchema), 18 | AuthController.refreshToken 19 | ); 20 | 21 | router.post( 22 | '/change-password', 23 | validateRequest(AuthValidation.changePasswordZodSchema), 24 | auth( 25 | ENUM_USER_ROLE.SUPER_ADMIN, 26 | ENUM_USER_ROLE.ADMIN, 27 | ENUM_USER_ROLE.FACULTY, 28 | ENUM_USER_ROLE.STUDENT 29 | ), 30 | AuthController.changePassword 31 | ); 32 | 33 | export const AuthRoutes = router; 34 | -------------------------------------------------------------------------------- /src/app/modules/admin/admin.route.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { AdminController } from './admin.controller'; 6 | import { AdminValidation } from './admin.validation'; 7 | const router = express.Router(); 8 | // admin route 9 | router.get( 10 | '/:id', 11 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 12 | AdminController.getSingleAdmin 13 | ); 14 | router.get( 15 | '/', 16 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 17 | AdminController.getAllAdmins 18 | ); 19 | 20 | router.patch( 21 | '/:id', 22 | validateRequest(AdminValidation.updateAdmin), 23 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 24 | AdminController.updateAdmin 25 | ); 26 | 27 | router.delete( 28 | '/:id', 29 | auth(ENUM_USER_ROLE.SUPER_ADMIN), 30 | AdminController.deleteAdmin 31 | ); 32 | 33 | export const AdminRoutes = router; 34 | -------------------------------------------------------------------------------- /src/app.ts: -------------------------------------------------------------------------------- 1 | import cors from 'cors'; 2 | import express, { Application, NextFunction, Request, Response } from 'express'; 3 | import httpStatus from 'http-status'; 4 | import globalErrorHandler from './app/middlewares/globalErrorHandler'; 5 | import routes from './app/routes'; 6 | // apps js 7 | import cookieParser from 'cookie-parser'; 8 | 9 | const app: Application = express(); 10 | 11 | app.use(cors()); 12 | app.use(cookieParser()); 13 | 14 | //parser 15 | app.use(express.json()); 16 | app.use(express.urlencoded({ extended: true })); 17 | 18 | app.use('/api/v1', routes); 19 | 20 | 21 | //global error handler 22 | app.use(globalErrorHandler); 23 | 24 | //handle not found 25 | app.use((req: Request, res: Response, next: NextFunction) => { 26 | res.status(httpStatus.NOT_FOUND).json({ 27 | success: false, 28 | message: 'Not Found', 29 | errorMessages: [ 30 | { 31 | path: req.originalUrl, 32 | message: 'API Not Found', 33 | }, 34 | ], 35 | }); 36 | next(); 37 | }); 38 | 39 | export default app; 40 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-22-08-23-success.log: -------------------------------------------------------------------------------- 1 | Tue Aug 22 2023 23:2:0 } [PH] info: SIGTERM received 2 | Tue Aug 22 2023 23:2:0 } [PH] info: Server running on port 5001 3 | Tue Aug 22 2023 23:6:52 } [PH] info: SIGTERM received 4 | Tue Aug 22 2023 23:6:53 } [PH] info: Server running on port 5001 5 | Tue Aug 22 2023 23:8:35 } [PH] info: SIGTERM received 6 | Tue Aug 22 2023 23:8:35 } [PH] info: Server running on port 5001 7 | Tue Aug 22 2023 23:11:24 } [PH] info: SIGTERM received 8 | Tue Aug 22 2023 23:11:24 } [PH] info: Server running on port 5001 9 | Tue Aug 22 2023 23:12:7 } [PH] info: SIGTERM received 10 | Tue Aug 22 2023 23:12:7 } [PH] info: Server running on port 5001 11 | Tue Aug 22 2023 23:14:1 } [PH] info: SIGTERM received 12 | Tue Aug 22 2023 23:14:1 } [PH] info: Server running on port 5001 13 | Tue Aug 22 2023 23:15:4 } [PH] info: SIGTERM received 14 | Tue Aug 22 2023 23:15:4 } [PH] info: Server running on port 5001 15 | Tue Aug 22 2023 23:15:51 } [PH] info: SIGTERM received 16 | Tue Aug 22 2023 23:15:51 } [PH] info: Server running on port 5001 17 | -------------------------------------------------------------------------------- /prisma/migrations/20230822165213_offered_course_section/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "offered_course_sections" ( 3 | "id" TEXT NOT NULL, 4 | "title" TEXT NOT NULL, 5 | "maxCapacity" INTEGER NOT NULL, 6 | "currentlyEnrolledStudent" INTEGER NOT NULL DEFAULT 0, 7 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 8 | "updatedAt" TIMESTAMP(3) NOT NULL, 9 | "offeredCourseId" TEXT NOT NULL, 10 | "semesterRegistrationId" TEXT NOT NULL, 11 | 12 | CONSTRAINT "offered_course_sections_pkey" PRIMARY KEY ("id") 13 | ); 14 | 15 | -- AddForeignKey 16 | ALTER TABLE "offered_course_sections" ADD CONSTRAINT "offered_course_sections_offeredCourseId_fkey" FOREIGN KEY ("offeredCourseId") REFERENCES "offered_courses"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 17 | 18 | -- AddForeignKey 19 | ALTER TABLE "offered_course_sections" ADD CONSTRAINT "offered_course_sections_semesterRegistrationId_fkey" FOREIGN KEY ("semesterRegistrationId") REFERENCES "semester_registrations"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 20 | -------------------------------------------------------------------------------- /src/app/modules/academicSemester/academicSemster.validation.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | 3 | const create = z.object({ 4 | body: z.object({ 5 | year: z.number({ 6 | required_error: "Year is required" 7 | }), 8 | title: z.string({ 9 | required_error: "Title is required" 10 | }), 11 | code: z.string({ 12 | required_error: "Code is required" 13 | }), 14 | startMonth: z.string({ 15 | required_error: "Start month is required" 16 | }), 17 | endMonth: z.string({ 18 | required_error: "End month is required" 19 | }) 20 | }) 21 | }) 22 | 23 | const update = z.object({ 24 | body: z.object({ 25 | title: z.string().optional(), 26 | code: z.string().optional(), 27 | year: z.number().optional(), 28 | startMonth: z.string().optional(), 29 | endMonth: z.string().optional() 30 | }) 31 | }); 32 | 33 | export const AcademicSemesterValidation = { 34 | create, 35 | update 36 | } -------------------------------------------------------------------------------- /src/app/modules/user/user.route.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { UserController } from './user.controller'; 6 | import { UserValidation } from './user.validation'; 7 | const router = express.Router(); 8 | 9 | router.post( 10 | '/create-student', 11 | validateRequest(UserValidation.createStudentZodSchema), 12 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 13 | UserController.createStudent 14 | ); 15 | 16 | router.post( 17 | '/create-faculty', 18 | validateRequest(UserValidation.createFacultyZodSchema), 19 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 20 | UserController.createFaculy 21 | ); 22 | 23 | router.post( 24 | '/create-admin', 25 | validateRequest(UserValidation.createAdminZodSchema), 26 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 27 | UserController.createAdmin 28 | ); 29 | 30 | export const UserRoutes = router; 31 | -------------------------------------------------------------------------------- /prisma/migrations/20230813162821_course/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "courses" ( 3 | "id" TEXT NOT NULL, 4 | "title" TEXT NOT NULL, 5 | "code" TEXT NOT NULL, 6 | "credits" INTEGER NOT NULL DEFAULT 0, 7 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 8 | "updatedAt" TIMESTAMP(3) NOT NULL, 9 | 10 | CONSTRAINT "courses_pkey" PRIMARY KEY ("id") 11 | ); 12 | 13 | -- CreateTable 14 | CREATE TABLE "CourseToPrerequisite" ( 15 | "courseId" TEXT NOT NULL, 16 | "preRequisiteId" TEXT NOT NULL, 17 | 18 | CONSTRAINT "CourseToPrerequisite_pkey" PRIMARY KEY ("courseId","preRequisiteId") 19 | ); 20 | 21 | -- AddForeignKey 22 | ALTER TABLE "CourseToPrerequisite" ADD CONSTRAINT "CourseToPrerequisite_courseId_fkey" FOREIGN KEY ("courseId") REFERENCES "courses"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 23 | 24 | -- AddForeignKey 25 | ALTER TABLE "CourseToPrerequisite" ADD CONSTRAINT "CourseToPrerequisite_preRequisiteId_fkey" FOREIGN KEY ("preRequisiteId") REFERENCES "courses"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 26 | -------------------------------------------------------------------------------- /src/app/modules/room/room.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { RoomController } from './room.controller'; 6 | import { RoomValidation } from './room.validations'; 7 | 8 | const router = express.Router(); 9 | 10 | router.get('/', RoomController.getAllFromDB); 11 | router.get('/:id', RoomController.getByIdFromDB); 12 | 13 | router.post( 14 | '/', 15 | validateRequest(RoomValidation.create), 16 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 17 | RoomController.insertIntoDB 18 | ); 19 | 20 | router.patch( 21 | '/:id', 22 | validateRequest(RoomValidation.update), 23 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 24 | RoomController.updateOneInDB 25 | ); 26 | 27 | router.delete( 28 | '/:id', 29 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 30 | RoomController.deleteByIdFromDB 31 | ); 32 | 33 | 34 | export const roomRoutes = router; -------------------------------------------------------------------------------- /prisma/migrations/20230822152644_offered_couse/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "offered_courses" ( 3 | "id" TEXT NOT NULL, 4 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 5 | "updatedAt" TIMESTAMP(3) NOT NULL, 6 | "courseId" TEXT NOT NULL, 7 | "academicDepartmentId" TEXT NOT NULL, 8 | "semesterRegistrationId" TEXT NOT NULL, 9 | 10 | CONSTRAINT "offered_courses_pkey" PRIMARY KEY ("id") 11 | ); 12 | 13 | -- AddForeignKey 14 | ALTER TABLE "offered_courses" ADD CONSTRAINT "offered_courses_courseId_fkey" FOREIGN KEY ("courseId") REFERENCES "courses"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 15 | 16 | -- AddForeignKey 17 | ALTER TABLE "offered_courses" ADD CONSTRAINT "offered_courses_academicDepartmentId_fkey" FOREIGN KEY ("academicDepartmentId") REFERENCES "academic_departments"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 18 | 19 | -- AddForeignKey 20 | ALTER TABLE "offered_courses" ADD CONSTRAINT "offered_courses_semesterRegistrationId_fkey" FOREIGN KEY ("semesterRegistrationId") REFERENCES "semester_registrations"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 21 | -------------------------------------------------------------------------------- /prisma/migrations/20230822154129_add_offered_course/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "offered_courses" ( 3 | "id" TEXT NOT NULL, 4 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 5 | "updatedAt" TIMESTAMP(3) NOT NULL, 6 | "courseId" TEXT NOT NULL, 7 | "academicDepartmentId" TEXT NOT NULL, 8 | "semesterRegistrationId" TEXT NOT NULL, 9 | 10 | CONSTRAINT "offered_courses_pkey" PRIMARY KEY ("id") 11 | ); 12 | 13 | -- AddForeignKey 14 | ALTER TABLE "offered_courses" ADD CONSTRAINT "offered_courses_courseId_fkey" FOREIGN KEY ("courseId") REFERENCES "courses"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 15 | 16 | -- AddForeignKey 17 | ALTER TABLE "offered_courses" ADD CONSTRAINT "offered_courses_academicDepartmentId_fkey" FOREIGN KEY ("academicDepartmentId") REFERENCES "academic_departments"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 18 | 19 | -- AddForeignKey 20 | ALTER TABLE "offered_courses" ADD CONSTRAINT "offered_courses_semesterRegistrationId_fkey" FOREIGN KEY ("semesterRegistrationId") REFERENCES "semester_registrations"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 21 | -------------------------------------------------------------------------------- /src/app/modules/student/student.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { StudentController } from './student.controller'; 6 | import { StudentValidation } from './student.validations'; 7 | 8 | const router = express.Router(); 9 | 10 | router.get('/', 11 | StudentController.getAllFromDB); 12 | 13 | router.get('/:id', StudentController.getByIdFromDB); 14 | 15 | router.post( 16 | '/', 17 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 18 | validateRequest(StudentValidation.create), 19 | StudentController.insertIntoDB 20 | ); 21 | 22 | router.patch( 23 | '/:id', 24 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 25 | validateRequest(StudentValidation.update), 26 | StudentController.updateIntoDB) 27 | 28 | router.delete( 29 | '/:id', 30 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 31 | StudentController.deleteFromDB); 32 | 33 | export const studentRoutes = router; -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-14-08-19-success.log: -------------------------------------------------------------------------------- 1 | Mon Aug 14 2023 19:10:45 } [PH] info: Server running on port 5001 2 | Mon Aug 14 2023 19:15:47 } [PH] info: SIGTERM received 3 | Mon Aug 14 2023 19:15:48 } [PH] info: Server running on port 5001 4 | Mon Aug 14 2023 19:16:21 } [PH] info: SIGTERM received 5 | Mon Aug 14 2023 19:16:21 } [PH] info: Server running on port 5001 6 | Mon Aug 14 2023 19:16:43 } [PH] info: SIGTERM received 7 | Mon Aug 14 2023 19:16:43 } [PH] info: Server running on port 5001 8 | Mon Aug 14 2023 19:20:54 } [PH] info: SIGTERM received 9 | Mon Aug 14 2023 19:20:54 } [PH] info: Server running on port 5001 10 | Mon Aug 14 2023 19:24:46 } [PH] info: SIGTERM received 11 | Mon Aug 14 2023 19:24:46 } [PH] info: Server running on port 5001 12 | Mon Aug 14 2023 19:26:51 } [PH] info: SIGTERM received 13 | Mon Aug 14 2023 19:26:52 } [PH] info: Server running on port 5001 14 | Mon Aug 14 2023 19:27:20 } [PH] info: SIGTERM received 15 | Mon Aug 14 2023 19:27:20 } [PH] info: Server running on port 5001 16 | Mon Aug 14 2023 19:38:12 } [PH] info: SIGTERM received 17 | Mon Aug 14 2023 19:38:12 } [PH] info: Server running on port 5001 18 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Hazrat Ali 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/app/modules/academicSemester/academicSemester.constant.ts: -------------------------------------------------------------------------------- 1 | import { 2 | IAcademicSemesterCodes, 3 | IAcademicSemesterMonths, 4 | IAcademicSemesterTitles, 5 | } from './academicSemester.interface'; 6 | // semester academy 7 | export const academicSemesterTitles: IAcademicSemesterTitles[] = [ 8 | 'Autumn', 9 | 'Summer', 10 | 'Fall', 11 | ]; 12 | 13 | export const academicSemesterCodes: IAcademicSemesterCodes[] = [ 14 | '01', 15 | '02', 16 | '03', 17 | ]; 18 | 19 | export const acdemicSemesterMonths: IAcademicSemesterMonths[] = [ 20 | 'January', 21 | 'February', 22 | 'March', 23 | 'April', 24 | 'May', 25 | 'June', 26 | 'July', 27 | 'August', 28 | 'September', 29 | 'October', 30 | 'November', 31 | 'December', 32 | ]; 33 | 34 | export const academicSemesterTitleCodeMapper: { 35 | [key: string]: string; 36 | } = { 37 | Autumn: '01', 38 | Summer: '02', 39 | Fall: '03', 40 | }; 41 | 42 | export const academicSemesterSearchableFields = ['title', 'code', 'year']; 43 | 44 | export const academicSemesterFilterableFields = [ 45 | 'searchTerm', 46 | 'title', 47 | 'code', 48 | 'year', 49 | ]; 50 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-04-06-20-success.log: -------------------------------------------------------------------------------- 1 | Sun Jun 04 2023 20:7:42 } [PH] info: 🛢 Database is connected successfully 2 | Sun Jun 04 2023 20:7:42 } [PH] info: Application listening on port 5000 3 | Sun Jun 04 2023 20:22:43 } [PH] info: 🛢 Database is connected successfully 4 | Sun Jun 04 2023 20:22:43 } [PH] info: Application listening on port 5000 5 | Sun Jun 04 2023 20:27:0 } [PH] info: 🛢 Database is connected successfully 6 | Sun Jun 04 2023 20:27:0 } [PH] info: Application listening on port 5000 7 | Sun Jun 04 2023 20:31:2 } [PH] info: 🛢 Database is connected successfully 8 | Sun Jun 04 2023 20:31:2 } [PH] info: Application listening on port 5000 9 | Sun Jun 04 2023 20:31:21 } [PH] info: 🛢 Database is connected successfully 10 | Sun Jun 04 2023 20:31:21 } [PH] info: Application listening on port 5000 11 | Sun Jun 04 2023 20:40:29 } [PH] info: 🛢 Database is connected successfully 12 | Sun Jun 04 2023 20:40:29 } [PH] info: Application listening on port 5000 13 | Sun Jun 04 2023 20:42:50 } [PH] info: 🛢 Database is connected successfully 14 | Sun Jun 04 2023 20:42:50 } [PH] info: Application listening on port 5000 15 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-20-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 20:12:7 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 20:12:7 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 20:12:25 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 20:12:25 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 20:12:38 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 20:12:38 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 20:12:53 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 20:12:53 } [PH] info: Application listening on port 5000 9 | Thu Jun 08 2023 20:15:53 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 08 2023 20:15:53 } [PH] info: Application listening on port 5000 11 | Thu Jun 08 2023 20:16:16 } [PH] info: 🛢 Database is connected successfully 12 | Thu Jun 08 2023 20:16:16 } [PH] info: Application listening on port 5000 13 | Thu Jun 08 2023 20:17:0 } [PH] info: 🛢 Database is connected successfully 14 | Thu Jun 08 2023 20:17:0 } [PH] info: Application listening on port 5000 15 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-17-06-10-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 17 2023 10:3:32 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 17 2023 10:3:32 } [PH] info: Application listening on port 5000 3 | Sat Jun 17 2023 10:7:39 } [PH] info: 🛢 Database is connected successfully 4 | Sat Jun 17 2023 10:7:39 } [PH] info: Application listening on port 5000 5 | Sat Jun 17 2023 10:12:23 } [PH] info: 🛢 Database is connected successfully 6 | Sat Jun 17 2023 10:12:23 } [PH] info: Application listening on port 5000 7 | Sat Jun 17 2023 10:12:31 } [PH] info: 🛢 Database is connected successfully 8 | Sat Jun 17 2023 10:12:31 } [PH] info: Application listening on port 5000 9 | Sat Jun 17 2023 10:15:18 } [PH] info: 🛢 Database is connected successfully 10 | Sat Jun 17 2023 10:15:18 } [PH] info: Application listening on port 5000 11 | Sat Jun 17 2023 10:15:43 } [PH] info: 🛢 Database is connected successfully 12 | Sat Jun 17 2023 10:15:43 } [PH] info: Application listening on port 5000 13 | Sat Jun 17 2023 10:20:55 } [PH] info: 🛢 Database is connected successfully 14 | Sat Jun 17 2023 10:20:55 } [PH] info: Application listening on port 5000 15 | -------------------------------------------------------------------------------- /src/app/modules/academicSemester/academicSemester.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { AcademicSemeterController } from './academicSemster.controller'; 6 | import { AcademicSemesterValidation } from './academicSemster.validation'; 7 | const router = express.Router(); 8 | 9 | router.get('/', AcademicSemeterController.getAllFromDB) 10 | router.get('/:id', AcademicSemeterController.getDataById) 11 | router.post( 12 | '/', 13 | validateRequest(AcademicSemesterValidation.create), 14 | AcademicSemeterController.insertIntoDB 15 | ) 16 | 17 | router.patch( 18 | '/:id', 19 | validateRequest(AcademicSemesterValidation.update), 20 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 21 | AcademicSemeterController.updateOneInDB 22 | ); 23 | 24 | router.delete( 25 | '/:id', 26 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 27 | AcademicSemeterController.deleteByIdFromDB 28 | ); 29 | 30 | export const AcademicSemeterRoutes = router; -------------------------------------------------------------------------------- /src/app/modules/building/building.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { BuildingController } from './building.controller'; 6 | import { BuildingValidations } from './building.validations'; 7 | //building routes 8 | const router = express.Router(); 9 | 10 | router.get('/', BuildingController.getAllFromDB); 11 | router.get('/:id', BuildingController.getByIdFromDB); 12 | 13 | router.post( 14 | '/', 15 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 16 | validateRequest(BuildingValidations.create), 17 | BuildingController.insertIntoDB); 18 | 19 | 20 | router.patch( 21 | '/:id', 22 | validateRequest(BuildingValidations.update), 23 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 24 | BuildingController.updateOneInDB 25 | ); 26 | 27 | router.delete( 28 | '/:id', 29 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 30 | BuildingController.deleteByIdFromDB 31 | ); 32 | 33 | export const buildingRoutes = router; -------------------------------------------------------------------------------- /src/errors/handleClientError.ts: -------------------------------------------------------------------------------- 1 | import { Prisma } from '@prisma/client'; 2 | import { IGenericErrorMessage } from '../interfaces/error'; 3 | 4 | const handleClientError = (error: Prisma.PrismaClientKnownRequestError) => { 5 | let errors: IGenericErrorMessage[] = []; 6 | let message = "" 7 | const statusCode = 400; 8 | 9 | if (error.code === 'P2025') { 10 | message = (error.meta?.cause as string) || "Record not found!" 11 | errors = [ 12 | { 13 | path: "", 14 | message 15 | } 16 | ] 17 | } 18 | else if (error.code === 'P2003') { 19 | if (error.message.includes('delete()` invocation:')) { 20 | message = "Delete failed" 21 | errors = [ 22 | { 23 | path: "", 24 | message 25 | } 26 | ] 27 | } 28 | } 29 | 30 | return { 31 | statusCode, 32 | message, 33 | errorMessages: errors, 34 | }; 35 | }; 36 | 37 | export default handleClientError; 38 | 39 | //"//\nInvalid `prisma.semesterRegistration.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.", 40 | -------------------------------------------------------------------------------- /src/app/modules/faculty/faculty.route.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { FacultyController } from './faculty.controller'; 6 | import { FacultyValidation } from './faculty.validations'; 7 | 8 | const router = express.Router(); 9 | 10 | router.get( 11 | '/:id', 12 | auth( 13 | ENUM_USER_ROLE.SUPER_ADMIN, 14 | ENUM_USER_ROLE.ADMIN, 15 | ENUM_USER_ROLE.FACULTY 16 | ), 17 | FacultyController.getSingleFaculty 18 | ); 19 | 20 | router.get( 21 | '/', 22 | auth( 23 | ENUM_USER_ROLE.SUPER_ADMIN, 24 | ENUM_USER_ROLE.ADMIN, 25 | ENUM_USER_ROLE.FACULTY 26 | ), 27 | FacultyController.getAllFaculties 28 | ); 29 | 30 | router.patch( 31 | '/:id', 32 | validateRequest(FacultyValidation.updateFacultyZodSchema), 33 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 34 | FacultyController.updateFaculty 35 | ); 36 | 37 | router.delete( 38 | '/:id', 39 | auth(ENUM_USER_ROLE.SUPER_ADMIN), 40 | FacultyController.deleteFaculty 41 | ); 42 | 43 | export const FacultyRoutes = router; 44 | -------------------------------------------------------------------------------- /src/app/modules/offeredCourse/offeredCourse.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { OfferedCourseController } from './offeredCourse.controller'; 6 | import { OfferedCourseValidations } from './offeredCourse.validation'; 7 | 8 | const router = express.Router(); 9 | 10 | router.get('/', OfferedCourseController.getAllFromDB); 11 | router.get('/:id', OfferedCourseController.getByIdFromDB); 12 | 13 | router.post( 14 | '/', 15 | validateRequest(OfferedCourseValidations.create), 16 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 17 | OfferedCourseController.insertIntoDB 18 | ); 19 | 20 | router.patch( 21 | '/:id', 22 | validateRequest(OfferedCourseValidations.update), 23 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 24 | OfferedCourseController.updateOneInDB 25 | ); 26 | 27 | router.delete( 28 | '/:id', 29 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 30 | OfferedCourseController.deleteByIdFromDB 31 | ); 32 | 33 | export const offeredCourseRoutes = router; -------------------------------------------------------------------------------- /src/app/middlewares/auth.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction, Request, Response } from 'express'; 2 | import httpStatus from 'http-status'; 3 | import { Secret } from 'jsonwebtoken'; 4 | import config from '../../config'; 5 | import ApiError from '../../errors/ApiError'; 6 | import { jwtHelpers } from '../../helpers/jwtHelpers'; 7 | // Auth Require 8 | const auth = 9 | (...requiredRoles: string[]) => 10 | async (req: Request, res: Response, next: NextFunction) => { 11 | try { 12 | //get authorization token 13 | const token = req.headers.authorization; 14 | if (!token) { 15 | throw new ApiError(httpStatus.UNAUTHORIZED, 'You are not authorized'); 16 | } 17 | // verify token 18 | let verifiedUser = null; 19 | 20 | verifiedUser = jwtHelpers.verifyToken(token, config.jwt.secret as Secret); 21 | 22 | req.user = verifiedUser; // role , userid 23 | 24 | // role diye guard korar jnno 25 | if (requiredRoles.length && !requiredRoles.includes(verifiedUser.role)) { 26 | throw new ApiError(httpStatus.FORBIDDEN, 'Forbidden'); 27 | } 28 | next(); 29 | } catch (error) { 30 | next(error); 31 | } 32 | }; 33 | 34 | export default auth; 35 | -------------------------------------------------------------------------------- /src/app/modules/admin/admin.interface.ts: -------------------------------------------------------------------------------- 1 | import { Model, Types } from 'mongoose'; 2 | import { IManagementDepartment } from '../managementDepartment/managementDepartment.inerface'; 3 | // Admin Interface 4 | export type UserName = { 5 | firstName: string; 6 | lastName: string; 7 | middleName: string; 8 | }; 9 | 10 | export type IAdmin = { 11 | id: string; 12 | name: UserName; 13 | profileImage: string; 14 | dateOfBirth?: string; 15 | email: string; 16 | contactNo: string; 17 | emergencyContactNo: string; 18 | gender?: 'male' | 'female'; 19 | permanentAddress?: string; 20 | presentAddress?: string; 21 | bloodGroup?: 'A+' | 'A-' | 'B+' | 'B-' | 'AB+' | 'AB-' | 'O+' | 'O-'; 22 | managementDepartment: Types.ObjectId | IManagementDepartment; 23 | designation: string; 24 | }; 25 | 26 | export type AdminModel = Model>; 27 | 28 | export type IAdminFilters = { 29 | searchTerm?: string; 30 | id?: string; 31 | email?: string; 32 | contactNo?: string; 33 | emergencyContactNo?: string; 34 | gender?: 'male' | 'female'; 35 | bloodGroup?: 'A+' | 'A-' | 'B+' | 'B-' | 'AB+' | 'AB-' | 'O+' | 'O-'; 36 | managementDepartment?: string; 37 | designation?: string; 38 | }; 39 | -------------------------------------------------------------------------------- /src/app/modules/academicFaculty/academicFaculty.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { AcademicFacultyController } from './academicFaculty.contoller'; 6 | import { AcademicFacultyValidation } from './academicFaculty.validation'; 7 | 8 | 9 | const router = express.Router(); 10 | 11 | router.get('/', AcademicFacultyController.getAllFromDB); 12 | router.get('/:id', AcademicFacultyController.getByIdFromDB); 13 | 14 | router.post( 15 | '/', 16 | validateRequest(AcademicFacultyValidation.create), 17 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 18 | AcademicFacultyController.insertIntoDB 19 | ); 20 | 21 | router.patch( 22 | '/:id', 23 | validateRequest(AcademicFacultyValidation.update), 24 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 25 | AcademicFacultyController.updateOneInDB 26 | ); 27 | 28 | router.delete( 29 | '/:id', 30 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 31 | AcademicFacultyController.deleteByIdFromDB 32 | ); 33 | 34 | export const academicFacultyRoutes = router; -------------------------------------------------------------------------------- /src/app/modules/academicDepartment/academicDepartment.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { AcademicDepartmentController } from './academicDepartment.controller'; 6 | import { AcademicDepartmentValidation } from './academicDepartment.validations'; 7 | 8 | const router = express.Router(); 9 | 10 | router.get('/', AcademicDepartmentController.getAllFromDB); 11 | router.get('/:id', AcademicDepartmentController.getByIdFromDB); 12 | 13 | router.post( 14 | '/', 15 | validateRequest(AcademicDepartmentValidation.create), 16 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 17 | AcademicDepartmentController.insertIntoDB 18 | ); 19 | 20 | router.patch( 21 | '/:id', 22 | validateRequest(AcademicDepartmentValidation.update), 23 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 24 | AcademicDepartmentController.updateOneInDB 25 | ); 26 | 27 | router.delete( 28 | '/:id', 29 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 30 | AcademicDepartmentController.deleteByIdFromDB 31 | ); 32 | 33 | 34 | export const academicDepartmentRoutes = router; -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-07-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 7:37:25 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 7:37:25 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 7:39:40 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 7:39:40 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 7:42:41 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 7:42:41 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 7:44:54 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 7:44:54 } [PH] info: Application listening on port 5000 9 | Thu Jun 08 2023 7:49:9 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 08 2023 7:49:9 } [PH] info: Application listening on port 5000 11 | Thu Jun 08 2023 7:49:36 } [PH] info: 🛢 Database is connected successfully 12 | Thu Jun 08 2023 7:49:36 } [PH] info: Application listening on port 5000 13 | Thu Jun 08 2023 7:56:36 } [PH] info: 🛢 Database is connected successfully 14 | Thu Jun 08 2023 7:56:36 } [PH] info: Application listening on port 5000 15 | Thu Jun 08 2023 7:58:41 } [PH] info: 🛢 Database is connected successfully 16 | Thu Jun 08 2023 7:58:41 } [PH] info: Application listening on port 5000 17 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-06-08-success.log: -------------------------------------------------------------------------------- 1 | Mon Jun 19 2023 8:11:20 } [PH] info: 🛢 Database is connected successfully 2 | Mon Jun 19 2023 8:11:20 } [PH] info: Application listening on port 5000 3 | Mon Jun 19 2023 8:11:30 } [PH] info: 🛢 Database is connected successfully 4 | Mon Jun 19 2023 8:11:30 } [PH] info: Application listening on port 5000 5 | Mon Jun 19 2023 8:11:49 } [PH] info: 🛢 Database is connected successfully 6 | Mon Jun 19 2023 8:11:49 } [PH] info: Application listening on port 5000 7 | Mon Jun 19 2023 8:13:0 } [PH] info: 🛢 Database is connected successfully 8 | Mon Jun 19 2023 8:13:0 } [PH] info: Application listening on port 5000 9 | Mon Jun 19 2023 8:13:17 } [PH] info: 🛢 Database is connected successfully 10 | Mon Jun 19 2023 8:13:17 } [PH] info: Application listening on port 5000 11 | Mon Jun 19 2023 8:13:28 } [PH] info: 🛢 Database is connected successfully 12 | Mon Jun 19 2023 8:13:28 } [PH] info: Application listening on port 5000 13 | Mon Jun 19 2023 8:13:46 } [PH] info: 🛢 Database is connected successfully 14 | Mon Jun 19 2023 8:13:46 } [PH] info: Application listening on port 5000 15 | Mon Jun 19 2023 8:14:35 } [PH] info: 🛢 Database is connected successfully 16 | Mon Jun 19 2023 8:14:35 } [PH] info: Application listening on port 5000 17 | -------------------------------------------------------------------------------- /src/app/modules/offeredCourseSection/offeredCourseSection.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { OfferedCourseSectionController } from './offeredCourseSection.controller'; 6 | import { OfferedCourseSectionValidation } from './offeredCourseSection.validation'; 7 | 8 | const router = express.Router(); 9 | 10 | router.get('/', OfferedCourseSectionController.getAllFromDB); 11 | router.get('/:id', OfferedCourseSectionController.getByIdFromDB); 12 | 13 | router.post( 14 | '/', 15 | validateRequest(OfferedCourseSectionValidation.create), 16 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 17 | OfferedCourseSectionController.insertIntoDB 18 | ); 19 | 20 | router.patch( 21 | '/:id', 22 | validateRequest(OfferedCourseSectionValidation.update), 23 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 24 | OfferedCourseSectionController.updateOneInDB 25 | ); 26 | 27 | router.delete( 28 | '/:id', 29 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 30 | OfferedCourseSectionController.deleteByIdFromDB 31 | ); 32 | 33 | export const offeredCourseSectionRoutes = router; -------------------------------------------------------------------------------- /src/app/modules/semesterRegistration/semesterRegistration.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { SemesterRegistrationController } from './semesterRegistration.controller'; 6 | import { SemesterRegistrationValidation } from './semesterRegistration.validations'; 7 | 8 | const router = express.Router(); 9 | 10 | router.get('/', SemesterRegistrationController.getAllFromDB); 11 | router.get('/:id', SemesterRegistrationController.getByIdFromDB); 12 | 13 | router.post( 14 | '/', 15 | validateRequest(SemesterRegistrationValidation.create), 16 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 17 | SemesterRegistrationController.insertIntoDB 18 | ); 19 | 20 | router.patch( 21 | '/:id', 22 | validateRequest(SemesterRegistrationValidation.update), 23 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 24 | SemesterRegistrationController.updateOneInDB 25 | ); 26 | 27 | router.delete( 28 | '/:id', 29 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 30 | SemesterRegistrationController.deleteByIdFromDB 31 | ); 32 | 33 | export const semesterRegistrationRoutes = router; -------------------------------------------------------------------------------- /src/app/modules/student/student.route.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { StudentController } from './student.controller'; 6 | import { StudentValidaion } from './student.validation'; 7 | const router = express.Router(); 8 | 9 | router.get( 10 | '/:id', 11 | auth( 12 | ENUM_USER_ROLE.SUPER_ADMIN, 13 | ENUM_USER_ROLE.ADMIN, 14 | ENUM_USER_ROLE.FACULTY, 15 | ENUM_USER_ROLE.FACULTY, 16 | ENUM_USER_ROLE.STUDENT 17 | ), 18 | StudentController.getSingleStudent 19 | ); 20 | router.delete( 21 | '/:id', 22 | auth(ENUM_USER_ROLE.SUPER_ADMIN), 23 | StudentController.deleteStudent 24 | ); 25 | 26 | router.patch( 27 | '/:id', 28 | validateRequest(StudentValidaion.updateStudentZodSchema), 29 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 30 | StudentController.updateStudent 31 | ); 32 | router.get( 33 | '/', 34 | auth( 35 | ENUM_USER_ROLE.SUPER_ADMIN, 36 | ENUM_USER_ROLE.ADMIN, 37 | ENUM_USER_ROLE.FACULTY, 38 | ENUM_USER_ROLE.FACULTY, 39 | ENUM_USER_ROLE.STUDENT 40 | ), 41 | StudentController.getAllStudents 42 | ); 43 | 44 | export const StudentRoutes = router; 45 | -------------------------------------------------------------------------------- /src/app/modules/semesterRegistration/semesterRegistration.validations.ts: -------------------------------------------------------------------------------- 1 | import { SemesterRegistrationStatus } from '@prisma/client'; 2 | import { z } from 'zod'; 3 | 4 | const create = z.object({ 5 | body: z.object({ 6 | startDate: z.string({ 7 | required_error: 'Start date is required' 8 | }), 9 | endDate: z.string({ 10 | required_error: 'End date is required' 11 | }), 12 | academicSemesterId: z.string({ 13 | required_error: 'Academic semester id is required' 14 | }), 15 | minCredit: z.number({ 16 | required_error: 'Min credit is required' 17 | }), 18 | maxCredit: z.number({ 19 | required_error: 'Max credit is required' 20 | }) 21 | }) 22 | }); 23 | 24 | const update = z.object({ 25 | body: z.object({ 26 | startDate: z.string().optional(), 27 | endDate: z.string().optional(), 28 | academicSemesterId: z.string().optional(), 29 | minCredit: z.number().optional(), 30 | maxCredit: z.number().optional(), 31 | status: z.enum([...Object.values(SemesterRegistrationStatus)] as [string, ...string[]], {}).optional() 32 | }) 33 | }); 34 | 35 | export const SemesterRegistrationValidation = { 36 | create, 37 | update 38 | }; -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-06-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 6:0:56 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 6:0:56 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 6:1:33 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 6:1:33 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 6:1:48 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 6:1:48 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 6:2:59 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 6:2:59 } [PH] info: Application listening on port 5000 9 | Thu Jun 08 2023 6:4:50 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 08 2023 6:4:50 } [PH] info: Application listening on port 5000 11 | Thu Jun 08 2023 6:5:21 } [PH] info: 🛢 Database is connected successfully 12 | Thu Jun 08 2023 6:5:21 } [PH] info: Application listening on port 5000 13 | Thu Jun 08 2023 6:10:53 } [PH] info: 🛢 Database is connected successfully 14 | Thu Jun 08 2023 6:10:53 } [PH] info: Application listening on port 5000 15 | Thu Jun 08 2023 6:11:2 } [PH] info: 🛢 Database is connected successfully 16 | Thu Jun 08 2023 6:11:2 } [PH] info: Application listening on port 5000 17 | Thu Jun 08 2023 6:12:24 } [PH] info: 🛢 Database is connected successfully 18 | Thu Jun 08 2023 6:12:24 } [PH] info: Application listening on port 5000 19 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-01-06-11-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 01 2023 11:32:8 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 01 2023 11:32:8 } [PH] info: Application listening on port 5000 3 | Thu Jun 01 2023 11:33:47 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 01 2023 11:33:47 } [PH] info: Application listening on port 5000 5 | Thu Jun 01 2023 11:34:57 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 01 2023 11:34:57 } [PH] info: Application listening on port 5000 7 | Thu Jun 01 2023 11:36:1 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 01 2023 11:36:1 } [PH] info: Application listening on port 5000 9 | Thu Jun 01 2023 11:36:39 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 01 2023 11:36:39 } [PH] info: Application listening on port 5000 11 | Thu Jun 01 2023 11:37:29 } [PH] info: 🛢 Database is connected successfully 12 | Thu Jun 01 2023 11:37:29 } [PH] info: Application listening on port 5000 13 | Thu Jun 01 2023 11:37:42 } [PH] info: 🛢 Database is connected successfully 14 | Thu Jun 01 2023 11:37:42 } [PH] info: Application listening on port 5000 15 | Thu Jun 01 2023 11:38:5 } [PH] info: 🛢 Database is connected successfully 16 | Thu Jun 01 2023 11:38:5 } [PH] info: Application listening on port 5000 17 | Thu Jun 01 2023 11:40:0 } [PH] info: 🛢 Database is connected successfully 18 | Thu Jun 01 2023 11:40:0 } [PH] info: Application listening on port 5000 19 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-16-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 16:16:16 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 16:16:16 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 16:17:20 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 16:17:20 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 16:18:0 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 16:18:0 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 16:19:55 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 16:19:55 } [PH] info: Application listening on port 5000 9 | Thu Jun 08 2023 16:20:39 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 08 2023 16:20:39 } [PH] info: Application listening on port 5000 11 | Thu Jun 08 2023 16:22:7 } [PH] info: 🛢 Database is connected successfully 12 | Thu Jun 08 2023 16:22:7 } [PH] info: Application listening on port 5000 13 | Thu Jun 08 2023 16:22:17 } [PH] info: 🛢 Database is connected successfully 14 | Thu Jun 08 2023 16:22:17 } [PH] info: Application listening on port 5000 15 | Thu Jun 08 2023 16:23:21 } [PH] info: 🛢 Database is connected successfully 16 | Thu Jun 08 2023 16:23:21 } [PH] info: Application listening on port 5000 17 | Thu Jun 08 2023 16:23:30 } [PH] info: 🛢 Database is connected successfully 18 | Thu Jun 08 2023 16:23:30 } [PH] info: Application listening on port 5000 19 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-22-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 22:24:21 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 22:24:21 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 22:28:4 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 22:28:4 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 22:28:14 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 22:28:14 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 22:29:3 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 22:29:3 } [PH] info: Application listening on port 5000 9 | Thu Jun 08 2023 22:33:10 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 08 2023 22:33:10 } [PH] info: Application listening on port 5000 11 | Thu Jun 08 2023 22:35:18 } [PH] info: 🛢 Database is connected successfully 12 | Thu Jun 08 2023 22:35:18 } [PH] info: Application listening on port 5000 13 | Thu Jun 08 2023 22:41:16 } [PH] info: 🛢 Database is connected successfully 14 | Thu Jun 08 2023 22:41:16 } [PH] info: Application listening on port 5000 15 | Thu Jun 08 2023 22:42:41 } [PH] info: 🛢 Database is connected successfully 16 | Thu Jun 08 2023 22:42:42 } [PH] info: Application listening on port 5000 17 | Thu Jun 08 2023 22:44:39 } [PH] info: 🛢 Database is connected successfully 18 | Thu Jun 08 2023 22:44:39 } [PH] info: Application listening on port 5000 19 | -------------------------------------------------------------------------------- /src/app/modules/course/course.validations.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | 3 | const create = z.object({ 4 | body: z.object({ 5 | title: z.string({ 6 | required_error: 'Title is required' 7 | }), 8 | code: z.string({ 9 | required_error: 'Code is required' 10 | }), 11 | credits: z.number({ 12 | required_error: 'Credits is required' 13 | }), 14 | preRequisiteCourses: z 15 | .array( 16 | z.object({ 17 | courseId: z.string({}) 18 | }) 19 | ) 20 | .optional() 21 | }) 22 | }); 23 | 24 | const update = z.object({ 25 | body: z.object({ 26 | title: z.string().optional(), 27 | code: z.string().optional(), 28 | credits: z.number().optional(), 29 | preRequisiteCourses: z 30 | .array( 31 | z.object({ 32 | courseId: z.string({}), 33 | isDeleted: z.boolean({}).optional() 34 | }) 35 | ) 36 | .optional() 37 | }) 38 | }); 39 | 40 | const assignOrRemoveFaculties = z.object({ 41 | body: z.object({ 42 | faculties: z.array(z.string(), { 43 | required_error: "Facultis are required" 44 | }) 45 | }) 46 | }) 47 | 48 | 49 | export const CourseValidation = { 50 | create, 51 | update, 52 | assignOrRemoveFaculties 53 | }; -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-11-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 11:29:33 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 11:29:33 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 11:35:54 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 11:35:54 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 11:36:54 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 11:36:54 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 11:44:37 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 11:44:38 } [PH] info: Application listening on port 5000 9 | Thu Jun 08 2023 11:45:32 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 08 2023 11:45:32 } [PH] info: Application listening on port 5000 11 | Thu Jun 08 2023 11:47:30 } [PH] info: 🛢 Database is connected successfully 12 | Thu Jun 08 2023 11:47:30 } [PH] info: Application listening on port 5000 13 | Thu Jun 08 2023 11:48:19 } [PH] info: 🛢 Database is connected successfully 14 | Thu Jun 08 2023 11:48:19 } [PH] info: Application listening on port 5000 15 | Thu Jun 08 2023 11:48:52 } [PH] info: 🛢 Database is connected successfully 16 | Thu Jun 08 2023 11:48:52 } [PH] info: Application listening on port 5000 17 | Thu Jun 08 2023 11:52:20 } [PH] info: 🛢 Database is connected successfully 18 | Thu Jun 08 2023 11:52:20 } [PH] info: Application listening on port 5000 19 | -------------------------------------------------------------------------------- /src/app/modules/faculty/faculty.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { FacultyController } from './faculty.controller'; 6 | import { FacultyValidation } from './faculty.validations'; 7 | 8 | const router = express.Router(); 9 | 10 | router.get('/', FacultyController.getAllFromDB); 11 | 12 | router.get('/:id', FacultyController.getByIdFromDB); 13 | 14 | 15 | router.post( 16 | '/', 17 | validateRequest(FacultyValidation.create), 18 | FacultyController.insertIntoDB 19 | ); 20 | 21 | router.patch( 22 | '/:id', 23 | validateRequest(FacultyValidation.update), 24 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 25 | FacultyController.updateOneInDB 26 | ); 27 | 28 | router.delete( 29 | '/:id', 30 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 31 | FacultyController.deleteByIdFromDB 32 | ); 33 | 34 | router.post( 35 | '/:id/assign-courses', 36 | validateRequest(FacultyValidation.assignOrRemoveCourses), 37 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 38 | FacultyController.assignCourses) 39 | 40 | router.delete( 41 | '/:id/remove-courses', 42 | validateRequest(FacultyValidation.assignOrRemoveCourses), 43 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 44 | FacultyController.removeCourses) 45 | 46 | export const facultyRoutes = router; -------------------------------------------------------------------------------- /src/app/modules/course/course.routes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { CourseController } from './course.controller'; 6 | import { CourseValidation } from './course.validations'; 7 | 8 | const router = express.Router(); 9 | router.get('/', CourseController.getAllFromDB); 10 | router.get('/:id', CourseController.getByIdFromDB); 11 | 12 | router.post( 13 | '/', 14 | validateRequest(CourseValidation.create), 15 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 16 | CourseController.insertIntoDB 17 | ); 18 | 19 | 20 | router.patch( 21 | '/:id', 22 | validateRequest(CourseValidation.update), 23 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 24 | CourseController.updateOneInDB 25 | ); 26 | 27 | 28 | router.delete( 29 | '/:id', 30 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 31 | CourseController.deleteByIdFromDB 32 | ); 33 | 34 | router.post( 35 | "/:id/assign-faculties", 36 | validateRequest(CourseValidation.assignOrRemoveFaculties), 37 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 38 | CourseController.assignFaculies) 39 | 40 | router.delete( 41 | "/:id/remove-faculties", 42 | validateRequest(CourseValidation.assignOrRemoveFaculties), 43 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 44 | CourseController.removeFaculties) 45 | 46 | export const courseRoutes = router; -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-18-06-02-success.log: -------------------------------------------------------------------------------- 1 | Sun Jun 18 2023 2:21:25 } [PH] info: 🛢 Database is connected successfully 2 | Sun Jun 18 2023 2:21:25 } [PH] info: Application listening on port 5000 3 | Sun Jun 18 2023 2:21:54 } [PH] info: 🛢 Database is connected successfully 4 | Sun Jun 18 2023 2:21:54 } [PH] info: Application listening on port 5000 5 | Sun Jun 18 2023 2:31:12 } [PH] info: 🛢 Database is connected successfully 6 | Sun Jun 18 2023 2:31:12 } [PH] info: Application listening on port 5000 7 | Sun Jun 18 2023 2:32:43 } [PH] info: 🛢 Database is connected successfully 8 | Sun Jun 18 2023 2:32:43 } [PH] info: Application listening on port 5000 9 | Sun Jun 18 2023 2:32:47 } [PH] info: 🛢 Database is connected successfully 10 | Sun Jun 18 2023 2:32:47 } [PH] info: Application listening on port 5000 11 | Sun Jun 18 2023 2:34:29 } [PH] info: 🛢 Database is connected successfully 12 | Sun Jun 18 2023 2:34:29 } [PH] info: Application listening on port 5000 13 | Sun Jun 18 2023 2:57:51 } [PH] info: 🛢 Database is connected successfully 14 | Sun Jun 18 2023 2:57:51 } [PH] info: Application listening on port 5000 15 | Sun Jun 18 2023 2:58:15 } [PH] info: 🛢 Database is connected successfully 16 | Sun Jun 18 2023 2:58:15 } [PH] info: Application listening on port 5000 17 | Sun Jun 18 2023 2:58:51 } [PH] info: 🛢 Database is connected successfully 18 | Sun Jun 18 2023 2:58:51 } [PH] info: Application listening on port 5000 19 | Sun Jun 18 2023 2:59:29 } [PH] info: 🛢 Database is connected successfully 20 | Sun Jun 18 2023 2:59:29 } [PH] info: Application listening on port 5000 21 | -------------------------------------------------------------------------------- /src/app/modules/academicFaculty/academicFaculty.route.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { AcademicFacultyController } from './academicFaculty.controller'; 6 | import { AcademicFacultyValidation } from './academicFaculty.validations'; 7 | // Faculty Route 8 | const router = express.Router(); 9 | 10 | router.post( 11 | '/create-faculty', 12 | validateRequest(AcademicFacultyValidation.createFacultyZodSchema), 13 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 14 | AcademicFacultyController.createFaculty 15 | ); 16 | 17 | router.get( 18 | '/:id', 19 | auth( 20 | ENUM_USER_ROLE.SUPER_ADMIN, 21 | ENUM_USER_ROLE.ADMIN, 22 | ENUM_USER_ROLE.FACULTY 23 | ), 24 | AcademicFacultyController.getSingleFaculty 25 | ); 26 | 27 | router.get( 28 | '/', 29 | auth( 30 | ENUM_USER_ROLE.SUPER_ADMIN, 31 | ENUM_USER_ROLE.ADMIN, 32 | ENUM_USER_ROLE.FACULTY 33 | ), 34 | AcademicFacultyController.getAllFaculties 35 | ); 36 | 37 | router.patch( 38 | '/:id', 39 | validateRequest(AcademicFacultyValidation.updatefacultyZodSchema), 40 | auth( 41 | ENUM_USER_ROLE.SUPER_ADMIN, 42 | ENUM_USER_ROLE.ADMIN, 43 | ENUM_USER_ROLE.FACULTY 44 | ), 45 | AcademicFacultyController.updateFaculty 46 | ); 47 | 48 | router.delete( 49 | '/:id', 50 | auth(ENUM_USER_ROLE.SUPER_ADMIN), 51 | AcademicFacultyController.deleteFaculty 52 | ); 53 | 54 | export const AcademicFacultyRoutes = router; 55 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-05-06-23-success.log: -------------------------------------------------------------------------------- 1 | Mon Jun 05 2023 23:6:10 } [PH] info: 🛢 Database is connected successfully 2 | Mon Jun 05 2023 23:6:10 } [PH] info: Application listening on port 5000 3 | Mon Jun 05 2023 23:6:57 } [PH] info: 🛢 Database is connected successfully 4 | Mon Jun 05 2023 23:6:57 } [PH] info: Application listening on port 5000 5 | Mon Jun 05 2023 23:17:52 } [PH] info: 🛢 Database is connected successfully 6 | Mon Jun 05 2023 23:17:52 } [PH] info: Application listening on port 5000 7 | Mon Jun 05 2023 23:21:51 } [PH] info: 🛢 Database is connected successfully 8 | Mon Jun 05 2023 23:21:52 } [PH] info: Application listening on port 5000 9 | Mon Jun 05 2023 23:38:2 } [PH] info: 🛢 Database is connected successfully 10 | Mon Jun 05 2023 23:38:2 } [PH] info: Application listening on port 5000 11 | Mon Jun 05 2023 23:40:23 } [PH] info: 🛢 Database is connected successfully 12 | Mon Jun 05 2023 23:40:24 } [PH] info: Application listening on port 5000 13 | Mon Jun 05 2023 23:44:54 } [PH] info: 🛢 Database is connected successfully 14 | Mon Jun 05 2023 23:44:54 } [PH] info: Application listening on port 5000 15 | Mon Jun 05 2023 23:49:39 } [PH] info: 🛢 Database is connected successfully 16 | Mon Jun 05 2023 23:49:39 } [PH] info: Application listening on port 5000 17 | Mon Jun 05 2023 23:51:46 } [PH] info: 🛢 Database is connected successfully 18 | Mon Jun 05 2023 23:51:46 } [PH] info: Application listening on port 5000 19 | Mon Jun 05 2023 23:52:8 } [PH] info: 🛢 Database is connected successfully 20 | Mon Jun 05 2023 23:52:8 } [PH] info: Application listening on port 5000 21 | -------------------------------------------------------------------------------- /src/app/modules/academicSemester/academicSemester.model.ts: -------------------------------------------------------------------------------- 1 | import httpStatus from 'http-status'; 2 | import { Schema, model } from 'mongoose'; 3 | import ApiError from '../../../errors/ApiError'; 4 | import { 5 | academicSemesterCodes, 6 | academicSemesterTitles, 7 | acdemicSemesterMonths, 8 | } from './academicSemester.constant'; 9 | import { IAcademicSemester } from './academicSemester.interface'; 10 | // academic semester constats 11 | const academicSemesterSchema = new Schema( 12 | { 13 | title: { 14 | type: String, 15 | required: true, 16 | enum: academicSemesterTitles, 17 | }, 18 | year: { 19 | type: String, 20 | required: true, 21 | }, 22 | code: { 23 | type: String, 24 | required: true, 25 | enum: academicSemesterCodes, 26 | }, 27 | startMonth: { 28 | type: String, 29 | required: true, 30 | enum: acdemicSemesterMonths, 31 | }, 32 | endMonth: { 33 | type: String, 34 | required: true, 35 | enum: acdemicSemesterMonths, 36 | }, 37 | }, 38 | { 39 | timestamps: true, 40 | toJSON: { 41 | virtuals: true, 42 | }, 43 | } 44 | ); 45 | 46 | academicSemesterSchema.pre('save', async function (next) { 47 | const isExist = await AcademicSemester.findOne({ 48 | title: this.title, 49 | year: this.year, 50 | }); 51 | if (isExist) { 52 | throw new ApiError( 53 | httpStatus.CONFLICT, 54 | 'Academic semester is already exist !' 55 | ); 56 | } 57 | next(); 58 | }); 59 | 60 | export const AcademicSemester = model( 61 | 'AcademicSemester', 62 | academicSemesterSchema 63 | ); 64 | -------------------------------------------------------------------------------- /src/app/modules/academicSemester/academicSemester.route.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import validateRequest from '../../middlewares/validateRequest'; 3 | // import { UserController } from './user.controller'; 4 | 5 | import { ENUM_USER_ROLE } from '../../../enums/user'; 6 | import auth from '../../middlewares/auth'; 7 | import { AcademicSemesterController } from './academicSemester.controller'; 8 | import { AcademicSemesterValidation } from './acdemicSemester.validation'; 9 | const router = express.Router(); 10 | 11 | router.post( 12 | '/create-semester', 13 | validateRequest(AcademicSemesterValidation.createAcademicSemesterZodSchema), 14 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 15 | AcademicSemesterController.createSemester 16 | ); 17 | 18 | router.get( 19 | '/:id', 20 | auth( 21 | ENUM_USER_ROLE.SUPER_ADMIN, 22 | ENUM_USER_ROLE.ADMIN, 23 | ENUM_USER_ROLE.FACULTY, 24 | ENUM_USER_ROLE.STUDENT 25 | ), 26 | AcademicSemesterController.getSingleSemester 27 | ); 28 | 29 | router.get( 30 | '/', 31 | auth( 32 | ENUM_USER_ROLE.SUPER_ADMIN, 33 | ENUM_USER_ROLE.ADMIN, 34 | ENUM_USER_ROLE.FACULTY, 35 | ENUM_USER_ROLE.STUDENT 36 | ), 37 | AcademicSemesterController.getAllSemesters 38 | ); 39 | 40 | router.patch( 41 | '/:id', 42 | validateRequest(AcademicSemesterValidation.updateAcademicSemesterZodSchema), 43 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 44 | AcademicSemesterController.updateSemester 45 | ); 46 | 47 | router.delete( 48 | '/:id', 49 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 50 | AcademicSemesterController.deleteSemester 51 | ); 52 | 53 | export const AcademicSemesterRoutes = router; 54 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-17-06-02-success.log: -------------------------------------------------------------------------------- 1 | Sat Jun 17 2023 2:37:24 } [PH] info: 🛢 Database is connected successfully 2 | Sat Jun 17 2023 2:37:24 } [PH] info: Application listening on port 5000 3 | Sat Jun 17 2023 2:47:10 } [PH] info: 🛢 Database is connected successfully 4 | Sat Jun 17 2023 2:47:10 } [PH] info: Application listening on port 5000 5 | Sat Jun 17 2023 2:48:8 } [PH] info: 🛢 Database is connected successfully 6 | Sat Jun 17 2023 2:48:8 } [PH] info: Application listening on port 5000 7 | Sat Jun 17 2023 2:49:4 } [PH] info: 🛢 Database is connected successfully 8 | Sat Jun 17 2023 2:49:4 } [PH] info: Application listening on port 5000 9 | Sat Jun 17 2023 2:49:48 } [PH] info: 🛢 Database is connected successfully 10 | Sat Jun 17 2023 2:49:48 } [PH] info: Application listening on port 5000 11 | Sat Jun 17 2023 2:52:17 } [PH] info: 🛢 Database is connected successfully 12 | Sat Jun 17 2023 2:52:17 } [PH] info: Application listening on port 5000 13 | Sat Jun 17 2023 2:52:40 } [PH] info: 🛢 Database is connected successfully 14 | Sat Jun 17 2023 2:52:40 } [PH] info: Application listening on port 5000 15 | Sat Jun 17 2023 2:54:3 } [PH] info: 🛢 Database is connected successfully 16 | Sat Jun 17 2023 2:54:3 } [PH] info: Application listening on port 5000 17 | Sat Jun 17 2023 2:56:41 } [PH] info: 🛢 Database is connected successfully 18 | Sat Jun 17 2023 2:56:41 } [PH] info: Application listening on port 5000 19 | Sat Jun 17 2023 2:58:23 } [PH] info: 🛢 Database is connected successfully 20 | Sat Jun 17 2023 2:58:23 } [PH] info: Application listening on port 5000 21 | Sat Jun 17 2023 2:58:27 } [PH] info: 🛢 Database is connected successfully 22 | Sat Jun 17 2023 2:58:27 } [PH] info: Application listening on port 5000 23 | -------------------------------------------------------------------------------- /src/app/modules/managementDepartment/managementDepartment.route.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { ENUM_USER_ROLE } from '../../../enums/user'; 3 | import auth from '../../middlewares/auth'; 4 | import validateRequest from '../../middlewares/validateRequest'; 5 | import { ManagementDepartmentController } from './managementDepartment.controller'; 6 | import { ManagementDepartmentValidation } from './managementDepartment.validation'; 7 | 8 | const router = express.Router(); 9 | 10 | router.post( 11 | '/create-department', 12 | validateRequest( 13 | ManagementDepartmentValidation.createManagementDepartmentZodSchema 14 | ), 15 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 16 | ManagementDepartmentController.createDepartment 17 | ); 18 | 19 | router.get( 20 | '/:id', 21 | auth( 22 | ENUM_USER_ROLE.SUPER_ADMIN, 23 | ENUM_USER_ROLE.ADMIN, 24 | ENUM_USER_ROLE.FACULTY, 25 | ENUM_USER_ROLE.STUDENT 26 | ), 27 | ManagementDepartmentController.getSingleDepartment 28 | ); 29 | 30 | router.patch( 31 | '/:id', 32 | validateRequest( 33 | ManagementDepartmentValidation.updateManagementDepartmentZodSchema 34 | ), 35 | auth(ENUM_USER_ROLE.SUPER_ADMIN, ENUM_USER_ROLE.ADMIN), 36 | ManagementDepartmentController.updateDepartment 37 | ); 38 | 39 | router.delete( 40 | '/:id', 41 | auth(ENUM_USER_ROLE.SUPER_ADMIN), 42 | ManagementDepartmentController.deleteDepartment 43 | ); 44 | 45 | router.get( 46 | '/', 47 | auth( 48 | ENUM_USER_ROLE.SUPER_ADMIN, 49 | ENUM_USER_ROLE.ADMIN, 50 | ENUM_USER_ROLE.FACULTY, 51 | ENUM_USER_ROLE.FACULTY, 52 | ENUM_USER_ROLE.STUDENT 53 | ), 54 | ManagementDepartmentController.getAllDepartments 55 | ); 56 | 57 | export const ManagementDepartmentRoutes = router; 58 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "university-management-core-service", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "src/server.ts", 6 | "scripts": { 7 | "start": "ts-node-dev --respawn --transpile-only src/server.ts", 8 | "lint:check": "eslint --ignore-path .eslintignore --ext .js,.ts .", 9 | "lint:fix": "eslint . --fix", 10 | "prettier:check": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"", 11 | "prettier:fix": "prettier --write .", 12 | "lint-prettier": "yarn lint:check && yarn prettier:check", 13 | "test": "echo \"Error: no test specified\" && exit 1" 14 | }, 15 | "author": "Programming Hero", 16 | "license": "ISC", 17 | "lint-staged": { 18 | "src/**/*.ts": "yarn lint-prettier" 19 | }, 20 | "devDependencies": { 21 | "@types/cors": "^2.8.13", 22 | "@types/express": "^4.17.17", 23 | "@typescript-eslint/eslint-plugin": "^4.0.0", 24 | "@typescript-eslint/parser": "^4.0.0", 25 | "eslint": "^7.0.0", 26 | "eslint-config-prettier": "^8.8.0", 27 | "husky": "^8.0.3", 28 | "lint-staged": "^13.2.2", 29 | "nodemon": "^3.0.1", 30 | "prettier": "^2.8.8", 31 | "ts-node-dev": "^2.0.0", 32 | "typescript": "^5.0.4" 33 | }, 34 | "dependencies": { 35 | "@prisma/client": "^5.1.1", 36 | "@types/bcrypt": "^5.0.0", 37 | "@types/cookie-parser": "^1.4.3", 38 | "@types/jsonwebtoken": "^9.0.2", 39 | "bcrypt": "^5.1.0", 40 | "cookie-parser": "^1.4.6", 41 | "cors": "^2.8.5", 42 | "dotenv": "^16.0.3", 43 | "express": "^4.18.2", 44 | "http-status": "^1.6.2", 45 | "jsonwebtoken": "^9.0.0", 46 | "prisma": "^5.1.1", 47 | "winston": "^3.9.0", 48 | "winston-daily-rotate-file": "^4.7.1", 49 | "zod": "^3.21.4" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/shared/logger.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | import path from 'path'; 3 | import { createLogger, format, transports } from 'winston'; 4 | import DailyRotateFile from 'winston-daily-rotate-file'; 5 | const { combine, timestamp, label, printf } = format; 6 | 7 | //Customm Log Format 8 | 9 | const myFormat = printf(({ level, message, label, timestamp }) => { 10 | const date = new Date(timestamp); 11 | const hour = date.getHours(); 12 | const minutes = date.getMinutes(); 13 | const seconds = date.getSeconds(); 14 | return `${date.toDateString()} ${hour}:${minutes}:${seconds} } [${label}] ${level}: ${message}`; 15 | }); 16 | 17 | const logger = createLogger({ 18 | level: 'info', 19 | format: combine(label({ label: 'PH' }), timestamp(), myFormat), 20 | transports: [ 21 | new transports.Console(), 22 | new DailyRotateFile({ 23 | filename: path.join( 24 | process.cwd(), 25 | 'logs', 26 | 'winston', 27 | 'successes', 28 | 'phu-%DATE%-success.log' 29 | ), 30 | datePattern: 'YYYY-DD-MM-HH', 31 | zippedArchive: true, 32 | maxSize: '20m', 33 | maxFiles: '14d', 34 | }), 35 | ], 36 | }); 37 | 38 | const errorlogger = createLogger({ 39 | level: 'error', 40 | format: combine(label({ label: 'PH' }), timestamp(), myFormat), 41 | transports: [ 42 | new transports.Console(), 43 | new DailyRotateFile({ 44 | filename: path.join( 45 | process.cwd(), 46 | 'logs', 47 | 'winston', 48 | 'errors', 49 | 'phu-%DATE%-error.log' 50 | ), 51 | datePattern: 'YYYY-DD-MM-HH', 52 | zippedArchive: true, 53 | maxSize: '20m', 54 | maxFiles: '14d', 55 | }), 56 | ], 57 | }); 58 | 59 | export { logger, errorlogger }; 60 | -------------------------------------------------------------------------------- /src/app/modules/student/student.validation.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | import { bloodGroup, gender } from '../student/student.constant'; 3 | 4 | const updateStudentZodSchema = z.object({ 5 | body: z.object({ 6 | name: z.object({ 7 | firstName: z.string().optional(), 8 | lastName: z.string().optional(), 9 | middleName: z.string().optional(), 10 | }), 11 | gender: z.enum([...gender] as [string, ...string[]]).optional(), 12 | dateOfBirth: z.string().optional(), 13 | email: z.string().email().optional(), 14 | contactNo: z.string().optional(), 15 | emergencyContactNo: z.string().optional(), 16 | bloodGroup: z.enum([...bloodGroup] as [string, ...string[]]).optional(), 17 | presentAddress: z.string().optional(), 18 | permanentAddress: z.string().optional(), 19 | academicSemester: z.string().optional(), 20 | academicDepartment: z.string().optional(), 21 | academicFaculty: z.string().optional(), 22 | guardian: z 23 | .object({ 24 | fatherName: z.string().optional(), 25 | fatherOccupation: z.string().optional(), 26 | fatherContactNo: z.string().optional(), 27 | motherName: z.string().optional(), 28 | motherOccupation: z.string().optional(), 29 | motherContactNo: z.string().optional(), 30 | address: z.string().optional(), 31 | }) 32 | .optional(), 33 | localGuardian: z 34 | .object({ 35 | name: z.string().optional(), 36 | occupation: z.string().optional(), 37 | contactNo: z.string().optional(), 38 | address: z.string().optional(), 39 | }) 40 | .optional(), 41 | profileImage: z.string().optional(), 42 | }), 43 | }); 44 | 45 | export const StudentValidaion = { 46 | updateStudentZodSchema, 47 | }; 48 | -------------------------------------------------------------------------------- /src/app/modules/user/user.controller.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from 'express'; 2 | import { RequestHandler } from 'express-serve-static-core'; 3 | import httpStatus from 'http-status'; 4 | import catchAsync from '../../../shared/catchAsync'; 5 | import sendResponse from '../../../shared/sendResponse'; 6 | import { IUser } from './user.interface'; 7 | import { UserService } from './user.service'; 8 | 9 | const createStudent: RequestHandler = catchAsync( 10 | async (req: Request, res: Response) => { 11 | const { student, ...userData } = req.body; 12 | const result = await UserService.createStudent(student, userData); 13 | 14 | sendResponse(res, { 15 | statusCode: httpStatus.OK, 16 | success: true, 17 | message: 'Student created successfully!', 18 | data: result, 19 | }); 20 | } 21 | ); 22 | 23 | const createFaculy: RequestHandler = catchAsync( 24 | async (req: Request, res: Response) => { 25 | const { faculty, ...userData } = req.body; 26 | const result = await UserService.createFaculty(faculty, userData); 27 | 28 | sendResponse(res, { 29 | statusCode: httpStatus.OK, 30 | success: true, 31 | message: 'Faculty created successfully!', 32 | data: result, 33 | }); 34 | } 35 | ); 36 | 37 | const createAdmin: RequestHandler = catchAsync( 38 | async (req: Request, res: Response) => { 39 | const { admin, ...userData } = req.body; 40 | const result = await UserService.createAdmin(admin, userData); 41 | 42 | sendResponse(res, { 43 | statusCode: httpStatus.OK, 44 | success: true, 45 | message: 'Admin created successfully!', 46 | data: result, 47 | }); 48 | } 49 | ); 50 | 51 | export const UserController = { 52 | createStudent, 53 | createFaculy, 54 | createAdmin, 55 | }; 56 | -------------------------------------------------------------------------------- /src/app/modules/student/student.interface.ts: -------------------------------------------------------------------------------- 1 | export type IStudentFilterRequest = { 2 | searchTerm?: string | undefined; 3 | academicFacultyId?: string | undefined; 4 | academicDepartmentId?: string | undefined; 5 | academicSemesterId?: string | undefined; 6 | studentId?: string | undefined; 7 | email?: string | undefined; 8 | contactNo?: string | undefined; 9 | gender?: string | undefined; 10 | bloodGroup?: string | undefined; 11 | } 12 | 13 | export type IStudentMyCoursesRequest = { 14 | academicSemesterId?: string | undefined; 15 | courseId?: string | undefined; 16 | } 17 | 18 | export type IStudentMyCourseSchedulesRequest = { 19 | academicSemesterId?: string | undefined; 20 | courseId?: string | undefined; 21 | } 22 | 23 | export type StudentCreatedEvent = { 24 | id: string; 25 | name: { 26 | firstName: string; 27 | lastName: string; 28 | middleName?: string; 29 | }; 30 | dateOfBirth: string; 31 | gender: string; 32 | bloodGroup: string; 33 | email: string; 34 | contactNo: string; 35 | profileImage: string; 36 | academicFaculty: { 37 | syncId: string; 38 | }; 39 | academicDepartment: { 40 | syncId: string; 41 | }; 42 | academicSemester: { 43 | syncId: string; 44 | }; 45 | }; 46 | 47 | export type StudentUpdatedEvent = { 48 | id: string; 49 | name: { 50 | firstName: string; 51 | lastName: string; 52 | middleName?: string; 53 | }; 54 | dateOfBirth: string; 55 | gender: string; 56 | bloodGroup: string; 57 | email: string; 58 | contactNo: string; 59 | profileImage: string; 60 | academicFaculty: { 61 | syncId: string; 62 | }; 63 | academicDepartment: { 64 | syncId: string; 65 | }; 66 | academicSemester: { 67 | syncId: string; 68 | }; 69 | }; -------------------------------------------------------------------------------- /src/app/modules/admin/admin.model.ts: -------------------------------------------------------------------------------- 1 | import { Schema, model } from 'mongoose'; 2 | import { AdminModel, IAdmin } from './admin.interface'; 3 | // admin model 4 | const AdminSchema = new Schema( 5 | { 6 | id: { 7 | type: String, 8 | required: true, 9 | unique: true, 10 | }, 11 | name: { 12 | type: { 13 | firstName: { 14 | type: String, 15 | required: true, 16 | }, 17 | lastName: { 18 | type: String, 19 | required: true, 20 | }, 21 | middleName: { 22 | type: String, 23 | required: false, 24 | }, 25 | }, 26 | required: true, 27 | }, 28 | dateOfBirth: { 29 | type: String, 30 | }, 31 | gender: { 32 | type: String, 33 | enum: ['male', 'female'], 34 | }, 35 | bloodGroup: { 36 | type: String, 37 | enum: ['A+', 'A-', 'B+', 'B-', 'AB+', 'AB-', 'O+', 'O-'], 38 | }, 39 | email: { 40 | type: String, 41 | unique: true, 42 | required: true, 43 | }, 44 | contactNo: { 45 | type: String, 46 | unique: true, 47 | required: true, 48 | }, 49 | emergencyContactNo: { 50 | type: String, 51 | required: true, 52 | }, 53 | presentAddress: { 54 | type: String, 55 | required: true, 56 | }, 57 | permanentAddress: { 58 | type: String, 59 | required: true, 60 | }, 61 | managementDepartment: { 62 | type: Schema.Types.ObjectId, 63 | ref: 'ManagementDepartment', 64 | required: true, 65 | }, 66 | designation: { 67 | type: String, 68 | required: true, 69 | }, 70 | profileImage: { 71 | type: String, 72 | }, 73 | }, 74 | { 75 | timestamps: true, 76 | } 77 | ); 78 | 79 | export const Admin = model('Admin', AdminSchema); 80 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-04-06-07-success.log: -------------------------------------------------------------------------------- 1 | Sun Jun 04 2023 7:14:3 } [PH] info: 🛢 Database is connected successfully 2 | Sun Jun 04 2023 7:14:3 } [PH] info: Application listening on port 5000 3 | Sun Jun 04 2023 7:14:19 } [PH] info: 🛢 Database is connected successfully 4 | Sun Jun 04 2023 7:14:19 } [PH] info: Application listening on port 5000 5 | Sun Jun 04 2023 7:22:45 } [PH] info: 🛢 Database is connected successfully 6 | Sun Jun 04 2023 7:22:45 } [PH] info: Application listening on port 5000 7 | Sun Jun 04 2023 7:26:50 } [PH] info: 🛢 Database is connected successfully 8 | Sun Jun 04 2023 7:26:50 } [PH] info: Application listening on port 5000 9 | Sun Jun 04 2023 7:27:0 } [PH] info: 🛢 Database is connected successfully 10 | Sun Jun 04 2023 7:27:0 } [PH] info: Application listening on port 5000 11 | Sun Jun 04 2023 7:28:1 } [PH] info: 🛢 Database is connected successfully 12 | Sun Jun 04 2023 7:28:1 } [PH] info: Application listening on port 5000 13 | Sun Jun 04 2023 7:30:24 } [PH] info: 🛢 Database is connected successfully 14 | Sun Jun 04 2023 7:30:24 } [PH] info: Application listening on port 5000 15 | Sun Jun 04 2023 7:32:49 } [PH] info: 🛢 Database is connected successfully 16 | Sun Jun 04 2023 7:32:49 } [PH] info: Application listening on port 5000 17 | Sun Jun 04 2023 7:36:33 } [PH] info: 🛢 Database is connected successfully 18 | Sun Jun 04 2023 7:36:33 } [PH] info: Application listening on port 5000 19 | Sun Jun 04 2023 7:37:2 } [PH] info: 🛢 Database is connected successfully 20 | Sun Jun 04 2023 7:37:2 } [PH] info: Application listening on port 5000 21 | Sun Jun 04 2023 7:39:44 } [PH] info: 🛢 Database is connected successfully 22 | Sun Jun 04 2023 7:39:44 } [PH] info: Application listening on port 5000 23 | Sun Jun 04 2023 7:39:54 } [PH] info: 🛢 Database is connected successfully 24 | Sun Jun 04 2023 7:39:54 } [PH] info: Application listening on port 5000 25 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-19-06-05-success.log: -------------------------------------------------------------------------------- 1 | Mon Jun 19 2023 5:1:8 } [PH] info: 🛢 Database is connected successfully 2 | Mon Jun 19 2023 5:1:9 } [PH] info: Application listening on port 5000 3 | Mon Jun 19 2023 5:5:48 } [PH] info: 🛢 Database is connected successfully 4 | Mon Jun 19 2023 5:5:48 } [PH] info: Application listening on port 5000 5 | Mon Jun 19 2023 5:7:7 } [PH] info: 🛢 Database is connected successfully 6 | Mon Jun 19 2023 5:7:7 } [PH] info: Application listening on port 5000 7 | Mon Jun 19 2023 5:7:57 } [PH] info: 🛢 Database is connected successfully 8 | Mon Jun 19 2023 5:7:57 } [PH] info: Application listening on port 5000 9 | Mon Jun 19 2023 5:14:30 } [PH] info: 🛢 Database is connected successfully 10 | Mon Jun 19 2023 5:14:30 } [PH] info: Application listening on port 5000 11 | Mon Jun 19 2023 5:16:33 } [PH] info: 🛢 Database is connected successfully 12 | Mon Jun 19 2023 5:16:33 } [PH] info: Application listening on port 5000 13 | Mon Jun 19 2023 5:50:36 } [PH] info: 🛢 Database is connected successfully 14 | Mon Jun 19 2023 5:50:36 } [PH] info: Application listening on port 5000 15 | Mon Jun 19 2023 5:51:52 } [PH] info: 🛢 Database is connected successfully 16 | Mon Jun 19 2023 5:51:52 } [PH] info: Application listening on port 5000 17 | Mon Jun 19 2023 5:52:11 } [PH] info: 🛢 Database is connected successfully 18 | Mon Jun 19 2023 5:52:11 } [PH] info: Application listening on port 5000 19 | Mon Jun 19 2023 5:53:34 } [PH] info: 🛢 Database is connected successfully 20 | Mon Jun 19 2023 5:53:34 } [PH] info: Application listening on port 5000 21 | Mon Jun 19 2023 5:57:6 } [PH] info: 🛢 Database is connected successfully 22 | Mon Jun 19 2023 5:57:6 } [PH] info: Application listening on port 5000 23 | Mon Jun 19 2023 5:59:21 } [PH] info: 🛢 Database is connected successfully 24 | Mon Jun 19 2023 5:59:21 } [PH] info: Application listening on port 5000 25 | Mon Jun 19 2023 5:59:26 } [PH] info: 🛢 Database is connected successfully 26 | Mon Jun 19 2023 5:59:26 } [PH] info: Application listening on port 5000 27 | -------------------------------------------------------------------------------- /src/app/modules/faculty/faculty.model.ts: -------------------------------------------------------------------------------- 1 | import { Schema, Types, model } from 'mongoose'; 2 | import { FacultyModel, IFaculty } from './faculty.interface'; 3 | 4 | const FacultySchema = new Schema( 5 | { 6 | id: { 7 | type: String, 8 | required: true, 9 | unique: true, 10 | }, 11 | name: { 12 | type: { 13 | firstName: { 14 | type: String, 15 | required: true, 16 | }, 17 | lastName: { 18 | type: String, 19 | required: true, 20 | }, 21 | middleName: { 22 | type: String, 23 | required: false, 24 | }, 25 | }, 26 | required: true, 27 | }, 28 | dateOfBirth: { 29 | type: String, 30 | }, 31 | gender: { 32 | type: String, 33 | enum: ['male', 'female'], 34 | }, 35 | bloodGroup: { 36 | type: String, 37 | enum: ['A+', 'A-', 'B+', 'B-', 'AB+', 'AB-', 'O+', 'O-'], 38 | }, 39 | email: { 40 | type: String, 41 | unique: true, 42 | required: true, 43 | }, 44 | contactNo: { 45 | type: String, 46 | unique: true, 47 | required: true, 48 | }, 49 | emergencyContactNo: { 50 | type: String, 51 | required: true, 52 | }, 53 | presentAddress: { 54 | type: String, 55 | required: true, 56 | }, 57 | permanentAddress: { 58 | type: String, 59 | required: true, 60 | }, 61 | academicDepartment: { 62 | type: Types.ObjectId, 63 | ref: 'AcademicDepartment', 64 | required: true, 65 | }, 66 | designation: { 67 | type: String, 68 | required: true, 69 | }, 70 | profileImage: { 71 | type: String, 72 | // required: true, 73 | }, 74 | academicFaculty: { 75 | type: Types.ObjectId, 76 | ref: 'AcademicFaculty', 77 | required: true, 78 | }, 79 | }, 80 | { 81 | timestamps: true, 82 | } 83 | ); 84 | 85 | export const Faculty = model('Faculty', FacultySchema); 86 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-08-06-19-success.log: -------------------------------------------------------------------------------- 1 | Thu Jun 08 2023 19:6:33 } [PH] info: 🛢 Database is connected successfully 2 | Thu Jun 08 2023 19:6:33 } [PH] info: Application listening on port 5000 3 | Thu Jun 08 2023 19:7:12 } [PH] info: 🛢 Database is connected successfully 4 | Thu Jun 08 2023 19:7:13 } [PH] info: Application listening on port 5000 5 | Thu Jun 08 2023 19:7:26 } [PH] info: 🛢 Database is connected successfully 6 | Thu Jun 08 2023 19:7:26 } [PH] info: Application listening on port 5000 7 | Thu Jun 08 2023 19:7:43 } [PH] info: 🛢 Database is connected successfully 8 | Thu Jun 08 2023 19:7:43 } [PH] info: Application listening on port 5000 9 | Thu Jun 08 2023 19:8:27 } [PH] info: 🛢 Database is connected successfully 10 | Thu Jun 08 2023 19:8:27 } [PH] info: Application listening on port 5000 11 | Thu Jun 08 2023 19:8:51 } [PH] info: 🛢 Database is connected successfully 12 | Thu Jun 08 2023 19:8:51 } [PH] info: Application listening on port 5000 13 | Thu Jun 08 2023 19:12:59 } [PH] info: 🛢 Database is connected successfully 14 | Thu Jun 08 2023 19:12:59 } [PH] info: Application listening on port 5000 15 | Thu Jun 08 2023 19:13:11 } [PH] info: 🛢 Database is connected successfully 16 | Thu Jun 08 2023 19:13:11 } [PH] info: Application listening on port 5000 17 | Thu Jun 08 2023 19:13:19 } [PH] info: 🛢 Database is connected successfully 18 | Thu Jun 08 2023 19:13:19 } [PH] info: Application listening on port 5000 19 | Thu Jun 08 2023 19:13:33 } [PH] info: 🛢 Database is connected successfully 20 | Thu Jun 08 2023 19:13:33 } [PH] info: Application listening on port 5000 21 | Thu Jun 08 2023 19:58:51 } [PH] info: 🛢 Database is connected successfully 22 | Thu Jun 08 2023 19:58:51 } [PH] info: Application listening on port 5000 23 | Thu Jun 08 2023 19:58:59 } [PH] info: 🛢 Database is connected successfully 24 | Thu Jun 08 2023 19:58:59 } [PH] info: Application listening on port 5000 25 | Thu Jun 08 2023 19:59:27 } [PH] info: 🛢 Database is connected successfully 26 | Thu Jun 08 2023 19:59:27 } [PH] info: Application listening on port 5000 27 | -------------------------------------------------------------------------------- /src/app/modules/auth/auth.controller.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from 'express'; 2 | import config from '../../../config'; 3 | import catchAsync from '../../../shared/catchAsync'; 4 | import sendResponse from '../../../shared/sendResponse'; 5 | import { ILoginUserResponse, IRefreshTokenResponse } from './auth.interface'; 6 | import { AuthService } from './auth.service'; 7 | // auth controller 8 | const loginUser = catchAsync(async (req: Request, res: Response) => { 9 | const { ...loginData } = req.body; 10 | const result = await AuthService.loginUser(loginData); 11 | const { refreshToken, ...others } = result; 12 | 13 | // set refresh token into cookie 14 | const cookieOptions = { 15 | secure: config.env === 'production', 16 | httpOnly: true, 17 | }; 18 | 19 | res.cookie('refreshToken', refreshToken, cookieOptions); 20 | 21 | sendResponse(res, { 22 | statusCode: 200, 23 | success: true, 24 | message: 'User logged in successfully !', 25 | data: others, 26 | }); 27 | }); 28 | 29 | const refreshToken = catchAsync(async (req: Request, res: Response) => { 30 | const { refreshToken } = req.cookies; 31 | 32 | const result = await AuthService.refreshToken(refreshToken); 33 | 34 | // set refresh token into cookie 35 | const cookieOptions = { 36 | secure: config.env === 'production', 37 | httpOnly: true, 38 | }; 39 | 40 | res.cookie('refreshToken', refreshToken, cookieOptions); 41 | 42 | sendResponse(res, { 43 | statusCode: 200, 44 | success: true, 45 | message: 'User logged in successfully !', 46 | data: result, 47 | }); 48 | }); 49 | 50 | const changePassword = catchAsync(async (req: Request, res: Response) => { 51 | const user = req.user; 52 | const { ...passwordData } = req.body; 53 | 54 | await AuthService.changePassword(user, passwordData); 55 | 56 | sendResponse(res, { 57 | statusCode: 200, 58 | success: true, 59 | message: 'Password changed successfully !', 60 | }); 61 | }); 62 | 63 | export const AuthController = { 64 | loginUser, 65 | refreshToken, 66 | changePassword, 67 | }; 68 | -------------------------------------------------------------------------------- /src/app/routes/index.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { academicDepartmentRoutes } from '../modules/academicDepartment/academicDepartment.routes'; 3 | import { academicFacultyRoutes } from '../modules/academicFaculty/academicFaculty.routes'; 4 | import { AcademicSemeterRoutes } from '../modules/academicSemester/academicSemester.routes'; 5 | import { buildingRoutes } from '../modules/building/building.routes'; 6 | import { courseRoutes } from '../modules/course/course.routes'; 7 | import { facultyRoutes } from '../modules/faculty/faculty.routes'; 8 | import { offeredCourseRoutes } from '../modules/offeredCourse/offeredCourse.routes'; 9 | import { offeredCourseSectionRoutes } from '../modules/offeredCourseSection/offeredCourseSection.routes'; 10 | import { roomRoutes } from '../modules/room/room.routes'; 11 | import { semesterRegistrationRoutes } from '../modules/semesterRegistration/semesterRegistration.routes'; 12 | import { studentRoutes } from '../modules/student/student.routes'; 13 | 14 | const router = express.Router(); 15 | 16 | const moduleRoutes = [ 17 | // ... routes 18 | { 19 | path: "/academic-semesters", 20 | route: AcademicSemeterRoutes 21 | }, 22 | { 23 | path: '/academic-faculties', 24 | route: academicFacultyRoutes 25 | }, 26 | { 27 | path: '/academic-departments', 28 | route: academicDepartmentRoutes 29 | }, 30 | { 31 | path: '/faculties', 32 | route: facultyRoutes 33 | }, 34 | { 35 | path: '/students', 36 | route: studentRoutes 37 | }, 38 | { 39 | path: '/buildings', 40 | route: buildingRoutes 41 | }, 42 | { 43 | path: '/rooms', 44 | route: roomRoutes 45 | }, 46 | { 47 | path: '/courses', 48 | route: courseRoutes 49 | }, 50 | { 51 | path: '/semester-registration', 52 | route: semesterRegistrationRoutes 53 | }, { 54 | path: '/offered-courses', 55 | route: offeredCourseRoutes 56 | }, 57 | { 58 | path: '/offered-course-sections', 59 | route: offeredCourseSectionRoutes 60 | } 61 | ]; 62 | 63 | moduleRoutes.forEach(route => router.use(route.path, route.route)); 64 | export default router; 65 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-18-08-19-success.log: -------------------------------------------------------------------------------- 1 | Fri Aug 18 2023 19:9:56 } [PH] info: Server running on port 5001 2 | Fri Aug 18 2023 19:10:35 } [PH] info: SIGTERM received 3 | Fri Aug 18 2023 19:10:35 } [PH] info: Server running on port 5001 4 | Fri Aug 18 2023 19:12:53 } [PH] info: SIGTERM received 5 | Fri Aug 18 2023 19:12:53 } [PH] info: Server running on port 5001 6 | Fri Aug 18 2023 19:13:4 } [PH] info: SIGTERM received 7 | Fri Aug 18 2023 19:13:4 } [PH] info: Server running on port 5001 8 | Fri Aug 18 2023 19:15:8 } [PH] info: Server running on port 5001 9 | Fri Aug 18 2023 19:15:43 } [PH] info: SIGTERM received 10 | Fri Aug 18 2023 19:15:49 } [PH] info: Server running on port 5001 11 | Fri Aug 18 2023 19:15:56 } [PH] info: SIGTERM received 12 | Fri Aug 18 2023 19:15:56 } [PH] info: Server running on port 5001 13 | Fri Aug 18 2023 19:28:37 } [PH] info: SIGTERM received 14 | Fri Aug 18 2023 19:28:37 } [PH] info: Server running on port 5001 15 | Fri Aug 18 2023 19:28:47 } [PH] info: SIGTERM received 16 | Fri Aug 18 2023 19:28:47 } [PH] info: Server running on port 5001 17 | Fri Aug 18 2023 19:30:5 } [PH] info: SIGTERM received 18 | Fri Aug 18 2023 19:30:5 } [PH] info: Server running on port 5001 19 | Fri Aug 18 2023 19:30:42 } [PH] info: SIGTERM received 20 | Fri Aug 18 2023 19:30:42 } [PH] info: Server running on port 5001 21 | Fri Aug 18 2023 19:30:47 } [PH] info: SIGTERM received 22 | Fri Aug 18 2023 19:30:47 } [PH] info: Server running on port 5001 23 | Fri Aug 18 2023 19:31:7 } [PH] info: SIGTERM received 24 | Fri Aug 18 2023 19:31:7 } [PH] info: Server running on port 5001 25 | Fri Aug 18 2023 19:31:36 } [PH] info: SIGTERM received 26 | Fri Aug 18 2023 19:31:36 } [PH] info: Server running on port 5001 27 | Fri Aug 18 2023 19:42:3 } [PH] info: SIGTERM received 28 | Fri Aug 18 2023 19:42:3 } [PH] info: Server running on port 5001 29 | Fri Aug 18 2023 19:42:13 } [PH] info: SIGTERM received 30 | Fri Aug 18 2023 19:42:13 } [PH] info: Server running on port 5001 31 | Fri Aug 18 2023 19:43:2 } [PH] info: SIGTERM received 32 | Fri Aug 18 2023 19:43:2 } [PH] info: Server running on port 5001 33 | Fri Aug 18 2023 19:43:25 } [PH] info: SIGTERM received 34 | Fri Aug 18 2023 19:43:25 } [PH] info: Server running on port 5001 35 | -------------------------------------------------------------------------------- /src/app/modules/academicSemester/acdemicSemester.validation.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | import { 3 | academicSemesterCodes, 4 | academicSemesterTitles, 5 | acdemicSemesterMonths, 6 | } from './academicSemester.constant'; 7 | 8 | const createAcademicSemesterZodSchema = z.object({ 9 | body: z.object({ 10 | title: z.enum([...academicSemesterTitles] as [string, ...string[]], { 11 | required_error: 'Title is required', 12 | }), 13 | year: z.string({ 14 | required_error: 'Year is required ', 15 | }), 16 | code: z.enum([...academicSemesterCodes] as [string, ...string[]]), 17 | startMonth: z.enum([...acdemicSemesterMonths] as [string, ...string[]], { 18 | required_error: 'Start month is needed', 19 | }), 20 | endMonth: z.enum([...acdemicSemesterMonths] as [string, ...string[]], { 21 | required_error: 'End month is needed', 22 | }), 23 | }), 24 | }); 25 | 26 | const updateAcademicSemesterZodSchema = z 27 | .object({ 28 | body: z.object({ 29 | title: z 30 | .enum([...academicSemesterTitles] as [string, ...string[]], { 31 | required_error: 'Title is required', 32 | }) 33 | .optional(), 34 | year: z 35 | .string({ 36 | required_error: 'Year is required ', 37 | }) 38 | .optional(), 39 | code: z 40 | .enum([...academicSemesterCodes] as [string, ...string[]]) 41 | .optional(), 42 | startMonth: z 43 | .enum([...acdemicSemesterMonths] as [string, ...string[]], { 44 | required_error: 'Start month is needed', 45 | }) 46 | .optional(), 47 | endMonth: z 48 | .enum([...acdemicSemesterMonths] as [string, ...string[]], { 49 | required_error: 'End month is needed', 50 | }) 51 | .optional(), 52 | }), 53 | }) 54 | .refine( 55 | data => 56 | (data.body.title && data.body.code) || 57 | (!data.body.title && !data.body.code), 58 | { 59 | message: 'Either both title and code should be provided or neither', 60 | } 61 | ); 62 | 63 | export const AcademicSemesterValidation = { 64 | createAcademicSemesterZodSchema, 65 | updateAcademicSemesterZodSchema, 66 | }; 67 | -------------------------------------------------------------------------------- /logs/winston/successes/phu-2023-09-06-01-success.log: -------------------------------------------------------------------------------- 1 | Fri Jun 09 2023 1:24:31 } [PH] info: 🛢 Database is connected successfully 2 | Fri Jun 09 2023 1:24:31 } [PH] info: Application listening on port 5000 3 | Fri Jun 09 2023 1:25:59 } [PH] info: 🛢 Database is connected successfully 4 | Fri Jun 09 2023 1:25:59 } [PH] info: Application listening on port 5000 5 | Fri Jun 09 2023 1:26:31 } [PH] info: 🛢 Database is connected successfully 6 | Fri Jun 09 2023 1:26:31 } [PH] info: Application listening on port 5000 7 | Fri Jun 09 2023 1:26:39 } [PH] info: 🛢 Database is connected successfully 8 | Fri Jun 09 2023 1:26:39 } [PH] info: Application listening on port 5000 9 | Fri Jun 09 2023 1:27:2 } [PH] info: 🛢 Database is connected successfully 10 | Fri Jun 09 2023 1:27:2 } [PH] info: Application listening on port 5000 11 | Fri Jun 09 2023 1:27:34 } [PH] info: 🛢 Database is connected successfully 12 | Fri Jun 09 2023 1:27:34 } [PH] info: Application listening on port 5000 13 | Fri Jun 09 2023 1:32:4 } [PH] info: 🛢 Database is connected successfully 14 | Fri Jun 09 2023 1:32:4 } [PH] info: Application listening on port 5000 15 | Fri Jun 09 2023 1:35:35 } [PH] info: 🛢 Database is connected successfully 16 | Fri Jun 09 2023 1:35:35 } [PH] info: Application listening on port 5000 17 | Fri Jun 09 2023 1:35:45 } [PH] info: 🛢 Database is connected successfully 18 | Fri Jun 09 2023 1:35:45 } [PH] info: Application listening on port 5000 19 | Fri Jun 09 2023 1:39:13 } [PH] info: 🛢 Database is connected successfully 20 | Fri Jun 09 2023 1:39:13 } [PH] info: Application listening on port 5000 21 | Fri Jun 09 2023 1:40:42 } [PH] info: 🛢 Database is connected successfully 22 | Fri Jun 09 2023 1:40:42 } [PH] info: Application listening on port 5000 23 | Fri Jun 09 2023 1:41:26 } [PH] info: 🛢 Database is connected successfully 24 | Fri Jun 09 2023 1:41:26 } [PH] info: Application listening on port 5000 25 | Fri Jun 09 2023 1:43:54 } [PH] info: 🛢 Database is connected successfully 26 | Fri Jun 09 2023 1:43:54 } [PH] info: Application listening on port 5000 27 | Fri Jun 09 2023 1:44:5 } [PH] info: 🛢 Database is connected successfully 28 | Fri Jun 09 2023 1:44:5 } [PH] info: Application listening on port 5000 29 | -------------------------------------------------------------------------------- /src/app/modules/student/student.validations.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | 3 | const create = z.object({ 4 | body: z.object({ 5 | studentId: z.string({ 6 | required_error: 'Student id is required' 7 | }), 8 | firstName: z.string({ 9 | required_error: 'First name is required' 10 | }), 11 | lastName: z.string({ 12 | required_error: 'Last name is required' 13 | }), 14 | middleName: z.string({ 15 | required_error: 'Middle name is required' 16 | }), 17 | profileImage: z.string({ 18 | required_error: 'Profile image is required' 19 | }), 20 | email: z.string({ 21 | required_error: 'Email is required' 22 | }), 23 | contactNo: z.string({ 24 | required_error: 'Contact no is required' 25 | }), 26 | gender: z.string({ 27 | required_error: 'Gender is required' 28 | }), 29 | bloodGroup: z.string({ 30 | required_error: 'Blood group is required' 31 | }), 32 | academicSemesterId: z.string({ 33 | required_error: 'Academic semester is required' 34 | }), 35 | academicDepartmentId: z.string({ 36 | required_error: 'Academic department is required' 37 | }), 38 | academicFacultyId: z.string({ 39 | required_error: 'Academic faculty is required' 40 | }) 41 | }) 42 | }); 43 | 44 | const update = z.object({ 45 | body: z.object({ 46 | studentId: z.string().optional(), 47 | firstName: z.string().optional(), 48 | lastName: z.string().optional(), 49 | middleName: z.string().optional(), 50 | profileImage: z.string().optional(), 51 | email: z.string().optional(), 52 | contactNo: z.string().optional(), 53 | gender: z.string().optional(), 54 | bloodGroup: z.string().optional(), 55 | academicSemesterId: z.string().optional(), 56 | academicDepartmentId: z.string().optional(), 57 | academicFacultyId: z.string().optional() 58 | }) 59 | }); 60 | 61 | 62 | 63 | export const StudentValidation = { 64 | create, 65 | update 66 | }; --------------------------------------------------------------------------------