Skip to content

Commit

Permalink
Endpoint Fixes | SIS-194 (#87)
Browse files Browse the repository at this point in the history
* /api/v1 Path Has Been Added to NEXT_PUBLIC_SIS_API_URL Variable in Environment Files

* DepartmentController Endpoints Have Been Fixed and Updated

* DepartmentController Endpoints Have Been Fixed and Updated & getExamScheduleFileDetailByExamScheduleFileId Method Name Has Been Renamed to getExamScheduleFileDetailByDepartmentId

* FacultyController Endpoints Have Been Fixed and Updated

* FeatureToggleController Endpoints Have Been Fixed and Updated

* LessonController Endpoints Have Been Fixed and Updated

* LessonScheduleFileController Endpoints Have Been Fixed and Updated

* LoginController Endpoints Have Been Fixed and Updated

* OfficerController Endpoints Have Been Fixed and Updated

* OfficerPasswordOperationController Endpoints Have Been Fixed and Updated

* StudentController Endpoints Have Been Fixed and Updated

* StudentGraduationController Endpoints Have Been Fixed and Updated

* StudentLessonController Endpoints Have Been Fixed and Updated

* StudentLessonNoteController Endpoints Have Been Fixed and Updated

* StudentLessonRegistrationController Endpoints Have Been Fixed and Updated

* StudentPasswordOperationController Endpoints Have Been Fixed and Updated

* TeacherController Endpoints Have Been Fixed and Updated

* TeacherLessonController Endpoints Have Been Fixed and Updated

* TeacherPasswordOperationController Endpoints Have Been Fixed and Updated
  • Loading branch information
agitrubard authored May 6, 2022
1 parent dc51e62 commit 851e941
Show file tree
Hide file tree
Showing 23 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .env.sis.live
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

NEXT_PUBLIC_SIS_PROFILE=live
NEXT_PUBLIC_SIS_API_URL=https://sis-be.herokuapp.com
NEXT_PUBLIC_SIS_API_URL=https://sis-be.herokuapp.com/api/v1
NEXT_PUBLIC_SIS_FE_URL=https://sis-fe.herokuapp.com
2 changes: 1 addition & 1 deletion .env.sis.local
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

PORT=8586
NEXT_PUBLIC_SIS_PROFILE=local
NEXT_PUBLIC_SIS_API_URL=http://localhost:8585
NEXT_PUBLIC_SIS_API_URL=http://localhost:8585/api/v1
NEXT_PUBLIC_SIS_FE_URL=http://localhost:8586
2 changes: 1 addition & 1 deletion pages/officer/operation/schedule/exam/file/[id]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function getServerSideProps(context) {
}

const {id} = context.query;
const examScheduleFileData = await ExamScheduleFileController.getExamScheduleFileDetailByExamScheduleFileId(id);
const examScheduleFileData = await ExamScheduleFileController.getExamScheduleFileDetailByDepartmentId(id);
if (examScheduleFileData.success) {
return {
props: {
Expand Down
2 changes: 1 addition & 1 deletion pages/student/schedule/exam/file/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function getServerSideProps(context) {
}

const departmentId = SisStudentStorage.getDepartmentNumberWithContext(context);
const examScheduleFileData = await ExamScheduleFileController.getExamScheduleFileDetailByExamScheduleFileId(departmentId);
const examScheduleFileData = await ExamScheduleFileController.getExamScheduleFileDetailByDepartmentId(departmentId);
if (examScheduleFileData.success) {
return {
props: {
Expand Down
2 changes: 1 addition & 1 deletion pages/teacher/schedule/exam/file/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function getServerSideProps(context) {
}

const departmentId = SisTeacherStorage.getDepartmentNumberWithContext(context);
const examScheduleFileData = await ExamScheduleFileController.getExamScheduleFileDetailByExamScheduleFileId(departmentId);
const examScheduleFileData = await ExamScheduleFileController.getExamScheduleFileDetailByDepartmentId(departmentId);
if (examScheduleFileData.success) {
return {
props: {
Expand Down
8 changes: 4 additions & 4 deletions public/api/department/DepartmentController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const SIS_API_URL = process.env.NEXT_PUBLIC_SIS_API_URL;

const getAllDepartmentsByStatus = async (status) => {
const apiResult = await fetch(`${SIS_API_URL}/department?status=${status}`, {
const apiResult = await fetch(`${SIS_API_URL}/departments?status=${status}`, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
Expand All @@ -18,7 +18,7 @@ const getDepartmentByDepartmentId = async (departmentId) => {
};

const saveDepartment = async (operationUserId, facultyId, preparatoryClass, name, totalClassLevel) => {
const apiResult = await fetch(`${SIS_API_URL}/department/save`, {
const apiResult = await fetch(`${SIS_API_URL}/department`, {
body: JSON.stringify({
operationInfoRequest: {
userId: operationUserId
Expand All @@ -39,7 +39,7 @@ const saveDepartment = async (operationUserId, facultyId, preparatoryClass, name
const updateDepartment = async (operationUserId, department,
facultyId, isTherePreparatoryClass, name, totalClassLevel) => {

const apiResult = await fetch(`${SIS_API_URL}/department/update/${department.departmentId}`, {
const apiResult = await fetch(`${SIS_API_URL}/department/${department.departmentId}`, {
headers: {'Content-Type': 'application/json'},
method: 'PUT',
body: JSON.stringify({
Expand Down Expand Up @@ -86,7 +86,7 @@ const passivateDepartment = async (operationUserId, departmentId) => {
};

const deleteDepartment = async (operationUserId, departmentId) => {
const apiResult = await fetch(`${SIS_API_URL}/department/delete`, {
const apiResult = await fetch(`${SIS_API_URL}/department`, {
headers: {'Content-Type': 'application/json'},
method: 'DELETE',
body: JSON.stringify({
Expand Down
12 changes: 6 additions & 6 deletions public/api/exam-file/ExamScheduleFileController.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const SIS_API_URL = process.env.NEXT_PUBLIC_SIS_API_URL;

const getAllExamScheduleFilesDetailByFacultyId = async (facultyId) => {
const apiResult = await fetch(`${SIS_API_URL}/exam-schedule-file/faculty/${facultyId}`, {
const apiResult = await fetch(`${SIS_API_URL}/exam/schedule/files/by/faculty/${facultyId}`, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
return await apiResult.json();
};

const getExamScheduleFileDetailByExamScheduleFileId = async (departmentId) => {
const apiResult = await fetch(`${SIS_API_URL}/exam-schedule-file/department/${departmentId}`, {
const getExamScheduleFileDetailByDepartmentId = async (departmentId) => {
const apiResult = await fetch(`${SIS_API_URL}/exam/schedule/file/by/department/${departmentId}`, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
Expand All @@ -20,15 +20,15 @@ const saveExamScheduleFile = async (examScheduleFileRequest) => {

examScheduleFileRequest.append('apiUrl', SIS_API_URL);

const apiResult = await fetch(`${SIS_API_URL}/exam-schedule-file/save`, {
const apiResult = await fetch(`${SIS_API_URL}/exam/schedule/file`, {
body: examScheduleFileRequest,
method: 'POST'
});
return await apiResult.json();
};

const deleteExamScheduleFile = async (departmentId) => {
const apiResult = await fetch(`${SIS_API_URL}/exam-schedule-file/delete/department/${departmentId}`, {
const apiResult = await fetch(`${SIS_API_URL}/exam/schedule/file/by/department/${departmentId}`, {
headers: {'Content-Type': 'application/json'},
method: 'DELETE'
});
Expand All @@ -38,7 +38,7 @@ const deleteExamScheduleFile = async (departmentId) => {

const ExamScheduleFileController = {
getAllExamScheduleFilesDetailByFacultyId,
getExamScheduleFileDetailByExamScheduleFileId,
getExamScheduleFileDetailByDepartmentId,
saveExamScheduleFile,
deleteExamScheduleFile
};
Expand Down
8 changes: 4 additions & 4 deletions public/api/exam-file/LessonScheduleFileController.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const SIS_API_URL = process.env.NEXT_PUBLIC_SIS_API_URL;

const getAllLessonScheduleFilesDetailByFacultyId = async (facultyId) => {
const apiResult = await fetch(`${SIS_API_URL}/lesson-schedule-file/faculty/${facultyId}`, {
const apiResult = await fetch(`${SIS_API_URL}/lesson/schedule/file/by/faculty/${facultyId}`, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
return await apiResult.json();
};

const getLessonScheduleFileDetailByLessonScheduleFileId = async (departmentId) => {
const apiResult = await fetch(`${SIS_API_URL}/lesson-schedule-file/department/${departmentId}`, {
const apiResult = await fetch(`${SIS_API_URL}/lesson/schedule/file/by/department/${departmentId}`, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
Expand All @@ -20,15 +20,15 @@ const saveLessonScheduleFile = async (lessonScheduleFileRequest) => {

lessonScheduleFileRequest.append('apiUrl', SIS_API_URL);

const apiResult = await fetch(`${SIS_API_URL}/lesson-schedule-file/save`, {
const apiResult = await fetch(`${SIS_API_URL}/lesson/schedule/file`, {
body: lessonScheduleFileRequest,
method: 'POST'
});
return await apiResult.json();
};

const deleteLessonScheduleFile = async (departmentId) => {
const apiResult = await fetch(`${SIS_API_URL}/lesson-schedule-file/delete/department/${departmentId}`, {
const apiResult = await fetch(`${SIS_API_URL}/lesson/schedule/file/by/department/${departmentId}`, {
headers: {'Content-Type': 'application/json'},
method: 'DELETE'
});
Expand Down
8 changes: 4 additions & 4 deletions public/api/faculty/FacultyController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const SIS_API_URL = process.env.NEXT_PUBLIC_SIS_API_URL;

const getAllFacultiesByStatus = async (status) => {
const apiResult = await fetch(`${SIS_API_URL}/faculty?status=${status}`, {
const apiResult = await fetch(`${SIS_API_URL}/faculties?status=${status}`, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
Expand All @@ -18,7 +18,7 @@ const getFacultyByFacultyId = async (facultyId) => {
};

const saveFaculty = async (operationUserId, name) => {
const apiResult = await fetch(`${SIS_API_URL}/faculty/save`, {
const apiResult = await fetch(`${SIS_API_URL}/faculty`, {
body: JSON.stringify({
operationInfoRequest: {
userId: operationUserId
Expand All @@ -34,7 +34,7 @@ const saveFaculty = async (operationUserId, name) => {
};

const updateFaculty = async (operationUserId, faculty, name) => {
const apiResult = await fetch(`${SIS_API_URL}/faculty/update/${faculty.facultyId}`, {
const apiResult = await fetch(`${SIS_API_URL}/faculty/${faculty.facultyId}`, {
headers: {'Content-Type': 'application/json'},
method: 'PUT',
body: JSON.stringify({
Expand Down Expand Up @@ -78,7 +78,7 @@ const passivateFaculty = async (operationUserId, facultyId) => {
};

const deleteFaculty = async (operationUserId, facultyId) => {
const apiResult = await fetch(`${SIS_API_URL}/faculty/delete`, {
const apiResult = await fetch(`${SIS_API_URL}/faculty`, {
headers: {'Content-Type': 'application/json'},
method: 'DELETE',
body: JSON.stringify({
Expand Down
8 changes: 4 additions & 4 deletions public/api/lesson/LessonController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const SIS_API_URL = process.env.NEXT_PUBLIC_SIS_API_URL;

const getAllLessonsByStatus = async (status) => {
const apiResult = await fetch(`${SIS_API_URL}/lesson?status=${status}`, {
const apiResult = await fetch(`${SIS_API_URL}/lessons?status=${status}`, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
Expand All @@ -18,7 +18,7 @@ const getLessonByLessonId = async (lessonId) => {
};

const saveLesson = async (operationUserId, lessonInfo) => {
const apiResult = await fetch(`${SIS_API_URL}/lesson/save`, {
const apiResult = await fetch(`${SIS_API_URL}/lesson`, {
body: JSON.stringify({
operationInfoRequest: {
userId: operationUserId
Expand All @@ -40,7 +40,7 @@ const saveLesson = async (operationUserId, lessonInfo) => {
};

const updateLesson = async (operationUserId, lessonId, lessonInfo) => {
const apiResult = await fetch(`${SIS_API_URL}/lesson/update/${lessonId}`, {
const apiResult = await fetch(`${SIS_API_URL}/lesson/${lessonId}`, {
headers: {'Content-Type': 'application/json'},
method: 'PUT',
body: JSON.stringify({
Expand Down Expand Up @@ -90,7 +90,7 @@ const passivateLesson = async (operationUserId, lessonId) => {
};

const deleteLesson = async (operationUserId, lessonId) => {
const apiResult = await fetch(`${SIS_API_URL}/lesson/delete`, {
const apiResult = await fetch(`${SIS_API_URL}/lesson`, {
headers: {'Content-Type': 'application/json'},
method: 'DELETE',
body: JSON.stringify({
Expand Down
6 changes: 3 additions & 3 deletions public/api/login/LoginController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const SIS_API_URL = process.env.NEXT_PUBLIC_SIS_API_URL;

const studentLogin = async (studentId, password) => {
const apiResult = await fetch(`${SIS_API_URL}/login/student`, {
const apiResult = await fetch(`${SIS_API_URL}/student/login`, {
body: JSON.stringify({
studentId: studentId,
password: password
Expand All @@ -15,7 +15,7 @@ const studentLogin = async (studentId, password) => {


const teacherLogin = async (teacherId, password) => {
const apiResult = await fetch(`${SIS_API_URL}/login/teacher`, {
const apiResult = await fetch(`${SIS_API_URL}/teacher/login`, {
body: JSON.stringify({
teacherId: teacherId,
password: password
Expand All @@ -27,7 +27,7 @@ const teacherLogin = async (teacherId, password) => {
};

const officerLogin = async (officerId, password) => {
const apiResult = await fetch(`${SIS_API_URL}/login/officer`, {
const apiResult = await fetch(`${SIS_API_URL}/officer/login`, {
body: JSON.stringify({
officerId: officerId,
password: password
Expand Down
10 changes: 5 additions & 5 deletions public/api/officer/OfficerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const SIS_API_URL = process.env.NEXT_PUBLIC_SIS_API_URL;

const getAllOfficersByStatus = async (status) => {
const apiResult = await fetch(`${SIS_API_URL}/officer?status=${status}`, {
const apiResult = await fetch(`${SIS_API_URL}/officers?status=${status}`, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
Expand All @@ -19,7 +19,7 @@ const getOfficerDetailByOfficerId = async (officerId) => {

const saveOfficer = async (operationUserId, academicInfo, personalInfo) => {

const apiResult = await fetch(`${SIS_API_URL}/officer/save`, {
const apiResult = await fetch(`${SIS_API_URL}/officer`, {
body: JSON.stringify({
operationInfoRequest: {
userId: operationUserId
Expand All @@ -46,7 +46,7 @@ const saveOfficer = async (operationUserId, academicInfo, personalInfo) => {

const updateOfficerAcademicInfo = async (operationUserId, officerId, academicInfo) => {

const apiResult = await fetch(`${SIS_API_URL}/officer/update/academic-info/${officerId}`, {
const apiResult = await fetch(`${SIS_API_URL}/officer/academic/info/${officerId}`, {
headers: {'Content-Type': 'application/json'},
method: 'PUT',
body: JSON.stringify({
Expand All @@ -64,7 +64,7 @@ const updateOfficerAcademicInfo = async (operationUserId, officerId, academicInf

const updateOfficerPersonalInfo = async (operationUserId, officerId, personalInfo) => {

const apiResult = await fetch(`${SIS_API_URL}/officer/update/personal-info/${officerId}`, {
const apiResult = await fetch(`${SIS_API_URL}/officer/personal/info/${officerId}`, {
headers: {'Content-Type': 'application/json'},
method: 'PUT',
body: JSON.stringify({
Expand Down Expand Up @@ -117,7 +117,7 @@ const passivateOfficer = async (operationUserId, officerId) => {

const deleteOfficer = async (operationUserId, officerId) => {

const apiResult = await fetch(`${SIS_API_URL}/officer/delete`, {
const apiResult = await fetch(`${SIS_API_URL}/officer`, {
headers: {'Content-Type': 'application/json'},
method: 'DELETE',
body: JSON.stringify({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
const SIS_API_URL = process.env.NEXT_PUBLIC_SIS_API_URL;

const isPasswordChangeOperationEnabled = async (operationId) => {
const apiResult = await fetch(`${SIS_API_URL}/officer/password-operation?operationId=${operationId}`, {
const apiResult = await fetch(`${SIS_API_URL}/officer/password/operation/enabled/${operationId}`, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
return await apiResult.json();
};

const changePassword = async (operationId, newPassword, newPasswordRepeat) => {
const apiResult = await fetch(`${SIS_API_URL}/officer/password-operation/change-password`, {
const apiResult = await fetch(`${SIS_API_URL}/officer/password/operation/change`, {
body: JSON.stringify({
operationId: operationId,
newPassword: newPassword,
Expand All @@ -23,7 +23,7 @@ const changePassword = async (operationId, newPassword, newPasswordRepeat) => {
};

const forgotPassword = async (officerId) => {
const apiResult = await fetch(`${SIS_API_URL}/officer/password-operation/forgot-password`, {
const apiResult = await fetch(`${SIS_API_URL}/officer/password/operation/forgot`, {
body: JSON.stringify({
officerId: officerId
}),
Expand Down
10 changes: 5 additions & 5 deletions public/api/student/StudentController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const SIS_API_URL = process.env.NEXT_PUBLIC_SIS_API_URL;

const getAllStudentsByStatus = async (status) => {
const apiResult = await fetch(`${SIS_API_URL}/student?status=${status}`, {
const apiResult = await fetch(`${SIS_API_URL}/students?status=${status}`, {
headers: {'Content-Type': 'application/json'},
method: 'GET'
});
Expand All @@ -20,7 +20,7 @@ const getStudentDetailByStudentId = async (studentId) => {

const saveStudent = async (operationUserId, academicInfo, personalInfo) => {

const apiResult = await fetch(`${SIS_API_URL}/student/save`, {
const apiResult = await fetch(`${SIS_API_URL}/student`, {
body: JSON.stringify({
operationInfoRequest: {
userId: operationUserId
Expand Down Expand Up @@ -48,7 +48,7 @@ const saveStudent = async (operationUserId, academicInfo, personalInfo) => {

const updateStudentAcademicInfo = async (operationUserId, studentId, academicInfo) => {

const apiResult = await fetch(`${SIS_API_URL}/student/update/academic-info/${studentId}`, {
const apiResult = await fetch(`${SIS_API_URL}/student/academic/info/${studentId}`, {
headers: {'Content-Type': 'application/json'},
method: 'PUT',
body: JSON.stringify({
Expand All @@ -67,7 +67,7 @@ const updateStudentAcademicInfo = async (operationUserId, studentId, academicInf

const updateStudentPersonalInfo = async (operationUserId, studentId, personalInfo) => {

const apiResult = await fetch(`${SIS_API_URL}/student/update/personal-info/${studentId}`, {
const apiResult = await fetch(`${SIS_API_URL}/student/personal/info/${studentId}`, {
headers: {'Content-Type': 'application/json'},
method: 'PUT',
body: JSON.stringify({
Expand Down Expand Up @@ -120,7 +120,7 @@ const passivateStudent = async (operationUserId, studentId) => {

const deleteStudent = async (operationUserId, studentId) => {

const apiResult = await fetch(`${SIS_API_URL}/student/delete`, {
const apiResult = await fetch(`${SIS_API_URL}/student`, {
headers: {'Content-Type': 'application/json'},
method: 'DELETE',
body: JSON.stringify({
Expand Down
Loading

0 comments on commit 851e941

Please sign in to comment.