Skip to content

Commit

Permalink
removed date formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
SodhiA1 committed Oct 11, 2023
1 parent 54af282 commit c452ca2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 3 additions & 6 deletions backend/src/components/edx/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ async function checkIfPrimaryCodeExists(req,res, token, instituteType, institute

async function districtUserActivationInvite(req, res) {
const token = utils.getBackendToken(req);
const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss');
if (!token) {
return res.status(HttpStatus.UNAUTHORIZED).json({
message: 'No access token'
Expand All @@ -512,7 +511,7 @@ async function districtUserActivationInvite(req, res) {

const payload = {
...req.body,
edxUserExpiryDate: req.body.edxUserExpiryDate ? LocalDate.parse(req.body.edxUserExpiryDate).atStartOfDay().format(formatter) : null
edxUserExpiryDate: req.body.edxUserExpiryDate
};
try {
const response = await utils.postData(token, config.get('server:edx:districtUserActivationInviteURL'), payload, null, utils.getUser(req).idir_username);
Expand Down Expand Up @@ -555,7 +554,6 @@ async function updateEdxUserSchoolRoles(req, res) {
try {
const token = utils.getBackendToken(req);
const userInfo = utils.getUser(req);
const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss');

let edxUser = await getData(token, `${config.get('server:edx:edxUsersURL')}/${req.body.params.edxUserID}`);
let selectedUserSchools = edxUser.edxUserSchools.filter(school => school.schoolID === req.body.params.schoolID);
Expand Down Expand Up @@ -584,7 +582,7 @@ async function updateEdxUserSchoolRoles(req, res) {

selectedUserSchool.updateDate = null;
selectedUserSchool.createDate = null;
selectedUserSchool.expiryDate = req.body.params.expiryDate ? LocalDate.parse(req.body.params.expiryDate).atStartOfDay().format(formatter) : null;
selectedUserSchool.expiryDate = req.body.params.expiryDate;

const result = await utils.putData(token, `${config.get('server:edx:edxUsersURL')}/${selectedUserSchool.edxUserID}/school`, selectedUserSchool, userInfo.idir_username);
return res.status(HttpStatus.OK).json(result);
Expand All @@ -598,7 +596,6 @@ async function updateEdxUserDistrictRoles(req, res) {
try {
const token = utils.getBackendToken(req);
const userInfo = utils.getUser(req);
const formatter = DateTimeFormatter.ofPattern('yyyy-MM-dd\'T\'HH:mm:ss');

let edxUser = await getData(token, `${config.get('server:edx:edxUsersURL')}/${req.body.params.edxUserID}`);
let selectedUserDistricts = edxUser.edxUserDistricts.filter(district => district.districtID === req.body.params.districtId);
Expand Down Expand Up @@ -627,7 +624,7 @@ async function updateEdxUserDistrictRoles(req, res) {

selectedUserDistrict.updateDate = null;
selectedUserDistrict.createDate = null;
selectedUserDistrict.expiryDate = req.body.params.expiryDate ? LocalDate.parse(req.body.params.expiryDate).atStartOfDay().format(formatter) : null;
selectedUserDistrict.expiryDate = req.body.params.expiryDate;

const result = await utils.putData(token, `${config.get('server:edx:edxUsersURL')}/${selectedUserDistrict.edxUserID}/district`, selectedUserDistrict, userInfo.idir_username);
return res.status(HttpStatus.OK).json(result);
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/secure-message/AccessUserCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
id="accessExpiryDate"
v-model="accessExpiryDate"
label="Access Expiry Date"
model-type="yyyy-MM-dd'T'00:00:00"
@clear-date="clearExpiryDate"
/>
</div>
Expand Down Expand Up @@ -479,7 +480,7 @@ export default {
});
this.selectedRoles = [...mySelection];
this.accessExpiryDate = this.formatExpiryDate(this.user.edxUserSchools[0].expiryDate);
this.accessExpiryDate = this.user.edxUserSchools[0].expiryDate;
},
clearExpiryDate(){
this.accessExpiryDate = null;
Expand Down

0 comments on commit c452ca2

Please sign in to comment.