Skip to content

Commit

Permalink
Merge pull request #67 from YoginiTayade/student-update-remove-groups
Browse files Browse the repository at this point in the history
Removed the groups from studentUpdateField
  • Loading branch information
ankush-maherwal authored Sep 16, 2024
2 parents ad9ac68 + 5c647ec commit 977891c
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions src/adapters/hasura/altStudent.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1100,16 +1100,15 @@ export class ALTStudentService {
decoded["https://hasura.io/jwt/claims"]["x-hasura-allowed-roles"];
const updatedBy =
decoded["https://hasura.io/jwt/claims"]["x-hasura-user-id"]; // Extracting user ID from token
if(!altUserRoles.includes('systemAdmin')){
return new ErrorResponse({
errorCode : "401",
errorMessage : "Unauthorized Access",
})
}
if (!altUserRoles.includes("systemAdmin")) {
return new ErrorResponse({
errorCode: "401",
errorMessage: "Unauthorized Access",
});
}

//students fields that can be updated
const studentFields = [
"groups",
"religion",
"caste",
"annualIncome",
Expand All @@ -1122,16 +1121,10 @@ export class ALTStudentService {
"board",
"state",
"block",
"district"
"district",
];
//users fields that can be updated
const userFields = [
"name",
"email",
"gender",
"dateOfBirth",
"mobile"
];
const userFields = ["name", "email", "gender", "dateOfBirth", "mobile"];
let userUpdate = "";
let studentUpdate = "";
let userUpdateFields = "";
Expand Down Expand Up @@ -1228,7 +1221,7 @@ export class ALTStudentService {
"userId",
"studentId",
"updatedAt",
"updatedBy"
"updatedBy",
];
const restrictedFieldNames = Object.keys(body).filter((field) =>
restrictedFields.includes(field)
Expand All @@ -1255,11 +1248,11 @@ export class ALTStudentService {
)}.`
: "";

return new SuccessResponse({
statusCode: 200,
message: `Ok. ${restrictedFieldsMessage}`,
data: result,
});
return new SuccessResponse({
statusCode: 200,
message: `Ok. ${restrictedFieldsMessage}`,
data: result,
});
}
}
}

0 comments on commit 977891c

Please sign in to comment.