Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DR-785,worked on certificate issue,change in issuermeta data payload … #211

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions apps/drec-api/src/pods/certificate-log/certificate-log.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,15 @@ export class CertificateLogService {
); //going back 1 second in start and going forward 1 second in end

await Promise.all(
obj.deviceIds.map(async (deviceid: number) => {
const device = await this.deviceService.findOne(deviceid);
obj.deviceIds.map(async (deviceid) => {
let device: Device;
if (typeof deviceid === 'number') {
device = await this.deviceService.findOne(deviceid);
}
if (typeof deviceid === 'string') {
device = await this.deviceService.findReads(deviceid);
}

const devicelog =
await this.getCheckCertificateIssueDateLogForDevice(
parseInt(groupid),
Expand Down Expand Up @@ -291,7 +298,14 @@ export class CertificateLogService {

await Promise.all(
obj.deviceIds.map(async (deviceid: number) => {
const device = await this.deviceService.findOne(deviceid);
let device: Device;
if (typeof deviceid === 'number') {
device = await this.deviceService.findOne(deviceid);
}
if (typeof deviceid === 'string') {
device = await this.deviceService.findReads(deviceid);
}

const devicelog =
await this.getCheckCertificateIssueDateLogForDevice(
parseInt(groupid),
Expand Down
6 changes: 5 additions & 1 deletion apps/drec-api/src/pods/device/device.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,15 @@ export class DeviceService {
return device;
}

async findReads(meterId: string): Promise<DeviceDTO | null> {
async findReads(meterId: string): Promise<Device | null> {
this.logger.verbose(`With in findReads`);
const result = await this.repository.findOne({
where: { externalId: meterId },
});
result.timezone = await getLocalTimeZoneFromDevice(
result.createdAt,
result,
);
delete result['organization'];

return result ?? null;
Expand Down
Loading
Loading