Skip to content

Commit

Permalink
fix: certificate, invitation and reads variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingcedru committed Dec 6, 2024
1 parent b3c8680 commit 5828e17
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class DecimalPermissionValue {
).isSet = true;
}
});
const getPermission: any = [];
const permission: any = [];
this.permissionListMAPToBItPOSITIONSAtAPI.forEach((ele) => {
if (
(ele.andOperationNumber & userPermission) ===
Expand All @@ -124,10 +124,10 @@ export class DecimalPermissionValue {
this.userPermissions.find(
(eleMod: any) => eleMod.bitPosition == ele.bitPosition,
).isSet = true;
getPermission.push(ele.permissionString);
permission.push(ele.permissionString);
}
}
});
return getPermission;
return permission;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ describe('CertificateLogService', () => {

const pageNumber = 1;

const getOldReservationInfo = {
const oldReservationInfo = {
deviceGroups: [
{
dg_id: 2,
Expand All @@ -331,15 +331,15 @@ describe('CertificateLogService', () => {
],
};

const ReservationInfo = { deviceGroups: [] };
const reservationInfo = { deviceGroups: [] };

const ReservationInforDeveloperBsiseSpy = jest
const reservationInforDeveloperBsiseSpy = jest
.spyOn(devicegroupService, 'getReservationInforDeveloperBsise')
.mockResolvedValueOnce(ReservationInfo);
.mockResolvedValueOnce(reservationInfo);

const OldReservationInforDeveloperBsiseSpy = jest
const oldReservationInforDeveloperBsiseSpy = jest
.spyOn(devicegroupService, 'getoldReservationInforDeveloperBsise')
.mockResolvedValueOnce(getOldReservationInfo);
.mockResolvedValueOnce(oldReservationInfo);

const expectedCertificates = {
certificatelog: [
Expand Down Expand Up @@ -395,15 +395,15 @@ describe('CertificateLogService', () => {
pageNumber,
);

expect(ReservationInforDeveloperBsiseSpy).toHaveBeenCalledWith(
expect(reservationInforDeveloperBsiseSpy).toHaveBeenCalledWith(
user.organizationId,
user.role,
filterDto,
pageNumber,
user.api_user_id,
);

expect(OldReservationInforDeveloperBsiseSpy).toHaveBeenCalledWith(
expect(oldReservationInforDeveloperBsiseSpy).toHaveBeenCalledWith(
user.organizationId,
user.role,
filterDto,
Expand Down
20 changes: 10 additions & 10 deletions apps/drec-api/src/pods/certificate-log/certificate-log.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ export class CertificateLogService {
oldcertificatelog: boolean;
}> {
this.logger.verbose(`With in getCertifiedlogofDevices`);
const getNewReservationInfo =
const reservationInfo =
await this.deviceGroupService.getReservationInforDeveloperBsise(
user.organizationId,
user.role,
Expand All @@ -598,9 +598,9 @@ export class CertificateLogService {
);
this.logger.debug(
'getNewReservationInfo',
getNewReservationInfo.deviceGroups.length,
reservationInfo.deviceGroups.length,
);
const getOldReservationInfo =
const oldReservationInfo =
await this.deviceGroupService.getoldReservationInforDeveloperBsise(
user.organizationId,
user.role,
Expand All @@ -610,34 +610,34 @@ export class CertificateLogService {
);
this.logger.debug(
'getOldReservationInfo',
getOldReservationInfo.deviceGroups.length,
oldReservationInfo.deviceGroups.length,
);
const oldCertificateLog = this.isTrue(filterDto.oldcertificatelog);
if (!oldCertificateLog && getNewReservationInfo.deviceGroups.length > 0) {
if (!oldCertificateLog && reservationInfo.deviceGroups.length > 0) {
this.logger.debug('Line No: 580');
const newLog =
await this.getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247(
getNewReservationInfo,
reservationInfo,
user.role,
);

return {
...newLog,
oldcertificatelog:
getOldReservationInfo.deviceGroups.length > 0 ? true : false,
oldReservationInfo.deviceGroups.length > 0 ? true : false,
};
}

if (oldCertificateLog && getOldReservationInfo.deviceGroups.length > 0) {
if (oldCertificateLog && oldReservationInfo.deviceGroups.length > 0) {
this.logger.debug('Line No: 581');
const oldLog = await this.getDeveloperfindCertifiedReservations(
getOldReservationInfo,
oldReservationInfo,
user.role,
);
return {
...oldLog,
oldcertificatelog:
getOldReservationInfo.deviceGroups.length > 0 ? true : false,
oldReservationInfo.deviceGroups.length > 0 ? true : false,
};
}

Expand Down
6 changes: 3 additions & 3 deletions apps/drec-api/src/pods/device-group/device-group.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2359,10 +2359,10 @@ export class DeviceGroupService {
historyNextIssuancer,
});

const AllDevicesHistNextIssuansInfo: any = [];
const allDevicesHistNextIssuansInfo: any = [];
deviceHistoryNextIssuance.forEach((ele) =>
ele.historyNextIssuancer.forEach((he) =>
AllDevicesHistNextIssuansInfo.push(he),
allDevicesHistNextIssuansInfo.push(he),
),
);

Expand All @@ -2377,7 +2377,7 @@ export class DeviceGroupService {

return {
historynextissuansinfo: {
AllDeviceshistnextissuansinfo: AllDevicesHistNextIssuansInfo,
AllDeviceshistnextissuansinfo: allDevicesHistNextIssuansInfo,
totalItems: count,
currentPage: pageNumber,
totalPages: totalPages,
Expand Down
6 changes: 3 additions & 3 deletions apps/drec-api/src/pods/invitation/invitation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,16 @@ export class InvitationService {

async remove(email: string, orgId: number): Promise<void> {
const lowerCaseEmail = email.toLowerCase();
const orgInvitee = await this.invitationRepository.findOne({
const orgInvite = await this.invitationRepository.findOne({
where: {
email: lowerCaseEmail,
organization: orgId,
},
relations: ['organization'],
});
this.logger.verbose('orginvitee');
if (orgInvitee) {
await this.invitationRepository.delete(orgInvitee.id);
if (orgInvite) {
await this.invitationRepository.delete(orgInvite.id);
}
}
async getinvite_info_byEmail(user: LoggedInUser): Promise<any> {
Expand Down
6 changes: 3 additions & 3 deletions apps/drec-api/src/pods/reads/reads.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -990,15 +990,15 @@ export class ReadsController extends BaseReadsController {
) {
datesContainingNullOrEmptyValues = true;
}
const startDateFormate = isValidUTCDateFormat(
const startDateFormat = isValidUTCDateFormat(
new Date(ele.starttimestamp).toISOString(),
);

const endDateFormate = isValidUTCDateFormat(
const endDateFormat = isValidUTCDateFormat(
new Date(ele.endtimestamp).toISOString(),
);

if (!startDateFormate || !endDateFormate) {
if (!startDateFormat || !endDateFormat) {
datevalid = false;
}
if (device && device.createdAt) {
Expand Down
16 changes: 8 additions & 8 deletions apps/drec-api/src/pods/reads/reads.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export class ReadsService {
?.hours || 0,
);

const checkHistroyreading = await this.checkhistoryreadexist(
const checkHistroyReading = await this.checkhistoryreadexist(
device.externalId,
element.starttimestamp,
element.endtimestamp,
Expand All @@ -409,7 +409,7 @@ export class ReadsService {
historyAge.setFullYear(historyAge.getFullYear() - 3);
this.logger.verbose('historyAge');

if (checkHistroyreading) {
if (checkHistroyReading) {
this.storeFailedReads(
device.externalId,
element.value,
Expand Down Expand Up @@ -1059,25 +1059,25 @@ export class ReadsService {
if (historyNextIssue != undefined) {
const startDate = new Date(startdate).getTime();
const endDate = new Date(enddate).getTime();
const reservedStartdate = new Date(
const reservedStartDate = new Date(
historyNextIssue.reservationStartDate,
).getTime();
this.logger.verbose(reservedStartdate);
this.logger.verbose(reservedStartDate);
const reservedEnddate = new Date(
historyNextIssue.reservationEndDate,
).getTime();
this.logger.verbose(reservedEnddate);
this.logger.verbose(
startDate >= reservedStartdate && startDate < reservedEnddate,
startDate >= reservedStartDate && startDate < reservedEnddate,
);
this.logger.verbose(
endDate <= reservedEnddate && endDate > reservedStartdate,
endDate <= reservedEnddate && endDate > reservedStartDate,
);
if (
startDate >= reservedStartdate &&
startDate >= reservedStartDate &&
startDate < reservedEnddate &&
endDate <= reservedEnddate &&
endDate > reservedStartdate
endDate > reservedStartDate
) {
this.deviceGroupService.updateHistoryCertificateIssueDate(
historyNextIssue.id,
Expand Down

0 comments on commit 5828e17

Please sign in to comment.