From c3d98ff4ececdd9041aea74d5db2be30dc089283 Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Thu, 7 Mar 2024 14:24:21 +0100 Subject: [PATCH 1/5] format: Apply `prettier` fix --- apps/drec-api/src/auth/auth.controller.ts | 27 +- apps/drec-api/src/auth/auth.module.ts | 15 +- apps/drec-api/src/auth/auth.service.ts | 43 +- apps/drec-api/src/auth/client-jwt.strategy.ts | 74 +- .../src/auth/client-password.strategy.ts | 36 +- apps/drec-api/src/auth/client.strategy.ts | 21 +- apps/drec-api/src/auth/jwt.strategy.ts | 25 +- apps/drec-api/src/auth/local.strategy.ts | 3 +- apps/drec-api/src/drec.module.ts | 73 +- apps/drec-api/src/guards/ActiveUserGuard.ts | 10 +- apps/drec-api/src/guards/PermissionGuard.ts | 26 +- apps/drec-api/src/guards/RolesGuard.ts | 10 +- apps/drec-api/src/guards/WithoutAuthGuard.ts | 173 +- apps/drec-api/src/guards/index.ts | 2 +- apps/drec-api/src/main.ts | 6 +- apps/drec-api/src/models/ACLModules.ts | 15 +- .../src/models/ACLModulesPermission.ts | 26 +- .../src/models/AggregateMetervalue.ts | 76 +- apps/drec-api/src/models/Delta_firstread.ts | 27 +- apps/drec-api/src/models/Device.ts | 12 +- apps/drec-api/src/models/DeviceGroup.ts | 16 +- .../DeviceGroupIssueCertificateRequest.ts | 35 +- apps/drec-api/src/models/Fuels.ts | 5 +- apps/drec-api/src/models/LoggedInUser.ts | 14 +- apps/drec-api/src/models/Organization.ts | 8 +- .../src/models/OrganizationInvitation.ts | 15 +- apps/drec-api/src/models/Roles.ts | 15 +- apps/drec-api/src/models/Sdgbenefit.ts | 46 +- apps/drec-api/src/models/User.ts | 21 +- .../src/models/UserRegistrationData.ts | 9 +- apps/drec-api/src/models/YieldConfig.ts | 15 +- apps/drec-api/src/models/country-code.ts | 8560 ++++++------ .../on-application-bootsrap-hook.service.ts | 50 +- ...control-layer-module-service.controller.ts | 166 +- ...ess-control-layer-module-service.module.ts | 15 +- ...ss-control-layer-module-service.service.ts | 62 +- ...ccess-control-layer-module-service.spec.ts | 74 +- .../aclmodule.entity.ts | 27 +- .../common/permissionBitposition.ts | 65 +- .../dto/aclmodule.dto.ts | 171 +- .../src/pods/admin/admin.controller.ts | 108 +- apps/drec-api/src/pods/admin/admin.module.ts | 15 +- .../pods/admin/dto/organization-filter.dto.ts | 16 +- .../src/pods/admin/dto/seed-user.dto.ts | 32 +- .../certificate-log.controller.ts | 846 +- .../certificate-log/certificate-log.module.ts | 26 +- .../certificate-log.service.spec.ts | 1015 +- .../certificate-log.service.ts | 1163 +- .../dto/certificatewithdevicelog.dto.ts | 43 +- .../pods/certificate-log/dto/filter.dto.ts | 26 +- .../src/pods/certificate-log/dto/index.ts | 2 +- .../src/pods/certificate-log/grouplog.ts | 10993 ++++++++-------- .../pods/certificate-log/issuercertificate.ts | 8824 +++++++------ .../countrycode/countrycode.controller.ts | 57 +- .../pods/countrycode/countrycode.module.ts | 12 +- .../countrycode/countrycode.service.spec.ts | 37 +- .../pods/countrycode/countrycode.service.ts | 34 +- .../pods/countrycode/dto/country-code.dto.ts | 6 +- .../pods/countrycode/dto/filterKeyDTO.dto.ts | 9 +- .../src/pods/countrycode/dto/index.ts | 2 +- .../buyer-reservation.controller.ts | 1897 +-- ..._issue_date_log_for_device_group.entity.ts | 28 +- .../device-group/device-group.controller.ts | 261 +- .../pods/device-group/device-group.entity.ts | 33 +- .../pods/device-group/device-group.module.ts | 92 +- .../device-group/device-group.service.spec.ts | 200 +- .../pods/device-group/device-group.service.ts | 2545 ++-- .../device_csv_processing_jobs.entity.ts | 2 +- .../device_group_issuecertificate.entity.ts | 13 +- .../device-group/dto/add-device-group.dto.ts | 38 +- .../pods/device-group/dto/device-group.dto.ts | 24 +- .../device-group/dto/job-failed-rows.dto.ts | 50 +- .../device-group/dto/new-device-group.dto.ts | 6 +- .../device-group/dto/unreserved-filter.dto.ts | 25 +- .../device-group/dto/update-device.dto.ts | 23 +- .../history_next_issuance_date_log.entity.ts | 9 +- ...ficate_issue_date_log_for_device.entity.ts | 30 +- .../src/pods/device/device.controller.ts | 570 +- .../drec-api/src/pods/device/device.entity.ts | 32 +- .../drec-api/src/pods/device/device.module.ts | 20 +- .../src/pods/device/device.service.spec.ts | 2104 +-- .../src/pods/device/device.service.ts | 794 +- .../device_lateongoing_certificate.entity.ts | 103 +- .../src/pods/device/dto/device.dto.ts | 24 +- .../src/pods/device/dto/filter.dto.ts | 49 +- .../pods/device/dto/grouped-devices.dto.ts | 16 +- .../src/pods/device/dto/new-device.dto.ts | 40 +- .../src/pods/device/dto/update-device.dto.ts | 42 +- .../device/irec_devices_information.entity.ts | 65 +- .../irec_error_log_information.entity.ts | 58 +- .../email-confirmation.module.ts | 6 +- .../email-confirmation.service.spec.ts | 96 +- .../email-confirmation.service.ts | 85 +- .../drec-api/src/pods/file/file-upload.dto.ts | 2 +- .../drec-api/src/pods/file/file.controller.ts | 23 +- apps/drec-api/src/pods/file/file.module.ts | 6 +- .../src/pods/file/file.service.spec.ts | 67 +- apps/drec-api/src/pods/file/file.service.ts | 56 +- .../integrators/integrators.service.spec.ts | 98 +- .../src/pods/invitation/dto/invitation.dto.ts | 7 +- .../src/pods/invitation/dto/invite.dto.ts | 23 +- .../pods/invitation/invitation.controller.ts | 112 +- .../src/pods/invitation/invitation.entity.ts | 3 +- .../src/pods/invitation/invitation.module.ts | 9 +- .../invitation/invitation.service.spec.ts | 989 +- .../src/pods/invitation/invitation.service.ts | 146 +- .../src/pods/issuer/drec-issuer.controller.ts | 116 +- .../issuer/dto/re-issue-certificate.dto.ts | 12 +- .../drec-api/src/pods/issuer/issuer.module.ts | 13 +- .../src/pods/issuer/issuer.service.spec.ts | 125 +- .../src/pods/issuer/issuer.service.ts | 2869 ++-- .../synchronize-blockchain-task.service.ts | 20 +- .../organization/dto/new-organization.dto.ts | 22 +- .../pods/organization/dto/organization.dto.ts | 2 +- .../dto/public-organization-info.dto.ts | 5 +- .../organization/organization.controller.ts | 142 +- .../pods/organization/organization.entity.ts | 3 +- .../pods/organization/organization.module.ts | 6 +- .../organization/organization.service.spec.ts | 1089 +- .../pods/organization/organization.service.ts | 111 +- .../permission/dto/modulepermission.dto.ts | 17 +- .../src/pods/permission/dto/role.dto.ts | 8 +- .../pods/permission/permission.controller.ts | 356 +- .../src/pods/permission/permission.entity.ts | 97 +- .../src/pods/permission/permission.module.ts | 18 +- .../permission/permission.service.spec.ts | 95 +- .../src/pods/permission/permission.service.ts | 593 +- .../pods/reads/aggregate_readvalue.entity.ts | 39 +- .../src/pods/reads/delta_firstread.entity.ts | 106 +- .../pods/reads/dto/filter-no-off-limit.dto.ts | 51 +- .../drec-api/src/pods/reads/dto/filter.dto.ts | 52 +- .../reads/dto/intermediate_meter_read.dto.ts | 32 +- .../history_intermideate_meterread.entity.ts | 61 +- .../src/pods/reads/reads.controller.ts | 3009 +++-- apps/drec-api/src/pods/reads/reads.module.ts | 18 +- .../src/pods/reads/reads.service.spec.ts | 143 +- apps/drec-api/src/pods/reads/reads.service.ts | 939 +- .../pods/sdgbenefit/dto/add_sdgbenefit.dto.ts | 55 +- .../pods/sdgbenefit/sdgbenefit.controller.ts | 109 +- .../src/pods/sdgbenefit/sdgbenefit.entity.ts | 56 +- .../src/pods/sdgbenefit/sdgbenefit.module.ts | 4 +- .../sdgbenefit/sdgbenefit.service.spec.ts | 60 +- .../src/pods/sdgbenefit/sdgbenefit.service.ts | 62 +- .../drec-api/src/pods/user/api-user.entity.ts | 32 +- .../pods/user/decorators/match.decorator.ts | 50 +- .../src/pods/user/dto/create-user.dto.ts | 42 +- .../src/pods/user/dto/new-user.dto.ts | 4 - .../src/pods/user/dto/update-password.dto.ts | 8 +- apps/drec-api/src/pods/user/dto/user.dto.ts | 6 +- .../pods/user/oauth_client.service.spec.ts | 520 +- .../src/pods/user/oauth_client.service.ts | 312 +- .../user/oauth_client_credentials.entity.ts | 56 +- .../drec-api/src/pods/user/user.controller.ts | 148 +- apps/drec-api/src/pods/user/user.entity.ts | 22 +- apps/drec-api/src/pods/user/user.module.ts | 25 +- .../src/pods/user/user.service.spec.ts | 1907 +-- apps/drec-api/src/pods/user/user.service.ts | 1629 +-- .../pods/user/user_login_session.entity.ts | 52 +- .../src/pods/user/user_role.entity.ts | 49 +- .../src/pods/yield-config/dto/index.ts | 2 +- .../yield-config/dto/new-yieldconfig.dto.ts | 37 +- .../yield-config/dto/update-yieldvalue.dto.ts | 53 +- .../pods/yield-config/dto/yield-config.dto.ts | 10 +- .../yield-config/yieldconfig.controller.ts | 56 +- .../pods/yield-config/yieldconfig.entity.ts | 10 +- .../pods/yield-config/yieldconfig.module.ts | 3 +- .../yield-config/yieldconfig.service.spec.ts | 59 +- .../pods/yield-config/yieldconfig.service.ts | 54 +- apps/drec-api/src/utils/PowerFormatter.ts | 76 +- .../src/utils/checkForISOStringFormat.ts | 24 +- .../src/utils/enums/capacity-range.enum.ts | 4 +- .../src/utils/enums/certificate-type.enum.ts | 4 +- .../src/utils/enums/device-status.enum.ts | 7 +- .../utils/enums/fuel&devicetype-code.enum.ts | 25 +- .../utils/enums/history_next_issuance.enum.ts | 10 +- apps/drec-api/src/utils/enums/index.ts | 3 +- .../src/utils/enums/off-taker.enum.ts | 11 +- .../src/utils/enums/read-type.enum.ts | 32 +- apps/drec-api/src/utils/enums/role.enum.ts | 21 +- .../src/utils/enums/sdgbenefits.enum.ts | 39 +- .../src/utils/enums/yieldstatus.enum.ts | 7 +- apps/drec-api/src/utils/evident-login.ts | 54 +- .../src/utils/get-capacity-range.spec.ts | 24 +- apps/drec-api/src/utils/get-capacity-range.ts | 33 +- .../get-commissioning-date-range.spec.ts | 48 +- .../src/utils/get-commissioning-date-range.ts | 2 +- .../drec-api/src/utils/get-lastread-influx.ts | 165 +- apps/drec-api/src/utils/getCodeFromCountry.ts | 9 +- .../src/utils/getDeviceTypeFromCode.spec.ts | 2 +- .../src/utils/getFuelNameFromCode.spec.ts | 2 +- .../src/utils/group-by-properties.spec.ts | 4 +- .../src/utils/history_next_issuance.enum.ts | 10 +- .../src/utils/localTimeDetailsForDevice.ts | 98 +- apps/drec-api/src/utils/number.spec.ts | 2 +- apps/drec-api/src/utils/types.ts | 12 +- 195 files changed, 32422 insertions(+), 28243 deletions(-) diff --git a/apps/drec-api/src/auth/auth.controller.ts b/apps/drec-api/src/auth/auth.controller.ts index 70f80f8cb..adc582b78 100755 --- a/apps/drec-api/src/auth/auth.controller.ts +++ b/apps/drec-api/src/auth/auth.controller.ts @@ -19,10 +19,10 @@ import { LoginDataDTO } from './dto/login-data.dto'; @ApiTags('auth') @ApiBearerAuth('access-token') @Controller() -export class AuthController { +export class AuthController { private readonly logger = new Logger(AuthController.name); - constructor(private readonly authService: AuthService) { } + constructor(private readonly authService: AuthService) {} @UseGuards(AuthGuard('local')) @Post('auth/login') @@ -34,17 +34,15 @@ export class AuthController { description: 'Log in', }) async login(@Request() req: ExpressRequest): Promise { - this.logger.verbose("Within login"); - return await this.authService.login(req.user as Omit); + this.logger.verbose('Within login'); + return await this.authService.login(req.user as Omit); } - @UseGuards(AuthGuard('jwt')) @Post('auth/logout') @HttpCode(HttpStatus.OK) - async logout(@Request() req: ExpressRequest - ) { - this.logger.verbose("Within login"); + async logout(@Request() req: ExpressRequest) { + this.logger.verbose('Within login'); await this.authService.logout(req.user as Omit); return { message: 'Logout successful' }; } @@ -52,8 +50,15 @@ export class AuthController { @UseGuards(AuthGuard('local')) @Post('auth/getAccess') @ApiBody({ type: LoginDataDTO }) - async generateToken(@Request() req: ExpressRequest, @Query('privateKey') privateKey: string) {//: Promise { - this.logger.verbose("With in generateToken"); - return await this.authService.generateToken(req.user as Omit, privateKey); + async generateToken( + @Request() req: ExpressRequest, + @Query('privateKey') privateKey: string, + ) { + //: Promise { + this.logger.verbose('With in generateToken'); + return await this.authService.generateToken( + req.user as Omit, + privateKey, + ); } } diff --git a/apps/drec-api/src/auth/auth.module.ts b/apps/drec-api/src/auth/auth.module.ts index 782a47fa2..b919d7ec3 100755 --- a/apps/drec-api/src/auth/auth.module.ts +++ b/apps/drec-api/src/auth/auth.module.ts @@ -4,7 +4,7 @@ import { PassportModule } from '@nestjs/passport'; import { ConfigService } from '@nestjs/config'; import { OrganizationModule } from '../pods/organization/organization.module'; import { UserModule } from '../pods/user/user.module'; -import {PermissionModule} from '../pods/permission/permission.module' +import { PermissionModule } from '../pods/permission/permission.module'; import { AuthController } from './auth.controller'; import { AuthService } from './auth.service'; import { JwtStrategy } from './jwt.strategy'; @@ -21,14 +21,17 @@ import { ClientJwtStrategy } from './client-jwt.strategy'; EmailConfirmationModule, PassportModule.register({ defaultStrategy: 'jwt' }), JwtModule.registerAsync({ - useFactory: async (configService: ConfigService) =>{ - return ({ + useFactory: async (configService: ConfigService) => { + return { secret: configService.get('JWT_SECRET') || 'thisisnotsecret', signOptions: { - expiresIn: '180 days' || configService.get('JWT_EXPIRY_TIME') || '7 days', + expiresIn: + '180 days' || + configService.get('JWT_EXPIRY_TIME') || + '7 days', }, - }) - } , + }; + }, inject: [ConfigService], }), ], diff --git a/apps/drec-api/src/auth/auth.service.ts b/apps/drec-api/src/auth/auth.service.ts index de304a079..9c7c53fde 100755 --- a/apps/drec-api/src/auth/auth.service.ts +++ b/apps/drec-api/src/auth/auth.service.ts @@ -1,4 +1,4 @@ -import { Injectable, Logger, } from '@nestjs/common'; +import { Injectable, Logger } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; import bcrypt from 'bcryptjs'; import { UserLoginReturnData } from '@energyweb/origin-backend-core'; @@ -24,13 +24,13 @@ export class AuthService { private readonly userService: UserService, private readonly jwtService: JwtService, private readonly oauthClientService: OauthClientCredentialsService, - ) { } + ) {} async validateUser( email: string, unencryptedPassword: string, ): Promise { - this.logger.verbose("With in validateUser") + this.logger.verbose('With in validateUser'); const user = await this.userService.getUserAndPasswordByEmail( email.toLowerCase(), ); @@ -41,40 +41,49 @@ export class AuthService { } async login(user: Omit): Promise { - this.logger.verbose("With in login") + this.logger.verbose('With in login'); const payload: IJWTPayload = { email: user.email.toLowerCase(), id: user.id, - role: user.role + role: user.role, }; - const token = this.jwtService.sign(payload) - this.userService.createUserSession(user, token) + const token = this.jwtService.sign(payload); + this.userService.createUserSession(user, token); return { accessToken: token, }; } - async logout(payload: IJWTPayload){ - return await this.userService.removeUsersession(payload.id) - + async logout(payload: IJWTPayload) { + return await this.userService.removeUsersession(payload.id); } - async isTokenBlacklisted(token: string, payload: IJWTPayload):Promise { + async isTokenBlacklisted( + token: string, + payload: IJWTPayload, + ): Promise { //hasUser({ email }) - const tokeninvalidate = await this.userService.hasgetUserTokenvalid({ accesstoken_hash:token, userId: payload.id }) + const tokeninvalidate = await this.userService.hasgetUserTokenvalid({ + accesstoken_hash: token, + userId: payload.id, + }); return tokeninvalidate; } - async generateToken(user: Omit, fileData: string) {//: Promise { - this.logger.verbose("With in generateToken"); + async generateToken(user: Omit, fileData: string) { + //: Promise { + this.logger.verbose('With in generateToken'); const payload: IJWTPayload = { email: user.email.toLowerCase(), id: user.id, - role: user.role + role: user.role, }; - const token = this.jwtService.sign(payload, {privateKey: fileData, secret: 'my-secret'}); + const token = this.jwtService.sign(payload, { + privateKey: fileData, + secret: 'my-secret', + }); return { accessToken: token, - } + }; } } diff --git a/apps/drec-api/src/auth/client-jwt.strategy.ts b/apps/drec-api/src/auth/client-jwt.strategy.ts index b2751f454..a8efbc74f 100644 --- a/apps/drec-api/src/auth/client-jwt.strategy.ts +++ b/apps/drec-api/src/auth/client-jwt.strategy.ts @@ -1,34 +1,40 @@ -import { Strategy, ExtractJwt } from 'passport-jwt'; -import { PassportStrategy } from '@nestjs/passport'; -import { Injectable } from '@nestjs/common'; -import { JwtService } from '@nestjs/jwt'; -import { OauthClientCredentialsService } from '../pods/user/oauth_client.service'; -import { IJWTPayload } from './auth.service'; -import { UserService } from '../pods/user/user.service'; -import { Role } from '../utils/enums'; - -@Injectable() -export class ClientJwtStrategy extends PassportStrategy(Strategy, 'oauth2-client-password') { - constructor( - private readonly jwtService: JwtService, - private readonly oauthClientService: OauthClientCredentialsService, - private readonly userService: UserService, - ) { - super({ - jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), - ignoreExpiration: false, - secretOrKey: 'my-secret', - passReqToCallback: true, - }) - } - - async validate(request: Request, payload: IJWTPayload) { - //@ts-ignore - const token = request.headers.authorization?.split(' ')[1]; - const user = await this.userService.findByEmail(payload.email); - //@ts-ignore - const publicKey = this.oauthClientService.get(user.api_user_id); - const verifiedData = await this.jwtService.verify(token, {publicKey:(await publicKey).client_id, secret: 'my-secret'}); - return user; - } -} \ No newline at end of file +import { Strategy, ExtractJwt } from 'passport-jwt'; +import { PassportStrategy } from '@nestjs/passport'; +import { Injectable } from '@nestjs/common'; +import { JwtService } from '@nestjs/jwt'; +import { OauthClientCredentialsService } from '../pods/user/oauth_client.service'; +import { IJWTPayload } from './auth.service'; +import { UserService } from '../pods/user/user.service'; +import { Role } from '../utils/enums'; + +@Injectable() +export class ClientJwtStrategy extends PassportStrategy( + Strategy, + 'oauth2-client-password', +) { + constructor( + private readonly jwtService: JwtService, + private readonly oauthClientService: OauthClientCredentialsService, + private readonly userService: UserService, + ) { + super({ + jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), + ignoreExpiration: false, + secretOrKey: 'my-secret', + passReqToCallback: true, + }); + } + + async validate(request: Request, payload: IJWTPayload) { + //@ts-ignore + const token = request.headers.authorization?.split(' ')[1]; + const user = await this.userService.findByEmail(payload.email); + //@ts-ignore + const publicKey = this.oauthClientService.get(user.api_user_id); + const verifiedData = await this.jwtService.verify(token, { + publicKey: (await publicKey).client_id, + secret: 'my-secret', + }); + return user; + } +} diff --git a/apps/drec-api/src/auth/client-password.strategy.ts b/apps/drec-api/src/auth/client-password.strategy.ts index acba02519..7118eda9d 100644 --- a/apps/drec-api/src/auth/client-password.strategy.ts +++ b/apps/drec-api/src/auth/client-password.strategy.ts @@ -11,7 +11,10 @@ export class ClientPasswordStrategy extends PassportStrategy { verify = options; options = {}; } - if (!verify) throw new Error('OAuth 2.0 client password strategy requires a verify function'); + if (!verify) + throw new Error( + 'OAuth 2.0 client password strategy requires a verify function', + ); super(); //@ts-ignore @@ -23,13 +26,29 @@ export class ClientPasswordStrategy extends PassportStrategy { } authenticate(req: any) { - if((req.url.split('/')[3] != 'register') && (req.url.split('/')[3] != 'forget-password') && (req.url.split('/')[3] != 'confirm-email') && (req.url.split('/')[3] != 'reset')) { - if((req.headers['client_id'] || req.headers['client_secret']) && req.user.role != Role.ApiUser) { + if ( + req.url.split('/')[3] != 'register' && + req.url.split('/')[3] != 'forget-password' && + req.url.split('/')[3] != 'confirm-email' && + req.url.split('/')[3] != 'reset' + ) { + if ( + (req.headers['client_id'] || req.headers['client_secret']) && + req.user.role != Role.ApiUser + ) { throw new UnauthorizedException(); } - - if ((!req.headers || (!req.headers['client_id'] || !req.headers['client_secret'])) && req.user.role === Role.ApiUser) { - throw new UnauthorizedException({ statusCode: 401, message: "client_id or client_secret missing from headers" }); + + if ( + (!req.headers || + !req.headers['client_id'] || + !req.headers['client_secret']) && + req.user.role === Role.ApiUser + ) { + throw new UnauthorizedException({ + statusCode: 401, + message: 'client_id or client_secret missing from headers', + }); //@ts-ignore //return this.fail(); } @@ -46,7 +65,10 @@ export class ClientPasswordStrategy extends PassportStrategy { return self.error(err); } if (!client) { - throw new UnauthorizedException({ statusCode: 401, message: "client is missing" }); + throw new UnauthorizedException({ + statusCode: 401, + message: 'client is missing', + }); //@ts-ignore return self.fail(); } diff --git a/apps/drec-api/src/auth/client.strategy.ts b/apps/drec-api/src/auth/client.strategy.ts index 7d6dbbbc0..e6c5ee9b8 100755 --- a/apps/drec-api/src/auth/client.strategy.ts +++ b/apps/drec-api/src/auth/client.strategy.ts @@ -1,4 +1,4 @@ -import { Injectable, UnauthorizedException, Logger, } from '@nestjs/common'; +import { Injectable, UnauthorizedException, Logger } from '@nestjs/common'; import { PassportStrategy } from '@nestjs/passport'; import { AuthService } from './auth.service'; import { OauthClientCredentialsService } from '../pods/user/oauth_client.service'; @@ -10,20 +10,20 @@ import { EmailConfirmationService } from '../pods/email-confirmation/email-confi @Injectable() export class ClientCredentialsStrategy extends PassportStrategy( ClientPasswordStrategy, - // 'oauth2-client-password', + // 'oauth2-client-password', ) { - private readonly logger = new Logger(ClientCredentialsStrategy.name); constructor( private readonly userService: UserService, - private readonly emailConfirmationService: EmailConfirmationService, - private readonly authService: AuthService, - private readonly oAuthClientCredentialService: OauthClientCredentialsService) { - super(); - } + private readonly emailConfirmationService: EmailConfirmationService, + private readonly authService: AuthService, + private readonly oAuthClientCredentialService: OauthClientCredentialsService, + ) { + super(); + } - async validate(request : any, clientId: string, clientSecret: string) { + async validate(request: any, clientId: string, clientSecret: string) { /* let client : any; //const clientId = request.headers['client-id']; @@ -132,7 +132,8 @@ export class ClientCredentialsStrategy extends PassportStrategy( return request.user ?? client; } */ } - async validateClient(clientId: string, clientSecret: string): Promise { /* + async validateClient(clientId: string, clientSecret: string): Promise { + /* this.logger.verbose('With in the validateClient'); // Implement your client ID and client secret validation logic here // Example: Fetch client information from the database and check if the provided client ID and client secret match diff --git a/apps/drec-api/src/auth/jwt.strategy.ts b/apps/drec-api/src/auth/jwt.strategy.ts index 784407b95..a564cb406 100755 --- a/apps/drec-api/src/auth/jwt.strategy.ts +++ b/apps/drec-api/src/auth/jwt.strategy.ts @@ -1,14 +1,18 @@ import { ExtractJwt, Strategy } from 'passport-jwt'; import { PassportStrategy } from '@nestjs/passport'; -import { Injectable, Inject, Logger,UnauthorizedException } from '@nestjs/common'; +import { + Injectable, + Inject, + Logger, + UnauthorizedException, +} from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { UserService } from '../pods/user/user.service'; -import { IJWTPayload ,AuthService} from './auth.service'; +import { IJWTPayload, AuthService } from './auth.service'; import { IUser } from '../models'; @Injectable() export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') { - private readonly logger = new Logger(JwtStrategy.name); constructor( @@ -20,17 +24,22 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') { jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), ignoreExpiration: false, secretOrKey: configService.get('JWT_SECRET') || 'thisisnotsecret', - passReqToCallback: true + passReqToCallback: true, }); } - async validate(request: Request,payload: IJWTPayload): Promise { + async validate( + request: Request, + payload: IJWTPayload, + ): Promise { this.logger.verbose('With in validate'); //@ts-ignore const token = request.headers.authorization?.split(' ')[1]; - let tokeninvalidate= await this.authService.isTokenBlacklisted(token,payload); - if (token && (!tokeninvalidate)) { - + let tokeninvalidate = await this.authService.isTokenBlacklisted( + token, + payload, + ); + if (token && !tokeninvalidate) { throw new UnauthorizedException('Token revoked. Please log in again.'); } const user = await this.userService.findByEmail(payload.email); diff --git a/apps/drec-api/src/auth/local.strategy.ts b/apps/drec-api/src/auth/local.strategy.ts index 8875627d8..6c2f9868b 100755 --- a/apps/drec-api/src/auth/local.strategy.ts +++ b/apps/drec-api/src/auth/local.strategy.ts @@ -7,7 +7,6 @@ import { UserDTO } from '../pods/user/dto/user.dto'; @Injectable() export class LocalStrategy extends PassportStrategy(Strategy) { - private readonly logger = new Logger(LocalStrategy.name); constructor(private readonly authService: AuthService) { @@ -15,7 +14,7 @@ export class LocalStrategy extends PassportStrategy(Strategy) { } async validate(email: string, password: string): Promise { - this.logger.verbose("With in validate"); + this.logger.verbose('With in validate'); const user = await this.authService.validateUser(email, password); return user; } diff --git a/apps/drec-api/src/drec.module.ts b/apps/drec-api/src/drec.module.ts index 720dbed25..63c74af44 100755 --- a/apps/drec-api/src/drec.module.ts +++ b/apps/drec-api/src/drec.module.ts @@ -1,17 +1,28 @@ -import { Module,MiddlewareConsumer, NestModule,HttpModule } from '@nestjs/common'; +import { + Module, + MiddlewareConsumer, + NestModule, + HttpModule, +} from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; import { ScheduleModule } from '@nestjs/schedule'; import { TypeOrmModule } from '@nestjs/typeorm'; import { BullModule } from '@nestjs/bull'; import fs from 'fs'; import path from 'path'; -import { BlockchainPropertiesModule, entities as IssuerEntities } from '@energyweb/issuer-api'; -import {OnChainCertificateEntities,OffChainCertificateEntities, OnChainCertificateModule} from '@energyweb/origin-247-certificate'; - +import { + BlockchainPropertiesModule, + entities as IssuerEntities, +} from '@energyweb/issuer-api'; +import { + OnChainCertificateEntities, + OffChainCertificateEntities, + OnChainCertificateModule, +} from '@energyweb/origin-247-certificate'; import { AuthModule } from './auth/auth.module'; import { User } from './pods/user/user.entity'; -import {UserRole} from './pods/user/user_role.entity'; +import { UserRole } from './pods/user/user_role.entity'; import { UserModule } from './pods/user/user.module'; import { Organization } from './pods/organization/organization.entity'; import { OrganizationModule } from './pods/organization/organization.module'; @@ -37,24 +48,24 @@ import { ACLModulePermissions } from './pods/permission/permission.entity'; import { PermissionModule } from './pods/permission/permission.module'; import { DeviceCsvFileProcessingJobsEntity } from './pods/device-group/device_csv_processing_jobs.entity'; import { DeviceCsvProcessingFailedRowsEntity } from './pods/device-group/device_csv_processing_failed_rows.entity'; -import {DeviceGroupNextIssueCertificate} from './pods/device-group/device_group_issuecertificate.entity' -import {AggregateMeterRead} from './pods/reads/aggregate_readvalue.entity'; -import {HistoryIntermediate_MeterRead} from './pods/reads/history_intermideate_meterread.entity'; -import {CheckCertificateIssueDateLogForDeviceEntity} from './pods/device/check_certificate_issue_date_log_for_device.entity' -import {CheckCertificateIssueDateLogForDeviceGroupEntity} from './pods/device-group/check_certificate_issue_date_log_for_device_group.entity'; -import { CountrycodeModule}from './pods/countrycode/countrycode.module' -import {SdgbenefitModule} from './pods/sdgbenefit/sdgbenefit.module'; -import {SdgBenefit} from './pods/sdgbenefit/sdgbenefit.entity'; +import { DeviceGroupNextIssueCertificate } from './pods/device-group/device_group_issuecertificate.entity'; +import { AggregateMeterRead } from './pods/reads/aggregate_readvalue.entity'; +import { HistoryIntermediate_MeterRead } from './pods/reads/history_intermideate_meterread.entity'; +import { CheckCertificateIssueDateLogForDeviceEntity } from './pods/device/check_certificate_issue_date_log_for_device.entity'; +import { CheckCertificateIssueDateLogForDeviceGroupEntity } from './pods/device-group/check_certificate_issue_date_log_for_device_group.entity'; +import { CountrycodeModule } from './pods/countrycode/countrycode.module'; +import { SdgbenefitModule } from './pods/sdgbenefit/sdgbenefit.module'; +import { SdgBenefit } from './pods/sdgbenefit/sdgbenefit.entity'; import { CertificateLogModule } from './pods/certificate-log/certificate-log.module'; -import {HistoryDeviceGroupNextIssueCertificate} from './pods/device-group/history_next_issuance_date_log.entity' -import {DeltaFirstRead} from './pods/reads/delta_firstread.entity' +import { HistoryDeviceGroupNextIssueCertificate } from './pods/device-group/history_next_issuance_date_log.entity'; +import { DeltaFirstRead } from './pods/reads/delta_firstread.entity'; import { OnApplicationBootstrapHookService } from './on-application-bootsrap-hook.service'; -import {IrecDevicesInformationEntity} from './pods/device/irec_devices_information.entity'; -import {IrecErrorLogInformationEntity} from './pods/device/irec_error_log_information.entity' +import { IrecDevicesInformationEntity } from './pods/device/irec_devices_information.entity'; +import { IrecErrorLogInformationEntity } from './pods/device/irec_error_log_information.entity'; import { OauthClientCredentials } from './pods/user/oauth_client_credentials.entity'; import { ApiUserEntity } from './pods/user/api-user.entity'; -import {UserLoginSessionEntity} from './pods/user/user_login_session.entity'; -import {DeviceLateongoingIssueCertificateEntity} from './pods/device/device_lateongoing_certificate.entity'; +import { UserLoginSessionEntity } from './pods/user/user_login_session.entity'; +import { DeviceLateongoingIssueCertificateEntity } from './pods/device/device_lateongoing_certificate.entity'; const getEnvFilePath = () => { const pathsToTest = [ @@ -96,14 +107,15 @@ export const entities = [ CheckCertificateIssueDateLogForDeviceEntity, CheckCertificateIssueDateLogForDeviceGroupEntity, SdgBenefit, - DeltaFirstRead,, + DeltaFirstRead, + , IrecDevicesInformationEntity, IrecErrorLogInformationEntity, UserLoginSessionEntity, DeviceLateongoingIssueCertificateEntity, ...IssuerEntities, ...OnChainCertificateEntities, - ...OffChainCertificateEntities + ...OffChainCertificateEntities, ]; const OriginAppTypeOrmModule = () => { @@ -129,14 +141,14 @@ const OriginAppTypeOrmModule = () => { }); }; -let redisOptions= { - host:process.env.REDIS_URL ?? 'localhost', - port: 6379 -} +let redisOptions = { + host: process.env.REDIS_URL ?? 'localhost', + port: 6379, +}; const QueueingModule = () => { return BullModule.forRoot({ - redis: redisOptions + redis: redisOptions, //process.env.REDIS_URL ?? { host: 'localhost', port: 6379 }, }); }; @@ -172,12 +184,7 @@ const QueueingModule = () => { CertificateLogModule, OnChainCertificateModule, BlockchainPropertiesModule, - - ], - providers:[OnApplicationBootstrapHookService] + providers: [OnApplicationBootstrapHookService], }) -export class DrecModule { - - -} +export class DrecModule {} diff --git a/apps/drec-api/src/guards/ActiveUserGuard.ts b/apps/drec-api/src/guards/ActiveUserGuard.ts index 1dc520e93..fdf0fe133 100755 --- a/apps/drec-api/src/guards/ActiveUserGuard.ts +++ b/apps/drec-api/src/guards/ActiveUserGuard.ts @@ -16,13 +16,15 @@ export class ActiveUserGuard implements CanActivate { constructor(private reflector: Reflector) {} canActivate(context: ExecutionContext): boolean { - this.logger.verbose(`With in canActivate`) + this.logger.verbose(`With in canActivate`); const request = context.switchToHttp().getRequest(); const user = request.user as IUser; const _user = user as IUser; if (_user.status === UserStatus.Deleted) { - this.logger.error(`Only not deleted users can perform this action. Your status is ${user.status}`); + this.logger.error( + `Only not deleted users can perform this action. Your status is ${user.status}`, + ); throw new HttpException( `Only not deleted users can perform this action. Your status is ${user.status}`, HttpStatus.FORBIDDEN, @@ -30,7 +32,9 @@ export class ActiveUserGuard implements CanActivate { } if (_user.status !== UserStatus.Active) { - this.logger.error(`Only active users can perform this action. Your status is ${_user.status}`); + this.logger.error( + `Only active users can perform this action. Your status is ${_user.status}`, + ); throw new HttpException( `Only active users can perform this action. Your status is ${_user.status}`, HttpStatus.PRECONDITION_FAILED, diff --git a/apps/drec-api/src/guards/PermissionGuard.ts b/apps/drec-api/src/guards/PermissionGuard.ts index 22f332b3b..70d6d018e 100755 --- a/apps/drec-api/src/guards/PermissionGuard.ts +++ b/apps/drec-api/src/guards/PermissionGuard.ts @@ -16,7 +16,6 @@ import { UserService } from '../pods/user/user.service'; import { Role } from '../utils/enums'; @Injectable() export class PermissionGuard implements CanActivate { - private readonly logger = new Logger(PermissionGuard.name); constructor( @@ -24,7 +23,7 @@ export class PermissionGuard implements CanActivate { @Inject(PermissionService) private readonly userPermission: PermissionService, @Inject(UserService) - private readonly userService : UserService + private readonly userService: UserService, ) {} //constructor(@Inject(KeyService) private keyService: KeyService) {} @@ -42,11 +41,11 @@ export class PermissionGuard implements CanActivate { return false; } const request = context.switchToHttp().getRequest(); - let user : IUser; - user = request.user; - if(request.url.split('/')[3] === 'register') { + let user: IUser; + user = request.user; + if (request.url.split('/')[3] === 'register') { this.logger.verbose(`When ${request.url.split('/')[3]}`); - if(request.body.organizationType === Role.ApiUser) { + if (request.body.organizationType === Role.ApiUser) { return true; } /* if(request.user.client_id != process.env.client_id) { @@ -58,15 +57,18 @@ export class PermissionGuard implements CanActivate { this.logger.debug('When the client is same as the client at dotEnv'); user = await this.userService.findOne({ api_user_id: client.api_user_id, role: Role.Admin }); } */ - } - else { + } else { user = request.user; } - + if (user.role === 'Admin') { return true; } - if(((request.url.split('/')[3] === 'confirm-email') || (request.url.split('/')[3] === 'reset')) && (user.role === Role.ApiUser)) { + if ( + (request.url.split('/')[3] === 'confirm-email' || + request.url.split('/')[3] === 'reset') && + user.role === Role.ApiUser + ) { return true; } var per: any = []; @@ -76,7 +78,7 @@ export class PermissionGuard implements CanActivate { user.id, module, ); - + userpermission1.forEach((e) => { e.permissions.forEach((element) => { if (!per.includes(element)) { @@ -89,7 +91,7 @@ export class PermissionGuard implements CanActivate { } user.permissions = per; const loggedInUser = new LoggedInUser(user); - + const hasPermission = () => loggedInUser.permissions.includes(permission[0]); diff --git a/apps/drec-api/src/guards/RolesGuard.ts b/apps/drec-api/src/guards/RolesGuard.ts index c99d6f851..cc572a0bb 100755 --- a/apps/drec-api/src/guards/RolesGuard.ts +++ b/apps/drec-api/src/guards/RolesGuard.ts @@ -1,16 +1,20 @@ -import { Injectable, CanActivate, ExecutionContext, Logger, } from '@nestjs/common'; +import { + Injectable, + CanActivate, + ExecutionContext, + Logger, +} from '@nestjs/common'; import { Reflector } from '@nestjs/core'; import { IUser, LoggedInUser } from '../models'; @Injectable() export class RolesGuard implements CanActivate { - private readonly logger = new Logger(RolesGuard.name); constructor(private readonly reflector: Reflector) {} canActivate(context: ExecutionContext): boolean { - this.logger.verbose( `With in canActivate`); + this.logger.verbose(`With in canActivate`); const roles = this.reflector.get('roles', context.getHandler()); if (!roles) { return true; diff --git a/apps/drec-api/src/guards/WithoutAuthGuard.ts b/apps/drec-api/src/guards/WithoutAuthGuard.ts index 06d1fea2d..691a27137 100644 --- a/apps/drec-api/src/guards/WithoutAuthGuard.ts +++ b/apps/drec-api/src/guards/WithoutAuthGuard.ts @@ -1,72 +1,101 @@ -import { IUser } from '../models'; -import { - CanActivate, - ExecutionContext, - Injectable, - Inject, - Logger, - UnauthorizedException, -} from '@nestjs/common'; -import { UserService } from '../pods/user/user.service'; -import { Role } from '../utils/enums'; -import { EmailConfirmationService } from '../pods/email-confirmation/email-confirmation.service'; -import { OauthClientCredentialsService } from '../pods/user/oauth_client.service'; -@Injectable() -export class WithoutAuthGuard implements CanActivate { - - private readonly logger = new Logger(WithoutAuthGuard.name); - - constructor( - @Inject(UserService) - private readonly userService : UserService, - @Inject(EmailConfirmationService) - private readonly emailConfirmationService: EmailConfirmationService, - @Inject(OauthClientCredentialsService) - private readonly oauthClientCredentialsService: OauthClientCredentialsService, - ) {} - - async canActivate(context: ExecutionContext) { - this.logger.verbose(`With in canActivate`); - - const request = context.switchToHttp().getRequest(); - let user: IUser; - - if(request.url.split('/')[3] === 'forget-password') { - user = await this.userService.findByEmail(request.body.email); - } - else if(request.url.split('/')[3] === 'confirm-email' || request.url.split('/')[3] === 'reset') { - user = (await this.emailConfirmationService.findOne({token : request.params.token})).user; - } - else if(request.url.split('/')[3] === 'register') { - if(!request.body.api_user_id && (request.body.organizationType === 'Developer' || request.body.organizationType === Role.Buyer)) { - user = await this.userService.findOne({role: Role.Admin}); - } - //@ts-ignore - else if(request.body.api_user_id && request.body.api_user_id != await this.userService.findOne({role: Role.Admin}).api_user_id && (request.body.organizationType === 'Developer' || request.body.organizationType === Role.Buyer)) { - user = await this.userService.findOne({ role: Role.ApiUser, api_user_id: request.body.api_user_id }); - if(!user) { - throw new UnauthorizedException({ - statusCode: 401, - message: "Requested apiuser is not available" - }); - } - } - else if(request.body.organizationType === Role.ApiUser) { - const api_user = await this.oauthClientCredentialsService.createAPIUser(); - request.body.api_user_id = api_user.api_user_id; - } - } - else if(request.url.split('/')[3] === 'export-accesskey') { - user = await this.userService.findOne({ role: Role.ApiUser, api_user_id: request.params.api_user_id }); - } - - //@ts-ignore - if(request.body.organizationType === undefined && user.role != Role.Admin && user.role != Role.ApiUser && (user.api_user_id != (await this.userService.findOne({role:Role.Admin}) as IUser).api_user_id)) { - throw new UnauthorizedException({statusCode: 401, message: "Unauthorized"}); - //return false; - } - - request.user = user; - return true; - } -} +import { IUser } from '../models'; +import { + CanActivate, + ExecutionContext, + Injectable, + Inject, + Logger, + UnauthorizedException, +} from '@nestjs/common'; +import { UserService } from '../pods/user/user.service'; +import { Role } from '../utils/enums'; +import { EmailConfirmationService } from '../pods/email-confirmation/email-confirmation.service'; +import { OauthClientCredentialsService } from '../pods/user/oauth_client.service'; +@Injectable() +export class WithoutAuthGuard implements CanActivate { + private readonly logger = new Logger(WithoutAuthGuard.name); + + constructor( + @Inject(UserService) + private readonly userService: UserService, + @Inject(EmailConfirmationService) + private readonly emailConfirmationService: EmailConfirmationService, + @Inject(OauthClientCredentialsService) + private readonly oauthClientCredentialsService: OauthClientCredentialsService, + ) {} + + async canActivate(context: ExecutionContext) { + this.logger.verbose(`With in canActivate`); + + const request = context.switchToHttp().getRequest(); + let user: IUser; + + if (request.url.split('/')[3] === 'forget-password') { + user = await this.userService.findByEmail(request.body.email); + } else if ( + request.url.split('/')[3] === 'confirm-email' || + request.url.split('/')[3] === 'reset' + ) { + user = ( + await this.emailConfirmationService.findOne({ + token: request.params.token, + }) + ).user; + } else if (request.url.split('/')[3] === 'register') { + if ( + !request.body.api_user_id && + (request.body.organizationType === 'Developer' || + request.body.organizationType === Role.Buyer) + ) { + user = await this.userService.findOne({ role: Role.Admin }); + } + //@ts-ignore + else if ( + request.body.api_user_id && + request.body.api_user_id != + (await this.userService.findOne({ role: Role.Admin }).api_user_id) && + (request.body.organizationType === 'Developer' || + request.body.organizationType === Role.Buyer) + ) { + user = await this.userService.findOne({ + role: Role.ApiUser, + api_user_id: request.body.api_user_id, + }); + if (!user) { + throw new UnauthorizedException({ + statusCode: 401, + message: 'Requested apiuser is not available', + }); + } + } else if (request.body.organizationType === Role.ApiUser) { + const api_user = + await this.oauthClientCredentialsService.createAPIUser(); + request.body.api_user_id = api_user.api_user_id; + } + } else if (request.url.split('/')[3] === 'export-accesskey') { + user = await this.userService.findOne({ + role: Role.ApiUser, + api_user_id: request.params.api_user_id, + }); + } + + //@ts-ignore + if ( + request.body.organizationType === undefined && + user.role != Role.Admin && + user.role != Role.ApiUser && + user.api_user_id != + ((await this.userService.findOne({ role: Role.Admin })) as IUser) + .api_user_id + ) { + throw new UnauthorizedException({ + statusCode: 401, + message: 'Unauthorized', + }); + //return false; + } + + request.user = user; + return true; + } +} diff --git a/apps/drec-api/src/guards/index.ts b/apps/drec-api/src/guards/index.ts index 8e4f4e9fb..79ca6e1a5 100755 --- a/apps/drec-api/src/guards/index.ts +++ b/apps/drec-api/src/guards/index.ts @@ -1,4 +1,4 @@ export * from './ActiveUserGuard'; export * from './RolesGuard'; export * from './PermissionGuard'; -export * from './WithoutAuthGuard'; \ No newline at end of file +export * from './WithoutAuthGuard'; diff --git a/apps/drec-api/src/main.ts b/apps/drec-api/src/main.ts index a8f2acc4b..60842bbaa 100755 --- a/apps/drec-api/src/main.ts +++ b/apps/drec-api/src/main.ts @@ -4,8 +4,10 @@ import { startAPI } from '.'; process.setMaxListeners(0); //@ts-ignore -process.on('warning', e => {console.warn("warning inside main.ts");console.warn(e.stack)}); - +process.on('warning', (e) => { + console.warn('warning inside main.ts'); + console.warn(e.stack); +}); /* https://stackoverflow.com/questions/57115918/maxlistenersexceededwarning-possible-eventemitter-memory-leak-dete diff --git a/apps/drec-api/src/models/ACLModules.ts b/apps/drec-api/src/models/ACLModules.ts index 2543e9b44..bcbad08b4 100755 --- a/apps/drec-api/src/models/ACLModules.ts +++ b/apps/drec-api/src/models/ACLModules.ts @@ -1,11 +1,10 @@ import { RoleStatus } from '../utils/enums'; export interface IACLModuleConfig { - id: number; - name: string; - description: string; - permissions: string[]; - permissionsValue: number; - status: RoleStatus; - -} \ No newline at end of file + id: number; + name: string; + description: string; + permissions: string[]; + permissionsValue: number; + status: RoleStatus; +} diff --git a/apps/drec-api/src/models/ACLModulesPermission.ts b/apps/drec-api/src/models/ACLModulesPermission.ts index 9266ceb1e..7de2e7ba4 100755 --- a/apps/drec-api/src/models/ACLModulesPermission.ts +++ b/apps/drec-api/src/models/ACLModulesPermission.ts @@ -1,20 +1,18 @@ import { EntityType } from '../utils/enums'; -import {IACLModuleConfig} from './ACLModules' +import { IACLModuleConfig } from './ACLModules'; export interface IModulePermissionsConfig { - id: number; + id: number; // aclmoduleId: number; - entityType: EntityType; - entityId: number; - permissions: string[]; - permissionValue: number; - status:number ; - + entityType: EntityType; + entityId: number; + permissions: string[]; + permissionValue: number; + status: number; } export interface IACLmodulsPermissions extends IaddModulePermission { - aclmodules: IACLModuleConfig; - - } - export interface IaddModulePermission extends IModulePermissionsConfig{ - aclmodulesId: number; - } \ No newline at end of file + aclmodules: IACLModuleConfig; +} +export interface IaddModulePermission extends IModulePermissionsConfig { + aclmodulesId: number; +} diff --git a/apps/drec-api/src/models/AggregateMetervalue.ts b/apps/drec-api/src/models/AggregateMetervalue.ts index 48758d3b0..49ad52ed6 100755 --- a/apps/drec-api/src/models/AggregateMetervalue.ts +++ b/apps/drec-api/src/models/AggregateMetervalue.ts @@ -1,48 +1,38 @@ -import { - Unit, -} from '@energyweb/energy-api-influxdb'; -import { - IsDate, - IsOptional, - IsPositive - - } from 'class-validator'; - import { ApiProperty } from '@nestjs/swagger'; - export class NewReadDTO { - @ApiProperty({ type: Date }) - @IsOptional() - starttimestamp: Date; - - @ApiProperty({ type: Date }) - @IsDate() - endtimestamp:Date; - - @ApiProperty({ type: Number }) - @IsPositive() - value: number; - } - -export interface IAggregateintermediate { - id: number; - // type: string; - unit: Unit; - value: number; - deltaValue: number; - datetime:string; - createdAt: Date; - updatedAt: Date; - externalId?:string; +import { Unit } from '@energyweb/energy-api-influxdb'; +import { IsDate, IsOptional, IsPositive } from 'class-validator'; +import { ApiProperty } from '@nestjs/swagger'; +export class NewReadDTO { + @ApiProperty({ type: Date }) + @IsOptional() + starttimestamp: Date; + @ApiProperty({ type: Date }) + @IsDate() + endtimestamp: Date; + @ApiProperty({ type: Number }) + @IsPositive() + value: number; +} + +export interface IAggregateintermediate { + id: number; + // type: string; + unit: Unit; + value: number; + deltaValue: number; + datetime: string; + createdAt: Date; + updatedAt: Date; + externalId?: string; } export interface Iintermediate { - id: number; - type: string; - unit: Unit; - - createdAt: Date; - externalId?:string; - reads?:NewReadDTO[] - // status:YieldStatus; + id: number; + type: string; + unit: Unit; -} \ No newline at end of file + createdAt: Date; + externalId?: string; + reads?: NewReadDTO[]; + // status:YieldStatus; +} diff --git a/apps/drec-api/src/models/Delta_firstread.ts b/apps/drec-api/src/models/Delta_firstread.ts index f2de596c5..4b32013d7 100755 --- a/apps/drec-api/src/models/Delta_firstread.ts +++ b/apps/drec-api/src/models/Delta_firstread.ts @@ -1,16 +1,11 @@ - -import { - Unit, - } from '@energyweb/energy-api-influxdb'; - - export interface IDeltaintermediate { - id: number; - unit: Unit; - readsvalue: number; - readsEndDate:Date; - createdAt: Date; - updatedAt: Date; - externalId?:string; - - -} \ No newline at end of file +import { Unit } from '@energyweb/energy-api-influxdb'; + +export interface IDeltaintermediate { + id: number; + unit: Unit; + readsvalue: number; + readsEndDate: Date; + createdAt: Date; + updatedAt: Date; + externalId?: string; +} diff --git a/apps/drec-api/src/models/Device.ts b/apps/drec-api/src/models/Device.ts index d87d854c1..5ba88b8e2 100755 --- a/apps/drec-api/src/models/Device.ts +++ b/apps/drec-api/src/models/Device.ts @@ -7,13 +7,13 @@ import { Sector, StandardCompliance, FuelCode, - DevicetypeCode + DevicetypeCode, } from '../utils/enums'; export interface IDevice { id: number; externalId: string; - developerExternalId?:string; + developerExternalId?: string; //status: DeviceStatus; organizationId: number; projectName: string; @@ -45,9 +45,9 @@ export interface IDevice { SDGBenefits?: string[]; qualityLabels?: string; meterReadtype?: string; - createdAt?:Date; - version?:string; - timezone?:string; + createdAt?: Date; + version?: string; + timezone?: string; } export enum DeviceDescription { @@ -83,7 +83,7 @@ export const DeviceSortPropertyMapper: DeviceSortTypeValuedKeys = { [DeviceOrderBy.OffTaker]: 'offTaker' as DeviceKey, [DeviceOrderBy.FuelCode]: 'fuelCode' as DeviceKey, [DeviceOrderBy.Country]: 'countryCode' as DeviceKey, - /* [DeviceOrderBy.StandardCompliance]: 'standardCompliance' as DeviceKey, + /* [DeviceOrderBy.StandardCompliance]: 'standardCompliance' as DeviceKey, [DeviceOrderBy.Sector]: 'sector' as DeviceKey, [DeviceOrderBy.InstallationConfiguration]: 'installationConfiguration' as DeviceKey, diff --git a/apps/drec-api/src/models/DeviceGroup.ts b/apps/drec-api/src/models/DeviceGroup.ts index 4d63e7bcf..78cae3340 100755 --- a/apps/drec-api/src/models/DeviceGroup.ts +++ b/apps/drec-api/src/models/DeviceGroup.ts @@ -10,11 +10,11 @@ import { DeviceDTO } from '../pods/device/dto'; import { OrganizationDTO } from '../pods/organization/dto'; export enum BuyerReservationCertificateGenerationFrequency { - hourly ='hourly', - daily='daily', - weekly='weekly', - monthly ='monthly', - quarterly ='quarterly' + hourly = 'hourly', + daily = 'daily', + weekly = 'weekly', + monthly = 'monthly', + quarterly = 'quarterly', } export interface IDeviceGroup { @@ -35,9 +35,9 @@ export interface IDeviceGroup { capacityRange: CapacityRange; commissioningDateRange: CommissioningDateRange[]; - // yieldValue?: number; // ideally all underlying devices should have the same, otherwise take average? + // yieldValue?: number; // ideally all underlying devices should have the same, otherwise take average? - // labels?: string[]; + // labels?: string[]; leftoverReads?: number; // in KW @@ -46,5 +46,5 @@ export interface IDeviceGroup { deviceIds?: number[]; buyerId?: number | null; buyerAddress?: string | null; - type?:string | null; + type?: string | null; } diff --git a/apps/drec-api/src/models/DeviceGroupIssueCertificateRequest.ts b/apps/drec-api/src/models/DeviceGroupIssueCertificateRequest.ts index 58dc5883e..dafff46b1 100755 --- a/apps/drec-api/src/models/DeviceGroupIssueCertificateRequest.ts +++ b/apps/drec-api/src/models/DeviceGroupIssueCertificateRequest.ts @@ -1,27 +1,24 @@ - export interface IDeviceGroupNextIssueCertificate { - id: number; - groupId: number; - start_date: string; - end_date: string - + id: number; + groupId: number; + start_date: string; + end_date: string; } export interface IHistoryDeviceGroupNextIssueCertificate { - id: number; - groupId: number; - device_externalid: string; - reservationStartDate: Date; - reservationEndDate: Date; - device_createdAt: Date + id: number; + groupId: number; + device_externalid: string; + reservationStartDate: Date; + reservationEndDate: Date; + device_createdAt: Date; } export interface IDeviceLateOngoingIssueCertificate { - id: number; - groupId: number; - device_externalid: string; - late_start_date: string; - late_end_date: string; - certificate_issued: boolean; - + id: number; + groupId: number; + device_externalid: string; + late_start_date: string; + late_end_date: string; + certificate_issued: boolean; } diff --git a/apps/drec-api/src/models/Fuels.ts b/apps/drec-api/src/models/Fuels.ts index 20343c54e..d23515f0b 100755 --- a/apps/drec-api/src/models/Fuels.ts +++ b/apps/drec-api/src/models/Fuels.ts @@ -1,14 +1,12 @@ import { CodeNameDTO } from '../pods/device/dto/code-name.dto'; export const IREC_FUEL_TYPES: CodeNameDTO[] = [ - { code: 'ES100', name: 'Solar' }, // { // code: 'ES990', // name: 'Co-fired with fossil: Solar thermal concentration', // } - ]; export const IREC_DEVICE_TYPES: CodeNameDTO[] = [ @@ -19,6 +17,5 @@ export const IREC_DEVICE_TYPES: CodeNameDTO[] = [ }, { code: 'TC130', name: 'PV Floating' }, { code: 'TC140', name: 'PV Aggregated' }, - { code: 'TC150', name: 'Solar Thermal Concentration' } - + { code: 'TC150', name: 'Solar Thermal Concentration' }, ]; diff --git a/apps/drec-api/src/models/LoggedInUser.ts b/apps/drec-api/src/models/LoggedInUser.ts index 34b9ede84..9b1ca91e7 100755 --- a/apps/drec-api/src/models/LoggedInUser.ts +++ b/apps/drec-api/src/models/LoggedInUser.ts @@ -1,6 +1,6 @@ -import { isRole, IUser,isPermission } from '.'; -import { Role,PermissionString } from '../utils/enums'; -import { IModulePermissionsConfig } from './ACLModulesPermission' +import { isRole, IUser, isPermission } from '.'; +import { Role, PermissionString } from '../utils/enums'; +import { IModulePermissionsConfig } from './ACLModulesPermission'; export interface ILoggedInUser { id: number; organizationId: number; @@ -10,8 +10,8 @@ export interface ILoggedInUser { hasRole(...role: Role[]): boolean; ownerId: string; hasOrganization: boolean; - permissions: PermissionString, -hasPermission(...permissions: PermissionString[]): boolean; + permissions: PermissionString; + hasPermission(...permissions: PermissionString[]): boolean; api_user_id: string; } @@ -38,8 +38,8 @@ export class LoggedInUser implements ILoggedInUser { blockchainAccountAddress: string | undefined; role: Role; - permissions:any; - + permissions: any; + hasRole(...role: Role[]): boolean { //console.log("39"); return isRole(this.role, ...role); diff --git a/apps/drec-api/src/models/Organization.ts b/apps/drec-api/src/models/Organization.ts index 27b150d86..2a773488b 100755 --- a/apps/drec-api/src/models/Organization.ts +++ b/apps/drec-api/src/models/Organization.ts @@ -1,15 +1,12 @@ import { OrganizationStatus, Role } from '../utils/enums'; - - export class IPublicAddOrganization { id: number; - name?: string=''; + name?: string = ''; organizationType?: string; //secretKey:string; status: OrganizationStatus; - } export class IPublicOrganization { id: number; @@ -19,7 +16,7 @@ export class IPublicOrganization { city: string; country: string; organizationType: string; - + status: OrganizationStatus; blockchainAccountAddress?: string; @@ -27,7 +24,6 @@ export class IPublicOrganization { } export interface IFullOrganization extends IPublicOrganization { - signatoryDocumentIds?: string[]; documentIds?: string[]; } diff --git a/apps/drec-api/src/models/OrganizationInvitation.ts b/apps/drec-api/src/models/OrganizationInvitation.ts index 049e29d2d..c8204ee1f 100755 --- a/apps/drec-api/src/models/OrganizationInvitation.ts +++ b/apps/drec-api/src/models/OrganizationInvitation.ts @@ -1,7 +1,11 @@ import { OrganizationInvitationStatus, Role } from '../utils/enums'; import { IPublicOrganization } from './Organization'; -export type OrganizationRole = Role.DeviceOwner | Role.OrganizationAdmin |Role.SubBuyer |Role.User; +export type OrganizationRole = + | Role.DeviceOwner + | Role.OrganizationAdmin + | Role.SubBuyer + | Role.User; export interface IOrganizationInvitationProperties { id: number; @@ -15,7 +19,7 @@ export interface IOrganizationInvitation organization: IPublicOrganization; sender: string; createdAt: Date; - permissionId?:number[]; + permissionId?: number[]; } export type OrganizationInviteCreateData = { @@ -29,7 +33,12 @@ export type OrganizationInviteUpdateData = Pick< >; export const ensureOrganizationRole = (role: Role): void => { - if (role !== Role.OrganizationAdmin && role !== Role.DeviceOwner && role !== Role.User&& role !== Role.SubBuyer) { + if ( + role !== Role.OrganizationAdmin && + role !== Role.DeviceOwner && + role !== Role.User && + role !== Role.SubBuyer + ) { throw new Error('Not an organization role'); } }; diff --git a/apps/drec-api/src/models/Roles.ts b/apps/drec-api/src/models/Roles.ts index d6e69e5ee..c128e6a21 100755 --- a/apps/drec-api/src/models/Roles.ts +++ b/apps/drec-api/src/models/Roles.ts @@ -1,10 +1,9 @@ -import {RoleStatus } from '../utils/enums'; +import { RoleStatus } from '../utils/enums'; export interface IRoleConfig { - id: number; - name: string; - description: string; - - status:RoleStatus; - - } \ No newline at end of file + id: number; + name: string; + description: string; + + status: RoleStatus; +} diff --git a/apps/drec-api/src/models/Sdgbenefit.ts b/apps/drec-api/src/models/Sdgbenefit.ts index 0bb95989d..a6771dc4c 100755 --- a/apps/drec-api/src/models/Sdgbenefit.ts +++ b/apps/drec-api/src/models/Sdgbenefit.ts @@ -1,29 +1,27 @@ export interface ISdgBenefit { - id: number; - SdgbenefitName: string; - sdgbenefitdescription: string; - - sdgbenefitBitposition: number; + id: number; + SdgbenefitName: string; + sdgbenefitdescription: string; + sdgbenefitBitposition: number; } export const SDGBenefits = [ - - { name: "SDG1", value: "No Poverty" }, - { name: "SDG2", value: "Zero Hunger" }, - { name: "SDG3", value: "Good Health and Well-being" }, - { name: "SDG4", value: "Quality Education" }, - { name: "SDG5", value: "Gender Equality" }, - { name: "SDG6", value: "Clean Water and Sanitation" }, - { name: "SDG7", value: "Affordable and Clean Energy" }, - { name: "SDG8", value: "Decent Work and Economic Growth" }, - { name: "SDG9", value: "Industry, Innovation and Infrastructure" }, - { name: "SDG10", value: "Reduced Inequality" }, - { name: "SDG11", value: "Sustainable Cities and Communities" }, - { name: "SDG12", value: "Responsible Consumption and Production" }, - { name: "SDG13", value: "Climate Action" }, - { name: "SDG14", value: "Life Below Water" }, - { name: "SDG15", value: "Life on Land" }, - { name: "SDG16", value: "Peace and Justice Strong Institutions" }, - { name: "SDG17", value: "Partnerships to achieve the SDG" } -] \ No newline at end of file + { name: 'SDG1', value: 'No Poverty' }, + { name: 'SDG2', value: 'Zero Hunger' }, + { name: 'SDG3', value: 'Good Health and Well-being' }, + { name: 'SDG4', value: 'Quality Education' }, + { name: 'SDG5', value: 'Gender Equality' }, + { name: 'SDG6', value: 'Clean Water and Sanitation' }, + { name: 'SDG7', value: 'Affordable and Clean Energy' }, + { name: 'SDG8', value: 'Decent Work and Economic Growth' }, + { name: 'SDG9', value: 'Industry, Innovation and Infrastructure' }, + { name: 'SDG10', value: 'Reduced Inequality' }, + { name: 'SDG11', value: 'Sustainable Cities and Communities' }, + { name: 'SDG12', value: 'Responsible Consumption and Production' }, + { name: 'SDG13', value: 'Climate Action' }, + { name: 'SDG14', value: 'Life Below Water' }, + { name: 'SDG15', value: 'Life on Land' }, + { name: 'SDG16', value: 'Peace and Justice Strong Institutions' }, + { name: 'SDG17', value: 'Partnerships to achieve the SDG' }, +]; diff --git a/apps/drec-api/src/models/User.ts b/apps/drec-api/src/models/User.ts index d0c4fe703..d0e944a7e 100755 --- a/apps/drec-api/src/models/User.ts +++ b/apps/drec-api/src/models/User.ts @@ -1,6 +1,6 @@ import { IEmailConfirmation, IFullOrganization } from '.'; -import { Role, UserStatus,PermissionString } from '../utils/enums'; -import {IModulePermissionsConfig} from './ACLModulesPermission' +import { Role, UserStatus, PermissionString } from '../utils/enums'; +import { IModulePermissionsConfig } from './ACLModulesPermission'; export interface IUserProperties { id: number; title?: string; @@ -11,9 +11,8 @@ export interface IUserProperties { notifications: boolean; status: UserStatus; role: Role; - roleId?:number; - permissions?:PermissionString; - + roleId?: number; + permissions?: PermissionString; } export interface IUserSeed extends IUser { @@ -24,8 +23,8 @@ export interface IUserSeed extends IUser { export interface IUser extends IUserProperties { organization: IFullOrganization; - - moduleName?:string; + + moduleName?: string; emailConfirmed?: IEmailConfirmation['confirmed']; } @@ -39,7 +38,6 @@ export declare type UserPasswordUpdate = { newPassword: string; }; export declare type UserChangePasswordUpdate = { - newPassword: string; }; export interface IFullUser extends IUser { @@ -51,6 +49,7 @@ export declare type UpdateUserResponseReturnType = IUser; export const isRole = (orgRole: Role, ...roles: Role[]): boolean => roles.some((role) => role === orgRole); - export const isPermission = (userPermissions: PermissionString, ...permissions: PermissionString[]): boolean => - permissions.some((permission) =>permission === userPermissions); - +export const isPermission = ( + userPermissions: PermissionString, + ...permissions: PermissionString[] +): boolean => permissions.some((permission) => permission === userPermissions); diff --git a/apps/drec-api/src/models/UserRegistrationData.ts b/apps/drec-api/src/models/UserRegistrationData.ts index 842c1d775..22c7bdc24 100755 --- a/apps/drec-api/src/models/UserRegistrationData.ts +++ b/apps/drec-api/src/models/UserRegistrationData.ts @@ -25,13 +25,9 @@ export class UserRegistrationData { @IsNotEmpty() @IsString() password: string; - } - export class UserORGRegistrationData { - - @IsNotEmpty() @IsString() firstName: string; @@ -51,7 +47,7 @@ export class UserORGRegistrationData { @IsNotEmpty() @IsString() confirmPassword?: string; - + @IsString() @IsOptional() orgName?: string; @@ -59,7 +55,4 @@ export class UserORGRegistrationData { @IsString() @IsOptional() orgAddress?: string; - - - } diff --git a/apps/drec-api/src/models/YieldConfig.ts b/apps/drec-api/src/models/YieldConfig.ts index 054b2c3cc..1cd3eb155 100755 --- a/apps/drec-api/src/models/YieldConfig.ts +++ b/apps/drec-api/src/models/YieldConfig.ts @@ -1,10 +1,9 @@ -import {YieldStatus } from '../utils/enums'; +import { YieldStatus } from '../utils/enums'; export interface IYieldConfig { - id: number; - countryName: string; - countryCode: string; - yieldValue: number; - status:YieldStatus; - - } \ No newline at end of file + id: number; + countryName: string; + countryCode: string; + yieldValue: number; + status: YieldStatus; +} diff --git a/apps/drec-api/src/models/country-code.ts b/apps/drec-api/src/models/country-code.ts index 08ab406b4..54aefca22 100755 --- a/apps/drec-api/src/models/country-code.ts +++ b/apps/drec-api/src/models/country-code.ts @@ -1,4280 +1,4280 @@ - -import {CountryCodeNameDTO} from '../pods/countrycode/dto' -export const countryCodesList:CountryCodeNameDTO[] =[ - { - "country": "Afghanistan", - "alpha2": "AF", - "alpha3": "AFG", - "numeric": "004", - "countryCode": "AFG", - "timezones": [ - { - "name": "Asia/Kabul", - "offset": -270 - } - ] - }, - { - "country": "Åland Islands", - "alpha2": "AX", - "alpha3": "ALA", - "numeric": "248", - "countryCode": "ALA", - "timezones": [ - { - "name": "Europe/Helsinki", - "offset": -180 - }, - { - "name": "Europe/Mariehamn", - "offset": -180 - } - ] - }, - { - "country": "Albania", - "alpha2": "AL", - "alpha3": "ALB", - "numeric": "008", - "countryCode": "ALB", - "timezones": [ - { - "name": "Europe/Tirane", - "offset": -120 - } - ] - }, - { - "country": "Algeria", - "alpha2": "DZ", - "alpha3": "DZA", - "numeric": "012", - "countryCode": "DZA", - "timezones": [ - { - "name": "Africa/Algiers", - "offset": -60 - } - ] - }, - { - "country": "American Samoa", - "alpha2": "AS", - "alpha3": "ASM", - "numeric": "016", - "countryCode": "ASM", - "timezones": [ - { - "name": "Pacific/Pago_Pago", - "offset": 660 - } - ] - }, - { - "country": "Andorra", - "alpha2": "AD", - "alpha3": "AND", - "numeric": "020", - "countryCode": "AND", - "timezones": [ - { - "name": "Europe/Andorra", - "offset": -120 - } - ] - }, - { - "country": "Angola", - "alpha2": "AO", - "alpha3": "AGO", - "numeric": "024", - "countryCode": "AGO", - "timezones": [ - { - "name": "Africa/Lagos", - "offset": -60 - }, - { - "name": "Africa/Luanda", - "offset": -60 - } - ] - }, - { - "country": "Anguilla", - "alpha2": "AI", - "alpha3": "AIA", - "numeric": "660", - "countryCode": "AIA", - "timezones": [ - { - "name": "America/Anguilla", - "offset": 240 - }, - { - "name": "America/Port_of_Spain", - "offset": 240 - } - ] - }, - { - "country": "Antarctica", - "alpha2": "AQ", - "alpha3": "ATA", - "numeric": "010", - "countryCode": "ATA", - "timezones": [ - { - "name": "Antarctica/Casey", - "offset": -480 - }, - { - "name": "Antarctica/Davis", - "offset": -420 - }, - { - "name": "Antarctica/DumontDUrville", - "offset": -600 - }, - { - "name": "Antarctica/Mawson", - "offset": -300 - }, - { - "name": "Antarctica/McMurdo", - "offset": -720 - }, - { - "name": "Antarctica/Palmer", - "offset": 180 - }, - { - "name": "Antarctica/Rothera", - "offset": 180 - }, - { - "name": "Antarctica/Syowa", - "offset": -180 - }, - { - "name": "Antarctica/Troll", - "offset": -120 - }, - { - "name": "Antarctica/Vostok", - "offset": -360 - }, - { - "name": "Pacific/Auckland", - "offset": -720 - } - ] - }, - { - "country": "Antigua and Barbuda", - "alpha2": "AG", - "alpha3": "ATG", - "numeric": "028", - "countryCode": "ATG", - "timezones": [ - { - "name": "America/Antigua", - "offset": 240 - }, - { - "name": "America/Port_of_Spain", - "offset": 240 - } - ] - }, - { - "country": "Argentina", - "alpha2": "AR", - "alpha3": "ARG", - "numeric": "032", - "countryCode": "ARG", - "timezones": [ - { - "name": "America/Argentina/Buenos_Aires", - "offset": 180 - }, - { - "name": "America/Argentina/Catamarca", - "offset": 180 - }, - { - "name": "America/Argentina/Cordoba", - "offset": 180 - }, - { - "name": "America/Argentina/Jujuy", - "offset": 180 - }, - { - "name": "America/Argentina/La_Rioja", - "offset": 180 - }, - { - "name": "America/Argentina/Mendoza", - "offset": 180 - }, - { - "name": "America/Argentina/Rio_Gallegos", - "offset": 180 - }, - { - "name": "America/Argentina/Salta", - "offset": 180 - }, - { - "name": "America/Argentina/San_Juan", - "offset": 180 - }, - { - "name": "America/Argentina/San_Luis", - "offset": 180 - }, - { - "name": "America/Argentina/Tucuman", - "offset": 180 - }, - { - "name": "America/Argentina/Ushuaia", - "offset": 180 - } - ] - }, - { - "country": "Armenia", - "alpha2": "AM", - "alpha3": "ARM", - "numeric": "051", - "countryCode": "ARM", - "timezones": [ - { - "name": "Asia/Yerevan", - "offset": -240 - } - ] - }, - { - "country": "Aruba", - "alpha2": "AW", - "alpha3": "ABW", - "numeric": "533", - "countryCode": "ABW", - "timezones": [ - { - "name": "America/Aruba", - "offset": 240 - }, - { - "name": "America/Curacao", - "offset": 240 - } - ] - }, - { - "country": "Australia", - "alpha2": "AU", - "alpha3": "AUS", - "numeric": "036", - "countryCode": "AUS", - "timezones": [ - { - "name": "Antarctica/Macquarie", - "offset": -660 - }, - { - "name": "Australia/Adelaide", - "offset": -570 - }, - { - "name": "Australia/Brisbane", - "offset": -600 - }, - { - "name": "Australia/Broken_Hill", - "offset": -570 - }, - { - "name": "Australia/Currie", - "offset": -600 - }, - { - "name": "Australia/Darwin", - "offset": -570 - }, - { - "name": "Australia/Eucla", - "offset": -525 - }, - { - "name": "Australia/Hobart", - "offset": -600 - }, - { - "name": "Australia/Lindeman", - "offset": -600 - }, - { - "name": "Australia/Lord_Howe", - "offset": -630 - }, - { - "name": "Australia/Melbourne", - "offset": -600 - }, - { - "name": "Australia/Perth", - "offset": -480 - }, - { - "name": "Australia/Sydney", - "offset": -600 - } - ] - }, - { - "country": "Austria", - "alpha2": "AT", - "alpha3": "AUT", - "numeric": "040", - "countryCode": "AUT", - "timezones": [ - { - "name": "Europe/Vienna", - "offset": -120 - } - ] - }, - { - "country": "Azerbaijan", - "alpha2": "AZ", - "alpha3": "AZE", - "numeric": "031", - "countryCode": "AZE", - "timezones": [ - { - "name": "Asia/Baku", - "offset": -240 - } - ] - }, - { - "country": "Bahamas", - "alpha2": "BS", - "alpha3": "BHS", - "numeric": "044", - "countryCode": "BHS", - "timezones": [ - { - "name": "America/Nassau", - "offset": 240 - } - ] - }, - { - "country": "Bahrain", - "alpha2": "BH", - "alpha3": "BHR", - "numeric": "048", - "countryCode": "BHR", - "timezones": [ - { - "name": "Asia/Bahrain", - "offset": -180 - }, - { - "name": "Asia/Qatar", - "offset": -180 - } - ] - }, - { - "country": "Bangladesh", - "alpha2": "BD", - "alpha3": "BGD", - "numeric": "050", - "countryCode": "BGD", - "timezones": [ - { - "name": "Asia/Dhaka", - "offset": -360 - } - ] - }, - { - "country": "Barbados", - "alpha2": "BB", - "alpha3": "BRB", - "numeric": "052", - "countryCode": "BRB", - "timezones": [ - { - "name": "America/Barbados", - "offset": 240 - } - ] - }, - { - "country": "Belarus", - "alpha2": "BY", - "alpha3": "BLR", - "numeric": "112", - "countryCode": "BLR", - "timezones": [ - { - "name": "Europe/Minsk", - "offset": -180 - } - ] - }, - { - "country": "Belgium", - "alpha2": "BE", - "alpha3": "BEL", - "numeric": "056", - "countryCode": "BEL", - "timezones": [ - { - "name": "Europe/Brussels", - "offset": -120 - } - ] - }, - { - "country": "Belize", - "alpha2": "BZ", - "alpha3": "BLZ", - "numeric": "084", - "countryCode": "BLZ", - "timezones": [ - { - "name": "America/Belize", - "offset": 360 - } - ] - }, - { - "country": "Benin", - "alpha2": "BJ", - "alpha3": "BEN", - "numeric": "204", - "countryCode": "BEN", - "timezones": [ - { - "name": "Africa/Lagos", - "offset": -60 - }, - { - "name": "Africa/Porto-Novo", - "offset": -60 - } - ] - }, - { - "country": "Bermuda", - "alpha2": "BM", - "alpha3": "BMU", - "numeric": "060", - "countryCode": "BMU", - "timezones": [ - { - "name": "Atlantic/Bermuda", - "offset": 180 - } - ] - }, - { - "country": "Bhutan", - "alpha2": "BT", - "alpha3": "BTN", - "numeric": "064", - "countryCode": "BTN", - "timezones": [ - { - "name": "Asia/Thimphu", - "offset": -360 - } - ] - }, - { - "country": "Bolivia", - "alpha2": "BO", - "alpha3": "BOL", - "numeric": "068", - "countryCode": "BOL", - "timezones": [ - { - "name": "America/La_Paz", - "offset": 240 - } - ] - }, - { - "country": "Bonaire, Sint Eustatius and Saba", - "alpha2": "BQ", - "alpha3": "BES", - "numeric": "535", - "countryCode": "BES", - "timezones": [ - { - "name": "America/Curacao", - "offset": 240 - }, - { - "name": "America/Kralendijk", - "offset": 240 - } - ] - }, - { - "country": "Bosnia and Herzegovina", - "alpha2": "BA", - "alpha3": "BIH", - "numeric": "070", - "countryCode": "BIH", - "timezones": [ - { - "name": "Europe/Belgrade", - "offset": -120 - }, - { - "name": "Europe/Sarajevo", - "offset": -120 - } - ] - }, - { - "country": "Botswana", - "alpha2": "BW", - "alpha3": "BWA", - "numeric": "072", - "countryCode": "BWA", - "timezones": [ - { - "name": "Africa/Gaborone", - "offset": -120 - }, - { - "name": "Africa/Maputo", - "offset": -120 - } - ] - }, - { - "country": "Bouvet Island", - "alpha2": "BV", - "alpha3": "BVT", - "numeric": "074", - "countryCode": "BVT", - "timezones": [ - { - "name": "Antarctica/Macquarie", - "offset": -660 - } - ] - }, - { - "country": "Brazil", - "alpha2": "BR", - "alpha3": "BRA", - "numeric": "076", - "countryCode": "BRA", - "timezones": [ - { - "name": "America/Araguaina", - "offset": 180 - }, - { - "name": "America/Bahia", - "offset": 180 - }, - { - "name": "America/Belem", - "offset": 180 - }, - { - "name": "America/Boa_Vista", - "offset": 240 - }, - { - "name": "America/Campo_Grande", - "offset": 240 - }, - { - "name": "America/Cuiaba", - "offset": 240 - }, - { - "name": "America/Eirunepe", - "offset": 300 - }, - { - "name": "America/Fortaleza", - "offset": 180 - }, - { - "name": "America/Maceio", - "offset": 180 - }, - { - "name": "America/Manaus", - "offset": 240 - }, - { - "name": "America/Noronha", - "offset": 120 - }, - { - "name": "America/Porto_Velho", - "offset": 240 - }, - { - "name": "America/Recife", - "offset": 180 - }, - { - "name": "America/Rio_Branco", - "offset": 300 - }, - { - "name": "America/Santarem", - "offset": 180 - }, - { - "name": "America/Sao_Paulo", - "offset": 180 - } - ] - }, - { - "country": "British Indian Ocean Territory", - "alpha2": "IO", - "alpha3": "IOT", - "numeric": "086", - "countryCode": "IOT", - "timezones": [ - { - "name": "Indian/Chagos", - "offset": -360 - } - ] - }, - { - "country": "Brunei Darussalam", - "alpha2": "BN", - "alpha3": "BRN", - "numeric": "096", - "countryCode": "BRN", - "timezones": [ - { - "name": "Asia/Brunei", - "offset": -480 - } - ] - }, - { - "country": "Bulgaria", - "alpha2": "BG", - "alpha3": "BGR", - "numeric": "100", - "countryCode": "BGR", - "timezones": [ - { - "name": "Europe/Sofia", - "offset": -180 - } - ] - }, - { - "country": "Burkina Faso", - "alpha2": "BF", - "alpha3": "BFA", - "numeric": "854", - "countryCode": "BFA", - "timezones": [ - { - "name": "Africa/Abidjan", - "offset": 0 - }, - { - "name": "Africa/Ouagadougou", - "offset": 0 - } - ] - }, - { - "country": "Burundi", - "alpha2": "BI", - "alpha3": "BDI", - "numeric": "108", - "countryCode": "BDI", - "timezones": [ - { - "name": "Africa/Bujumbura", - "offset": -120 - }, - { - "name": "Africa/Maputo", - "offset": -120 - } - ] - }, - { - "country": "Cabo Verde", - "alpha2": "CV", - "alpha3": "CPV", - "numeric": "132", - "countryCode": "CPV", - "timezones": [ - { - "name": "Atlantic/Cape_Verde", - "offset": 60 - } - ] - }, - { - "country": "Cambodia", - "alpha2": "KH", - "alpha3": "KHM", - "numeric": "116", - "countryCode": "KHM", - "timezones": [ - { - "name": "Asia/Bangkok", - "offset": -420 - }, - { - "name": "Asia/Phnom_Penh", - "offset": -420 - } - ] - }, - { - "country": "Cameroon", - "alpha2": "CM", - "alpha3": "CMR", - "numeric": "120", - "countryCode": "CMR", - "timezones": [ - { - "name": "Africa/Douala", - "offset": -60 - }, - { - "name": "Africa/Lagos", - "offset": -60 - } - ] - }, - { - "country": "Canada", - "alpha2": "CA", - "alpha3": "CAN", - "numeric": "124", - "countryCode": "CAN", - "timezones": [ - { - "name": "America/Atikokan", - "offset": 300 - }, - { - "name": "America/Blanc-Sablon", - "offset": 240 - }, - { - "name": "America/Cambridge_Bay", - "offset": 360 - }, - { - "name": "America/Creston", - "offset": 420 - }, - { - "name": "America/Dawson", - "offset": 420 - }, - { - "name": "America/Dawson_Creek", - "offset": 420 - }, - { - "name": "America/Edmonton", - "offset": 360 - }, - { - "name": "America/Fort_Nelson", - "offset": 420 - }, - { - "name": "America/Glace_Bay", - "offset": 180 - }, - { - "name": "America/Goose_Bay", - "offset": 180 - }, - { - "name": "America/Halifax", - "offset": 180 - }, - { - "name": "America/Inuvik", - "offset": 360 - }, - { - "name": "America/Iqaluit", - "offset": 240 - }, - { - "name": "America/Moncton", - "offset": 180 - }, - { - "name": "America/Nipigon", - "offset": 240 - }, - { - "name": "America/Pangnirtung", - "offset": 240 - }, - { - "name": "America/Rainy_River", - "offset": 300 - }, - { - "name": "America/Rankin_Inlet", - "offset": 300 - }, - { - "name": "America/Regina", - "offset": 360 - }, - { - "name": "America/Resolute", - "offset": 300 - }, - { - "name": "America/St_Johns", - "offset": 150 - }, - { - "name": "America/Swift_Current", - "offset": 360 - }, - { - "name": "America/Thunder_Bay", - "offset": 240 - }, - { - "name": "America/Toronto", - "offset": 240 - }, - { - "name": "America/Vancouver", - "offset": 420 - }, - { - "name": "America/Whitehorse", - "offset": 420 - }, - { - "name": "America/Winnipeg", - "offset": 300 - }, - { - "name": "America/Yellowknife", - "offset": 360 - } - ] - }, - { - "country": "Cayman Islands", - "alpha2": "KY", - "alpha3": "CYM", - "numeric": "136", - "countryCode": "CYM", - "timezones": [ - { - "name": "America/Cayman", - "offset": 300 - }, - { - "name": "America/Panama", - "offset": 300 - } - ] - }, - { - "country": "Central African Republic", - "alpha2": "CF", - "alpha3": "CAF", - "numeric": "140", - "countryCode": "CAF", - "timezones": [ - { - "name": "Africa/Bangui", - "offset": -60 - }, - { - "name": "Africa/Lagos", - "offset": -60 - } - ] - }, - { - "country": "Chad", - "alpha2": "TD", - "alpha3": "TCD", - "numeric": "148", - "countryCode": "TCD", - "timezones": [ - { - "name": "Africa/Ndjamena", - "offset": -60 - } - ] - }, - { - "country": "Chile", - "alpha2": "CL", - "alpha3": "CHL", - "numeric": "152", - "countryCode": "CHL", - "timezones": [ - { - "name": "America/Punta_Arenas", - "offset": 180 - }, - { - "name": "America/Santiago", - "offset": 240 - }, - { - "name": "Pacific/Easter", - "offset": 360 - } - ] - }, - { - "country": "China", - "alpha2": "CN", - "alpha3": "CHN", - "numeric": "156", - "countryCode": "CHN", - "timezones": [ - { - "name": "Asia/Shanghai", - "offset": -480 - }, - { - "name": "Asia/Urumqi", - "offset": -360 - } - ] - }, - { - "country": "Christmas Island", - "alpha2": "CX", - "alpha3": "CXR", - "numeric": "162", - "countryCode": "CXR", - "timezones": [ - { - "name": "Indian/Christmas", - "offset": -420 - } - ] - }, - { - "country": "Cocos Islands", - "alpha2": "CC", - "alpha3": "CCK", - "numeric": "166", - "countryCode": "CCK", - "timezones": [ - { - "name": "Indian/Cocos", - "offset": -390 - } - ] - }, - { - "country": "Colombia", - "alpha2": "CO", - "alpha3": "COL", - "numeric": "170", - "countryCode": "COL", - "timezones": [ - { - "name": "America/Bogota", - "offset": 300 - } - ] - }, - { - "country": "Comoros", - "alpha2": "KM", - "alpha3": "COM", - "numeric": "174", - "countryCode": "COM", - "timezones": [ - { - "name": "Africa/Nairobi", - "offset": -180 - }, - { - "name": "Indian/Comoro", - "offset": -180 - } - ] - }, - { - "country": "Congo", - "alpha2": "CG", - "alpha3": "COG", - "numeric": "178", - "countryCode": "COG", - "timezones": [ - { - "name": "Africa/Brazzaville", - "offset": -60 - }, - { - "name": "Africa/Lagos", - "offset": -60 - } - ] - }, - { - "country": "Congo", - "alpha2": "CD", - "alpha3": "COD", - "numeric": "180", - "countryCode": "COD", - "timezones": [ - { - "name": "Africa/Kinshasa", - "offset": -60 - }, - { - "name": "Africa/Lagos", - "offset": -60 - }, - { - "name": "Africa/Lubumbashi", - "offset": -120 - }, - { - "name": "Africa/Maputo", - "offset": -120 - } - ] - }, - { - "country": "Cook Islands", - "alpha2": "CK", - "alpha3": "COK", - "numeric": "184", - "countryCode": "COK", - "timezones": [ - { - "name": "Pacific/Rarotonga", - "offset": 600 - } - ] - }, - { - "country": "Costa Rica", - "alpha2": "CR", - "alpha3": "CRI", - "numeric": "188", - "countryCode": "CRI", - "timezones": [ - { - "name": "America/Costa_Rica", - "offset": 360 - } - ] - }, - { - "country": "Côte d'Ivoire", - "alpha2": "CI", - "alpha3": "CIV", - "numeric": "384", - "countryCode": "CIV", - "timezones": [ - { - "name": "Africa/Abidjan", - "offset": 0 - } - ] - }, - { - "country": "Croatia", - "alpha2": "HR", - "alpha3": "HRV", - "numeric": "191", - "countryCode": "HRV", - "timezones": [ - { - "name": "Europe/Belgrade", - "offset": -120 - }, - { - "name": "Europe/Zagreb", - "offset": -120 - } - ] - }, - { - "country": "Cuba", - "alpha2": "CU", - "alpha3": "CUB", - "numeric": "192", - "countryCode": "CUB", - "timezones": [ - { - "name": "America/Havana", - "offset": 240 - } - ] - }, - { - "country": "Curaçao", - "alpha2": "CW", - "alpha3": "CUW", - "numeric": "531", - "countryCode": "CUW", - "timezones": [ - { - "name": "America/Curacao", - "offset": 240 - } - ] - }, - { - "country": "Cyprus", - "alpha2": "CY", - "alpha3": "CYP", - "numeric": "196", - "countryCode": "CYP", - "timezones": [ - { - "name": "Asia/Famagusta", - "offset": -180 - }, - { - "name": "Asia/Nicosia", - "offset": -180 - } - ] - }, - { - "country": "Czech Republic", - "alpha2": "CZ", - "alpha3": "CZE", - "numeric": "203", - "countryCode": "CZE", - "timezones": [ - { - "name": "Europe/Prague", - "offset": -120 - } - ] - }, - { - "country": "Denmark", - "alpha2": "DK", - "alpha3": "DNK", - "numeric": "208", - "countryCode": "DNK", - "timezones": [ - { - "name": "Europe/Copenhagen", - "offset": -120 - } - ] - }, - { - "country": "Djibouti", - "alpha2": "DJ", - "alpha3": "DJI", - "numeric": "262", - "countryCode": "DJI", - "timezones": [ - { - "name": "Africa/Djibouti", - "offset": -180 - }, - { - "name": "Africa/Nairobi", - "offset": -180 - } - ] - }, - { - "country": "Dominica", - "alpha2": "DM", - "alpha3": "DMA", - "numeric": "212", - "countryCode": "DMA", - "timezones": [ - { - "name": "America/Dominica", - "offset": 240 - }, - { - "name": "America/Port_of_Spain", - "offset": 240 - } - ] - }, - { - "country": "Dominican Republic", - "alpha2": "DO", - "alpha3": "DOM", - "numeric": "214", - "countryCode": "DOM", - "timezones": [ - { - "name": "America/Santo_Domingo", - "offset": 240 - } - ] - }, - { - "country": "Ecuador", - "alpha2": "EC", - "alpha3": "ECU", - "numeric": "218", - "countryCode": "ECU", - "timezones": [ - { - "name": "America/Guayaquil", - "offset": 300 - }, - { - "name": "Pacific/Galapagos", - "offset": 360 - } - ] - }, - { - "country": "Egypt", - "alpha2": "EG", - "alpha3": "EGY", - "numeric": "818", - "countryCode": "EGY", - "timezones": [ - { - "name": "Africa/Cairo", - "offset": -120 - } - ] - }, - { - "country": "El Salvador", - "alpha2": "SV", - "alpha3": "SLV", - "numeric": "222", - "countryCode": "SLV", - "timezones": [ - { - "name": "America/El_Salvador", - "offset": 360 - } - ] - }, - { - "country": "Equatorial Guinea", - "alpha2": "GQ", - "alpha3": "GNQ", - "numeric": "226", - "countryCode": "GNQ", - "timezones": [ - { - "name": "Africa/Lagos", - "offset": -60 - }, - { - "name": "Africa/Malabo", - "offset": -60 - } - ] - }, - { - "country": "Eritrea", - "alpha2": "ER", - "alpha3": "ERI", - "numeric": "232", - "countryCode": "ERI", - "timezones": [ - { - "name": "Africa/Asmara", - "offset": -180 - }, - { - "name": "Africa/Nairobi", - "offset": -180 - } - ] - }, - { - "country": "Estonia", - "alpha2": "EE", - "alpha3": "EST", - "numeric": "233", - "countryCode": "EST", - "timezones": [ - { - "name": "Europe/Tallinn", - "offset": -180 - } - ] - }, - { - "country": "Ethiopia", - "alpha2": "ET", - "alpha3": "ETH", - "numeric": "231", - "countryCode": "ETH", - "timezones": [ - { - "name": "Africa/Addis_Ababa", - "offset": -180 - }, - { - "name": "Africa/Nairobi", - "offset": -180 - } - ] - }, - { - "country": "Falkland Islands", - "alpha2": "FK", - "alpha3": "FLK", - "numeric": "238", - "countryCode": "FLK", - "timezones": [ - { - "name": "Atlantic/Stanley", - "offset": 180 - } - ] - }, - { - "country": "Faroe Islands", - "alpha2": "FO", - "alpha3": "FRO", - "numeric": "234", - "countryCode": "FRO", - "timezones": [ - { - "name": "Atlantic/Faroe", - "offset": -60 - } - ] - }, - { - "country": "Fiji", - "alpha2": "FJ", - "alpha3": "FJI", - "numeric": "242", - "countryCode": "FJI", - "timezones": [ - { - "name": "Pacific/Fiji", - "offset": -720 - } - ] - }, - { - "country": "Finland", - "alpha2": "FI", - "alpha3": "FIN", - "numeric": "246", - "countryCode": "FIN", - "timezones": [ - { - "name": "Europe/Helsinki", - "offset": -180 - } - ] - }, - { - "country": "France", - "alpha2": "FR", - "alpha3": "FRA", - "numeric": "250", - "countryCode": "FRA", - "timezones": [ - { - "name": "Europe/Paris", - "offset": -120 - } - ] - }, - { - "country": "French Guiana", - "alpha2": "GF", - "alpha3": "GUF", - "numeric": "254", - "countryCode": "GUF", - "timezones": [ - { - "name": "America/Cayenne", - "offset": 180 - } - ] - }, - { - "country": "French Polynesia", - "alpha2": "PF", - "alpha3": "PYF", - "numeric": "258", - "countryCode": "PYF", - "timezones": [ - { - "name": "Pacific/Gambier", - "offset": 540 - }, - { - "name": "Pacific/Marquesas", - "offset": 570 - }, - { - "name": "Pacific/Tahiti", - "offset": 600 - } - ] - }, - { - "country": "French Southern Territories", - "alpha2": "TF", - "alpha3": "ATF", - "numeric": "260", - "countryCode": "ATF", - "timezones": [ - { - "name": "Indian/Kerguelen", - "offset": -300 - }, - { - "name": "Indian/Reunion", - "offset": -240 - } - ] - }, - { - "country": "Gabon", - "alpha2": "GA", - "alpha3": "GAB", - "numeric": "266", - "countryCode": "GAB", - "timezones": [ - { - "name": "Africa/Lagos", - "offset": -60 - }, - { - "name": "Africa/Libreville", - "offset": -60 - } - ] - }, - { - "country": "Gambia", - "alpha2": "GM", - "alpha3": "GMB", - "numeric": "270", - "countryCode": "GMB", - "timezones": [ - { - "name": "Africa/Abidjan", - "offset": 0 - }, - { - "name": "Africa/Banjul", - "offset": 0 - } - ] - }, - { - "country": "Georgia", - "alpha2": "GE", - "alpha3": "GEO", - "numeric": "268", - "countryCode": "GEO", - "timezones": [ - { - "name": "Asia/Tbilisi", - "offset": -240 - } - ] - }, - { - "country": "Germany", - "alpha2": "DE", - "alpha3": "DEU", - "numeric": "276", - "countryCode": "DEU", - "timezones": [ - { - "name": "Europe/Berlin", - "offset": -120 - }, - { - "name": "Europe/Busingen", - "offset": -120 - }, - { - "name": "Europe/Zurich", - "offset": -120 - } - ] - }, - { - "country": "Ghana", - "alpha2": "GH", - "alpha3": "GHA", - "numeric": "288", - "countryCode": "GHA", - "timezones": [ - { - "name": "Africa/Accra", - "offset": 0 - } - ] - }, - { - "country": "Gibraltar", - "alpha2": "GI", - "alpha3": "GIB", - "numeric": "292", - "countryCode": "GIB", - "timezones": [ - { - "name": "Europe/Gibraltar", - "offset": -120 - } - ] - }, - { - "country": "Greece", - "alpha2": "GR", - "alpha3": "GRC", - "numeric": "300", - "countryCode": "GRC", - "timezones": [ - { - "name": "Europe/Athens", - "offset": -180 - } - ] - }, - { - "country": "Greenland", - "alpha2": "GL", - "alpha3": "GRL", - "numeric": "304", - "countryCode": "GRL", - "timezones": [ - { - "name": "America/Danmarkshavn", - "offset": 0 - }, - { - "name": "America/Godthab", - "offset": 120 - }, - { - "name": "America/Scoresbysund", - "offset": 0 - }, - { - "name": "America/Thule", - "offset": 180 - } - ] - }, - { - "country": "Grenada", - "alpha2": "GD", - "alpha3": "GRD", - "numeric": "308", - "countryCode": "GRD", - "timezones": [ - { - "name": "America/Grenada", - "offset": 240 - }, - { - "name": "America/Port_of_Spain", - "offset": 240 - } - ] - }, - { - "country": "Guadeloupe", - "alpha2": "GP", - "alpha3": "GLP", - "numeric": "312", - "countryCode": "GLP", - "timezones": [ - { - "name": "America/Guadeloupe", - "offset": 240 - }, - { - "name": "America/Port_of_Spain", - "offset": 240 - } - ] - }, - { - "country": "Guam", - "alpha2": "GU", - "alpha3": "GUM", - "numeric": "316", - "countryCode": "GUM", - "timezones": [ - { - "name": "Pacific/Guam", - "offset": -600 - } - ] - }, - { - "country": "Guatemala", - "alpha2": "GT", - "alpha3": "GTM", - "numeric": "320", - "countryCode": "GTM", - "timezones": [ - { - "name": "America/Guatemala", - "offset": 360 - } - ] - }, - { - "country": "Guernsey", - "alpha2": "GG", - "alpha3": "GGY", - "numeric": "831", - "countryCode": "GGY", - "timezones": [ - { - "name": "Europe/Guernsey", - "offset": -60 - }, - { - "name": "Europe/London", - "offset": -60 - } - ] - }, - { - "country": "Guinea", - "alpha2": "GN", - "alpha3": "GIN", - "numeric": "324", - "countryCode": "GIN", - "timezones": [ - { - "name": "Africa/Abidjan", - "offset": 0 - }, - { - "name": "Africa/Conakry", - "offset": 0 - } - ] - }, - { - "country": "Guinea-Bissau", - "alpha2": "GW", - "alpha3": "GNB", - "numeric": "624", - "countryCode": "GNB", - "timezones": [ - { - "name": "Africa/Bissau", - "offset": 0 - } - ] - }, - { - "country": "Guyana", - "alpha2": "GY", - "alpha3": "GUY", - "numeric": "328", - "countryCode": "GUY", - "timezones": [ - { - "name": "America/Guyana", - "offset": 240 - } - ] - }, - { - "country": "Haiti", - "alpha2": "HT", - "alpha3": "HTI", - "numeric": "332", - "countryCode": "HTI", - "timezones": [ - { - "name": "America/Port-au-Prince", - "offset": 240 - } - ] - }, - { - "country": "Heard Island and McDonald Islands", - "alpha2": "HM", - "alpha3": "HMD", - "numeric": "334", - "countryCode": "HMD", - "timezones": [ - { - "name": "Africa/Johannesburg", - "offset": -120 - } - ] - }, - { - "country": "Holy See", - "alpha2": "VA", - "alpha3": "VAT", - "numeric": "336", - "countryCode": "VAT", - "timezones": [ - { - "name": "Europe/Rome", - "offset": -120 - }, - { - "name": "Europe/Vatican", - "offset": -120 - } - ] - }, - { - "country": "Honduras", - "alpha2": "HN", - "alpha3": "HND", - "numeric": "340", - "countryCode": "HND", - "timezones": [ - { - "name": "America/Tegucigalpa", - "offset": 360 - } - ] - }, - { - "country": "Hong Kong", - "alpha2": "HK", - "alpha3": "HKG", - "numeric": "344", - "countryCode": "HKG", - "timezones": [ - { - "name": "Asia/Hong_Kong", - "offset": -480 - } - ] - }, - { - "country": "Hungary", - "alpha2": "HU", - "alpha3": "HUN", - "numeric": "348", - "countryCode": "HUN", - "timezones": [ - { - "name": "Europe/Budapest", - "offset": -120 - } - ] - }, - { - "country": "Iceland", - "alpha2": "IS", - "alpha3": "ISL", - "numeric": "352", - "countryCode": "ISL", - "timezones": [ - { - "name": "Atlantic/Reykjavik", - "offset": 0 - } - ] - }, - { - "country": "India", - "alpha2": "IN", - "alpha3": "IND", - "numeric": "356", - "countryCode": "IND", - "timezones": [ { - "name": "Asia/Kolkata", - "offset": -330 - }, - { - "name": "Asia/Calcutta", - "offset": -330 - } - ] - }, - { - "country": "Indonesia", - "alpha2": "ID", - "alpha3": "IDN", - "numeric": "360", - "countryCode": "IDN", - "timezones": [ - { - "name": "Asia/Jakarta", - "offset": -420 - }, - { - "name": "Asia/Jayapura", - "offset": -540 - }, - { - "name": "Asia/Makassar", - "offset": -480 - }, - { - "name": "Asia/Pontianak", - "offset": -420 - } - ] - }, - { - "country": "Islamic Republic of Iran", - "alpha2": "IR", - "alpha3": "IRN", - "numeric": "364", - "countryCode": "IRN", - "timezones": [ - { - "name": "Asia/Tehran", - "offset": -270 - } - ] - }, - { - "country": "Iraq", - "alpha2": "IQ", - "alpha3": "IRQ", - "numeric": "368", - "countryCode": "IRQ", - "timezones": [ - { - "name": "Asia/Baghdad", - "offset": -180 - } - ] - }, - { - "country": "Ireland", - "alpha2": "IE", - "alpha3": "IRL", - "numeric": "372", - "countryCode": "IRL", - "timezones": [ - { - "name": "Europe/Dublin", - "offset": -60 - } - ] - }, - { - "country": "Isle of Man", - "alpha2": "IM", - "alpha3": "IMN", - "numeric": "833", - "countryCode": "IMN", - "timezones": [ - { - "name": "Europe/Isle_of_Man", - "offset": -60 - }, - { - "name": "Europe/London", - "offset": -60 - } - ] - }, - { - "country": "Israel", - "alpha2": "IL", - "alpha3": "ISR", - "numeric": "376", - "countryCode": "ISR", - "timezones": [ - { - "name": "Asia/Jerusalem", - "offset": -180 - } - ] - }, - { - "country": "Italy", - "alpha2": "IT", - "alpha3": "ITA", - "numeric": "380", - "countryCode": "ITA", - "timezones": [ - { - "name": "Europe/Rome", - "offset": -120 - } - ] - }, - { - "country": "Jamaica", - "alpha2": "JM", - "alpha3": "JAM", - "numeric": "388", - "countryCode": "JAM", - "timezones": [ - { - "name": "America/Jamaica", - "offset": 300 - } - ] - }, - { - "country": "Japan", - "alpha2": "JP", - "alpha3": "JPN", - "numeric": "392", - "countryCode": "JPN", - "timezones": [ - { - "name": "Asia/Tokyo", - "offset": -540 - } - ] - }, - { - "country": "Jersey", - "alpha2": "JE", - "alpha3": "JEY", - "numeric": "832", - "countryCode": "JEY", - "timezones": [ - { - "name": "Europe/Jersey", - "offset": -60 - }, - { - "name": "Europe/London", - "offset": -60 - } - ] - }, - { - "country": "Jordan", - "alpha2": "JO", - "alpha3": "JOR", - "numeric": "400", - "countryCode": "JOR", - "timezones": [ - { - "name": "Asia/Amman", - "offset": -180 - } - ] - }, - { - "country": "Kazakhstan", - "alpha2": "KZ", - "alpha3": "KAZ", - "numeric": "398", - "countryCode": "KAZ", - "timezones": [ - { - "name": "Asia/Almaty", - "offset": -360 - }, - { - "name": "Asia/Aqtau", - "offset": -300 - }, - { - "name": "Asia/Aqtobe", - "offset": -300 - }, - { - "name": "Asia/Atyrau", - "offset": -300 - }, - { - "name": "Asia/Oral", - "offset": -300 - }, - { - "name": "Asia/Qostanay", - "offset": -360 - }, - { - "name": "Asia/Qyzylorda", - "offset": -300 - } - ] - }, - { - "country": "Kenya", - "alpha2": "KE", - "alpha3": "KEN", - "numeric": "404", - "countryCode": "KEN", - "timezones": [ - { - "name": "Africa/Nairobi", - "offset": -180 - } - ] - }, - { - "country": "Kiribati", - "alpha2": "KI", - "alpha3": "KIR", - "numeric": "296", - "countryCode": "KIR", - "timezones": [ - { - "name": "Pacific/Enderbury", - "offset": -780 - }, - { - "name": "Pacific/Kiritimati", - "offset": -840 - }, - { - "name": "Pacific/Tarawa", - "offset": -720 - } - ] - }, - { - "country": "Democratic People's Republic of Korea", - "alpha2": "KP", - "alpha3": "PRK", - "numeric": "408", - "countryCode": "PRK", - "timezones": [ - { - "name": "Asia/Pyongyang", - "offset": -540 - } - ] - }, - { - "country": "Republic of Korea", - "alpha2": "KR", - "alpha3": "KOR", - "numeric": "410", - "countryCode": "KOR", - "timezones": [ - { - "name": "Asia/Seoul", - "offset": -540 - } - ] - }, - { - "country": "Kuwait", - "alpha2": "KW", - "alpha3": "KWT", - "numeric": "414", - "countryCode": "KWT", - "timezones": [ - { - "name": "Asia/Kuwait", - "offset": -180 - }, - { - "name": "Asia/Riyadh", - "offset": -180 - } - ] - }, - { - "country": "Kyrgyzstan", - "alpha2": "KG", - "alpha3": "KGZ", - "numeric": "417", - "countryCode": "KGZ", - "timezones": [ - { - "name": "Asia/Bishkek", - "offset": -360 - } - ] - }, - { - "country": "Lao People's Democratic Republic", - "alpha2": "LA", - "alpha3": "LAO", - "numeric": "418", - "countryCode": "LAO", - "timezones": [ - { - "name": "Asia/Bangkok", - "offset": -420 - }, - { - "name": "Asia/Vientiane", - "offset": -420 - } - ] - }, - { - "country": "Latvia", - "alpha2": "LV", - "alpha3": "LVA", - "numeric": "428", - "countryCode": "LVA", - "timezones": [ - { - "name": "Europe/Riga", - "offset": -180 - } - ] - }, - { - "country": "Lebanon", - "alpha2": "LB", - "alpha3": "LBN", - "numeric": "422", - "countryCode": "LBN", - "timezones": [ - { - "name": "Asia/Beirut", - "offset": -180 - } - ] - }, - { - "country": "Lesotho", - "alpha2": "LS", - "alpha3": "LSO", - "numeric": "426", - "countryCode": "LSO", - "timezones": [ - { - "name": "Africa/Johannesburg", - "offset": -120 - }, - { - "name": "Africa/Maseru", - "offset": -120 - } - ] - }, - { - "country": "Liberia", - "alpha2": "LR", - "alpha3": "LBR", - "numeric": "430", - "countryCode": "LBR", - "timezones": [ - { - "name": "Africa/Monrovia", - "offset": 0 - } - ] - }, - { - "country": "Libya", - "alpha2": "LY", - "alpha3": "LBY", - "numeric": "434", - "countryCode": "LBY", - "timezones": [ - { - "name": "Africa/Tripoli", - "offset": -120 - } - ] - }, - { - "country": "Liechtenstein", - "alpha2": "LI", - "alpha3": "LIE", - "numeric": "438", - "countryCode": "LIE", - "timezones": [ - { - "name": "Europe/Vaduz", - "offset": -120 - }, - { - "name": "Europe/Zurich", - "offset": -120 - } - ] - }, - { - "country": "Lithuania", - "alpha2": "LT", - "alpha3": "LTU", - "numeric": "440", - "countryCode": "LTU", - "timezones": [ - { - "name": "Europe/Vilnius", - "offset": -180 - } - ] - }, - { - "country": "Luxembourg", - "alpha2": "LU", - "alpha3": "LUX", - "numeric": "442", - "countryCode": "LUX", - "timezones": [ - { - "name": "Europe/Luxembourg", - "offset": -120 - } - ] - }, - { - "country": "Macao", - "alpha2": "MO", - "alpha3": "MAC", - "numeric": "446", - "countryCode": "MAC", - "timezones": [ - { - "name": "Asia/Macau", - "offset": -480 - } - ] - }, - { - "country": "Macedonia", - "alpha2": "MK", - "alpha3": "MKD", - "numeric": "807", - "countryCode": "MKD", - "timezones": [ - { - "name": "Europe/Belgrade", - "offset": -120 - }, - { - "name": "Europe/Skopje", - "offset": -120 - } - ] - }, - { - "country": "Madagascar", - "alpha2": "MG", - "alpha3": "MDG", - "numeric": "450", - "countryCode": "MDG", - "timezones": [ - { - "name": "Africa/Nairobi", - "offset": -180 - }, - { - "name": "Indian/Antananarivo", - "offset": -180 - } - ] - }, - { - "country": "Malawi", - "alpha2": "MW", - "alpha3": "MWI", - "numeric": "454", - "countryCode": "MWI", - "timezones": [ - { - "name": "Africa/Blantyre", - "offset": -120 - }, - { - "name": "Africa/Maputo", - "offset": -120 - } - ] - }, - { - "country": "Malaysia", - "alpha2": "MY", - "alpha3": "MYS", - "numeric": "458", - "countryCode": "MYS", - "timezones": [ - { - "name": "Asia/Kuala_Lumpur", - "offset": -480 - }, - { - "name": "Asia/Kuching", - "offset": -480 - } - ] - }, - { - "country": "Maldives", - "alpha2": "MV", - "alpha3": "MDV", - "numeric": "462", - "countryCode": "MDV", - "timezones": [ - { - "name": "Indian/Maldives", - "offset": -300 - } - ] - }, - { - "country": "Mali", - "alpha2": "ML", - "alpha3": "MLI", - "numeric": "466", - "countryCode": "MLI", - "timezones": [ - { - "name": "Africa/Abidjan", - "offset": 0 - }, - { - "name": "Africa/Bamako", - "offset": 0 - } - ] - }, - { - "country": "Malta", - "alpha2": "MT", - "alpha3": "MLT", - "numeric": "470", - "countryCode": "MLT", - "timezones": [ - { - "name": "Europe/Malta", - "offset": -120 - } - ] - }, - { - "country": "Marshall Islands", - "alpha2": "MH", - "alpha3": "MHL", - "numeric": "584", - "countryCode": "MHL", - "timezones": [ - { - "name": "Pacific/Kwajalein", - "offset": -720 - }, - { - "name": "Pacific/Majuro", - "offset": -720 - } - ] - }, - { - "country": "Martinique", - "alpha2": "MQ", - "alpha3": "MTQ", - "numeric": "474", - "countryCode": "MTQ", - "timezones": [ - { - "name": "America/Martinique", - "offset": 240 - } - ] - }, - { - "country": "Mauritania", - "alpha2": "MR", - "alpha3": "MRT", - "numeric": "478", - "countryCode": "MRT", - "timezones": [ - { - "name": "Africa/Abidjan", - "offset": 0 - }, - { - "name": "Africa/Nouakchott", - "offset": 0 - } - ] - }, - { - "country": "Mauritius", - "alpha2": "MU", - "alpha3": "MUS", - "numeric": "480", - "countryCode": "MUS", - "timezones": [ - { - "name": "Indian/Mauritius", - "offset": -240 - } - ] - }, - { - "country": "Mayotte", - "alpha2": "YT", - "alpha3": "MYT", - "numeric": "175", - "countryCode": "MYT", - "timezones": [ - { - "name": "Africa/Nairobi", - "offset": -180 - }, - { - "name": "Indian/Mayotte", - "offset": -180 - } - ] - }, - { - "country": "Mexico", - "alpha2": "MX", - "alpha3": "MEX", - "numeric": "484", - "countryCode": "MEX", - "timezones": [ - { - "name": "America/Bahia_Banderas", - "offset": 300 - }, - { - "name": "America/Cancun", - "offset": 300 - }, - { - "name": "America/Chihuahua", - "offset": 360 - }, - { - "name": "America/Hermosillo", - "offset": 420 - }, - { - "name": "America/Matamoros", - "offset": 300 - }, - { - "name": "America/Mazatlan", - "offset": 360 - }, - { - "name": "America/Merida", - "offset": 300 - }, - { - "name": "America/Mexico_City", - "offset": 300 - }, - { - "name": "America/Monterrey", - "offset": 300 - }, - { - "name": "America/Ojinaga", - "offset": 360 - }, - { - "name": "America/Tijuana", - "offset": 420 - } - ] - }, - { - "country": "Federated States of Micronesia", - "alpha2": "FM", - "alpha3": "FSM", - "numeric": "583", - "countryCode": "FSM", - "timezones": [ - { - "name": "Pacific/Chuuk", - "offset": -600 - }, - { - "name": "Pacific/Kosrae", - "offset": -660 - }, - { - "name": "Pacific/Pohnpei", - "offset": -660 - } - ] - }, - { - "country": "Republic of Moldova", - "alpha2": "MD", - "alpha3": "MDA", - "numeric": "498", - "countryCode": "MDA", - "timezones": [ - { - "name": "Europe/Chisinau", - "offset": -180 - } - ] - }, - { - "country": "Monaco", - "alpha2": "MC", - "alpha3": "MCO", - "numeric": "492", - "countryCode": "MCO", - "timezones": [ - { - "name": "Europe/Monaco", - "offset": -120 - } - ] - }, - { - "country": "Mongolia", - "alpha2": "MN", - "alpha3": "MNG", - "numeric": "496", - "countryCode": "MNG", - "timezones": [ - { - "name": "Asia/Choibalsan", - "offset": -480 - }, - { - "name": "Asia/Hovd", - "offset": -420 - }, - { - "name": "Asia/Ulaanbaatar", - "offset": -480 - } - ] - }, - { - "country": "Montenegro", - "alpha2": "ME", - "alpha3": "MNE", - "numeric": "499", - "countryCode": "MNE", - "timezones": [ - { - "name": "Europe/Belgrade", - "offset": -120 - }, - { - "name": "Europe/Podgorica", - "offset": -120 - } - ] - }, - { - "country": "Montserrat", - "alpha2": "MS", - "alpha3": "MSR", - "numeric": "500", - "countryCode": "MSR", - "timezones": [ - { - "name": "America/Montserrat", - "offset": 240 - }, - { - "name": "America/Port_of_Spain", - "offset": 240 - } - ] - }, - { - "country": "Morocco", - "alpha2": "MA", - "alpha3": "MAR", - "numeric": "504", - "countryCode": "MAR", - "timezones": [ - { - "name": "Africa/Casablanca", - "offset": -60 - } - ] - }, - { - "country": "Mozambique", - "alpha2": "MZ", - "alpha3": "MOZ", - "numeric": "508", - "countryCode": "MOZ", - "timezones": [ - { - "name": "Africa/Maputo", - "offset": -120 - } - ] - }, - { - "country": "Myanmar", - "alpha2": "MM", - "alpha3": "MMR", - "numeric": "104", - "countryCode": "MMR", - "timezones": [ - { - "name": "Asia/Yangon", - "offset": -390 - } - ] - }, - { - "country": "Namibia", - "alpha2": "NA", - "alpha3": "NAM", - "numeric": "516", - "countryCode": "NAM", - "timezones": [ - { - "name": "Africa/Windhoek", - "offset": -120 - } - ] - }, - { - "country": "Nauru", - "alpha2": "NR", - "alpha3": "NRU", - "numeric": "520", - "countryCode": "NRU", - "timezones": [ - { - "name": "Pacific/Nauru", - "offset": -720 - } - ] - }, - { - "country": "Nepal", - "alpha2": "NP", - "alpha3": "NPL", - "numeric": "524", - "countryCode": "NPL", - "timezones": [ - { - "name": "Asia/Kathmandu", - "offset": -345 - } - ] - }, - { - "country": "Netherlands", - "alpha2": "NL", - "alpha3": "NLD", - "numeric": "528", - "countryCode": "NLD", - "timezones": [ - { - "name": "Europe/Amsterdam", - "offset": -120 - } - ] - }, - { - "country": "New Caledonia", - "alpha2": "NC", - "alpha3": "NCL", - "numeric": "540", - "countryCode": "NCL", - "timezones": [ - { - "name": "Pacific/Noumea", - "offset": -660 - } - ] - }, - { - "country": "New Zealand", - "alpha2": "NZ", - "alpha3": "NZL", - "numeric": "554", - "countryCode": "NZL", - "timezones": [ - { - "name": "Pacific/Auckland", - "offset": -720 - }, - { - "name": "Pacific/Chatham", - "offset": -765 - } - ] - }, - { - "country": "Nicaragua", - "alpha2": "NI", - "alpha3": "NIC", - "numeric": "558", - "countryCode": "NIC", - "timezones": [ - { - "name": "America/Managua", - "offset": 360 - } - ] - }, - { - "country": "Niger", - "alpha2": "NE", - "alpha3": "NER", - "numeric": "562", - "countryCode": "NER", - "timezones": [ - { - "name": "Africa/Lagos", - "offset": -60 - }, - { - "name": "Africa/Niamey", - "offset": -60 - } - ] - }, - { - "country": "Nigeria", - "alpha2": "NG", - "alpha3": "NGA", - "numeric": "566", - "countryCode": "NGA", - "timezones": [ - { - "name": "Africa/Lagos", - "offset": -60 - } - ] - }, - { - "country": "Niue", - "alpha2": "NU", - "alpha3": "NIU", - "numeric": "570", - "countryCode": "NIU", - "timezones": [ - { - "name": "Pacific/Niue", - "offset": 660 - } - ] - }, - { - "country": "Norfolk Island", - "alpha2": "NF", - "alpha3": "NFK", - "numeric": "574", - "countryCode": "NFK", - "timezones": [ - { - "name": "Pacific/Norfolk", - "offset": -660 - } - ] - }, - { - "country": "Northern Mariana Islands", - "alpha2": "MP", - "alpha3": "MNP", - "numeric": "580", - "countryCode": "MNP", - "timezones": [ - { - "name": "Pacific/Guam", - "offset": -600 - }, - { - "name": "Pacific/Saipan", - "offset": -600 - } - ] - }, - { - "country": "Norway", - "alpha2": "NO", - "alpha3": "NOR", - "numeric": "578", - "countryCode": "NOR", - "timezones": [ - { - "name": "Europe/Oslo", - "offset": -120 - } - ] - }, - { - "country": "Oman", - "alpha2": "OM", - "alpha3": "OMN", - "numeric": "512", - "countryCode": "OMN", - "timezones": [ - { - "name": "Asia/Dubai", - "offset": -240 - }, - { - "name": "Asia/Muscat", - "offset": -240 - } - ] - }, - { - "country": "Pakistan", - "alpha2": "PK", - "alpha3": "PAK", - "numeric": "586", - "countryCode": "PAK", - "timezones": [ - { - "name": "Asia/Karachi", - "offset": -300 - } - ] - }, - { - "country": "Palau", - "alpha2": "PW", - "alpha3": "PLW", - "numeric": "585", - "countryCode": "PLW", - "timezones": [ - { - "name": "Pacific/Palau", - "offset": -540 - } - ] - }, - { - "country": "State of Palestine", - "alpha2": "PS", - "alpha3": "PSE", - "numeric": "275", - "countryCode": "PSE", - "timezones": [ - { - "name": "Asia/Gaza", - "offset": -180 - }, - { - "name": "Asia/Hebron", - "offset": -180 - } - ] - }, - { - "country": "Panama", - "alpha2": "PA", - "alpha3": "PAN", - "numeric": "591", - "countryCode": "PAN", - "timezones": [ - { - "name": "America/Panama", - "offset": 300 - } - ] - }, - { - "country": "Papua New Guinea", - "alpha2": "PG", - "alpha3": "PNG", - "numeric": "598", - "countryCode": "PNG", - "timezones": [ - { - "name": "Pacific/Bougainville", - "offset": -660 - }, - { - "name": "Pacific/Port_Moresby", - "offset": -600 - } - ] - }, - { - "country": "Paraguay", - "alpha2": "PY", - "alpha3": "PRY", - "numeric": "600", - "countryCode": "PRY", - "timezones": [ - { - "name": "America/Asuncion", - "offset": 240 - } - ] - }, - { - "country": "Peru", - "alpha2": "PE", - "alpha3": "PER", - "numeric": "604", - "countryCode": "PER", - "timezones": [ - { - "name": "America/Lima", - "offset": 300 - } - ] - }, - { - "country": "Philippines", - "alpha2": "PH", - "alpha3": "PHL", - "numeric": "608", - "countryCode": "PHL", - "timezones": [ - { - "name": "Asia/Manila", - "offset": -480 - } - ] - }, - { - "country": "Pitcairn", - "alpha2": "PN", - "alpha3": "PCN", - "numeric": "612", - "countryCode": "PCN", - "timezones": [ - { - "name": "Pacific/Pitcairn", - "offset": 480 - } - ] - }, - { - "country": "Poland", - "alpha2": "PL", - "alpha3": "POL", - "numeric": "616", - "countryCode": "POL", - "timezones": [ - { - "name": "Europe/Warsaw", - "offset": -120 - } - ] - }, - { - "country": "Portugal", - "alpha2": "PT", - "alpha3": "PRT", - "numeric": "620", - "countryCode": "PRT", - "timezones": [ - { - "name": "Atlantic/Azores", - "offset": 0 - }, - { - "name": "Atlantic/Madeira", - "offset": -60 - }, - { - "name": "Europe/Lisbon", - "offset": -60 - } - ] - }, - { - "country": "Puerto Rico", - "alpha2": "PR", - "alpha3": "PRI", - "numeric": "630", - "countryCode": "PRI", - "timezones": [ - { - "name": "America/Puerto_Rico", - "offset": 240 - } - ] - }, - { - "country": "Qatar", - "alpha2": "QA", - "alpha3": "QAT", - "numeric": "634", - "countryCode": "QAT", - "timezones": [ - { - "name": "Asia/Qatar", - "offset": -180 - } - ] - }, - { - "country": "Réunion", - "alpha2": "RE", - "alpha3": "REU", - "numeric": "638", - "countryCode": "REU", - "timezones": [ - { - "name": "Indian/Reunion", - "offset": -240 - } - ] - }, - { - "country": "Romania", - "alpha2": "RO", - "alpha3": "ROU", - "numeric": "642", - "countryCode": "ROU", - "timezones": [ - { - "name": "Europe/Bucharest", - "offset": -180 - } - ] - }, - { - "country": "Russian Federation", - "alpha2": "RU", - "alpha3": "RUS", - "numeric": "643", - "countryCode": "RUS", - "timezones": [ - { - "name": "Asia/Anadyr", - "offset": -720 - }, - { - "name": "Asia/Barnaul", - "offset": -420 - }, - { - "name": "Asia/Chita", - "offset": -540 - }, - { - "name": "Asia/Irkutsk", - "offset": -480 - }, - { - "name": "Asia/Kamchatka", - "offset": -720 - }, - { - "name": "Asia/Khandyga", - "offset": -540 - }, - { - "name": "Asia/Krasnoyarsk", - "offset": -420 - }, - { - "name": "Asia/Magadan", - "offset": -660 - }, - { - "name": "Asia/Novokuznetsk", - "offset": -420 - }, - { - "name": "Asia/Novosibirsk", - "offset": -420 - }, - { - "name": "Asia/Omsk", - "offset": -360 - }, - { - "name": "Asia/Sakhalin", - "offset": -660 - }, - { - "name": "Asia/Srednekolymsk", - "offset": -660 - }, - { - "name": "Asia/Tomsk", - "offset": -420 - }, - { - "name": "Asia/Ust-Nera", - "offset": -600 - }, - { - "name": "Asia/Vladivostok", - "offset": -600 - }, - { - "name": "Asia/Yakutsk", - "offset": -540 - }, - { - "name": "Asia/Yekaterinburg", - "offset": -300 - }, - { - "name": "Europe/Astrakhan", - "offset": -240 - }, - { - "name": "Europe/Kaliningrad", - "offset": -120 - }, - { - "name": "Europe/Kirov", - "offset": -180 - }, - { - "name": "Europe/Moscow", - "offset": -180 - }, - { - "name": "Europe/Samara", - "offset": -240 - }, - { - "name": "Europe/Saratov", - "offset": -240 - }, - { - "name": "Europe/Simferopol", - "offset": -180 - }, - { - "name": "Europe/Ulyanovsk", - "offset": -240 - }, - { - "name": "Europe/Volgograd", - "offset": -240 - } - ] - }, - { - "country": "Rwanda", - "alpha2": "RW", - "alpha3": "RWA", - "numeric": "646", - "countryCode": "RWA", - "timezones": [ - { - "name": "Africa/Kigali", - "offset": -120 - }, - { - "name": "Africa/Maputo", - "offset": -120 - } - ] - }, - { - "country": "Saint Barthélemy", - "alpha2": "BL", - "alpha3": "BLM", - "numeric": "652", - "countryCode": "BLM", - "timezones": [ - { - "name": "America/Port_of_Spain", - "offset": 240 - }, - { - "name": "America/St_Barthelemy", - "offset": 240 - } - ] - }, - { - "country": "Saint Helena, Ascension and Tristan da Cunha", - "alpha2": "SH", - "alpha3": "SHN", - "numeric": "654", - "countryCode": "SHN", - "timezones": [ - { - "name": "Africa/Abidjan", - "offset": 0 - }, - { - "name": "Atlantic/St_Helena", - "offset": 0 - } - ] - }, - { - "country": "Saint Kitts and Nevis", - "alpha2": "KN", - "alpha3": "KNA", - "numeric": "659", - "countryCode": "KNA", - "timezones": [ - { - "name": "America/Port_of_Spain", - "offset": 240 - }, - { - "name": "America/St_Kitts", - "offset": 240 - } - ] - }, - { - "country": "Saint Lucia", - "alpha2": "LC", - "alpha3": "LCA", - "numeric": "662", - "countryCode": "LCA", - "timezones": [ - { - "name": "America/Port_of_Spain", - "offset": 240 - }, - { - "name": "America/St_Lucia", - "offset": 240 - } - ] - }, - { - "country": "Saint Martin", - "alpha2": "MF", - "alpha3": "MAF", - "numeric": "663", - "countryCode": "MAF", - "timezones": [ - { - "name": "America/Marigot", - "offset": 240 - }, - { - "name": "America/Port_of_Spain", - "offset": 240 - } - ] - }, - { - "country": "Saint Pierre and Miquelon", - "alpha2": "PM", - "alpha3": "SPM", - "numeric": "666", - "countryCode": "SPM", - "timezones": [ - { - "name": "America/Miquelon", - "offset": 120 - } - ] - }, - { - "country": "Saint Vincent and the Grenadines", - "alpha2": "VC", - "alpha3": "VCT", - "numeric": "670", - "countryCode": "VCT", - "timezones": [ - { - "name": "America/Port_of_Spain", - "offset": 240 - }, - { - "name": "America/St_Vincent", - "offset": 240 - } - ] - }, - { - "country": "Samoa", - "alpha2": "WS", - "alpha3": "WSM", - "numeric": "882", - "countryCode": "WSM", - "timezones": [ - { - "name": "Pacific/Apia", - "offset": -780 - } - ] - }, - { - "country": "San Marino", - "alpha2": "SM", - "alpha3": "SMR", - "numeric": "674", - "countryCode": "SMR", - "timezones": [ - { - "name": "Europe/Rome", - "offset": -120 - }, - { - "name": "Europe/San_Marino", - "offset": -120 - } - ] - }, - { - "country": "Sao Tome and Principe", - "alpha2": "ST", - "alpha3": "STP", - "numeric": "678", - "countryCode": "STP", - "timezones": [ - { - "name": "Africa/Sao_Tome", - "offset": 0 - } - ] - }, - { - "country": "Saudi Arabia", - "alpha2": "SA", - "alpha3": "SAU", - "numeric": "682", - "countryCode": "SAU", - "timezones": [ - { - "name": "Asia/Riyadh", - "offset": -180 - } - ] - }, - { - "country": "Senegal", - "alpha2": "SN", - "alpha3": "SEN", - "numeric": "686", - "countryCode": "SEN", - "timezones": [ - { - "name": "Africa/Abidjan", - "offset": 0 - }, - { - "name": "Africa/Dakar", - "offset": 0 - } - ] - }, - { - "country": "Serbia", - "alpha2": "RS", - "alpha3": "SRB", - "numeric": "688", - "countryCode": "SRB", - "timezones": [ - { - "name": "Europe/Belgrade", - "offset": -120 - } - ] - }, - { - "country": "Seychelles", - "alpha2": "SC", - "alpha3": "SYC", - "numeric": "690", - "countryCode": "SYC", - "timezones": [ - { - "name": "Indian/Mahe", - "offset": -240 - } - ] - }, - { - "country": "Sierra Leone", - "alpha2": "SL", - "alpha3": "SLE", - "numeric": "694", - "countryCode": "SLE", - "timezones": [ - { - "name": "Africa/Abidjan", - "offset": 0 - }, - { - "name": "Africa/Freetown", - "offset": 0 - } - ] - }, - { - "country": "Singapore", - "alpha2": "SG", - "alpha3": "SGP", - "numeric": "702", - "countryCode": "SGP", - "timezones": [ - { - "name": "Asia/Singapore", - "offset": -480 - } - ] - }, - { - "country": "Sint Maarten", - "alpha2": "SX", - "alpha3": "SXM", - "numeric": "534", - "countryCode": "SXM", - "timezones": [ - { - "name": "America/Curacao", - "offset": 240 - }, - { - "name": "America/Lower_Princes", - "offset": 240 - } - ] - }, - { - "country": "Slovakia", - "alpha2": "SK", - "alpha3": "SVK", - "numeric": "703", - "countryCode": "SVK", - "timezones": [ - { - "name": "Europe/Bratislava", - "offset": -120 - }, - { - "name": "Europe/Prague", - "offset": -120 - } - ] - }, - { - "country": "Slovenia", - "alpha2": "SI", - "alpha3": "SVN", - "numeric": "705", - "countryCode": "SVN", - "timezones": [ - { - "name": "Europe/Belgrade", - "offset": -120 - }, - { - "name": "Europe/Ljubljana", - "offset": -120 - } - ] - }, - { - "country": "Solomon Islands", - "alpha2": "SB", - "alpha3": "SLB", - "numeric": "090", - "countryCode": "SLB", - "timezones": [ - { - "name": "Pacific/Guadalcanal", - "offset": -660 - } - ] - }, - { - "country": "Somalia", - "alpha2": "SO", - "alpha3": "SOM", - "numeric": "706", - "countryCode": "SOM", - "timezones": [ - { - "name": "Africa/Mogadishu", - "offset": -180 - }, - { - "name": "Africa/Nairobi", - "offset": -180 - } - ] - }, - { - "country": "South Africa", - "alpha2": "ZA", - "alpha3": "ZAF", - "numeric": "710", - "countryCode": "ZAF", - "timezones": [ - { - "name": "Africa/Johannesburg", - "offset": -120 - } - ] - }, - { - "country": "South Georgia and the South Sandwich Islands", - "alpha2": "GS", - "alpha3": "SGS", - "numeric": "239", - "countryCode": "SGS", - "timezones": [ - { - "name": "Atlantic/South_Georgia", - "offset": 120 - } - ] - }, - { - "country": "South Sudan", - "alpha2": "SS", - "alpha3": "SSD", - "numeric": "728", - "countryCode": "SSD", - "timezones": [ - { - "name": "Africa/Juba", - "offset": -180 - } - ] - }, - { - "country": "Spain", - "alpha2": "ES", - "alpha3": "ESP", - "numeric": "724", - "countryCode": "ESP", - "timezones": [ - { - "name": "Africa/Ceuta", - "offset": -120 - }, - { - "name": "Atlantic/Canary", - "offset": -60 - }, - { - "name": "Europe/Madrid", - "offset": -120 - } - ] - }, - { - "country": "Sri Lanka", - "alpha2": "LK", - "alpha3": "LKA", - "numeric": "144", - "countryCode": "LKA", - "timezones": [ - { - "name": "Asia/Colombo", - "offset": -330 - } - ] - }, - { - "country": "Sudan", - "alpha2": "SD", - "alpha3": "SDN", - "numeric": "729", - "countryCode": "SDN", - "timezones": [ - { - "name": "Africa/Khartoum", - "offset": -120 - } - ] - }, - { - "country": "Suriname", - "alpha2": "SR", - "alpha3": "SUR", - "numeric": "740", - "countryCode": "SUR", - "timezones": [ - { - "name": "America/Paramaribo", - "offset": 180 - } - ] - }, - { - "country": "Svalbard and Jan Mayen", - "alpha2": "SJ", - "alpha3": "SJM", - "numeric": "744", - "countryCode": "SJM", - "timezones": [ - { - "name": "Arctic/Longyearbyen", - "offset": -120 - }, - { - "name": "Europe/Oslo", - "offset": -120 - } - ] - }, - { - "country": "Swaziland", - "alpha2": "SZ", - "alpha3": "SWZ", - "numeric": "748", - "countryCode": "SWZ", - "timezones": [ - { - "name": "Africa/Johannesburg", - "offset": -120 - }, - { - "name": "Africa/Mbabane", - "offset": -120 - } - ] - }, - { - "country": "Sweden", - "alpha2": "SE", - "alpha3": "SWE", - "numeric": "752", - "countryCode": "SWE", - "timezones": [ - { - "name": "Europe/Stockholm", - "offset": -120 - } - ] - }, - { - "country": "Switzerland", - "alpha2": "CH", - "alpha3": "CHE", - "numeric": "756", - "countryCode": "CHE", - "timezones": [ - { - "name": "Europe/Zurich", - "offset": -120 - } - ] - }, - { - "country": "Syrian Arab Republic", - "alpha2": "SY", - "alpha3": "SYR", - "numeric": "760", - "countryCode": "SYR", - "timezones": [ - { - "name": "Asia/Damascus", - "offset": -180 - } - ] - }, - { - "country": "Taiwan, Province of China", - "alpha2": "TW", - "alpha3": "TWN", - "numeric": "158", - "countryCode": "TWN", - "timezones": [ - { - "name": "Asia/Taipei", - "offset": -480 - } - ] - }, - { - "country": "Tajikistan", - "alpha2": "TJ", - "alpha3": "TJK", - "numeric": "762", - "countryCode": "TJK", - "timezones": [ - { - "name": "Asia/Dushanbe", - "offset": -300 - } - ] - }, - { - "country": "United Republic of Tanzania", - "alpha2": "TZ", - "alpha3": "TZA", - "numeric": "834", - "countryCode": "TZA", - "timezones": [ - { - "name": "Africa/Dar_es_Salaam", - "offset": -180 - }, - { - "name": "Africa/Nairobi", - "offset": -180 - } - ] - }, - { - "country": "Thailand", - "alpha2": "TH", - "alpha3": "THA", - "numeric": "764", - "countryCode": "THA", - "timezones": [ - { - "name": "Asia/Bangkok", - "offset": -420 - } - ] - }, - { - "country": "Timor-Leste", - "alpha2": "TL", - "alpha3": "TLS", - "numeric": "626", - "countryCode": "TLS", - "timezones": [ - { - "name": "Asia/Dili", - "offset": -540 - } - ] - }, - { - "country": "Togo", - "alpha2": "TG", - "alpha3": "TGO", - "numeric": "768", - "countryCode": "TGO", - "timezones": [ - { - "name": "Africa/Abidjan", - "offset": 0 - }, - { - "name": "Africa/Lome", - "offset": 0 - } - ] - }, - { - "country": "Tokelau", - "alpha2": "TK", - "alpha3": "TKL", - "numeric": "772", - "countryCode": "TKL", - "timezones": [ - { - "name": "Pacific/Fakaofo", - "offset": -780 - } - ] - }, - { - "country": "Tonga", - "alpha2": "TO", - "alpha3": "TON", - "numeric": "776", - "countryCode": "TON", - "timezones": [ - { - "name": "Pacific/Tongatapu", - "offset": -780 - } - ] - }, - { - "country": "Trinidad and Tobago", - "alpha2": "TT", - "alpha3": "TTO", - "numeric": "780", - "countryCode": "TTO", - "timezones": [ - { - "name": "America/Port_of_Spain", - "offset": 240 - } - ] - }, - { - "country": "Tunisia", - "alpha2": "TN", - "alpha3": "TUN", - "numeric": "788", - "countryCode": "TUN", - "timezones": [ - { - "name": "Africa/Tunis", - "offset": -60 - } - ] - }, - { - "country": "Turkey", - "alpha2": "TR", - "alpha3": "TUR", - "numeric": "792", - "countryCode": "TUR", - "timezones": [ - { - "name": "Europe/Istanbul", - "offset": -180 - } - ] - }, - { - "country": "Turkmenistan", - "alpha2": "TM", - "alpha3": "TKM", - "numeric": "795", - "countryCode": "TKM", - "timezones": [ - { - "name": "Asia/Ashgabat", - "offset": -300 - } - ] - }, - { - "country": "Turks and Caicos Islands", - "alpha2": "TC", - "alpha3": "TCA", - "numeric": "796", - "countryCode": "TCA", - "timezones": [ - { - "name": "America/Grand_Turk", - "offset": 240 - } - ] - }, - { - "country": "Tuvalu", - "alpha2": "TV", - "alpha3": "TUV", - "numeric": "798", - "countryCode": "TUV", - "timezones": [ - { - "name": "Pacific/Funafuti", - "offset": -720 - } - ] - }, - { - "country": "Uganda", - "alpha2": "UG", - "alpha3": "UGA", - "numeric": "800", - "countryCode": "UGA", - "timezones": [ - { - "name": "Africa/Kampala", - "offset": -180 - }, - { - "name": "Africa/Nairobi", - "offset": -180 - } - ] - }, - { - "country": "Ukraine", - "alpha2": "UA", - "alpha3": "UKR", - "numeric": "804", - "countryCode": "UKR", - "timezones": [ - { - "name": "Europe/Kiev", - "offset": -180 - }, - { - "name": "Europe/Simferopol", - "offset": -180 - }, - { - "name": "Europe/Uzhgorod", - "offset": -180 - }, - { - "name": "Europe/Zaporozhye", - "offset": -180 - } - ] - }, - { - "country": "United Arab Emirates", - "alpha2": "AE", - "alpha3": "ARE", - "numeric": "784", - "countryCode": "ARE", - "timezones": [ - { - "name": "Asia/Dubai", - "offset": -240 - } - ] - }, - { - "country": "United Kingdom of Great Britain and Northern Ireland", - "alpha2": "GB", - "alpha3": "GBR", - "numeric": "826", - "countryCode": "GBR", - "timezones": [ - { - "name": "Europe/London", - "offset": -60 - } - ] - }, - { - "country": "United States of America", - "alpha2": "US", - "alpha3": "USA", - "numeric": "840", - "countryCode": "USA", - "timezones": [ - { - "name": "America/Adak", - "offset": 540 - }, - { - "name": "America/Anchorage", - "offset": 480 - }, - { - "name": "America/Boise", - "offset": 360 - }, - { - "name": "America/Chicago", - "offset": 300 - }, - { - "name": "America/Denver", - "offset": 360 - }, - { - "name": "America/Detroit", - "offset": 240 - }, - { - "name": "America/Indiana/Indianapolis", - "offset": 240 - }, - { - "name": "America/Indiana/Knox", - "offset": 300 - }, - { - "name": "America/Indiana/Marengo", - "offset": 240 - }, - { - "name": "America/Indiana/Petersburg", - "offset": 240 - }, - { - "name": "America/Indiana/Tell_City", - "offset": 300 - }, - { - "name": "America/Indiana/Vevay", - "offset": 240 - }, - { - "name": "America/Indiana/Vincennes", - "offset": 240 - }, - { - "name": "America/Indiana/Winamac", - "offset": 240 - }, - { - "name": "America/Juneau", - "offset": 480 - }, - { - "name": "America/Kentucky/Louisville", - "offset": 240 - }, - { - "name": "America/Kentucky/Monticello", - "offset": 240 - }, - { - "name": "America/Los_Angeles", - "offset": 420 - }, - { - "name": "America/Menominee", - "offset": 300 - }, - { - "name": "America/Metlakatla", - "offset": 480 - }, - { - "name": "America/New_York", - "offset": 240 - }, - { - "name": "America/Nome", - "offset": 480 - }, - { - "name": "America/North_Dakota/Beulah", - "offset": 300 - }, - { - "name": "America/North_Dakota/Center", - "offset": 300 - }, - { - "name": "America/North_Dakota/New_Salem", - "offset": 300 - }, - { - "name": "America/Phoenix", - "offset": 420 - }, - { - "name": "America/Sitka", - "offset": 480 - }, - { - "name": "America/Yakutat", - "offset": 480 - }, - { - "name": "Pacific/Honolulu", - "offset": 600 - } - ] - }, - { - "country": "United States Minor Outlying Islands", - "alpha2": "UM", - "alpha3": "UMI", - "numeric": "581", - "countryCode": "UMI", - "timezones": [ - { - "name": "Pacific/Honolulu", - "offset": 600 - }, - { - "name": "Pacific/Midway", - "offset": 660 - }, - { - "name": "Pacific/Pago_Pago", - "offset": 660 - }, - { - "name": "Pacific/Wake", - "offset": -720 - } - ] - }, - { - "country": "Uruguay", - "alpha2": "UY", - "alpha3": "URY", - "numeric": "858", - "countryCode": "URY", - "timezones": [ - { - "name": "America/Montevideo", - "offset": 180 - } - ] - }, - { - "country": "Uzbekistan", - "alpha2": "UZ", - "alpha3": "UZB", - "numeric": "860", - "countryCode": "UZB", - "timezones": [ - { - "name": "Asia/Samarkand", - "offset": -300 - }, - { - "name": "Asia/Tashkent", - "offset": -300 - } - ] - }, - { - "country": "Vanuatu", - "alpha2": "VU", - "alpha3": "VUT", - "numeric": "548", - "countryCode": "VUT", - "timezones": [ - { - "name": "Pacific/Efate", - "offset": -660 - } - ] - }, - { - "country": "Venezuela (Bolivarian Republic of)", - "alpha2": "VE", - "alpha3": "VEN", - "numeric": "862", - "countryCode": "VEN", - "timezones": [ - { - "name": "America/Caracas", - "offset": 240 - } - ] - }, - { - "country": "Viet Nam", - "alpha2": "VN", - "alpha3": "VNM", - "numeric": "704", - "countryCode": "VNM", - "timezones": [ - { - "name": "Asia/Bangkok", - "offset": -420 - }, - { - "name": "Asia/Ho_Chi_Minh", - "offset": -420 - } - ] - }, - { - "country": "Virgin Islands", - "alpha2": "VG", - "alpha3": "VGB", - "numeric": "092", - "countryCode": "VGB", - "timezones": [ - { - "name": "America/Port_of_Spain", - "offset": 240 - }, - { - "name": "America/Tortola", - "offset": 240 - } - ] - }, - { - "country": "Virgin Islands of the United States", - "alpha2": "VI", - "alpha3": "VIR", - "numeric": "850", - "countryCode": "VIR", - "timezones": [ - { - "name": "America/Port_of_Spain", - "offset": 240 - }, - { - "name": "America/St_Thomas", - "offset": 240 - } - ] - }, - { - "country": "Wallis and Futuna", - "alpha2": "WF", - "alpha3": "WLF", - "numeric": "876", - "countryCode": "WLF", - "timezones": [ - { - "name": "Pacific/Wallis", - "offset": -720 - } - ] - }, - { - "country": "Western Sahara", - "alpha2": "EH", - "alpha3": "ESH", - "numeric": "732", - "countryCode": "ESH", - "timezones": [ - { - "name": "Africa/El_Aaiun", - "offset": -60 - } - ] - }, - { - "country": "Yemen", - "alpha2": "YE", - "alpha3": "YEM", - "numeric": "887", - "countryCode": "YEM", - "timezones": [ - { - "name": "Asia/Aden", - "offset": -180 - }, - { - "name": "Asia/Riyadh", - "offset": -180 - } - ] - }, - { - "country": "Zambia", - "alpha2": "ZM", - "alpha3": "ZMB", - "numeric": "894", - "countryCode": "ZMB", - "timezones": [ - { - "name": "Africa/Lusaka", - "offset": -120 - }, - { - "name": "Africa/Maputo", - "offset": -120 - } - ] - }, - { - "country": "Zimbabwe", - "alpha2": "ZW", - "alpha3": "ZWE", - "numeric": "716", - "countryCode": "ZWE", - "timezones": [ - { - "name": "Africa/Harare", - "offset": -120 - }, - { - "name": "Africa/Maputo", - "offset": -120 - } - ] - } -] \ No newline at end of file +import { CountryCodeNameDTO } from '../pods/countrycode/dto'; +export const countryCodesList: CountryCodeNameDTO[] = [ + { + country: 'Afghanistan', + alpha2: 'AF', + alpha3: 'AFG', + numeric: '004', + countryCode: 'AFG', + timezones: [ + { + name: 'Asia/Kabul', + offset: -270, + }, + ], + }, + { + country: 'Åland Islands', + alpha2: 'AX', + alpha3: 'ALA', + numeric: '248', + countryCode: 'ALA', + timezones: [ + { + name: 'Europe/Helsinki', + offset: -180, + }, + { + name: 'Europe/Mariehamn', + offset: -180, + }, + ], + }, + { + country: 'Albania', + alpha2: 'AL', + alpha3: 'ALB', + numeric: '008', + countryCode: 'ALB', + timezones: [ + { + name: 'Europe/Tirane', + offset: -120, + }, + ], + }, + { + country: 'Algeria', + alpha2: 'DZ', + alpha3: 'DZA', + numeric: '012', + countryCode: 'DZA', + timezones: [ + { + name: 'Africa/Algiers', + offset: -60, + }, + ], + }, + { + country: 'American Samoa', + alpha2: 'AS', + alpha3: 'ASM', + numeric: '016', + countryCode: 'ASM', + timezones: [ + { + name: 'Pacific/Pago_Pago', + offset: 660, + }, + ], + }, + { + country: 'Andorra', + alpha2: 'AD', + alpha3: 'AND', + numeric: '020', + countryCode: 'AND', + timezones: [ + { + name: 'Europe/Andorra', + offset: -120, + }, + ], + }, + { + country: 'Angola', + alpha2: 'AO', + alpha3: 'AGO', + numeric: '024', + countryCode: 'AGO', + timezones: [ + { + name: 'Africa/Lagos', + offset: -60, + }, + { + name: 'Africa/Luanda', + offset: -60, + }, + ], + }, + { + country: 'Anguilla', + alpha2: 'AI', + alpha3: 'AIA', + numeric: '660', + countryCode: 'AIA', + timezones: [ + { + name: 'America/Anguilla', + offset: 240, + }, + { + name: 'America/Port_of_Spain', + offset: 240, + }, + ], + }, + { + country: 'Antarctica', + alpha2: 'AQ', + alpha3: 'ATA', + numeric: '010', + countryCode: 'ATA', + timezones: [ + { + name: 'Antarctica/Casey', + offset: -480, + }, + { + name: 'Antarctica/Davis', + offset: -420, + }, + { + name: 'Antarctica/DumontDUrville', + offset: -600, + }, + { + name: 'Antarctica/Mawson', + offset: -300, + }, + { + name: 'Antarctica/McMurdo', + offset: -720, + }, + { + name: 'Antarctica/Palmer', + offset: 180, + }, + { + name: 'Antarctica/Rothera', + offset: 180, + }, + { + name: 'Antarctica/Syowa', + offset: -180, + }, + { + name: 'Antarctica/Troll', + offset: -120, + }, + { + name: 'Antarctica/Vostok', + offset: -360, + }, + { + name: 'Pacific/Auckland', + offset: -720, + }, + ], + }, + { + country: 'Antigua and Barbuda', + alpha2: 'AG', + alpha3: 'ATG', + numeric: '028', + countryCode: 'ATG', + timezones: [ + { + name: 'America/Antigua', + offset: 240, + }, + { + name: 'America/Port_of_Spain', + offset: 240, + }, + ], + }, + { + country: 'Argentina', + alpha2: 'AR', + alpha3: 'ARG', + numeric: '032', + countryCode: 'ARG', + timezones: [ + { + name: 'America/Argentina/Buenos_Aires', + offset: 180, + }, + { + name: 'America/Argentina/Catamarca', + offset: 180, + }, + { + name: 'America/Argentina/Cordoba', + offset: 180, + }, + { + name: 'America/Argentina/Jujuy', + offset: 180, + }, + { + name: 'America/Argentina/La_Rioja', + offset: 180, + }, + { + name: 'America/Argentina/Mendoza', + offset: 180, + }, + { + name: 'America/Argentina/Rio_Gallegos', + offset: 180, + }, + { + name: 'America/Argentina/Salta', + offset: 180, + }, + { + name: 'America/Argentina/San_Juan', + offset: 180, + }, + { + name: 'America/Argentina/San_Luis', + offset: 180, + }, + { + name: 'America/Argentina/Tucuman', + offset: 180, + }, + { + name: 'America/Argentina/Ushuaia', + offset: 180, + }, + ], + }, + { + country: 'Armenia', + alpha2: 'AM', + alpha3: 'ARM', + numeric: '051', + countryCode: 'ARM', + timezones: [ + { + name: 'Asia/Yerevan', + offset: -240, + }, + ], + }, + { + country: 'Aruba', + alpha2: 'AW', + alpha3: 'ABW', + numeric: '533', + countryCode: 'ABW', + timezones: [ + { + name: 'America/Aruba', + offset: 240, + }, + { + name: 'America/Curacao', + offset: 240, + }, + ], + }, + { + country: 'Australia', + alpha2: 'AU', + alpha3: 'AUS', + numeric: '036', + countryCode: 'AUS', + timezones: [ + { + name: 'Antarctica/Macquarie', + offset: -660, + }, + { + name: 'Australia/Adelaide', + offset: -570, + }, + { + name: 'Australia/Brisbane', + offset: -600, + }, + { + name: 'Australia/Broken_Hill', + offset: -570, + }, + { + name: 'Australia/Currie', + offset: -600, + }, + { + name: 'Australia/Darwin', + offset: -570, + }, + { + name: 'Australia/Eucla', + offset: -525, + }, + { + name: 'Australia/Hobart', + offset: -600, + }, + { + name: 'Australia/Lindeman', + offset: -600, + }, + { + name: 'Australia/Lord_Howe', + offset: -630, + }, + { + name: 'Australia/Melbourne', + offset: -600, + }, + { + name: 'Australia/Perth', + offset: -480, + }, + { + name: 'Australia/Sydney', + offset: -600, + }, + ], + }, + { + country: 'Austria', + alpha2: 'AT', + alpha3: 'AUT', + numeric: '040', + countryCode: 'AUT', + timezones: [ + { + name: 'Europe/Vienna', + offset: -120, + }, + ], + }, + { + country: 'Azerbaijan', + alpha2: 'AZ', + alpha3: 'AZE', + numeric: '031', + countryCode: 'AZE', + timezones: [ + { + name: 'Asia/Baku', + offset: -240, + }, + ], + }, + { + country: 'Bahamas', + alpha2: 'BS', + alpha3: 'BHS', + numeric: '044', + countryCode: 'BHS', + timezones: [ + { + name: 'America/Nassau', + offset: 240, + }, + ], + }, + { + country: 'Bahrain', + alpha2: 'BH', + alpha3: 'BHR', + numeric: '048', + countryCode: 'BHR', + timezones: [ + { + name: 'Asia/Bahrain', + offset: -180, + }, + { + name: 'Asia/Qatar', + offset: -180, + }, + ], + }, + { + country: 'Bangladesh', + alpha2: 'BD', + alpha3: 'BGD', + numeric: '050', + countryCode: 'BGD', + timezones: [ + { + name: 'Asia/Dhaka', + offset: -360, + }, + ], + }, + { + country: 'Barbados', + alpha2: 'BB', + alpha3: 'BRB', + numeric: '052', + countryCode: 'BRB', + timezones: [ + { + name: 'America/Barbados', + offset: 240, + }, + ], + }, + { + country: 'Belarus', + alpha2: 'BY', + alpha3: 'BLR', + numeric: '112', + countryCode: 'BLR', + timezones: [ + { + name: 'Europe/Minsk', + offset: -180, + }, + ], + }, + { + country: 'Belgium', + alpha2: 'BE', + alpha3: 'BEL', + numeric: '056', + countryCode: 'BEL', + timezones: [ + { + name: 'Europe/Brussels', + offset: -120, + }, + ], + }, + { + country: 'Belize', + alpha2: 'BZ', + alpha3: 'BLZ', + numeric: '084', + countryCode: 'BLZ', + timezones: [ + { + name: 'America/Belize', + offset: 360, + }, + ], + }, + { + country: 'Benin', + alpha2: 'BJ', + alpha3: 'BEN', + numeric: '204', + countryCode: 'BEN', + timezones: [ + { + name: 'Africa/Lagos', + offset: -60, + }, + { + name: 'Africa/Porto-Novo', + offset: -60, + }, + ], + }, + { + country: 'Bermuda', + alpha2: 'BM', + alpha3: 'BMU', + numeric: '060', + countryCode: 'BMU', + timezones: [ + { + name: 'Atlantic/Bermuda', + offset: 180, + }, + ], + }, + { + country: 'Bhutan', + alpha2: 'BT', + alpha3: 'BTN', + numeric: '064', + countryCode: 'BTN', + timezones: [ + { + name: 'Asia/Thimphu', + offset: -360, + }, + ], + }, + { + country: 'Bolivia', + alpha2: 'BO', + alpha3: 'BOL', + numeric: '068', + countryCode: 'BOL', + timezones: [ + { + name: 'America/La_Paz', + offset: 240, + }, + ], + }, + { + country: 'Bonaire, Sint Eustatius and Saba', + alpha2: 'BQ', + alpha3: 'BES', + numeric: '535', + countryCode: 'BES', + timezones: [ + { + name: 'America/Curacao', + offset: 240, + }, + { + name: 'America/Kralendijk', + offset: 240, + }, + ], + }, + { + country: 'Bosnia and Herzegovina', + alpha2: 'BA', + alpha3: 'BIH', + numeric: '070', + countryCode: 'BIH', + timezones: [ + { + name: 'Europe/Belgrade', + offset: -120, + }, + { + name: 'Europe/Sarajevo', + offset: -120, + }, + ], + }, + { + country: 'Botswana', + alpha2: 'BW', + alpha3: 'BWA', + numeric: '072', + countryCode: 'BWA', + timezones: [ + { + name: 'Africa/Gaborone', + offset: -120, + }, + { + name: 'Africa/Maputo', + offset: -120, + }, + ], + }, + { + country: 'Bouvet Island', + alpha2: 'BV', + alpha3: 'BVT', + numeric: '074', + countryCode: 'BVT', + timezones: [ + { + name: 'Antarctica/Macquarie', + offset: -660, + }, + ], + }, + { + country: 'Brazil', + alpha2: 'BR', + alpha3: 'BRA', + numeric: '076', + countryCode: 'BRA', + timezones: [ + { + name: 'America/Araguaina', + offset: 180, + }, + { + name: 'America/Bahia', + offset: 180, + }, + { + name: 'America/Belem', + offset: 180, + }, + { + name: 'America/Boa_Vista', + offset: 240, + }, + { + name: 'America/Campo_Grande', + offset: 240, + }, + { + name: 'America/Cuiaba', + offset: 240, + }, + { + name: 'America/Eirunepe', + offset: 300, + }, + { + name: 'America/Fortaleza', + offset: 180, + }, + { + name: 'America/Maceio', + offset: 180, + }, + { + name: 'America/Manaus', + offset: 240, + }, + { + name: 'America/Noronha', + offset: 120, + }, + { + name: 'America/Porto_Velho', + offset: 240, + }, + { + name: 'America/Recife', + offset: 180, + }, + { + name: 'America/Rio_Branco', + offset: 300, + }, + { + name: 'America/Santarem', + offset: 180, + }, + { + name: 'America/Sao_Paulo', + offset: 180, + }, + ], + }, + { + country: 'British Indian Ocean Territory', + alpha2: 'IO', + alpha3: 'IOT', + numeric: '086', + countryCode: 'IOT', + timezones: [ + { + name: 'Indian/Chagos', + offset: -360, + }, + ], + }, + { + country: 'Brunei Darussalam', + alpha2: 'BN', + alpha3: 'BRN', + numeric: '096', + countryCode: 'BRN', + timezones: [ + { + name: 'Asia/Brunei', + offset: -480, + }, + ], + }, + { + country: 'Bulgaria', + alpha2: 'BG', + alpha3: 'BGR', + numeric: '100', + countryCode: 'BGR', + timezones: [ + { + name: 'Europe/Sofia', + offset: -180, + }, + ], + }, + { + country: 'Burkina Faso', + alpha2: 'BF', + alpha3: 'BFA', + numeric: '854', + countryCode: 'BFA', + timezones: [ + { + name: 'Africa/Abidjan', + offset: 0, + }, + { + name: 'Africa/Ouagadougou', + offset: 0, + }, + ], + }, + { + country: 'Burundi', + alpha2: 'BI', + alpha3: 'BDI', + numeric: '108', + countryCode: 'BDI', + timezones: [ + { + name: 'Africa/Bujumbura', + offset: -120, + }, + { + name: 'Africa/Maputo', + offset: -120, + }, + ], + }, + { + country: 'Cabo Verde', + alpha2: 'CV', + alpha3: 'CPV', + numeric: '132', + countryCode: 'CPV', + timezones: [ + { + name: 'Atlantic/Cape_Verde', + offset: 60, + }, + ], + }, + { + country: 'Cambodia', + alpha2: 'KH', + alpha3: 'KHM', + numeric: '116', + countryCode: 'KHM', + timezones: [ + { + name: 'Asia/Bangkok', + offset: -420, + }, + { + name: 'Asia/Phnom_Penh', + offset: -420, + }, + ], + }, + { + country: 'Cameroon', + alpha2: 'CM', + alpha3: 'CMR', + numeric: '120', + countryCode: 'CMR', + timezones: [ + { + name: 'Africa/Douala', + offset: -60, + }, + { + name: 'Africa/Lagos', + offset: -60, + }, + ], + }, + { + country: 'Canada', + alpha2: 'CA', + alpha3: 'CAN', + numeric: '124', + countryCode: 'CAN', + timezones: [ + { + name: 'America/Atikokan', + offset: 300, + }, + { + name: 'America/Blanc-Sablon', + offset: 240, + }, + { + name: 'America/Cambridge_Bay', + offset: 360, + }, + { + name: 'America/Creston', + offset: 420, + }, + { + name: 'America/Dawson', + offset: 420, + }, + { + name: 'America/Dawson_Creek', + offset: 420, + }, + { + name: 'America/Edmonton', + offset: 360, + }, + { + name: 'America/Fort_Nelson', + offset: 420, + }, + { + name: 'America/Glace_Bay', + offset: 180, + }, + { + name: 'America/Goose_Bay', + offset: 180, + }, + { + name: 'America/Halifax', + offset: 180, + }, + { + name: 'America/Inuvik', + offset: 360, + }, + { + name: 'America/Iqaluit', + offset: 240, + }, + { + name: 'America/Moncton', + offset: 180, + }, + { + name: 'America/Nipigon', + offset: 240, + }, + { + name: 'America/Pangnirtung', + offset: 240, + }, + { + name: 'America/Rainy_River', + offset: 300, + }, + { + name: 'America/Rankin_Inlet', + offset: 300, + }, + { + name: 'America/Regina', + offset: 360, + }, + { + name: 'America/Resolute', + offset: 300, + }, + { + name: 'America/St_Johns', + offset: 150, + }, + { + name: 'America/Swift_Current', + offset: 360, + }, + { + name: 'America/Thunder_Bay', + offset: 240, + }, + { + name: 'America/Toronto', + offset: 240, + }, + { + name: 'America/Vancouver', + offset: 420, + }, + { + name: 'America/Whitehorse', + offset: 420, + }, + { + name: 'America/Winnipeg', + offset: 300, + }, + { + name: 'America/Yellowknife', + offset: 360, + }, + ], + }, + { + country: 'Cayman Islands', + alpha2: 'KY', + alpha3: 'CYM', + numeric: '136', + countryCode: 'CYM', + timezones: [ + { + name: 'America/Cayman', + offset: 300, + }, + { + name: 'America/Panama', + offset: 300, + }, + ], + }, + { + country: 'Central African Republic', + alpha2: 'CF', + alpha3: 'CAF', + numeric: '140', + countryCode: 'CAF', + timezones: [ + { + name: 'Africa/Bangui', + offset: -60, + }, + { + name: 'Africa/Lagos', + offset: -60, + }, + ], + }, + { + country: 'Chad', + alpha2: 'TD', + alpha3: 'TCD', + numeric: '148', + countryCode: 'TCD', + timezones: [ + { + name: 'Africa/Ndjamena', + offset: -60, + }, + ], + }, + { + country: 'Chile', + alpha2: 'CL', + alpha3: 'CHL', + numeric: '152', + countryCode: 'CHL', + timezones: [ + { + name: 'America/Punta_Arenas', + offset: 180, + }, + { + name: 'America/Santiago', + offset: 240, + }, + { + name: 'Pacific/Easter', + offset: 360, + }, + ], + }, + { + country: 'China', + alpha2: 'CN', + alpha3: 'CHN', + numeric: '156', + countryCode: 'CHN', + timezones: [ + { + name: 'Asia/Shanghai', + offset: -480, + }, + { + name: 'Asia/Urumqi', + offset: -360, + }, + ], + }, + { + country: 'Christmas Island', + alpha2: 'CX', + alpha3: 'CXR', + numeric: '162', + countryCode: 'CXR', + timezones: [ + { + name: 'Indian/Christmas', + offset: -420, + }, + ], + }, + { + country: 'Cocos Islands', + alpha2: 'CC', + alpha3: 'CCK', + numeric: '166', + countryCode: 'CCK', + timezones: [ + { + name: 'Indian/Cocos', + offset: -390, + }, + ], + }, + { + country: 'Colombia', + alpha2: 'CO', + alpha3: 'COL', + numeric: '170', + countryCode: 'COL', + timezones: [ + { + name: 'America/Bogota', + offset: 300, + }, + ], + }, + { + country: 'Comoros', + alpha2: 'KM', + alpha3: 'COM', + numeric: '174', + countryCode: 'COM', + timezones: [ + { + name: 'Africa/Nairobi', + offset: -180, + }, + { + name: 'Indian/Comoro', + offset: -180, + }, + ], + }, + { + country: 'Congo', + alpha2: 'CG', + alpha3: 'COG', + numeric: '178', + countryCode: 'COG', + timezones: [ + { + name: 'Africa/Brazzaville', + offset: -60, + }, + { + name: 'Africa/Lagos', + offset: -60, + }, + ], + }, + { + country: 'Congo', + alpha2: 'CD', + alpha3: 'COD', + numeric: '180', + countryCode: 'COD', + timezones: [ + { + name: 'Africa/Kinshasa', + offset: -60, + }, + { + name: 'Africa/Lagos', + offset: -60, + }, + { + name: 'Africa/Lubumbashi', + offset: -120, + }, + { + name: 'Africa/Maputo', + offset: -120, + }, + ], + }, + { + country: 'Cook Islands', + alpha2: 'CK', + alpha3: 'COK', + numeric: '184', + countryCode: 'COK', + timezones: [ + { + name: 'Pacific/Rarotonga', + offset: 600, + }, + ], + }, + { + country: 'Costa Rica', + alpha2: 'CR', + alpha3: 'CRI', + numeric: '188', + countryCode: 'CRI', + timezones: [ + { + name: 'America/Costa_Rica', + offset: 360, + }, + ], + }, + { + country: "Côte d'Ivoire", + alpha2: 'CI', + alpha3: 'CIV', + numeric: '384', + countryCode: 'CIV', + timezones: [ + { + name: 'Africa/Abidjan', + offset: 0, + }, + ], + }, + { + country: 'Croatia', + alpha2: 'HR', + alpha3: 'HRV', + numeric: '191', + countryCode: 'HRV', + timezones: [ + { + name: 'Europe/Belgrade', + offset: -120, + }, + { + name: 'Europe/Zagreb', + offset: -120, + }, + ], + }, + { + country: 'Cuba', + alpha2: 'CU', + alpha3: 'CUB', + numeric: '192', + countryCode: 'CUB', + timezones: [ + { + name: 'America/Havana', + offset: 240, + }, + ], + }, + { + country: 'Curaçao', + alpha2: 'CW', + alpha3: 'CUW', + numeric: '531', + countryCode: 'CUW', + timezones: [ + { + name: 'America/Curacao', + offset: 240, + }, + ], + }, + { + country: 'Cyprus', + alpha2: 'CY', + alpha3: 'CYP', + numeric: '196', + countryCode: 'CYP', + timezones: [ + { + name: 'Asia/Famagusta', + offset: -180, + }, + { + name: 'Asia/Nicosia', + offset: -180, + }, + ], + }, + { + country: 'Czech Republic', + alpha2: 'CZ', + alpha3: 'CZE', + numeric: '203', + countryCode: 'CZE', + timezones: [ + { + name: 'Europe/Prague', + offset: -120, + }, + ], + }, + { + country: 'Denmark', + alpha2: 'DK', + alpha3: 'DNK', + numeric: '208', + countryCode: 'DNK', + timezones: [ + { + name: 'Europe/Copenhagen', + offset: -120, + }, + ], + }, + { + country: 'Djibouti', + alpha2: 'DJ', + alpha3: 'DJI', + numeric: '262', + countryCode: 'DJI', + timezones: [ + { + name: 'Africa/Djibouti', + offset: -180, + }, + { + name: 'Africa/Nairobi', + offset: -180, + }, + ], + }, + { + country: 'Dominica', + alpha2: 'DM', + alpha3: 'DMA', + numeric: '212', + countryCode: 'DMA', + timezones: [ + { + name: 'America/Dominica', + offset: 240, + }, + { + name: 'America/Port_of_Spain', + offset: 240, + }, + ], + }, + { + country: 'Dominican Republic', + alpha2: 'DO', + alpha3: 'DOM', + numeric: '214', + countryCode: 'DOM', + timezones: [ + { + name: 'America/Santo_Domingo', + offset: 240, + }, + ], + }, + { + country: 'Ecuador', + alpha2: 'EC', + alpha3: 'ECU', + numeric: '218', + countryCode: 'ECU', + timezones: [ + { + name: 'America/Guayaquil', + offset: 300, + }, + { + name: 'Pacific/Galapagos', + offset: 360, + }, + ], + }, + { + country: 'Egypt', + alpha2: 'EG', + alpha3: 'EGY', + numeric: '818', + countryCode: 'EGY', + timezones: [ + { + name: 'Africa/Cairo', + offset: -120, + }, + ], + }, + { + country: 'El Salvador', + alpha2: 'SV', + alpha3: 'SLV', + numeric: '222', + countryCode: 'SLV', + timezones: [ + { + name: 'America/El_Salvador', + offset: 360, + }, + ], + }, + { + country: 'Equatorial Guinea', + alpha2: 'GQ', + alpha3: 'GNQ', + numeric: '226', + countryCode: 'GNQ', + timezones: [ + { + name: 'Africa/Lagos', + offset: -60, + }, + { + name: 'Africa/Malabo', + offset: -60, + }, + ], + }, + { + country: 'Eritrea', + alpha2: 'ER', + alpha3: 'ERI', + numeric: '232', + countryCode: 'ERI', + timezones: [ + { + name: 'Africa/Asmara', + offset: -180, + }, + { + name: 'Africa/Nairobi', + offset: -180, + }, + ], + }, + { + country: 'Estonia', + alpha2: 'EE', + alpha3: 'EST', + numeric: '233', + countryCode: 'EST', + timezones: [ + { + name: 'Europe/Tallinn', + offset: -180, + }, + ], + }, + { + country: 'Ethiopia', + alpha2: 'ET', + alpha3: 'ETH', + numeric: '231', + countryCode: 'ETH', + timezones: [ + { + name: 'Africa/Addis_Ababa', + offset: -180, + }, + { + name: 'Africa/Nairobi', + offset: -180, + }, + ], + }, + { + country: 'Falkland Islands', + alpha2: 'FK', + alpha3: 'FLK', + numeric: '238', + countryCode: 'FLK', + timezones: [ + { + name: 'Atlantic/Stanley', + offset: 180, + }, + ], + }, + { + country: 'Faroe Islands', + alpha2: 'FO', + alpha3: 'FRO', + numeric: '234', + countryCode: 'FRO', + timezones: [ + { + name: 'Atlantic/Faroe', + offset: -60, + }, + ], + }, + { + country: 'Fiji', + alpha2: 'FJ', + alpha3: 'FJI', + numeric: '242', + countryCode: 'FJI', + timezones: [ + { + name: 'Pacific/Fiji', + offset: -720, + }, + ], + }, + { + country: 'Finland', + alpha2: 'FI', + alpha3: 'FIN', + numeric: '246', + countryCode: 'FIN', + timezones: [ + { + name: 'Europe/Helsinki', + offset: -180, + }, + ], + }, + { + country: 'France', + alpha2: 'FR', + alpha3: 'FRA', + numeric: '250', + countryCode: 'FRA', + timezones: [ + { + name: 'Europe/Paris', + offset: -120, + }, + ], + }, + { + country: 'French Guiana', + alpha2: 'GF', + alpha3: 'GUF', + numeric: '254', + countryCode: 'GUF', + timezones: [ + { + name: 'America/Cayenne', + offset: 180, + }, + ], + }, + { + country: 'French Polynesia', + alpha2: 'PF', + alpha3: 'PYF', + numeric: '258', + countryCode: 'PYF', + timezones: [ + { + name: 'Pacific/Gambier', + offset: 540, + }, + { + name: 'Pacific/Marquesas', + offset: 570, + }, + { + name: 'Pacific/Tahiti', + offset: 600, + }, + ], + }, + { + country: 'French Southern Territories', + alpha2: 'TF', + alpha3: 'ATF', + numeric: '260', + countryCode: 'ATF', + timezones: [ + { + name: 'Indian/Kerguelen', + offset: -300, + }, + { + name: 'Indian/Reunion', + offset: -240, + }, + ], + }, + { + country: 'Gabon', + alpha2: 'GA', + alpha3: 'GAB', + numeric: '266', + countryCode: 'GAB', + timezones: [ + { + name: 'Africa/Lagos', + offset: -60, + }, + { + name: 'Africa/Libreville', + offset: -60, + }, + ], + }, + { + country: 'Gambia', + alpha2: 'GM', + alpha3: 'GMB', + numeric: '270', + countryCode: 'GMB', + timezones: [ + { + name: 'Africa/Abidjan', + offset: 0, + }, + { + name: 'Africa/Banjul', + offset: 0, + }, + ], + }, + { + country: 'Georgia', + alpha2: 'GE', + alpha3: 'GEO', + numeric: '268', + countryCode: 'GEO', + timezones: [ + { + name: 'Asia/Tbilisi', + offset: -240, + }, + ], + }, + { + country: 'Germany', + alpha2: 'DE', + alpha3: 'DEU', + numeric: '276', + countryCode: 'DEU', + timezones: [ + { + name: 'Europe/Berlin', + offset: -120, + }, + { + name: 'Europe/Busingen', + offset: -120, + }, + { + name: 'Europe/Zurich', + offset: -120, + }, + ], + }, + { + country: 'Ghana', + alpha2: 'GH', + alpha3: 'GHA', + numeric: '288', + countryCode: 'GHA', + timezones: [ + { + name: 'Africa/Accra', + offset: 0, + }, + ], + }, + { + country: 'Gibraltar', + alpha2: 'GI', + alpha3: 'GIB', + numeric: '292', + countryCode: 'GIB', + timezones: [ + { + name: 'Europe/Gibraltar', + offset: -120, + }, + ], + }, + { + country: 'Greece', + alpha2: 'GR', + alpha3: 'GRC', + numeric: '300', + countryCode: 'GRC', + timezones: [ + { + name: 'Europe/Athens', + offset: -180, + }, + ], + }, + { + country: 'Greenland', + alpha2: 'GL', + alpha3: 'GRL', + numeric: '304', + countryCode: 'GRL', + timezones: [ + { + name: 'America/Danmarkshavn', + offset: 0, + }, + { + name: 'America/Godthab', + offset: 120, + }, + { + name: 'America/Scoresbysund', + offset: 0, + }, + { + name: 'America/Thule', + offset: 180, + }, + ], + }, + { + country: 'Grenada', + alpha2: 'GD', + alpha3: 'GRD', + numeric: '308', + countryCode: 'GRD', + timezones: [ + { + name: 'America/Grenada', + offset: 240, + }, + { + name: 'America/Port_of_Spain', + offset: 240, + }, + ], + }, + { + country: 'Guadeloupe', + alpha2: 'GP', + alpha3: 'GLP', + numeric: '312', + countryCode: 'GLP', + timezones: [ + { + name: 'America/Guadeloupe', + offset: 240, + }, + { + name: 'America/Port_of_Spain', + offset: 240, + }, + ], + }, + { + country: 'Guam', + alpha2: 'GU', + alpha3: 'GUM', + numeric: '316', + countryCode: 'GUM', + timezones: [ + { + name: 'Pacific/Guam', + offset: -600, + }, + ], + }, + { + country: 'Guatemala', + alpha2: 'GT', + alpha3: 'GTM', + numeric: '320', + countryCode: 'GTM', + timezones: [ + { + name: 'America/Guatemala', + offset: 360, + }, + ], + }, + { + country: 'Guernsey', + alpha2: 'GG', + alpha3: 'GGY', + numeric: '831', + countryCode: 'GGY', + timezones: [ + { + name: 'Europe/Guernsey', + offset: -60, + }, + { + name: 'Europe/London', + offset: -60, + }, + ], + }, + { + country: 'Guinea', + alpha2: 'GN', + alpha3: 'GIN', + numeric: '324', + countryCode: 'GIN', + timezones: [ + { + name: 'Africa/Abidjan', + offset: 0, + }, + { + name: 'Africa/Conakry', + offset: 0, + }, + ], + }, + { + country: 'Guinea-Bissau', + alpha2: 'GW', + alpha3: 'GNB', + numeric: '624', + countryCode: 'GNB', + timezones: [ + { + name: 'Africa/Bissau', + offset: 0, + }, + ], + }, + { + country: 'Guyana', + alpha2: 'GY', + alpha3: 'GUY', + numeric: '328', + countryCode: 'GUY', + timezones: [ + { + name: 'America/Guyana', + offset: 240, + }, + ], + }, + { + country: 'Haiti', + alpha2: 'HT', + alpha3: 'HTI', + numeric: '332', + countryCode: 'HTI', + timezones: [ + { + name: 'America/Port-au-Prince', + offset: 240, + }, + ], + }, + { + country: 'Heard Island and McDonald Islands', + alpha2: 'HM', + alpha3: 'HMD', + numeric: '334', + countryCode: 'HMD', + timezones: [ + { + name: 'Africa/Johannesburg', + offset: -120, + }, + ], + }, + { + country: 'Holy See', + alpha2: 'VA', + alpha3: 'VAT', + numeric: '336', + countryCode: 'VAT', + timezones: [ + { + name: 'Europe/Rome', + offset: -120, + }, + { + name: 'Europe/Vatican', + offset: -120, + }, + ], + }, + { + country: 'Honduras', + alpha2: 'HN', + alpha3: 'HND', + numeric: '340', + countryCode: 'HND', + timezones: [ + { + name: 'America/Tegucigalpa', + offset: 360, + }, + ], + }, + { + country: 'Hong Kong', + alpha2: 'HK', + alpha3: 'HKG', + numeric: '344', + countryCode: 'HKG', + timezones: [ + { + name: 'Asia/Hong_Kong', + offset: -480, + }, + ], + }, + { + country: 'Hungary', + alpha2: 'HU', + alpha3: 'HUN', + numeric: '348', + countryCode: 'HUN', + timezones: [ + { + name: 'Europe/Budapest', + offset: -120, + }, + ], + }, + { + country: 'Iceland', + alpha2: 'IS', + alpha3: 'ISL', + numeric: '352', + countryCode: 'ISL', + timezones: [ + { + name: 'Atlantic/Reykjavik', + offset: 0, + }, + ], + }, + { + country: 'India', + alpha2: 'IN', + alpha3: 'IND', + numeric: '356', + countryCode: 'IND', + timezones: [ + { + name: 'Asia/Kolkata', + offset: -330, + }, + { + name: 'Asia/Calcutta', + offset: -330, + }, + ], + }, + { + country: 'Indonesia', + alpha2: 'ID', + alpha3: 'IDN', + numeric: '360', + countryCode: 'IDN', + timezones: [ + { + name: 'Asia/Jakarta', + offset: -420, + }, + { + name: 'Asia/Jayapura', + offset: -540, + }, + { + name: 'Asia/Makassar', + offset: -480, + }, + { + name: 'Asia/Pontianak', + offset: -420, + }, + ], + }, + { + country: 'Islamic Republic of Iran', + alpha2: 'IR', + alpha3: 'IRN', + numeric: '364', + countryCode: 'IRN', + timezones: [ + { + name: 'Asia/Tehran', + offset: -270, + }, + ], + }, + { + country: 'Iraq', + alpha2: 'IQ', + alpha3: 'IRQ', + numeric: '368', + countryCode: 'IRQ', + timezones: [ + { + name: 'Asia/Baghdad', + offset: -180, + }, + ], + }, + { + country: 'Ireland', + alpha2: 'IE', + alpha3: 'IRL', + numeric: '372', + countryCode: 'IRL', + timezones: [ + { + name: 'Europe/Dublin', + offset: -60, + }, + ], + }, + { + country: 'Isle of Man', + alpha2: 'IM', + alpha3: 'IMN', + numeric: '833', + countryCode: 'IMN', + timezones: [ + { + name: 'Europe/Isle_of_Man', + offset: -60, + }, + { + name: 'Europe/London', + offset: -60, + }, + ], + }, + { + country: 'Israel', + alpha2: 'IL', + alpha3: 'ISR', + numeric: '376', + countryCode: 'ISR', + timezones: [ + { + name: 'Asia/Jerusalem', + offset: -180, + }, + ], + }, + { + country: 'Italy', + alpha2: 'IT', + alpha3: 'ITA', + numeric: '380', + countryCode: 'ITA', + timezones: [ + { + name: 'Europe/Rome', + offset: -120, + }, + ], + }, + { + country: 'Jamaica', + alpha2: 'JM', + alpha3: 'JAM', + numeric: '388', + countryCode: 'JAM', + timezones: [ + { + name: 'America/Jamaica', + offset: 300, + }, + ], + }, + { + country: 'Japan', + alpha2: 'JP', + alpha3: 'JPN', + numeric: '392', + countryCode: 'JPN', + timezones: [ + { + name: 'Asia/Tokyo', + offset: -540, + }, + ], + }, + { + country: 'Jersey', + alpha2: 'JE', + alpha3: 'JEY', + numeric: '832', + countryCode: 'JEY', + timezones: [ + { + name: 'Europe/Jersey', + offset: -60, + }, + { + name: 'Europe/London', + offset: -60, + }, + ], + }, + { + country: 'Jordan', + alpha2: 'JO', + alpha3: 'JOR', + numeric: '400', + countryCode: 'JOR', + timezones: [ + { + name: 'Asia/Amman', + offset: -180, + }, + ], + }, + { + country: 'Kazakhstan', + alpha2: 'KZ', + alpha3: 'KAZ', + numeric: '398', + countryCode: 'KAZ', + timezones: [ + { + name: 'Asia/Almaty', + offset: -360, + }, + { + name: 'Asia/Aqtau', + offset: -300, + }, + { + name: 'Asia/Aqtobe', + offset: -300, + }, + { + name: 'Asia/Atyrau', + offset: -300, + }, + { + name: 'Asia/Oral', + offset: -300, + }, + { + name: 'Asia/Qostanay', + offset: -360, + }, + { + name: 'Asia/Qyzylorda', + offset: -300, + }, + ], + }, + { + country: 'Kenya', + alpha2: 'KE', + alpha3: 'KEN', + numeric: '404', + countryCode: 'KEN', + timezones: [ + { + name: 'Africa/Nairobi', + offset: -180, + }, + ], + }, + { + country: 'Kiribati', + alpha2: 'KI', + alpha3: 'KIR', + numeric: '296', + countryCode: 'KIR', + timezones: [ + { + name: 'Pacific/Enderbury', + offset: -780, + }, + { + name: 'Pacific/Kiritimati', + offset: -840, + }, + { + name: 'Pacific/Tarawa', + offset: -720, + }, + ], + }, + { + country: "Democratic People's Republic of Korea", + alpha2: 'KP', + alpha3: 'PRK', + numeric: '408', + countryCode: 'PRK', + timezones: [ + { + name: 'Asia/Pyongyang', + offset: -540, + }, + ], + }, + { + country: 'Republic of Korea', + alpha2: 'KR', + alpha3: 'KOR', + numeric: '410', + countryCode: 'KOR', + timezones: [ + { + name: 'Asia/Seoul', + offset: -540, + }, + ], + }, + { + country: 'Kuwait', + alpha2: 'KW', + alpha3: 'KWT', + numeric: '414', + countryCode: 'KWT', + timezones: [ + { + name: 'Asia/Kuwait', + offset: -180, + }, + { + name: 'Asia/Riyadh', + offset: -180, + }, + ], + }, + { + country: 'Kyrgyzstan', + alpha2: 'KG', + alpha3: 'KGZ', + numeric: '417', + countryCode: 'KGZ', + timezones: [ + { + name: 'Asia/Bishkek', + offset: -360, + }, + ], + }, + { + country: "Lao People's Democratic Republic", + alpha2: 'LA', + alpha3: 'LAO', + numeric: '418', + countryCode: 'LAO', + timezones: [ + { + name: 'Asia/Bangkok', + offset: -420, + }, + { + name: 'Asia/Vientiane', + offset: -420, + }, + ], + }, + { + country: 'Latvia', + alpha2: 'LV', + alpha3: 'LVA', + numeric: '428', + countryCode: 'LVA', + timezones: [ + { + name: 'Europe/Riga', + offset: -180, + }, + ], + }, + { + country: 'Lebanon', + alpha2: 'LB', + alpha3: 'LBN', + numeric: '422', + countryCode: 'LBN', + timezones: [ + { + name: 'Asia/Beirut', + offset: -180, + }, + ], + }, + { + country: 'Lesotho', + alpha2: 'LS', + alpha3: 'LSO', + numeric: '426', + countryCode: 'LSO', + timezones: [ + { + name: 'Africa/Johannesburg', + offset: -120, + }, + { + name: 'Africa/Maseru', + offset: -120, + }, + ], + }, + { + country: 'Liberia', + alpha2: 'LR', + alpha3: 'LBR', + numeric: '430', + countryCode: 'LBR', + timezones: [ + { + name: 'Africa/Monrovia', + offset: 0, + }, + ], + }, + { + country: 'Libya', + alpha2: 'LY', + alpha3: 'LBY', + numeric: '434', + countryCode: 'LBY', + timezones: [ + { + name: 'Africa/Tripoli', + offset: -120, + }, + ], + }, + { + country: 'Liechtenstein', + alpha2: 'LI', + alpha3: 'LIE', + numeric: '438', + countryCode: 'LIE', + timezones: [ + { + name: 'Europe/Vaduz', + offset: -120, + }, + { + name: 'Europe/Zurich', + offset: -120, + }, + ], + }, + { + country: 'Lithuania', + alpha2: 'LT', + alpha3: 'LTU', + numeric: '440', + countryCode: 'LTU', + timezones: [ + { + name: 'Europe/Vilnius', + offset: -180, + }, + ], + }, + { + country: 'Luxembourg', + alpha2: 'LU', + alpha3: 'LUX', + numeric: '442', + countryCode: 'LUX', + timezones: [ + { + name: 'Europe/Luxembourg', + offset: -120, + }, + ], + }, + { + country: 'Macao', + alpha2: 'MO', + alpha3: 'MAC', + numeric: '446', + countryCode: 'MAC', + timezones: [ + { + name: 'Asia/Macau', + offset: -480, + }, + ], + }, + { + country: 'Macedonia', + alpha2: 'MK', + alpha3: 'MKD', + numeric: '807', + countryCode: 'MKD', + timezones: [ + { + name: 'Europe/Belgrade', + offset: -120, + }, + { + name: 'Europe/Skopje', + offset: -120, + }, + ], + }, + { + country: 'Madagascar', + alpha2: 'MG', + alpha3: 'MDG', + numeric: '450', + countryCode: 'MDG', + timezones: [ + { + name: 'Africa/Nairobi', + offset: -180, + }, + { + name: 'Indian/Antananarivo', + offset: -180, + }, + ], + }, + { + country: 'Malawi', + alpha2: 'MW', + alpha3: 'MWI', + numeric: '454', + countryCode: 'MWI', + timezones: [ + { + name: 'Africa/Blantyre', + offset: -120, + }, + { + name: 'Africa/Maputo', + offset: -120, + }, + ], + }, + { + country: 'Malaysia', + alpha2: 'MY', + alpha3: 'MYS', + numeric: '458', + countryCode: 'MYS', + timezones: [ + { + name: 'Asia/Kuala_Lumpur', + offset: -480, + }, + { + name: 'Asia/Kuching', + offset: -480, + }, + ], + }, + { + country: 'Maldives', + alpha2: 'MV', + alpha3: 'MDV', + numeric: '462', + countryCode: 'MDV', + timezones: [ + { + name: 'Indian/Maldives', + offset: -300, + }, + ], + }, + { + country: 'Mali', + alpha2: 'ML', + alpha3: 'MLI', + numeric: '466', + countryCode: 'MLI', + timezones: [ + { + name: 'Africa/Abidjan', + offset: 0, + }, + { + name: 'Africa/Bamako', + offset: 0, + }, + ], + }, + { + country: 'Malta', + alpha2: 'MT', + alpha3: 'MLT', + numeric: '470', + countryCode: 'MLT', + timezones: [ + { + name: 'Europe/Malta', + offset: -120, + }, + ], + }, + { + country: 'Marshall Islands', + alpha2: 'MH', + alpha3: 'MHL', + numeric: '584', + countryCode: 'MHL', + timezones: [ + { + name: 'Pacific/Kwajalein', + offset: -720, + }, + { + name: 'Pacific/Majuro', + offset: -720, + }, + ], + }, + { + country: 'Martinique', + alpha2: 'MQ', + alpha3: 'MTQ', + numeric: '474', + countryCode: 'MTQ', + timezones: [ + { + name: 'America/Martinique', + offset: 240, + }, + ], + }, + { + country: 'Mauritania', + alpha2: 'MR', + alpha3: 'MRT', + numeric: '478', + countryCode: 'MRT', + timezones: [ + { + name: 'Africa/Abidjan', + offset: 0, + }, + { + name: 'Africa/Nouakchott', + offset: 0, + }, + ], + }, + { + country: 'Mauritius', + alpha2: 'MU', + alpha3: 'MUS', + numeric: '480', + countryCode: 'MUS', + timezones: [ + { + name: 'Indian/Mauritius', + offset: -240, + }, + ], + }, + { + country: 'Mayotte', + alpha2: 'YT', + alpha3: 'MYT', + numeric: '175', + countryCode: 'MYT', + timezones: [ + { + name: 'Africa/Nairobi', + offset: -180, + }, + { + name: 'Indian/Mayotte', + offset: -180, + }, + ], + }, + { + country: 'Mexico', + alpha2: 'MX', + alpha3: 'MEX', + numeric: '484', + countryCode: 'MEX', + timezones: [ + { + name: 'America/Bahia_Banderas', + offset: 300, + }, + { + name: 'America/Cancun', + offset: 300, + }, + { + name: 'America/Chihuahua', + offset: 360, + }, + { + name: 'America/Hermosillo', + offset: 420, + }, + { + name: 'America/Matamoros', + offset: 300, + }, + { + name: 'America/Mazatlan', + offset: 360, + }, + { + name: 'America/Merida', + offset: 300, + }, + { + name: 'America/Mexico_City', + offset: 300, + }, + { + name: 'America/Monterrey', + offset: 300, + }, + { + name: 'America/Ojinaga', + offset: 360, + }, + { + name: 'America/Tijuana', + offset: 420, + }, + ], + }, + { + country: 'Federated States of Micronesia', + alpha2: 'FM', + alpha3: 'FSM', + numeric: '583', + countryCode: 'FSM', + timezones: [ + { + name: 'Pacific/Chuuk', + offset: -600, + }, + { + name: 'Pacific/Kosrae', + offset: -660, + }, + { + name: 'Pacific/Pohnpei', + offset: -660, + }, + ], + }, + { + country: 'Republic of Moldova', + alpha2: 'MD', + alpha3: 'MDA', + numeric: '498', + countryCode: 'MDA', + timezones: [ + { + name: 'Europe/Chisinau', + offset: -180, + }, + ], + }, + { + country: 'Monaco', + alpha2: 'MC', + alpha3: 'MCO', + numeric: '492', + countryCode: 'MCO', + timezones: [ + { + name: 'Europe/Monaco', + offset: -120, + }, + ], + }, + { + country: 'Mongolia', + alpha2: 'MN', + alpha3: 'MNG', + numeric: '496', + countryCode: 'MNG', + timezones: [ + { + name: 'Asia/Choibalsan', + offset: -480, + }, + { + name: 'Asia/Hovd', + offset: -420, + }, + { + name: 'Asia/Ulaanbaatar', + offset: -480, + }, + ], + }, + { + country: 'Montenegro', + alpha2: 'ME', + alpha3: 'MNE', + numeric: '499', + countryCode: 'MNE', + timezones: [ + { + name: 'Europe/Belgrade', + offset: -120, + }, + { + name: 'Europe/Podgorica', + offset: -120, + }, + ], + }, + { + country: 'Montserrat', + alpha2: 'MS', + alpha3: 'MSR', + numeric: '500', + countryCode: 'MSR', + timezones: [ + { + name: 'America/Montserrat', + offset: 240, + }, + { + name: 'America/Port_of_Spain', + offset: 240, + }, + ], + }, + { + country: 'Morocco', + alpha2: 'MA', + alpha3: 'MAR', + numeric: '504', + countryCode: 'MAR', + timezones: [ + { + name: 'Africa/Casablanca', + offset: -60, + }, + ], + }, + { + country: 'Mozambique', + alpha2: 'MZ', + alpha3: 'MOZ', + numeric: '508', + countryCode: 'MOZ', + timezones: [ + { + name: 'Africa/Maputo', + offset: -120, + }, + ], + }, + { + country: 'Myanmar', + alpha2: 'MM', + alpha3: 'MMR', + numeric: '104', + countryCode: 'MMR', + timezones: [ + { + name: 'Asia/Yangon', + offset: -390, + }, + ], + }, + { + country: 'Namibia', + alpha2: 'NA', + alpha3: 'NAM', + numeric: '516', + countryCode: 'NAM', + timezones: [ + { + name: 'Africa/Windhoek', + offset: -120, + }, + ], + }, + { + country: 'Nauru', + alpha2: 'NR', + alpha3: 'NRU', + numeric: '520', + countryCode: 'NRU', + timezones: [ + { + name: 'Pacific/Nauru', + offset: -720, + }, + ], + }, + { + country: 'Nepal', + alpha2: 'NP', + alpha3: 'NPL', + numeric: '524', + countryCode: 'NPL', + timezones: [ + { + name: 'Asia/Kathmandu', + offset: -345, + }, + ], + }, + { + country: 'Netherlands', + alpha2: 'NL', + alpha3: 'NLD', + numeric: '528', + countryCode: 'NLD', + timezones: [ + { + name: 'Europe/Amsterdam', + offset: -120, + }, + ], + }, + { + country: 'New Caledonia', + alpha2: 'NC', + alpha3: 'NCL', + numeric: '540', + countryCode: 'NCL', + timezones: [ + { + name: 'Pacific/Noumea', + offset: -660, + }, + ], + }, + { + country: 'New Zealand', + alpha2: 'NZ', + alpha3: 'NZL', + numeric: '554', + countryCode: 'NZL', + timezones: [ + { + name: 'Pacific/Auckland', + offset: -720, + }, + { + name: 'Pacific/Chatham', + offset: -765, + }, + ], + }, + { + country: 'Nicaragua', + alpha2: 'NI', + alpha3: 'NIC', + numeric: '558', + countryCode: 'NIC', + timezones: [ + { + name: 'America/Managua', + offset: 360, + }, + ], + }, + { + country: 'Niger', + alpha2: 'NE', + alpha3: 'NER', + numeric: '562', + countryCode: 'NER', + timezones: [ + { + name: 'Africa/Lagos', + offset: -60, + }, + { + name: 'Africa/Niamey', + offset: -60, + }, + ], + }, + { + country: 'Nigeria', + alpha2: 'NG', + alpha3: 'NGA', + numeric: '566', + countryCode: 'NGA', + timezones: [ + { + name: 'Africa/Lagos', + offset: -60, + }, + ], + }, + { + country: 'Niue', + alpha2: 'NU', + alpha3: 'NIU', + numeric: '570', + countryCode: 'NIU', + timezones: [ + { + name: 'Pacific/Niue', + offset: 660, + }, + ], + }, + { + country: 'Norfolk Island', + alpha2: 'NF', + alpha3: 'NFK', + numeric: '574', + countryCode: 'NFK', + timezones: [ + { + name: 'Pacific/Norfolk', + offset: -660, + }, + ], + }, + { + country: 'Northern Mariana Islands', + alpha2: 'MP', + alpha3: 'MNP', + numeric: '580', + countryCode: 'MNP', + timezones: [ + { + name: 'Pacific/Guam', + offset: -600, + }, + { + name: 'Pacific/Saipan', + offset: -600, + }, + ], + }, + { + country: 'Norway', + alpha2: 'NO', + alpha3: 'NOR', + numeric: '578', + countryCode: 'NOR', + timezones: [ + { + name: 'Europe/Oslo', + offset: -120, + }, + ], + }, + { + country: 'Oman', + alpha2: 'OM', + alpha3: 'OMN', + numeric: '512', + countryCode: 'OMN', + timezones: [ + { + name: 'Asia/Dubai', + offset: -240, + }, + { + name: 'Asia/Muscat', + offset: -240, + }, + ], + }, + { + country: 'Pakistan', + alpha2: 'PK', + alpha3: 'PAK', + numeric: '586', + countryCode: 'PAK', + timezones: [ + { + name: 'Asia/Karachi', + offset: -300, + }, + ], + }, + { + country: 'Palau', + alpha2: 'PW', + alpha3: 'PLW', + numeric: '585', + countryCode: 'PLW', + timezones: [ + { + name: 'Pacific/Palau', + offset: -540, + }, + ], + }, + { + country: 'State of Palestine', + alpha2: 'PS', + alpha3: 'PSE', + numeric: '275', + countryCode: 'PSE', + timezones: [ + { + name: 'Asia/Gaza', + offset: -180, + }, + { + name: 'Asia/Hebron', + offset: -180, + }, + ], + }, + { + country: 'Panama', + alpha2: 'PA', + alpha3: 'PAN', + numeric: '591', + countryCode: 'PAN', + timezones: [ + { + name: 'America/Panama', + offset: 300, + }, + ], + }, + { + country: 'Papua New Guinea', + alpha2: 'PG', + alpha3: 'PNG', + numeric: '598', + countryCode: 'PNG', + timezones: [ + { + name: 'Pacific/Bougainville', + offset: -660, + }, + { + name: 'Pacific/Port_Moresby', + offset: -600, + }, + ], + }, + { + country: 'Paraguay', + alpha2: 'PY', + alpha3: 'PRY', + numeric: '600', + countryCode: 'PRY', + timezones: [ + { + name: 'America/Asuncion', + offset: 240, + }, + ], + }, + { + country: 'Peru', + alpha2: 'PE', + alpha3: 'PER', + numeric: '604', + countryCode: 'PER', + timezones: [ + { + name: 'America/Lima', + offset: 300, + }, + ], + }, + { + country: 'Philippines', + alpha2: 'PH', + alpha3: 'PHL', + numeric: '608', + countryCode: 'PHL', + timezones: [ + { + name: 'Asia/Manila', + offset: -480, + }, + ], + }, + { + country: 'Pitcairn', + alpha2: 'PN', + alpha3: 'PCN', + numeric: '612', + countryCode: 'PCN', + timezones: [ + { + name: 'Pacific/Pitcairn', + offset: 480, + }, + ], + }, + { + country: 'Poland', + alpha2: 'PL', + alpha3: 'POL', + numeric: '616', + countryCode: 'POL', + timezones: [ + { + name: 'Europe/Warsaw', + offset: -120, + }, + ], + }, + { + country: 'Portugal', + alpha2: 'PT', + alpha3: 'PRT', + numeric: '620', + countryCode: 'PRT', + timezones: [ + { + name: 'Atlantic/Azores', + offset: 0, + }, + { + name: 'Atlantic/Madeira', + offset: -60, + }, + { + name: 'Europe/Lisbon', + offset: -60, + }, + ], + }, + { + country: 'Puerto Rico', + alpha2: 'PR', + alpha3: 'PRI', + numeric: '630', + countryCode: 'PRI', + timezones: [ + { + name: 'America/Puerto_Rico', + offset: 240, + }, + ], + }, + { + country: 'Qatar', + alpha2: 'QA', + alpha3: 'QAT', + numeric: '634', + countryCode: 'QAT', + timezones: [ + { + name: 'Asia/Qatar', + offset: -180, + }, + ], + }, + { + country: 'Réunion', + alpha2: 'RE', + alpha3: 'REU', + numeric: '638', + countryCode: 'REU', + timezones: [ + { + name: 'Indian/Reunion', + offset: -240, + }, + ], + }, + { + country: 'Romania', + alpha2: 'RO', + alpha3: 'ROU', + numeric: '642', + countryCode: 'ROU', + timezones: [ + { + name: 'Europe/Bucharest', + offset: -180, + }, + ], + }, + { + country: 'Russian Federation', + alpha2: 'RU', + alpha3: 'RUS', + numeric: '643', + countryCode: 'RUS', + timezones: [ + { + name: 'Asia/Anadyr', + offset: -720, + }, + { + name: 'Asia/Barnaul', + offset: -420, + }, + { + name: 'Asia/Chita', + offset: -540, + }, + { + name: 'Asia/Irkutsk', + offset: -480, + }, + { + name: 'Asia/Kamchatka', + offset: -720, + }, + { + name: 'Asia/Khandyga', + offset: -540, + }, + { + name: 'Asia/Krasnoyarsk', + offset: -420, + }, + { + name: 'Asia/Magadan', + offset: -660, + }, + { + name: 'Asia/Novokuznetsk', + offset: -420, + }, + { + name: 'Asia/Novosibirsk', + offset: -420, + }, + { + name: 'Asia/Omsk', + offset: -360, + }, + { + name: 'Asia/Sakhalin', + offset: -660, + }, + { + name: 'Asia/Srednekolymsk', + offset: -660, + }, + { + name: 'Asia/Tomsk', + offset: -420, + }, + { + name: 'Asia/Ust-Nera', + offset: -600, + }, + { + name: 'Asia/Vladivostok', + offset: -600, + }, + { + name: 'Asia/Yakutsk', + offset: -540, + }, + { + name: 'Asia/Yekaterinburg', + offset: -300, + }, + { + name: 'Europe/Astrakhan', + offset: -240, + }, + { + name: 'Europe/Kaliningrad', + offset: -120, + }, + { + name: 'Europe/Kirov', + offset: -180, + }, + { + name: 'Europe/Moscow', + offset: -180, + }, + { + name: 'Europe/Samara', + offset: -240, + }, + { + name: 'Europe/Saratov', + offset: -240, + }, + { + name: 'Europe/Simferopol', + offset: -180, + }, + { + name: 'Europe/Ulyanovsk', + offset: -240, + }, + { + name: 'Europe/Volgograd', + offset: -240, + }, + ], + }, + { + country: 'Rwanda', + alpha2: 'RW', + alpha3: 'RWA', + numeric: '646', + countryCode: 'RWA', + timezones: [ + { + name: 'Africa/Kigali', + offset: -120, + }, + { + name: 'Africa/Maputo', + offset: -120, + }, + ], + }, + { + country: 'Saint Barthélemy', + alpha2: 'BL', + alpha3: 'BLM', + numeric: '652', + countryCode: 'BLM', + timezones: [ + { + name: 'America/Port_of_Spain', + offset: 240, + }, + { + name: 'America/St_Barthelemy', + offset: 240, + }, + ], + }, + { + country: 'Saint Helena, Ascension and Tristan da Cunha', + alpha2: 'SH', + alpha3: 'SHN', + numeric: '654', + countryCode: 'SHN', + timezones: [ + { + name: 'Africa/Abidjan', + offset: 0, + }, + { + name: 'Atlantic/St_Helena', + offset: 0, + }, + ], + }, + { + country: 'Saint Kitts and Nevis', + alpha2: 'KN', + alpha3: 'KNA', + numeric: '659', + countryCode: 'KNA', + timezones: [ + { + name: 'America/Port_of_Spain', + offset: 240, + }, + { + name: 'America/St_Kitts', + offset: 240, + }, + ], + }, + { + country: 'Saint Lucia', + alpha2: 'LC', + alpha3: 'LCA', + numeric: '662', + countryCode: 'LCA', + timezones: [ + { + name: 'America/Port_of_Spain', + offset: 240, + }, + { + name: 'America/St_Lucia', + offset: 240, + }, + ], + }, + { + country: 'Saint Martin', + alpha2: 'MF', + alpha3: 'MAF', + numeric: '663', + countryCode: 'MAF', + timezones: [ + { + name: 'America/Marigot', + offset: 240, + }, + { + name: 'America/Port_of_Spain', + offset: 240, + }, + ], + }, + { + country: 'Saint Pierre and Miquelon', + alpha2: 'PM', + alpha3: 'SPM', + numeric: '666', + countryCode: 'SPM', + timezones: [ + { + name: 'America/Miquelon', + offset: 120, + }, + ], + }, + { + country: 'Saint Vincent and the Grenadines', + alpha2: 'VC', + alpha3: 'VCT', + numeric: '670', + countryCode: 'VCT', + timezones: [ + { + name: 'America/Port_of_Spain', + offset: 240, + }, + { + name: 'America/St_Vincent', + offset: 240, + }, + ], + }, + { + country: 'Samoa', + alpha2: 'WS', + alpha3: 'WSM', + numeric: '882', + countryCode: 'WSM', + timezones: [ + { + name: 'Pacific/Apia', + offset: -780, + }, + ], + }, + { + country: 'San Marino', + alpha2: 'SM', + alpha3: 'SMR', + numeric: '674', + countryCode: 'SMR', + timezones: [ + { + name: 'Europe/Rome', + offset: -120, + }, + { + name: 'Europe/San_Marino', + offset: -120, + }, + ], + }, + { + country: 'Sao Tome and Principe', + alpha2: 'ST', + alpha3: 'STP', + numeric: '678', + countryCode: 'STP', + timezones: [ + { + name: 'Africa/Sao_Tome', + offset: 0, + }, + ], + }, + { + country: 'Saudi Arabia', + alpha2: 'SA', + alpha3: 'SAU', + numeric: '682', + countryCode: 'SAU', + timezones: [ + { + name: 'Asia/Riyadh', + offset: -180, + }, + ], + }, + { + country: 'Senegal', + alpha2: 'SN', + alpha3: 'SEN', + numeric: '686', + countryCode: 'SEN', + timezones: [ + { + name: 'Africa/Abidjan', + offset: 0, + }, + { + name: 'Africa/Dakar', + offset: 0, + }, + ], + }, + { + country: 'Serbia', + alpha2: 'RS', + alpha3: 'SRB', + numeric: '688', + countryCode: 'SRB', + timezones: [ + { + name: 'Europe/Belgrade', + offset: -120, + }, + ], + }, + { + country: 'Seychelles', + alpha2: 'SC', + alpha3: 'SYC', + numeric: '690', + countryCode: 'SYC', + timezones: [ + { + name: 'Indian/Mahe', + offset: -240, + }, + ], + }, + { + country: 'Sierra Leone', + alpha2: 'SL', + alpha3: 'SLE', + numeric: '694', + countryCode: 'SLE', + timezones: [ + { + name: 'Africa/Abidjan', + offset: 0, + }, + { + name: 'Africa/Freetown', + offset: 0, + }, + ], + }, + { + country: 'Singapore', + alpha2: 'SG', + alpha3: 'SGP', + numeric: '702', + countryCode: 'SGP', + timezones: [ + { + name: 'Asia/Singapore', + offset: -480, + }, + ], + }, + { + country: 'Sint Maarten', + alpha2: 'SX', + alpha3: 'SXM', + numeric: '534', + countryCode: 'SXM', + timezones: [ + { + name: 'America/Curacao', + offset: 240, + }, + { + name: 'America/Lower_Princes', + offset: 240, + }, + ], + }, + { + country: 'Slovakia', + alpha2: 'SK', + alpha3: 'SVK', + numeric: '703', + countryCode: 'SVK', + timezones: [ + { + name: 'Europe/Bratislava', + offset: -120, + }, + { + name: 'Europe/Prague', + offset: -120, + }, + ], + }, + { + country: 'Slovenia', + alpha2: 'SI', + alpha3: 'SVN', + numeric: '705', + countryCode: 'SVN', + timezones: [ + { + name: 'Europe/Belgrade', + offset: -120, + }, + { + name: 'Europe/Ljubljana', + offset: -120, + }, + ], + }, + { + country: 'Solomon Islands', + alpha2: 'SB', + alpha3: 'SLB', + numeric: '090', + countryCode: 'SLB', + timezones: [ + { + name: 'Pacific/Guadalcanal', + offset: -660, + }, + ], + }, + { + country: 'Somalia', + alpha2: 'SO', + alpha3: 'SOM', + numeric: '706', + countryCode: 'SOM', + timezones: [ + { + name: 'Africa/Mogadishu', + offset: -180, + }, + { + name: 'Africa/Nairobi', + offset: -180, + }, + ], + }, + { + country: 'South Africa', + alpha2: 'ZA', + alpha3: 'ZAF', + numeric: '710', + countryCode: 'ZAF', + timezones: [ + { + name: 'Africa/Johannesburg', + offset: -120, + }, + ], + }, + { + country: 'South Georgia and the South Sandwich Islands', + alpha2: 'GS', + alpha3: 'SGS', + numeric: '239', + countryCode: 'SGS', + timezones: [ + { + name: 'Atlantic/South_Georgia', + offset: 120, + }, + ], + }, + { + country: 'South Sudan', + alpha2: 'SS', + alpha3: 'SSD', + numeric: '728', + countryCode: 'SSD', + timezones: [ + { + name: 'Africa/Juba', + offset: -180, + }, + ], + }, + { + country: 'Spain', + alpha2: 'ES', + alpha3: 'ESP', + numeric: '724', + countryCode: 'ESP', + timezones: [ + { + name: 'Africa/Ceuta', + offset: -120, + }, + { + name: 'Atlantic/Canary', + offset: -60, + }, + { + name: 'Europe/Madrid', + offset: -120, + }, + ], + }, + { + country: 'Sri Lanka', + alpha2: 'LK', + alpha3: 'LKA', + numeric: '144', + countryCode: 'LKA', + timezones: [ + { + name: 'Asia/Colombo', + offset: -330, + }, + ], + }, + { + country: 'Sudan', + alpha2: 'SD', + alpha3: 'SDN', + numeric: '729', + countryCode: 'SDN', + timezones: [ + { + name: 'Africa/Khartoum', + offset: -120, + }, + ], + }, + { + country: 'Suriname', + alpha2: 'SR', + alpha3: 'SUR', + numeric: '740', + countryCode: 'SUR', + timezones: [ + { + name: 'America/Paramaribo', + offset: 180, + }, + ], + }, + { + country: 'Svalbard and Jan Mayen', + alpha2: 'SJ', + alpha3: 'SJM', + numeric: '744', + countryCode: 'SJM', + timezones: [ + { + name: 'Arctic/Longyearbyen', + offset: -120, + }, + { + name: 'Europe/Oslo', + offset: -120, + }, + ], + }, + { + country: 'Swaziland', + alpha2: 'SZ', + alpha3: 'SWZ', + numeric: '748', + countryCode: 'SWZ', + timezones: [ + { + name: 'Africa/Johannesburg', + offset: -120, + }, + { + name: 'Africa/Mbabane', + offset: -120, + }, + ], + }, + { + country: 'Sweden', + alpha2: 'SE', + alpha3: 'SWE', + numeric: '752', + countryCode: 'SWE', + timezones: [ + { + name: 'Europe/Stockholm', + offset: -120, + }, + ], + }, + { + country: 'Switzerland', + alpha2: 'CH', + alpha3: 'CHE', + numeric: '756', + countryCode: 'CHE', + timezones: [ + { + name: 'Europe/Zurich', + offset: -120, + }, + ], + }, + { + country: 'Syrian Arab Republic', + alpha2: 'SY', + alpha3: 'SYR', + numeric: '760', + countryCode: 'SYR', + timezones: [ + { + name: 'Asia/Damascus', + offset: -180, + }, + ], + }, + { + country: 'Taiwan, Province of China', + alpha2: 'TW', + alpha3: 'TWN', + numeric: '158', + countryCode: 'TWN', + timezones: [ + { + name: 'Asia/Taipei', + offset: -480, + }, + ], + }, + { + country: 'Tajikistan', + alpha2: 'TJ', + alpha3: 'TJK', + numeric: '762', + countryCode: 'TJK', + timezones: [ + { + name: 'Asia/Dushanbe', + offset: -300, + }, + ], + }, + { + country: 'United Republic of Tanzania', + alpha2: 'TZ', + alpha3: 'TZA', + numeric: '834', + countryCode: 'TZA', + timezones: [ + { + name: 'Africa/Dar_es_Salaam', + offset: -180, + }, + { + name: 'Africa/Nairobi', + offset: -180, + }, + ], + }, + { + country: 'Thailand', + alpha2: 'TH', + alpha3: 'THA', + numeric: '764', + countryCode: 'THA', + timezones: [ + { + name: 'Asia/Bangkok', + offset: -420, + }, + ], + }, + { + country: 'Timor-Leste', + alpha2: 'TL', + alpha3: 'TLS', + numeric: '626', + countryCode: 'TLS', + timezones: [ + { + name: 'Asia/Dili', + offset: -540, + }, + ], + }, + { + country: 'Togo', + alpha2: 'TG', + alpha3: 'TGO', + numeric: '768', + countryCode: 'TGO', + timezones: [ + { + name: 'Africa/Abidjan', + offset: 0, + }, + { + name: 'Africa/Lome', + offset: 0, + }, + ], + }, + { + country: 'Tokelau', + alpha2: 'TK', + alpha3: 'TKL', + numeric: '772', + countryCode: 'TKL', + timezones: [ + { + name: 'Pacific/Fakaofo', + offset: -780, + }, + ], + }, + { + country: 'Tonga', + alpha2: 'TO', + alpha3: 'TON', + numeric: '776', + countryCode: 'TON', + timezones: [ + { + name: 'Pacific/Tongatapu', + offset: -780, + }, + ], + }, + { + country: 'Trinidad and Tobago', + alpha2: 'TT', + alpha3: 'TTO', + numeric: '780', + countryCode: 'TTO', + timezones: [ + { + name: 'America/Port_of_Spain', + offset: 240, + }, + ], + }, + { + country: 'Tunisia', + alpha2: 'TN', + alpha3: 'TUN', + numeric: '788', + countryCode: 'TUN', + timezones: [ + { + name: 'Africa/Tunis', + offset: -60, + }, + ], + }, + { + country: 'Turkey', + alpha2: 'TR', + alpha3: 'TUR', + numeric: '792', + countryCode: 'TUR', + timezones: [ + { + name: 'Europe/Istanbul', + offset: -180, + }, + ], + }, + { + country: 'Turkmenistan', + alpha2: 'TM', + alpha3: 'TKM', + numeric: '795', + countryCode: 'TKM', + timezones: [ + { + name: 'Asia/Ashgabat', + offset: -300, + }, + ], + }, + { + country: 'Turks and Caicos Islands', + alpha2: 'TC', + alpha3: 'TCA', + numeric: '796', + countryCode: 'TCA', + timezones: [ + { + name: 'America/Grand_Turk', + offset: 240, + }, + ], + }, + { + country: 'Tuvalu', + alpha2: 'TV', + alpha3: 'TUV', + numeric: '798', + countryCode: 'TUV', + timezones: [ + { + name: 'Pacific/Funafuti', + offset: -720, + }, + ], + }, + { + country: 'Uganda', + alpha2: 'UG', + alpha3: 'UGA', + numeric: '800', + countryCode: 'UGA', + timezones: [ + { + name: 'Africa/Kampala', + offset: -180, + }, + { + name: 'Africa/Nairobi', + offset: -180, + }, + ], + }, + { + country: 'Ukraine', + alpha2: 'UA', + alpha3: 'UKR', + numeric: '804', + countryCode: 'UKR', + timezones: [ + { + name: 'Europe/Kiev', + offset: -180, + }, + { + name: 'Europe/Simferopol', + offset: -180, + }, + { + name: 'Europe/Uzhgorod', + offset: -180, + }, + { + name: 'Europe/Zaporozhye', + offset: -180, + }, + ], + }, + { + country: 'United Arab Emirates', + alpha2: 'AE', + alpha3: 'ARE', + numeric: '784', + countryCode: 'ARE', + timezones: [ + { + name: 'Asia/Dubai', + offset: -240, + }, + ], + }, + { + country: 'United Kingdom of Great Britain and Northern Ireland', + alpha2: 'GB', + alpha3: 'GBR', + numeric: '826', + countryCode: 'GBR', + timezones: [ + { + name: 'Europe/London', + offset: -60, + }, + ], + }, + { + country: 'United States of America', + alpha2: 'US', + alpha3: 'USA', + numeric: '840', + countryCode: 'USA', + timezones: [ + { + name: 'America/Adak', + offset: 540, + }, + { + name: 'America/Anchorage', + offset: 480, + }, + { + name: 'America/Boise', + offset: 360, + }, + { + name: 'America/Chicago', + offset: 300, + }, + { + name: 'America/Denver', + offset: 360, + }, + { + name: 'America/Detroit', + offset: 240, + }, + { + name: 'America/Indiana/Indianapolis', + offset: 240, + }, + { + name: 'America/Indiana/Knox', + offset: 300, + }, + { + name: 'America/Indiana/Marengo', + offset: 240, + }, + { + name: 'America/Indiana/Petersburg', + offset: 240, + }, + { + name: 'America/Indiana/Tell_City', + offset: 300, + }, + { + name: 'America/Indiana/Vevay', + offset: 240, + }, + { + name: 'America/Indiana/Vincennes', + offset: 240, + }, + { + name: 'America/Indiana/Winamac', + offset: 240, + }, + { + name: 'America/Juneau', + offset: 480, + }, + { + name: 'America/Kentucky/Louisville', + offset: 240, + }, + { + name: 'America/Kentucky/Monticello', + offset: 240, + }, + { + name: 'America/Los_Angeles', + offset: 420, + }, + { + name: 'America/Menominee', + offset: 300, + }, + { + name: 'America/Metlakatla', + offset: 480, + }, + { + name: 'America/New_York', + offset: 240, + }, + { + name: 'America/Nome', + offset: 480, + }, + { + name: 'America/North_Dakota/Beulah', + offset: 300, + }, + { + name: 'America/North_Dakota/Center', + offset: 300, + }, + { + name: 'America/North_Dakota/New_Salem', + offset: 300, + }, + { + name: 'America/Phoenix', + offset: 420, + }, + { + name: 'America/Sitka', + offset: 480, + }, + { + name: 'America/Yakutat', + offset: 480, + }, + { + name: 'Pacific/Honolulu', + offset: 600, + }, + ], + }, + { + country: 'United States Minor Outlying Islands', + alpha2: 'UM', + alpha3: 'UMI', + numeric: '581', + countryCode: 'UMI', + timezones: [ + { + name: 'Pacific/Honolulu', + offset: 600, + }, + { + name: 'Pacific/Midway', + offset: 660, + }, + { + name: 'Pacific/Pago_Pago', + offset: 660, + }, + { + name: 'Pacific/Wake', + offset: -720, + }, + ], + }, + { + country: 'Uruguay', + alpha2: 'UY', + alpha3: 'URY', + numeric: '858', + countryCode: 'URY', + timezones: [ + { + name: 'America/Montevideo', + offset: 180, + }, + ], + }, + { + country: 'Uzbekistan', + alpha2: 'UZ', + alpha3: 'UZB', + numeric: '860', + countryCode: 'UZB', + timezones: [ + { + name: 'Asia/Samarkand', + offset: -300, + }, + { + name: 'Asia/Tashkent', + offset: -300, + }, + ], + }, + { + country: 'Vanuatu', + alpha2: 'VU', + alpha3: 'VUT', + numeric: '548', + countryCode: 'VUT', + timezones: [ + { + name: 'Pacific/Efate', + offset: -660, + }, + ], + }, + { + country: 'Venezuela (Bolivarian Republic of)', + alpha2: 'VE', + alpha3: 'VEN', + numeric: '862', + countryCode: 'VEN', + timezones: [ + { + name: 'America/Caracas', + offset: 240, + }, + ], + }, + { + country: 'Viet Nam', + alpha2: 'VN', + alpha3: 'VNM', + numeric: '704', + countryCode: 'VNM', + timezones: [ + { + name: 'Asia/Bangkok', + offset: -420, + }, + { + name: 'Asia/Ho_Chi_Minh', + offset: -420, + }, + ], + }, + { + country: 'Virgin Islands', + alpha2: 'VG', + alpha3: 'VGB', + numeric: '092', + countryCode: 'VGB', + timezones: [ + { + name: 'America/Port_of_Spain', + offset: 240, + }, + { + name: 'America/Tortola', + offset: 240, + }, + ], + }, + { + country: 'Virgin Islands of the United States', + alpha2: 'VI', + alpha3: 'VIR', + numeric: '850', + countryCode: 'VIR', + timezones: [ + { + name: 'America/Port_of_Spain', + offset: 240, + }, + { + name: 'America/St_Thomas', + offset: 240, + }, + ], + }, + { + country: 'Wallis and Futuna', + alpha2: 'WF', + alpha3: 'WLF', + numeric: '876', + countryCode: 'WLF', + timezones: [ + { + name: 'Pacific/Wallis', + offset: -720, + }, + ], + }, + { + country: 'Western Sahara', + alpha2: 'EH', + alpha3: 'ESH', + numeric: '732', + countryCode: 'ESH', + timezones: [ + { + name: 'Africa/El_Aaiun', + offset: -60, + }, + ], + }, + { + country: 'Yemen', + alpha2: 'YE', + alpha3: 'YEM', + numeric: '887', + countryCode: 'YEM', + timezones: [ + { + name: 'Asia/Aden', + offset: -180, + }, + { + name: 'Asia/Riyadh', + offset: -180, + }, + ], + }, + { + country: 'Zambia', + alpha2: 'ZM', + alpha3: 'ZMB', + numeric: '894', + countryCode: 'ZMB', + timezones: [ + { + name: 'Africa/Lusaka', + offset: -120, + }, + { + name: 'Africa/Maputo', + offset: -120, + }, + ], + }, + { + country: 'Zimbabwe', + alpha2: 'ZW', + alpha3: 'ZWE', + numeric: '716', + countryCode: 'ZWE', + timezones: [ + { + name: 'Africa/Harare', + offset: -120, + }, + { + name: 'Africa/Maputo', + offset: -120, + }, + ], + }, +]; diff --git a/apps/drec-api/src/on-application-bootsrap-hook.service.ts b/apps/drec-api/src/on-application-bootsrap-hook.service.ts index 594112dbd..5f150e99d 100755 --- a/apps/drec-api/src/on-application-bootsrap-hook.service.ts +++ b/apps/drec-api/src/on-application-bootsrap-hook.service.ts @@ -1,30 +1,34 @@ import { DeploymentPropertiesRepository } from '@energyweb/origin-247-certificate/dist/js/src/onchain-certificate/repositories/deploymentProperties/deploymentProperties.repository'; +import { Inject, Injectable, OnApplicationBootstrap } from '@nestjs/common'; import { - Inject, - Injectable, - OnApplicationBootstrap, -} from '@nestjs/common'; -import { BlockchainProperties, BlockchainPropertiesService } from '@energyweb/issuer-api'; + BlockchainProperties, + BlockchainPropertiesService, +} from '@energyweb/issuer-api'; import { ModuleRef } from '@nestjs/core'; @Injectable() -export class OnApplicationBootstrapHookService implements OnApplicationBootstrap { - public deploymentRepository: DeploymentPropertiesRepository=null; - constructor( - private moduleRef: ModuleRef, - public blockchainPropertiesService: BlockchainPropertiesService - ) { } +export class OnApplicationBootstrapHookService + implements OnApplicationBootstrap +{ + public deploymentRepository: DeploymentPropertiesRepository = null; + constructor( + private moduleRef: ModuleRef, + public blockchainPropertiesService: BlockchainPropertiesService, + ) {} - async onApplicationBootstrap() { - this.deploymentRepository = this.moduleRef.get(DeploymentPropertiesRepository as any, { strict: false }) as DeploymentPropertiesRepository; - const isDeployed = await this.deploymentRepository.propertiesExist(); - if (!isDeployed) { - let blockchainProperties: BlockchainProperties = await this.blockchainPropertiesService.get(); - await this.deploymentRepository.save({ - registry: blockchainProperties.registry, - issuer: blockchainProperties.issuer, - }); - - } + async onApplicationBootstrap() { + this.deploymentRepository = this.moduleRef.get( + DeploymentPropertiesRepository as any, + { strict: false }, + ) as DeploymentPropertiesRepository; + const isDeployed = await this.deploymentRepository.propertiesExist(); + if (!isDeployed) { + let blockchainProperties: BlockchainProperties = + await this.blockchainPropertiesService.get(); + await this.deploymentRepository.save({ + registry: blockchainProperties.registry, + issuer: blockchainProperties.issuer, + }); } -} \ No newline at end of file + } +} diff --git a/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.controller.ts b/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.controller.ts index 800d9f735..dba2bf117 100755 --- a/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.controller.ts +++ b/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.controller.ts @@ -1,101 +1,107 @@ import { - Controller, - Get, - Post, - Body, - Put, - Param, - ParseIntPipe, - HttpStatus, - UseGuards, - Logger, + Controller, + Get, + Post, + Body, + Put, + Param, + ParseIntPipe, + HttpStatus, + UseGuards, + Logger, } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; import { - ApiBearerAuth, - ApiResponse, - ApiBody, - ApiTags, - ApiSecurity, + ApiBearerAuth, + ApiResponse, + ApiBody, + ApiTags, + ApiSecurity, } from '@nestjs/swagger'; import { Role } from '../../utils/enums'; -import { AccessControlLayerModuleServiceService } from './access-control-layer-module-service.service' -import { ACLModuleDTO, NewACLModuleDTO, UpdateACLModuleDTO } from './dto/aclmodule.dto' +import { AccessControlLayerModuleServiceService } from './access-control-layer-module-service.service'; +import { + ACLModuleDTO, + NewACLModuleDTO, + UpdateACLModuleDTO, +} from './dto/aclmodule.dto'; import { Roles } from '../user/decorators/roles.decorator'; import { RolesGuard } from '../../guards/RolesGuard'; /* -* It is Controller of ACL Module with the endpoints of ACL module operations. -*/ + * It is Controller of ACL Module with the endpoints of ACL module operations. + */ @ApiTags('aclmoduleservices') @ApiBearerAuth('access-token') @ApiSecurity('drec') @Controller('access-control-layer-module-service') export class AccessControlLayerModuleServiceController { + private readonly logger = new Logger( + AccessControlLayerModuleServiceController.name, + ); - private readonly logger = new Logger(AccessControlLayerModuleServiceController.name); - - constructor(private readonly ModulesService: AccessControlLayerModuleServiceService) { } - - /* - * This is Get Api to list all the Acl modules. - * @return {Array | null}. - * It returns array of ACLModuleDto when there is the list of all ACLModules - * in response of query and returns null when there is no list of ACLModules or empty. - * */ - @Get() - @UseGuards(AuthGuard('jwt'), RolesGuard) + constructor( + private readonly ModulesService: AccessControlLayerModuleServiceService, + ) {} - //@Roles(Role.Admin) - @ApiResponse({ - status: HttpStatus.OK, - type: [ACLModuleDTO], - description: 'ACL Module list', - }) - async getAll(): Promise { - this.logger.verbose(`With in getAll`); - return this.ModulesService.getAll(); - } + /* + * This is Get Api to list all the Acl modules. + * @return {Array | null}. + * It returns array of ACLModuleDto when there is the list of all ACLModules + * in response of query and returns null when there is no list of ACLModules or empty. + * */ + @Get() + @UseGuards(AuthGuard('jwt'), RolesGuard) - /* - * It is POST api to create an ACL Module. - * @return {ACLModuleDto} when create api is successfull. - */ - @Post() - @UseGuards(AuthGuard('jwt'), RolesGuard) - @Roles(Role.Admin) - @ApiResponse({ - status: HttpStatus.CREATED, - type: ACLModuleDTO, - description: 'Add a Module', - }) - public async register( - @Body() moduleData: NewACLModuleDTO, - ): Promise { - this.logger.verbose(`With in create`); - return this.ModulesService.create(moduleData); - } + //@Roles(Role.Admin) + @ApiResponse({ + status: HttpStatus.OK, + type: [ACLModuleDTO], + description: 'ACL Module list', + }) + async getAll(): Promise { + this.logger.verbose(`With in getAll`); + return this.ModulesService.getAll(); + } - /* - * This is PUT api to update a module permissions or status - * @return {ACLModuleDto} when the update is successfull. - * @param {id} is the type of number and identifier of ACl Modules. - */ - @Put('/update/:id') - @UseGuards(AuthGuard('jwt'), RolesGuard) - @ApiBody({ type: UpdateACLModuleDTO }) - @Roles(Role.Admin) - @ApiResponse({ - status: HttpStatus.OK, - type: ACLModuleDTO, - description: 'Updates a Module Permission or status by admin', - }) - public async updateyield( - @Param('id', new ParseIntPipe()) id: number, - @Body() body: UpdateACLModuleDTO, + /* + * It is POST api to create an ACL Module. + * @return {ACLModuleDto} when create api is successfull. + */ + @Post() + @UseGuards(AuthGuard('jwt'), RolesGuard) + @Roles(Role.Admin) + @ApiResponse({ + status: HttpStatus.CREATED, + type: ACLModuleDTO, + description: 'Add a Module', + }) + public async register( + @Body() moduleData: NewACLModuleDTO, + ): Promise { + this.logger.verbose(`With in create`); + return this.ModulesService.create(moduleData); + } - ): Promise { - this.logger.verbose(`With in update`); - return this.ModulesService.update(id, body); - } + /* + * This is PUT api to update a module permissions or status + * @return {ACLModuleDto} when the update is successfull. + * @param {id} is the type of number and identifier of ACl Modules. + */ + @Put('/update/:id') + @UseGuards(AuthGuard('jwt'), RolesGuard) + @ApiBody({ type: UpdateACLModuleDTO }) + @Roles(Role.Admin) + @ApiResponse({ + status: HttpStatus.OK, + type: ACLModuleDTO, + description: 'Updates a Module Permission or status by admin', + }) + public async updateyield( + @Param('id', new ParseIntPipe()) id: number, + @Body() body: UpdateACLModuleDTO, + ): Promise { + this.logger.verbose(`With in update`); + return this.ModulesService.update(id, body); + } } diff --git a/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.module.ts b/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.module.ts index 0ae6197e9..db5c1083f 100755 --- a/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.module.ts +++ b/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.module.ts @@ -1,14 +1,13 @@ import { Module } from '@nestjs/common'; -import {AClModules} from './aclmodule.entity' -import {DecimalPermissionValue} from './common/permissionBitposition'; +import { AClModules } from './aclmodule.entity'; +import { DecimalPermissionValue } from './common/permissionBitposition'; import { TypeOrmModule } from '@nestjs/typeorm'; import { AccessControlLayerModuleServiceController } from './access-control-layer-module-service.controller'; -import {AccessControlLayerModuleServiceService} from './access-control-layer-module-service.service'; +import { AccessControlLayerModuleServiceService } from './access-control-layer-module-service.service'; @Module({ - imports: [TypeOrmModule.forFeature([AClModules])], - providers: [AccessControlLayerModuleServiceService,DecimalPermissionValue], - controllers: [ AccessControlLayerModuleServiceController], - exports: [AccessControlLayerModuleServiceService] - + imports: [TypeOrmModule.forFeature([AClModules])], + providers: [AccessControlLayerModuleServiceService, DecimalPermissionValue], + controllers: [AccessControlLayerModuleServiceController], + exports: [AccessControlLayerModuleServiceService], }) export class AccessControlLayerModuleServiceModule {} diff --git a/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.service.ts b/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.service.ts index b17aebbdd..d78b91ef9 100755 --- a/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.service.ts +++ b/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.service.ts @@ -5,27 +5,28 @@ import { NotFoundException, } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { - FindConditions, - Repository, -} from 'typeorm'; +import { FindConditions, Repository } from 'typeorm'; import { AClModules } from './aclmodule.entity'; -import { ACLModuleDTO, NewACLModuleDTO, UpdateACLModuleDTO } from './dto/aclmodule.dto'; -import { IACLModuleConfig } from '../../models' +import { + ACLModuleDTO, + NewACLModuleDTO, + UpdateACLModuleDTO, +} from './dto/aclmodule.dto'; +import { IACLModuleConfig } from '../../models'; import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; export type TmoduleBaseEntity = ExtendedBaseEntity & IACLModuleConfig; import { DecimalPermissionValue } from './common/permissionBitposition'; @Injectable() export class AccessControlLayerModuleServiceService { - - - private readonly logger = new Logger(AccessControlLayerModuleServiceService.name); + private readonly logger = new Logger( + AccessControlLayerModuleServiceService.name, + ); constructor( - @InjectRepository(AClModules) private readonly repository: Repository, + @InjectRepository(AClModules) + private readonly repository: Repository, private readonly Permissionvalue: DecimalPermissionValue, - ) { } - + ) {} public async create(data: NewACLModuleDTO): Promise { this.logger.verbose(`With in create`); @@ -40,20 +41,20 @@ export class AccessControlLayerModuleServiceService { if (myArr === key) { addedPermissionList[key] = true; } - }) - + }); } - var permissionValue = await this.Permissionvalue.computePermissions(addedPermissionList); - + var permissionValue = + await this.Permissionvalue.computePermissions(addedPermissionList); + await this.checkForExistingmodule(data.name); const moduledata = new AClModules({ ...data, - permissionsValue:permissionValue, - }) - + permissionsValue: permissionValue, + }); + const module = await this.repository.save(moduledata); - + return module; } private async checkForExistingmodule(name: string): Promise { @@ -83,9 +84,13 @@ export class AccessControlLayerModuleServiceService { } return user; } - async findOne(conditions: FindConditions): Promise { + async findOne( + conditions: FindConditions, + ): Promise { this.logger.verbose(`With in findOne`); - const module = await (this.repository.findOne(conditions) as Promise as Promise); + const module = await (this.repository.findOne( + conditions, + ) as Promise as Promise); return module; } @@ -106,19 +111,18 @@ export class AccessControlLayerModuleServiceService { Update: false, }; for (var key in addedPermissionList) { - data.permissions.map((myArr, index) => { if (myArr === key) { addedPermissionList[key] = true; } - }) - + }); } - - const permissionValue = await this.Permissionvalue.computePermissions(addedPermissionList); + + const permissionValue = + await this.Permissionvalue.computePermissions(addedPermissionList); await this.repository.update(id, { - permissions:data.permissions, - permissionsValue:permissionValue, + permissions: data.permissions, + permissionsValue: permissionValue, }); return this.findOne({ id }); diff --git a/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.spec.ts b/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.spec.ts index b051ae275..3b823365b 100644 --- a/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.spec.ts +++ b/apps/drec-api/src/pods/access-control-layer-module-service/access-control-layer-module-service.spec.ts @@ -1,35 +1,39 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { Repository } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { AccessControlLayerModuleServiceService } from './access-control-layer-module-service.service'; -import { AClModules } from './aclmodule.entity'; -import { DecimalPermissionValue } from './common/permissionBitposition'; - - -describe('AccessControlLayerModuleServiceService', () => { - let service: AccessControlLayerModuleServiceService; - let repository: Repository; - let Permissionvalue: DecimalPermissionValue; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [AccessControlLayerModuleServiceService, - { - provide: getRepositoryToken(AClModules), - useClass: Repository, - }, - { - provide: DecimalPermissionValue, - useValue: {} as any, - }, - ], - }).compile(); - - service = module.get(AccessControlLayerModuleServiceService); - repository = module.get>(getRepositoryToken(AClModules)); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { Repository } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { AccessControlLayerModuleServiceService } from './access-control-layer-module-service.service'; +import { AClModules } from './aclmodule.entity'; +import { DecimalPermissionValue } from './common/permissionBitposition'; + +describe('AccessControlLayerModuleServiceService', () => { + let service: AccessControlLayerModuleServiceService; + let repository: Repository; + let Permissionvalue: DecimalPermissionValue; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + AccessControlLayerModuleServiceService, + { + provide: getRepositoryToken(AClModules), + useClass: Repository, + }, + { + provide: DecimalPermissionValue, + useValue: {} as any, + }, + ], + }).compile(); + + service = module.get( + AccessControlLayerModuleServiceService, + ); + repository = module.get>( + getRepositoryToken(AClModules), + ); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/access-control-layer-module-service/aclmodule.entity.ts b/apps/drec-api/src/pods/access-control-layer-module-service/aclmodule.entity.ts index c0ba8d6db..c4d72ed3b 100755 --- a/apps/drec-api/src/pods/access-control-layer-module-service/aclmodule.entity.ts +++ b/apps/drec-api/src/pods/access-control-layer-module-service/aclmodule.entity.ts @@ -1,11 +1,17 @@ -import { Entity, PrimaryGeneratedColumn, Column, ManyToOne,OneToMany } from 'typeorm'; +import { + Entity, + PrimaryGeneratedColumn, + Column, + ManyToOne, + OneToMany, +} from 'typeorm'; import { Exclude } from 'class-transformer'; import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; import { ApiProperty } from '@nestjs/swagger'; import { Role, RoleStatus } from '../../utils/enums'; import { IsEnum, IsString, IsArray } from 'class-validator'; import { IACLModuleConfig } from '../../models'; -import {ACLModulePermissions} from '../permission/permission.entity' +import { ACLModulePermissions } from '../permission/permission.entity'; @Entity('aclmodules') export class AClModules extends ExtendedBaseEntity implements IACLModuleConfig { constructor(module: Partial) { @@ -27,7 +33,6 @@ export class AClModules extends ExtendedBaseEntity implements IACLModuleConfig { @IsString() description: string; - @ApiProperty({ enum: RoleStatus, enumName: 'RoleStatus' }) @Column({ default: RoleStatus.Enable, nullable: true }) @IsEnum(RoleStatus) @@ -38,16 +43,16 @@ export class AClModules extends ExtendedBaseEntity implements IACLModuleConfig { @IsArray() permissions: string[]; - @ApiProperty({ type: Number }) @Column() permissionsValue: number; - - - @OneToMany(() => ACLModulePermissions, (aclpermission) => aclpermission.aclmodules, { - cascade: true, - - }) + @OneToMany( + () => ACLModulePermissions, + (aclpermission) => aclpermission.aclmodules, + { + cascade: true, + }, + ) aclpermission: ACLModulePermissions[]; -} \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/access-control-layer-module-service/common/permissionBitposition.ts b/apps/drec-api/src/pods/access-control-layer-module-service/common/permissionBitposition.ts index c3d20c14c..d27996703 100755 --- a/apps/drec-api/src/pods/access-control-layer-module-service/common/permissionBitposition.ts +++ b/apps/drec-api/src/pods/access-control-layer-module-service/common/permissionBitposition.ts @@ -1,10 +1,8 @@ - import { PermissionString } from '../../../utils/enums'; //32 bit permission export class DecimalPermissionValue { - // permissionModuleNumber: number = 11; // permissionUserTobegiven: number = 6; // constructor() { @@ -37,27 +35,27 @@ export class DecimalPermissionValue { bitPosition: number; andOperationNumber: number; }> = [ - { - permissionString: PermissionString.Read, - bitPosition: 1, - andOperationNumber: 1, - }, - { - permissionString: PermissionString.Write, - bitPosition: 2, - andOperationNumber: 2, - }, - { - permissionString: PermissionString.Update, - bitPosition: 3, - andOperationNumber: 4, - }, - { - permissionString: PermissionString.Delete, - bitPosition: 4, - andOperationNumber: 8, - }, - ]; + { + permissionString: PermissionString.Read, + bitPosition: 1, + andOperationNumber: 1, + }, + { + permissionString: PermissionString.Write, + bitPosition: 2, + andOperationNumber: 2, + }, + { + permissionString: PermissionString.Update, + bitPosition: 3, + andOperationNumber: 4, + }, + { + permissionString: PermissionString.Delete, + bitPosition: 4, + andOperationNumber: 8, + }, + ]; modulePermissions: any = [ { bitPosition: 1, @@ -115,14 +113,17 @@ export class DecimalPermissionValue { decimalFormPermission = decimalFormPermission + Math.pow(2, ele.bitPosition - 1) * - (addedPermissionList[ele.permissionString] === true ? 1 : 0); + (addedPermissionList[ele.permissionString] === true ? 1 : 0); }); this.decimalFormPermission = decimalFormPermission; //console.log(this.decimalFormPermission) return this.decimalFormPermission; } - checkModulePermissionAgainstUserPermission(modulePermission: number, userPermission: number) { + checkModulePermissionAgainstUserPermission( + modulePermission: number, + userPermission: number, + ) { //console.log(modulePermission); //console.log(userPermission); this.permissionListMAPToBItPOSITIONSAtAPI.forEach((ele) => { @@ -130,15 +131,13 @@ export class DecimalPermissionValue { (ele.andOperationNumber & modulePermission) === ele.andOperationNumber ) { - this.modulePermissions.find( - (eleMod: any) => eleMod.bitPosition == ele.bitPosition).isSet = true; - - + (eleMod: any) => eleMod.bitPosition == ele.bitPosition, + ).isSet = true; } }); //console.log(this.modulePermissions); - const getpermission:any=[] + const getpermission: any = []; this.permissionListMAPToBItPOSITIONSAtAPI.forEach((ele) => { if ( (ele.andOperationNumber & userPermission) === @@ -146,13 +145,13 @@ export class DecimalPermissionValue { ) { if ( this.modulePermissions.find( - (eleMod: any) => eleMod.bitPosition == ele.bitPosition + (eleMod: any) => eleMod.bitPosition == ele.bitPosition, ).isSet ) { this.userPermissions.find( - (eleMod: any) => eleMod.bitPosition == ele.bitPosition + (eleMod: any) => eleMod.bitPosition == ele.bitPosition, ).isSet = true; - getpermission.push(ele.permissionString) + getpermission.push(ele.permissionString); } } }); diff --git a/apps/drec-api/src/pods/access-control-layer-module-service/dto/aclmodule.dto.ts b/apps/drec-api/src/pods/access-control-layer-module-service/dto/aclmodule.dto.ts index b6cc9b809..e3b69f58c 100755 --- a/apps/drec-api/src/pods/access-control-layer-module-service/dto/aclmodule.dto.ts +++ b/apps/drec-api/src/pods/access-control-layer-module-service/dto/aclmodule.dto.ts @@ -3,102 +3,93 @@ import { IACLModuleConfig } from '../../../models'; import { Role, RoleStatus } from '../../../utils/enums'; import { Expose } from 'class-transformer'; import { - IsBoolean, - IsEmail, - IsEnum, - IsNotEmpty, - IsNumber, - IsString, - IsArray, - IsOptional, - ValidateNested, + IsBoolean, + IsEmail, + IsEnum, + IsNotEmpty, + IsNumber, + IsString, + IsArray, + IsOptional, + ValidateNested, } from 'class-validator'; import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm'; - export class ACLModuleDTO implements Omit { - - - @ApiProperty({ type: Number }) - @PrimaryGeneratedColumn() - id: number; - - @ApiProperty({ type: String }) - @Column() - @IsString() - name: string; - - @ApiProperty({ enum: RoleStatus, enumName: 'RoleStatus' }) - @IsEnum(RoleStatus) - status: RoleStatus; - - @ApiProperty({ type: String }) - @Column() - description: string; - - - @ApiProperty({ type: () => [String] }) - @Column('simple-array', { nullable: true }) - @IsArray() - permissions: string[]; - @ApiProperty({ type: Number }) - @Column() - permissionsValue: number; + @ApiProperty({ type: Number }) + @PrimaryGeneratedColumn() + id: number; + + @ApiProperty({ type: String }) + @Column() + @IsString() + name: string; + + @ApiProperty({ enum: RoleStatus, enumName: 'RoleStatus' }) + @IsEnum(RoleStatus) + status: RoleStatus; + + @ApiProperty({ type: String }) + @Column() + description: string; + + @ApiProperty({ type: () => [String] }) + @Column('simple-array', { nullable: true }) + @IsArray() + permissions: string[]; + @ApiProperty({ type: Number }) + @Column() + permissionsValue: number; } export class NewACLModuleDTO implements Omit { - - - - @ApiProperty({ type: String }) - @Column() - @IsString() - name: string; - - @ApiProperty({ enum: RoleStatus, enumName: 'RoleStatus' }) - @IsEnum(RoleStatus) - status: RoleStatus; - - @ApiProperty({ type: String }) - @Column() - description: string; - - @ApiProperty({ type: () => [String], description: 'Add ( Read, Delete ,Update , Write )' }) - @Column('simple-array') - @IsArray() - permissions: string[]; - - @Column() - permissionsValue: number; + @ApiProperty({ type: String }) + @Column() + @IsString() + name: string; + + @ApiProperty({ enum: RoleStatus, enumName: 'RoleStatus' }) + @IsEnum(RoleStatus) + status: RoleStatus; + + @ApiProperty({ type: String }) + @Column() + description: string; + + @ApiProperty({ + type: () => [String], + description: 'Add ( Read, Delete ,Update , Write )', + }) + @Column('simple-array') + @IsArray() + permissions: string[]; + + @Column() + permissionsValue: number; } export class UpdateACLModuleDTO implements Omit { - - - - // @ApiProperty({ type: String }) - @Column() - @IsOptional() - @IsString() - name: string; - - @ApiProperty({ enum: RoleStatus, enumName: 'RoleStatus' }) - @IsEnum(RoleStatus) - @IsOptional() - status: RoleStatus; - - // @ApiProperty({ type: String }) - @Column() - @IsOptional() - description: string; - - @ApiProperty({ type: () => [String] }) - @Column('simple-array') - - @IsArray() - permissions: string[]; - - @Column() - @IsOptional() - permissionsValue: number; - -} \ No newline at end of file + // @ApiProperty({ type: String }) + @Column() + @IsOptional() + @IsString() + name: string; + + @ApiProperty({ enum: RoleStatus, enumName: 'RoleStatus' }) + @IsEnum(RoleStatus) + @IsOptional() + status: RoleStatus; + + // @ApiProperty({ type: String }) + @Column() + @IsOptional() + description: string; + + @ApiProperty({ type: () => [String] }) + @Column('simple-array') + @IsArray() + permissions: string[]; + + @Column() + @IsOptional() + permissionsValue: number; +} diff --git a/apps/drec-api/src/pods/admin/admin.controller.ts b/apps/drec-api/src/pods/admin/admin.controller.ts index 490b5692f..6d5469910 100755 --- a/apps/drec-api/src/pods/admin/admin.controller.ts +++ b/apps/drec-api/src/pods/admin/admin.controller.ts @@ -14,7 +14,7 @@ import { NotFoundException, Patch, Post, - DefaultValuePipe + DefaultValuePipe, } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; import { @@ -23,7 +23,7 @@ import { ApiNotFoundResponse, ApiResponse, ApiTags, - ApiQuery + ApiQuery, } from '@nestjs/swagger'; import { @@ -44,12 +44,12 @@ import { ResponseSuccess } from '../../models'; // import { CreateUserDTO } from '../user/dto/create-user.dto'; import { CreateUserORGDTO } from '../user/dto/create-user.dto'; import { SeedUserDTO } from './dto/seed-user.dto'; -import { DeviceService } from '../device/device.service' -import { DeviceGroupService } from '../device-group/device-group.service' +import { DeviceService } from '../device/device.service'; +import { DeviceGroupService } from '../device-group/device-group.service'; import { Permission } from '../permission/decorators/permission.decorator'; import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator'; import { OrganizationFilterDTO } from './dto/organization-filter.dto'; -import {InvitationService} from '../invitation/invitation.service' +import { InvitationService } from '../invitation/invitation.service'; @ApiTags('admin') @ApiBearerAuth('access-token') @Controller('admin') @@ -62,7 +62,7 @@ export class AdminController { private readonly deviceService: DeviceService, private readonly devicegroupService: DeviceGroupService, private readonly invitationservice: InvitationService, - ) { } + ) {} @Get('/users') @Roles(Role.Admin) @@ -77,9 +77,10 @@ export class AdminController { }) public async getUsers( @Query(ValidationPipe) filterDto: UserFilterDTO, - @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) pageNumber: number, + @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) + pageNumber: number, @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit: number, - )/*: Promise*/ { + ) /*: Promise*/ { return this.userService.getUsersByFilter(filterDto, pageNumber, limit); } @@ -96,14 +97,15 @@ export class AdminController { }) async getAllOrganizations( @Query(ValidationPipe) filterDto: OrganizationFilterDTO, - @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) pageNumber: number, + @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) + pageNumber: number, @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit: number, - )/*: Promise*/ { + ) /*: Promise*/ { return await this.organizationService.getAll(filterDto, pageNumber, limit); } @Get('/organizations/user/:organizationId') @Permission('Read') - @ACLModules("ADMIN_APIUSER_ORGANIZATION_CRUDL") + @ACLModules('ADMIN_APIUSER_ORGANIZATION_CRUDL') @ApiQuery({ name: 'pageNumber', type: Number, required: false }) @ApiQuery({ name: 'limit', type: Number, required: false }) @ApiResponse({ @@ -112,16 +114,21 @@ export class AdminController { }) async getAllUserOrganizations( @Param('organizationId', new ParseIntPipe()) organizationId: number, - @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) pageNumber: number, + @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) + pageNumber: number, @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit: number, - )/*: Promise*/ { - return this.organizationService.findOrganizationUsers(organizationId, pageNumber, limit); + ) /*: Promise*/ { + return this.organizationService.findOrganizationUsers( + organizationId, + pageNumber, + limit, + ); } @Get('/organizations/:id') @UseGuards(AuthGuard('jwt'), ActiveUserGuard, RolesGuard, PermissionGuard) @Roles(Role.Admin) @Permission('Read') - @ACLModules("ADMIN_MANAGEMENT-CRUDL") + @ACLModules('ADMIN_MANAGEMENT-CRUDL') @ApiResponse({ status: HttpStatus.OK, type: OrganizationDTO, @@ -151,8 +158,7 @@ export class AdminController { return await this.userService.adminnewcreate(newUser); } - @Post('/seed/users' - ) + @Post('/seed/users') @UseGuards(AuthGuard('jwt'), ActiveUserGuard, RolesGuard, PermissionGuard) @Roles(Role.Admin) @Permission('Write') @@ -283,40 +289,48 @@ export class AdminController { async deleteUser( @Param('id', new ParseIntPipe()) userid: number, ): Promise { - const user = await this.userService.findById(userid); - + if (!user) { throw new NotFoundException('Does not exist'); } - const manyotheruserinorg = await this.userService.getatleastoneotheruserinOrg(user.organization.id, user.id) - + const manyotheruserinorg = + await this.userService.getatleastoneotheruserinOrg( + user.organization.id, + user.id, + ); + if (user.role === Role.Buyer || user.role === Role.OrganizationAdmin) { - const buyerresrvation = await this.devicegroupService.findOne({ organizationId: user.organization.id }) - - if (buyerresrvation) { - throw new NotFoundException('This user is part of reservation,So you cannot remove this user and organization'); + const buyerresrvation = await this.devicegroupService.findOne({ + organizationId: user.organization.id, + }); + if (buyerresrvation) { + throw new NotFoundException( + 'This user is part of reservation,So you cannot remove this user and organization', + ); } - const deviceoforg = await this.deviceService.getatleastonedeviceinOrg(user.organization.id) - + const deviceoforg = await this.deviceService.getatleastonedeviceinOrg( + user.organization.id, + ); + if (deviceoforg.length > 0) { - throw new NotFoundException('Some device are available in organization '); + throw new NotFoundException( + 'Some device are available in organization ', + ); } // if (manyotheruserinorg) { // throw new NotFoundException('Some more users availble in organization. So user cannot remove'); // } - if (!(manyotheruserinorg.length>0)) { + if (!(manyotheruserinorg.length > 0)) { // throw new NotFoundException('Some more users availble in organization. So user cannot remove'); await this.userService.remove(user.id); await this.organizationService.remove(user.organization.id); - } - - } - else { - await this.invitationservice.remove(user.email,user.organization.id) - await this.userService.remove(user.id); - } + } + } else { + await this.invitationservice.remove(user.email, user.organization.id); + await this.userService.remove(user.id); + } return ResponseSuccess(); } @@ -339,7 +353,6 @@ export class AdminController { return await this.deviceService.I_recPostData(id); } - @Get('/devices/autocomplete') @UseGuards(AuthGuard('jwt'), ActiveUserGuard, RolesGuard, PermissionGuard) @Roles(Role.Admin) @@ -350,16 +363,14 @@ export class AdminController { status: HttpStatus.OK, description: 'Returns Auto-Complete', }) - @ApiQuery({ name: 'externalId', description: 'externalId', type: String }) - async autocomplete( // @UserDecorator() { organizationId }: ILoggedInUser, @Query('externalId') externalId: String, @Query('organizationId') organizationId: number, ) { //@ts-ignore - console.log("adminaddorgId", organizationId) + console.log('adminaddorgId', organizationId); // if (adminaddorgId != null || adminaddorgId != undefined) { // organizationId = adminaddorgId; // } @@ -367,8 +378,8 @@ export class AdminController { } /* - * It is GET api to list all ApiUsers with pagination and filteration by Organization. - */ + * It is GET api to list all ApiUsers with pagination and filteration by Organization. + */ @Get('/apiusers') @UseGuards(AuthGuard('jwt'), ActiveUserGuard, RolesGuard, PermissionGuard) @Roles(Role.Admin) @@ -376,19 +387,20 @@ export class AdminController { @ACLModules('ADMIN_MANAGEMENT_CRUDL') @ApiQuery({ name: 'pageNumber', type: Number, required: false }) @ApiQuery({ name: 'limit', type: Number, required: false }) - @ApiQuery({ name: 'organizationName', type: String, required: false}) + @ApiQuery({ name: 'organizationName', type: String, required: false }) @ApiResponse({ status: HttpStatus.OK, type: [UserDTO], description: 'Gets all apiusers', }) public async getApiUsers( - @Query('organizationName',new DefaultValuePipe(null)) organizationName: string | null, - @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) pageNumber: number, + @Query('organizationName', new DefaultValuePipe(null)) + organizationName: string | null, + @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) + pageNumber: number, @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit: number, ) { - // this.logger.verbose(`With in getAllApiUsers`); - return this.userService.getApiUsers(organizationName,pageNumber, limit); + // this.logger.verbose(`With in getAllApiUsers`); + return this.userService.getApiUsers(organizationName, pageNumber, limit); } - } diff --git a/apps/drec-api/src/pods/admin/admin.module.ts b/apps/drec-api/src/pods/admin/admin.module.ts index 5b600bab0..c0b1bcb7f 100755 --- a/apps/drec-api/src/pods/admin/admin.module.ts +++ b/apps/drec-api/src/pods/admin/admin.module.ts @@ -6,13 +6,18 @@ import { AdminController } from './admin.controller'; import { UserModule } from '../user/user.module'; import { OrganizationModule } from '../organization/organization.module'; import { DeviceModule } from '../device'; -import {DeviceGroupModule} from '../device-group/device-group.module'; -import {InvitationModule} from '../invitation/invitation.module' +import { DeviceGroupModule } from '../device-group/device-group.module'; +import { InvitationModule } from '../invitation/invitation.module'; @Module({ - imports: [TypeOrmModule.forFeature([User]), UserModule, - OrganizationModule,DeviceModule, - DeviceGroupModule,InvitationModule], + imports: [ + TypeOrmModule.forFeature([User]), + UserModule, + OrganizationModule, + DeviceModule, + DeviceGroupModule, + InvitationModule, + ], controllers: [AdminController], }) export class AdminModule {} diff --git a/apps/drec-api/src/pods/admin/dto/organization-filter.dto.ts b/apps/drec-api/src/pods/admin/dto/organization-filter.dto.ts index 0d2781f75..b06846a9c 100755 --- a/apps/drec-api/src/pods/admin/dto/organization-filter.dto.ts +++ b/apps/drec-api/src/pods/admin/dto/organization-filter.dto.ts @@ -1,8 +1,8 @@ -import { IsOptional } from 'class-validator'; -import { ApiPropertyOptional } from '@nestjs/swagger'; - -export class OrganizationFilterDTO { - @IsOptional() - @ApiPropertyOptional({ type: String, description: 'Organization name' }) - organizationName: string; -} +import { IsOptional } from 'class-validator'; +import { ApiPropertyOptional } from '@nestjs/swagger'; + +export class OrganizationFilterDTO { + @IsOptional() + @ApiPropertyOptional({ type: String, description: 'Organization name' }) + organizationName: string; +} diff --git a/apps/drec-api/src/pods/admin/dto/seed-user.dto.ts b/apps/drec-api/src/pods/admin/dto/seed-user.dto.ts index 421849d99..516e61e96 100755 --- a/apps/drec-api/src/pods/admin/dto/seed-user.dto.ts +++ b/apps/drec-api/src/pods/admin/dto/seed-user.dto.ts @@ -1,4 +1,4 @@ -import { ApiProperty, PickType ,IntersectionType} from '@nestjs/swagger'; +import { ApiProperty, PickType, IntersectionType } from '@nestjs/swagger'; import { IsNotEmpty, IsNumber, @@ -13,18 +13,18 @@ import { OrganizationDTO } from '../../organization/dto/organization.dto'; export class SeedUserDTO extends IntersectionType( PickType(UserDTO, [ - // 'title', - 'firstName', - 'lastName', - 'email', - // 'telephone', - 'notifications', - 'status', - 'role', - 'organization' - ] as const), - PickType(OrganizationDTO,['organizationType']as const) - ) + // 'title', + 'firstName', + 'lastName', + 'email', + // 'telephone', + 'notifications', + 'status', + 'role', + 'organization', + ] as const), + PickType(OrganizationDTO, ['organizationType'] as const), + ) implements Omit { @ApiProperty({ type: String }) @@ -43,13 +43,11 @@ export class SeedUserDTO message: 'Password must contain minimum 6 characters (upper and/or lower case) and at least 1 digit', }) - @ApiProperty({ type: Number }) @IsNumber() organizationId: number; - // permissions?: IModulePermissionsConfig; + // permissions?: IModulePermissionsConfig; moduleName: string; - roleId:number; - + roleId: number; } diff --git a/apps/drec-api/src/pods/certificate-log/certificate-log.controller.ts b/apps/drec-api/src/pods/certificate-log/certificate-log.controller.ts index 3d10a3220..e67572309 100755 --- a/apps/drec-api/src/pods/certificate-log/certificate-log.controller.ts +++ b/apps/drec-api/src/pods/certificate-log/certificate-log.controller.ts @@ -1,33 +1,37 @@ import { - Controller, - Get, - HttpStatus, - Param, - UseGuards, - ValidationPipe, - Query, - ConflictException, - BadRequestException, - Logger, - Res + Controller, + Get, + HttpStatus, + Param, + UseGuards, + ValidationPipe, + Query, + ConflictException, + BadRequestException, + Logger, + Res, } from '@nestjs/common'; import { - ApiBearerAuth, - ApiResponse, - ApiOkResponse, - ApiSecurity, - ApiTags, - ApiQuery, + ApiBearerAuth, + ApiResponse, + ApiOkResponse, + ApiSecurity, + ApiTags, + ApiQuery, } from '@nestjs/swagger'; import { AuthGuard } from '@nestjs/passport'; -import { CheckCertificateIssueDateLogForDeviceEntity } from '../device/check_certificate_issue_date_log_for_device.entity' -import { CertificateLogService } from './certificate-log.service' -import { AmountFormattingDTO, FilterDTO, GroupIDBasedFilteringDTO } from './dto/filter.dto' +import { CheckCertificateIssueDateLogForDeviceEntity } from '../device/check_certificate_issue_date_log_for_device.entity'; +import { CertificateLogService } from './certificate-log.service'; +import { + AmountFormattingDTO, + FilterDTO, + GroupIDBasedFilteringDTO, +} from './dto/filter.dto'; import { UserDecorator } from '../user/decorators/user.decorator'; import { ILoggedInUser } from '../../models'; import { DeviceGroupService } from '../device-group/device-group.service'; -import { CertificateNewWithPerDeviceLog, CertificatelogResponse } from './dto' +import { CertificateNewWithPerDeviceLog, CertificatelogResponse } from './dto'; import { PowerFormatter } from '../../utils/PowerFormatter'; import { ActiveUserGuard } from '../../guards/ActiveUserGuard'; import { PermissionGuard } from '../../guards/PermissionGuard'; @@ -39,400 +43,476 @@ import { OrganizationService } from '../organization/organization.service'; import { UserService } from '../user/user.service'; import { Response } from 'express'; /* -* It is Controller of ACL Module with the endpoints of ACL module operations. -*/ + * It is Controller of ACL Module with the endpoints of ACL module operations. + */ @ApiTags('certificate-log') @ApiBearerAuth('access-token') @ApiSecurity('drec') @Controller('/certificate-log') export class CertificateLogController { + private readonly logger = new Logger(CertificateLogController.name); - private readonly logger = new Logger(CertificateLogController.name); + constructor( + private readonly certificateLogService: CertificateLogService, + private readonly devicegroupService: DeviceGroupService, + private readonly organizationService: OrganizationService, + private readonly userService: UserService, + ) {} - constructor( - private readonly certificateLogService: CertificateLogService, - private readonly devicegroupService: DeviceGroupService, - private readonly organizationService: OrganizationService, - private readonly userService: UserService, - ) { } + /* + * It is GET api to list all certificate issues date log of devices. + * @return { Array } returns all issue logs of device + */ + @Get() + @UseGuards(AuthGuard('jwt'), PermissionGuard) + @Permission('Read') + @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') + @ApiOkResponse({ + type: [CheckCertificateIssueDateLogForDeviceEntity], + description: 'Returns all individual devices certificate log', + }) + async getAll(): Promise { + this.logger.verbose(`With in getAll`); + return this.certificateLogService.find(); + } - /* - * It is GET api to list all certificate issues date log of devices. - * @return { Array } returns all issue logs of device - */ - @Get() - @UseGuards(AuthGuard('jwt'), PermissionGuard) - @Permission('Read') - @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') - @ApiOkResponse({ type: [CheckCertificateIssueDateLogForDeviceEntity], description: 'Returns all individual devices certificate log' }) - async getAll( - ): Promise { - this.logger.verbose(`With in getAll`); - return this.certificateLogService.find(); + /* + * Need to ask Namrata + */ + @Get('/claim-amount-in-ethers-json') + @UseGuards(PermissionGuard) + @Permission('Read') + @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') + async getClaimAmountInEthersJSON( + @Query() amountFormatData: AmountFormattingDTO, + ) { + if (Number.isNaN(parseInt(amountFormatData.amount))) { + this.logger.error(`amount invalid value was sent`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: 'amount invalid value was sent', + }), + ); + }); } + this.logger.verbose(`with in getClaimAmountInEthersJSON`); + return PowerFormatter.getBaseValueFromValueInDisplayUnitInEthers( + amountFormatData.amount, + ); + } - /* - * Need to ask Namrata - */ - @Get('/claim-amount-in-ethers-json') - @UseGuards(PermissionGuard) - @Permission('Read') - @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') - async getClaimAmountInEthersJSON( - @Query() amountFormatData: AmountFormattingDTO, - ) { - if (Number.isNaN(parseInt(amountFormatData.amount))) { - this.logger.error(`amount invalid value was sent`); - return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: 'amount invalid value was sent', - })) - }) - - } - this.logger.verbose(`with in getClaimAmountInEthersJSON`); - return PowerFormatter.getBaseValueFromValueInDisplayUnitInEthers(amountFormatData.amount) + /* + * It is GET api to list the cerficate log of devices filtered by groupId + * @return { Array } returns the logs of certicates + */ + @Get('/by-reservation-groupId') + @UseGuards(AuthGuard('jwt'), PermissionGuard) + @Permission('Read') + @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') + @ApiOkResponse({ + type: [CheckCertificateIssueDateLogForDeviceEntity], + description: + 'Returns Certificate logs For individual devices based on groupId', + }) + async getByGroupId( + @Query(ValidationPipe) filterDto: GroupIDBasedFilteringDTO, + ): Promise { + this.logger.verbose(`With in getByGroupId`); + if (parseInt(filterDto.groupId) === NaN) { + this.logger.error(`Group Id is a number, invalid value was sent`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: 'Group Id is a number, invalid value was sent', + }), + ); + }); } + return this.certificateLogService.findByGroupId(filterDto.groupId); + } - /* - * It is GET api to list the cerficate log of devices filtered by groupId - * @return { Array } returns the logs of certicates - */ - @Get('/by-reservation-groupId') - @UseGuards(AuthGuard('jwt'), PermissionGuard) - @Permission('Read') - @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') - @ApiOkResponse({ type: [CheckCertificateIssueDateLogForDeviceEntity], description: 'Returns Certificate logs For individual devices based on groupId' }) - async getByGroupId( - @Query(ValidationPipe) filterDto: GroupIDBasedFilteringDTO, - ): Promise { - this.logger.verbose(`With in getByGroupId`); - if (parseInt(filterDto.groupId) === NaN) { - this.logger.error(`Group Id is a number, invalid value was sent`); - return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: 'Group Id is a number, invalid value was sent', - })) - }) - - } - return this.certificateLogService.findByGroupId(filterDto.groupId); + /** + * It is GET api to list issuer certificates of groupId + * @return { Array } returns issuer certicates of groupId + * @param { groupUid } is an uniqueId in the certificate log from reservation + */ + @Get('/issuer/certified/:groupUid') + @UseGuards(AuthGuard('jwt'), PermissionGuard) + @Permission('Read') + @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') + @ApiOkResponse({ + type: [CertificateNewWithPerDeviceLog], + description: 'Returns issuer Certificate of groupId', + }) + async getissueCertificate( + @Param('groupUid') groupuId: string, + @UserDecorator() user: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in getissueCertificate`); + const regexExp = + /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/; + //console.log(regexExp.test(groupuId)); + if (groupuId === null || !regexExp.test(groupuId)) { + this.logger.error( + `Please Add the valid UID ,invalid group uid value was sent`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Please Add the valid UID ,invalid group uid value was sent', + }), + ); + }); } + const devicegroup = await this.devicegroupService.findOne({ + devicegroup_uid: groupuId, + }); + //console.log("devicegroup"); + //console.log(devicegroup); - /** - * It is GET api to list issuer certificates of groupId - * @return { Array } returns issuer certicates of groupId - * @param { groupUid } is an uniqueId in the certificate log from reservation - */ - @Get('/issuer/certified/:groupUid') - @UseGuards(AuthGuard('jwt'), PermissionGuard) - @Permission('Read') - @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') - @ApiOkResponse({ type: [CertificateNewWithPerDeviceLog], description: 'Returns issuer Certificate of groupId' }) - async getissueCertificate( - @Param('groupUid') groupuId: string, - @UserDecorator() user: ILoggedInUser, - ): Promise { - this.logger.verbose(`With in getissueCertificate`); - const regexExp = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/; - //console.log(regexExp.test(groupuId)); - if (groupuId === null || !regexExp.test(groupuId)) { - this.logger.error(`Please Add the valid UID ,invalid group uid value was sent`); - return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: ' Please Add the valid UID ,invalid group uid value was sent', - })) - }) - } - const devicegroup = await this.devicegroupService.findOne({ devicegroup_uid: groupuId }) - //console.log("devicegroup"); - //console.log(devicegroup); - - - if (devicegroup === null || devicegroup.buyerId != user.id) { - this.logger.error(`Group UId is not of this buyer, invalid value was sent`); - return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: 'Group UId is not of this buyer, invalid value was sent', - })) - }) - } - // setTimeout(() => { - - // }, 2000) - return await this.certificateLogService.getCertificateFromOldOrNewUfinction(devicegroup.id.toString()); + if (devicegroup === null || devicegroup.buyerId != user.id) { + this.logger.error( + `Group UId is not of this buyer, invalid value was sent`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: 'Group UId is not of this buyer, invalid value was sent', + }), + ); + }); } + // setTimeout(() => { - /* - * It is GET api to list issuer certificates of groupId - * @return { Array } returns issuer certicates of groupId - * @param { groupid } Need to ask Namrata - */ - @Get('/issuer/certified/new/:groupUid') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) - @Permission('Read') - @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') - @ApiOkResponse({ type: [CertificateNewWithPerDeviceLog], description: 'Returns issuer Certificate of groupId' }) - async getCertificatesFromUpdatedCertificateTables( - @Param('groupUid') groupuId: string, - @Query('pageNumber') pageNumber: number, - @UserDecorator() user: ILoggedInUser, - ): Promise { - this.logger.verbose('With in getCertificatesFromUpdatedCertificateTables'); - const regexExp = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/; - if (groupuId === null || !regexExp.test(groupuId)) { - this.logger.error(`Please Add the valid UID ,invalid group uid value was sent`); - return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: ' Please Add the valid UID ,invalid group uid value was sent', - })) - }) - } - const devicegroup = await this.devicegroupService.findOne({ devicegroup_uid: groupuId }) - if (user.role === Role.ApiUser) { - if (devicegroup.api_user_id != user.api_user_id) { - this.logger.error(`Group UId does not belongs to this apiuser`); - throw new BadRequestException({ - success: false, - message: 'Group UId does not belongs to this apiuser', - }); - } - return this.certificateLogService.getCertificateFromOldOrNewUfinction(devicegroup.id.toString(), pageNumber); - } else { - if (devicegroup === null || devicegroup.buyerId != user.id) { - this.logger.error(`Group UId is not of this buyer, invalid value was sent`); - return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: 'Group UId is not of this buyer, invalid value was sent', - })) - }) - } - return this.certificateLogService.getCertificateFromOldOrNewUfinction(devicegroup.id.toString(), pageNumber); - } - + // }, 2000) + return await this.certificateLogService.getCertificateFromOldOrNewUfinction( + devicegroup.id.toString(), + ); + } + /* + * It is GET api to list issuer certificates of groupId + * @return { Array } returns issuer certicates of groupId + * @param { groupid } Need to ask Namrata + */ + @Get('/issuer/certified/new/:groupUid') + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) + @Permission('Read') + @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') + @ApiOkResponse({ + type: [CertificateNewWithPerDeviceLog], + description: 'Returns issuer Certificate of groupId', + }) + async getCertificatesFromUpdatedCertificateTables( + @Param('groupUid') groupuId: string, + @Query('pageNumber') pageNumber: number, + @UserDecorator() user: ILoggedInUser, + ): Promise { + this.logger.verbose('With in getCertificatesFromUpdatedCertificateTables'); + const regexExp = + /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/; + if (groupuId === null || !regexExp.test(groupuId)) { + this.logger.error( + `Please Add the valid UID ,invalid group uid value was sent`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Please Add the valid UID ,invalid group uid value was sent', + }), + ); + }); } - - /** - * This is GET api used in previous version of Drec, after claiming certicate user can view the redemption report - */ - @Get('/redemption-report') - @UseGuards(AuthGuard('jwt'), PermissionGuard) - @Permission('Read') - @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') - @ApiOkResponse - ({ - status: HttpStatus.OK, - description: 'Returns a new created Device id' - }) - async getRedemptionReport( - @UserDecorator() { id }: ILoggedInUser, - ): Promise { - this.logger.verbose(`With in getRedemptionReport`); - return this.certificateLogService.getCertificateRedemptionReport(id); + const devicegroup = await this.devicegroupService.findOne({ + devicegroup_uid: groupuId, + }); + if (user.role === Role.ApiUser) { + if (devicegroup.api_user_id != user.api_user_id) { + this.logger.error(`Group UId does not belongs to this apiuser`); + throw new BadRequestException({ + success: false, + message: 'Group UId does not belongs to this apiuser', + }); + } + return this.certificateLogService.getCertificateFromOldOrNewUfinction( + devicegroup.id.toString(), + pageNumber, + ); + } else { + if (devicegroup === null || devicegroup.buyerId != user.id) { + this.logger.error( + `Group UId is not of this buyer, invalid value was sent`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: 'Group UId is not of this buyer, invalid value was sent', + }), + ); + }); + } + return this.certificateLogService.getCertificateFromOldOrNewUfinction( + devicegroup.id.toString(), + pageNumber, + ); } + } + /** + * This is GET api used in previous version of Drec, after claiming certicate user can view the redemption report + */ + @Get('/redemption-report') + @UseGuards(AuthGuard('jwt'), PermissionGuard) + @Permission('Read') + @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') + @ApiOkResponse({ + status: HttpStatus.OK, + description: 'Returns a new created Device id', + }) + async getRedemptionReport( + @UserDecorator() { id }: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in getRedemptionReport`); + return this.certificateLogService.getCertificateRedemptionReport(id); + } - // @Get('/missingCertificate') - // findAll() { - // return this.certificateLogService.getmissingtoken(); - // } + // @Get('/missingCertificate') + // findAll() { + // return this.certificateLogService.getmissingtoken(); + // } + /* + * It is GET api to list all the readings of organization witn pagination and filered by device + */ + @Get('/certificateReadModule') + @UseGuards(AuthGuard('jwt'), ActiveUserGuard, PermissionGuard) + @Permission('Read') + @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') + @ApiResponse({ + status: HttpStatus.OK, + description: 'Returns the certificate_read_module table', + }) + @ApiQuery({ + name: 'certificateStartDate', + required: false, + }) + @ApiQuery({ + name: 'certiifcateEndDate', + required: false, + }) + @ApiQuery({ + name: 'pageNumber', + type: Number, + required: true, + }) + @ApiQuery({ + name: 'targetVolumeCertificateGenerationRequestedInMegaWattHour', + type: Number, + required: false, + }) + @ApiQuery({ + name: 'deviceFilter', + type: Object, + required: false, + }) + async GetCertificateReadModule( + @UserDecorator() { organizationId }: ILoggedInUser, + @Query('pageNumber') pageNumber: number, + @Query('certificateStartDate') generationStartTime?: string, + @Query('certiifcateEndDate') generationEndTime?: string, + @Query('targetVolumeCertificateGenerationRequestedInMegaWattHour') + targetVolumeCertificateGenerationRequestedInMegaWattHour?: number, + @Query('deviceFilter') deviceFilter?: deviceFilterDTO, + ) { + this.logger.verbose(`With in GetCertificateReadModule`); + return await this.certificateLogService.getsCertificateReadModule( + organizationId.toString(), + pageNumber, + deviceFilter, + generationStartTime, + generationEndTime, + targetVolumeCertificateGenerationRequestedInMegaWattHour, + ); + } - /* - * It is GET api to list all the readings of organization witn pagination and filered by device - */ - @Get('/certificateReadModule') - @UseGuards(AuthGuard('jwt'), ActiveUserGuard, PermissionGuard) - @Permission('Read') - @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') - @ApiResponse({ - status: HttpStatus.OK, - description: 'Returns the certificate_read_module table', - }) - @ApiQuery({ - name: 'certificateStartDate', - required: false, - }) - @ApiQuery({ - name: 'certiifcateEndDate', - required: false, - }) - @ApiQuery({ - name: 'pageNumber', - type: Number, - required: true, - }) - @ApiQuery({ - name: 'targetVolumeCertificateGenerationRequestedInMegaWattHour', - type: Number, - required: false, - }) - @ApiQuery({ - name: 'deviceFilter', - type: Object, - required: false, - }) - async GetCertificateReadModule( - @UserDecorator() { organizationId }: ILoggedInUser, - @Query('pageNumber') pageNumber: number, - @Query('certificateStartDate') generationStartTime?: string, - @Query('certiifcateEndDate') generationEndTime?: string, - @Query('targetVolumeCertificateGenerationRequestedInMegaWattHour') targetVolumeCertificateGenerationRequestedInMegaWattHour?: number, - @Query('deviceFilter') deviceFilter?: deviceFilterDTO, - ) { - this.logger.verbose(`With in GetCertificateReadModule`); - return await this.certificateLogService.getsCertificateReadModule( - organizationId.toString(), - pageNumber, - deviceFilter, - generationStartTime, - generationEndTime, - targetVolumeCertificateGenerationRequestedInMegaWattHour, - ); - } - - /* - * It is GET api to fetch certificate log of reserved device. - * @retrurn {CertificatelogResponse} return an certificate log an reservred device. - */ - /* for developre*/ - // @Get('/issuer/certifiedlogOfdevices') - // @UseGuards(AuthGuard('jwt'), AuthGuard('oauth2-client-password'), PermissionGuard) - // @Permission('Read') - // @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') - // @ApiQuery({ name: 'organizationId', type: Number, required: false, description : 'This query parameter is for apiuser' }) - // @ApiOkResponse({ type: [CertificatelogResponse], description: 'Returns issuer Certificate of Reservation' }) - // async getCertificatesForDeveloper( + /* + * It is GET api to fetch certificate log of reserved device. + * @retrurn {CertificatelogResponse} return an certificate log an reservred device. + */ + /* for developre*/ + // @Get('/issuer/certifiedlogOfdevices') + // @UseGuards(AuthGuard('jwt'), AuthGuard('oauth2-client-password'), PermissionGuard) + // @Permission('Read') + // @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') + // @ApiQuery({ name: 'organizationId', type: Number, required: false, description : 'This query parameter is for apiuser' }) + // @ApiOkResponse({ type: [CertificatelogResponse], description: 'Returns issuer Certificate of Reservation' }) + // async getCertificatesForDeveloper( - // @UserDecorator() user: ILoggedInUser, - // @Query(ValidationPipe) filterDto: FilterDTO, - // @Query('pageNumber') pageNumber: number, - // @Query('organizationId') organizationId: number, - // ): Promise { - // console.log("238"); - // if(organizationId) { - // if(user.role === Role.ApiUser) { - // const organization = await this.organizationService.findOne(organizationId); - // const orguser = await this.userService.findByEmail(organization.orgEmail); + // @UserDecorator() user: ILoggedInUser, + // @Query(ValidationPipe) filterDto: FilterDTO, + // @Query('pageNumber') pageNumber: number, + // @Query('organizationId') organizationId: number, + // ): Promise { + // console.log("238"); + // if(organizationId) { + // if(user.role === Role.ApiUser) { + // const organization = await this.organizationService.findOne(organizationId); + // const orguser = await this.userService.findByEmail(organization.orgEmail); - // if(organization.api_user_id != user.api_user_id) { - // throw new BadRequestException({ - // success: false, - // message: 'Organization requested belongs to other apiuser', - // }); - // } - // else { - // user.organizationId = organizationId; - // user.role = orguser.role; - // } - // } - // else { - // if(organizationId != user.organizationId) { - // throw new BadRequestException({ - // success: false, - // message: 'Organization requested belongs to other organization', - // }); - // } - // } - // } + // if(organization.api_user_id != user.api_user_id) { + // throw new BadRequestException({ + // success: false, + // message: 'Organization requested belongs to other apiuser', + // }); + // } + // else { + // user.organizationId = organizationId; + // user.role = orguser.role; + // } + // } + // else { + // if(organizationId != user.organizationId) { + // throw new BadRequestException({ + // success: false, + // message: 'Organization requested belongs to other organization', + // }); + // } + // } + // } - // return this.certificateLogService.getCertifiedlogofDevices(user, filterDto, pageNumber); - // } - @Get('/issuer/certifiedlogOfdevices') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) - @Permission('Read') - @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') - @ApiQuery({ name: 'organizationId', type: Number, required: false, description: 'This query parameter is for apiuser' }) - @ApiOkResponse({ type: [CertificatelogResponse], description: 'Returns issuer Certificate of Reservation' }) - async getCertificatesForDeveloper( - @UserDecorator() user: ILoggedInUser, - @Query(ValidationPipe) filterDto: FilterDTO, - @Query('pageNumber') pageNumber: number, - @Query('organizationId', new ValidationPipe({ skipMissingProperties: true })) organizationId: number, - ): Promise { - this.logger.verbose(`With in getCertificatesForDeveloper`); + // return this.certificateLogService.getCertifiedlogofDevices(user, filterDto, pageNumber); + // } + @Get('/issuer/certifiedlogOfdevices') + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) + @Permission('Read') + @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') + @ApiQuery({ + name: 'organizationId', + type: Number, + required: false, + description: 'This query parameter is for apiuser', + }) + @ApiOkResponse({ + type: [CertificatelogResponse], + description: 'Returns issuer Certificate of Reservation', + }) + async getCertificatesForDeveloper( + @UserDecorator() user: ILoggedInUser, + @Query(ValidationPipe) filterDto: FilterDTO, + @Query('pageNumber') pageNumber: number, + @Query( + 'organizationId', + new ValidationPipe({ skipMissingProperties: true }), + ) + organizationId: number, + ): Promise { + this.logger.verbose(`With in getCertificatesForDeveloper`); - if (user.role === Role.ApiUser) { - // If the user is an ApiUser, organizationId is optional + if (user.role === Role.ApiUser) { + // If the user is an ApiUser, organizationId is optional - if(organizationId) { - const organization = await this.organizationService.findOne(organizationId); - const orguser = await this.userService.findByEmail(organization.orgEmail); + if (organizationId) { + const organization = + await this.organizationService.findOne(organizationId); + const orguser = await this.userService.findByEmail( + organization.orgEmail, + ); - if (organization.api_user_id != user.api_user_id) { - this.logger.error(`Organization requested belongs to other apiuser`); - throw new BadRequestException({ - success: false, - message: 'Organization requested belongs to other apiuser', - }); - } else { - user.organizationId = organizationId; - user.role = orguser.role; - } - } + if (organization.api_user_id != user.api_user_id) { + this.logger.error(`Organization requested belongs to other apiuser`); + throw new BadRequestException({ + success: false, + message: 'Organization requested belongs to other apiuser', + }); } else { - // If the user is not an ApiUser, organizationId is optional - if (organizationId && organizationId != user.organizationId) { - this.logger.verbose(`Organization requested belongs to other organization`); - throw new BadRequestException({ - success: false, - message: 'Organization requested belongs to other organization', - }); - } + user.organizationId = organizationId; + user.role = orguser.role; } + } + } else { + // If the user is not an ApiUser, organizationId is optional + if (organizationId && organizationId != user.organizationId) { + this.logger.verbose( + `Organization requested belongs to other organization`, + ); + throw new BadRequestException({ + success: false, + message: 'Organization requested belongs to other organization', + }); + } + } - return this.certificateLogService.getCertifiedlogofDevices(user, filterDto, pageNumber); + return this.certificateLogService.getCertifiedlogofDevices( + user, + filterDto, + pageNumber, + ); + } + /** + * + * @param groupuId reservat group uuid + * @param user user login details + * @returns + */ + @Get('/expoert_perdevice/:groupUid') + @UseGuards(AuthGuard('jwt'), PermissionGuard) + @Permission('Read') + @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') + //@ApiOkResponse({ type: [Response], description: 'Returns Certificate logs For individual devices based on groupId' }) + async getcertifcateLog_Perdevice( + @UserDecorator() user: ILoggedInUser, + @Param('groupUid') groupuId: string, + @Res() res: Response, + ) { + this.logger.verbose(`With in getByGroupId`); + this.logger.verbose('With in getCertificatesFromUpdatedCertificateTables'); + const regexExp = + /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/; + if (groupuId === null || !regexExp.test(groupuId)) { + this.logger.error( + `Please Add the valid UID ,invalid group uid value was sent`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Please Add the valid UID ,invalid group uid value was sent', + }), + ); + }); } -/** - * - * @param groupuId reservat group uuid - * @param user user login details - * @returns - */ - @Get('/expoert_perdevice/:groupUid') - @UseGuards(AuthGuard('jwt'), PermissionGuard) - @Permission('Read') - @ACLModules('CERTIFICATE_LOG_MANAGEMENT_CRUDL') - //@ApiOkResponse({ type: [Response], description: 'Returns Certificate logs For individual devices based on groupId' }) - async getcertifcateLog_Perdevice( - @UserDecorator() user: ILoggedInUser, - @Param('groupUid') groupuId: string, - @Res()res: Response - ){ - this.logger.verbose(`With in getByGroupId`); - this.logger.verbose('With in getCertificatesFromUpdatedCertificateTables'); - const regexExp = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/; - if (groupuId === null || !regexExp.test(groupuId)) { - this.logger.error(`Please Add the valid UID ,invalid group uid value was sent`); - return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: ' Please Add the valid UID ,invalid group uid value was sent', - })) - }) - } - const devicegroup = await this.devicegroupService.findOne({ devicegroup_uid: groupuId }) - if (user.role === Role.ApiUser) { - if (devicegroup.api_user_id != user.api_user_id) { - this.logger.error(`Group UId does not belongs to this apiuser`); - throw new BadRequestException({ - success: false, - message: 'Group UId does not belongs to this apiuser', - }); - } - user.organizationId = devicegroup.organizationId; - } - return this.certificateLogService.createCSV(res,devicegroup.id, user.organizationId,devicegroup.name); + const devicegroup = await this.devicegroupService.findOne({ + devicegroup_uid: groupuId, + }); + if (user.role === Role.ApiUser) { + if (devicegroup.api_user_id != user.api_user_id) { + this.logger.error(`Group UId does not belongs to this apiuser`); + throw new BadRequestException({ + success: false, + message: 'Group UId does not belongs to this apiuser', + }); + } + user.organizationId = devicegroup.organizationId; } - // @Get('export-csv') - // async exportCsv(@Res()res: Response, ) { - // return await this.certificateLogService.createCSV(res); - // } + return this.certificateLogService.createCSV( + res, + devicegroup.id, + user.organizationId, + devicegroup.name, + ); + } + // @Get('export-csv') + // async exportCsv(@Res()res: Response, ) { + // return await this.certificateLogService.createCSV(res); + // } } diff --git a/apps/drec-api/src/pods/certificate-log/certificate-log.module.ts b/apps/drec-api/src/pods/certificate-log/certificate-log.module.ts index ee6fedb4f..5503d31c2 100755 --- a/apps/drec-api/src/pods/certificate-log/certificate-log.module.ts +++ b/apps/drec-api/src/pods/certificate-log/certificate-log.module.ts @@ -2,29 +2,31 @@ import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { CertificateLogController } from './certificate-log.controller'; import { CertificateLogService } from './certificate-log.service'; -import {CheckCertificateIssueDateLogForDeviceEntity} from '../device/check_certificate_issue_date_log_for_device.entity' -import {Certificate} from '@energyweb/issuer-api'; -import {DeviceGroupModule} from '../device-group/device-group.module' -import {DeviceModule} from'../device/device.module'; +import { CheckCertificateIssueDateLogForDeviceEntity } from '../device/check_certificate_issue_date_log_for_device.entity'; +import { Certificate } from '@energyweb/issuer-api'; +import { DeviceGroupModule } from '../device-group/device-group.module'; +import { DeviceModule } from '../device/device.module'; import { OffChainCertificateModule } from '@energyweb/origin-247-certificate'; import { CertificateReadModelEntity } from '@energyweb/origin-247-certificate/dist/js/src/offchain-certificate/repositories/CertificateReadModel/CertificateReadModel.entity'; -import {DeviceGroup} from '../device-group/device-group.entity' -import {OrganizationModule} from '../organization/organization.module'; +import { DeviceGroup } from '../device-group/device-group.entity'; +import { OrganizationModule } from '../organization/organization.module'; import { UserModule } from '../user/user.module'; - @Module({ - imports: [ - - TypeOrmModule.forFeature([CheckCertificateIssueDateLogForDeviceEntity,Certificate,CertificateReadModelEntity,DeviceGroup]), + TypeOrmModule.forFeature([ + CheckCertificateIssueDateLogForDeviceEntity, + Certificate, + CertificateReadModelEntity, + DeviceGroup, + ]), DeviceGroupModule, DeviceModule, OffChainCertificateModule, OrganizationModule, - UserModule + UserModule, ], controllers: [CertificateLogController], - providers: [CertificateLogService] + providers: [CertificateLogService], }) export class CertificateLogModule {} diff --git a/apps/drec-api/src/pods/certificate-log/certificate-log.service.spec.ts b/apps/drec-api/src/pods/certificate-log/certificate-log.service.spec.ts index 3012eea1e..f886a57db 100644 --- a/apps/drec-api/src/pods/certificate-log/certificate-log.service.spec.ts +++ b/apps/drec-api/src/pods/certificate-log/certificate-log.service.spec.ts @@ -1,443 +1,572 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { Repository } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { CheckCertificateIssueDateLogForDeviceEntity } from '../device/check_certificate_issue_date_log_for_device.entity' -import { CertificateLogService } from './certificate-log.service'; -import { Certificate } from '@energyweb/issuer-api'; -import { CertificateReadModelEntity } from '@energyweb/origin-247-certificate/dist/js/src/offchain-certificate/repositories/CertificateReadModel/CertificateReadModel.entity'; -import { DeviceService } from '../device'; -import { DeviceGroupService } from '../device-group/device-group.service'; -import { Response } from 'express'; -import { ILoggedInUser } from '../../models/LoggedInUser'; -import { DevicetypeCode, FuelCode, OffTaker, PermissionString, Role } from '../../utils/enums'; -import { FilterDTO } from './dto/filter.dto'; -import { CertificatelogResponse } from './dto'; - -describe('CertificateLogService', () => { - let service: CertificateLogService; - let repository: Repository; - let certificaterrepository: Repository; - let certificateReadModelEntity: Repository>; - let mockResponse: Partial; - let deviceService: DeviceService; - let devicegroupService: DeviceGroupService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [CertificateLogService, - { - provide: getRepositoryToken(CheckCertificateIssueDateLogForDeviceEntity), - useClass: Repository, - useValue: { - createQueryBuilder: jest.fn(() => ({ - select: jest.fn().mockReturnThis(), - addSelect: jest.fn().mockReturnThis(), - from: jest.fn().mockReturnThis(), - leftJoin: jest.fn().mockReturnThis(), - innerJoin: jest.fn().mockReturnThis(), - where: jest.fn().mockReturnThis(), - andWhere: jest.fn().mockReturnThis(), - getRawMany: jest.fn(), - })), - }, - }, - { - provide: getRepositoryToken(Certificate), - useClass: Repository, - }, - { - provide: getRepositoryToken(CertificateReadModelEntity), - useClass: Repository, - }, - { - provide: DeviceService, - useValue: {} as any, - }, - { - provide: DeviceGroupService, - useValue: { - getReservationInforDeveloperBsise: jest.fn(), - getoldReservationInforDeveloperBsise: jest.fn(), - } as any, - }, - ], - }).compile(); - - service = module.get(CertificateLogService); - repository = module.get>(getRepositoryToken(CheckCertificateIssueDateLogForDeviceEntity)); - certificaterrepository = module.get>(getRepositoryToken(Certificate)); - certificateReadModelEntity = module.get>>(getRepositoryToken(CertificateReadModelEntity)); - deviceService = module.get(DeviceService); - devicegroupService = module.get(DeviceGroupService); - - mockResponse = { - setHeader: jest.fn(), - write: jest.fn().mockImplementation((data, encoding, callback) => callback()), - end: jest.fn(), - }; - - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); - - describe('createCSV', ()=> { - it('should create CSV file and send it as response', async () => { - const mockData: CheckCertificateIssueDateLogForDeviceEntity[] = [ - { - certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), - certificate_issuance_enddate: new Date('2023-11-10T04:15:58.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '14f8bcd3-095b-4659-90d8-bbc7523d14b4', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 3 - }, - { - certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), - certificate_issuance_enddate: new Date('2023-11-09T04:15:58.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '37aa312a-405d-4e37-97f3-8af06a0b1e10', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 2 - }, - { - certificate_issuance_startdate: new Date('2022-11-26T11:01:00.000Z'), - certificate_issuance_enddate: new Date('2023-11-06T08:27:44.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '770d39fd-fbb3-4eb9-82df-260a740b5151', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 1 - } - ]; - - jest.spyOn(service, 'Findperdevicecertificatelog').mockResolvedValue(mockData); - - await service.createCSV(mockResponse as Response, 1, 1, 'Certificates'); - - expect(mockResponse.setHeader).toHaveBeenCalledWith( - 'Content-Disposition', - 'attachment; filename=Certificates ' + new Date().toLocaleDateString() + '.csv' - ); - expect(mockResponse.setHeader).toHaveBeenCalledWith('Content-Type', 'text/csv'); - expect(mockResponse.write).toHaveBeenCalledTimes(1); - expect(mockResponse.end).toHaveBeenCalledTimes(1); - }); - - it('should handle errors and throw HttpException', async () => { - jest.spyOn(service, 'Findperdevicecertificatelog').mockRejectedValue(new Error('Test error')); - - await expect(service.createCSV(mockResponse as Response, 1, 1, 'Certificates')).rejects.toThrowError( - 'Devices log Not found' - ); - - expect(mockResponse.setHeader).not.toHaveBeenCalled(); - expect(mockResponse.write).not.toHaveBeenCalled(); - expect(mockResponse.end).not.toHaveBeenCalled(); - }); - }); - - describe('Findperdevicecertificatelog', ()=> { - it('should return certificate logs for the provided group and organization', async () => { - const groupId = 1; - const organizationId = 1; - - const expectedLogs: CheckCertificateIssueDateLogForDeviceEntity[] = [ - { - certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), - certificate_issuance_enddate: new Date('2023-11-10T04:15:58.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '14f8bcd3-095b-4659-90d8-bbc7523d14b4', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 3 - }, - { - certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), - certificate_issuance_enddate: new Date('2023-11-09T04:15:58.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '37aa312a-405d-4e37-97f3-8af06a0b1e10', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 2 - }, - { - certificate_issuance_startdate: new Date('2022-11-26T11:01:00.000Z'), - certificate_issuance_enddate: new Date('2023-11-06T08:27:44.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '770d39fd-fbb3-4eb9-82df-260a740b5151', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 1 - }, - ]; - - jest.spyOn(service, 'Findperdevicecertificatelog').mockResolvedValueOnce(expectedLogs); - - const result = await service.Findperdevicecertificatelog(groupId, organizationId); - - expect(result).toEqual(expectedLogs); - expect(service.Findperdevicecertificatelog).toHaveBeenCalledWith(groupId, organizationId); - }); - - it('should handle error for invalid group id', async () => { - const groupId = 'invalidGroupId'; - const organizationId = 'validOrganizationId'; - jest.spyOn(service, 'Findperdevicecertificatelog').mockRejectedValueOnce(new Error('Invalid group id')); - - await expect(service.Findperdevicecertificatelog(groupId, organizationId)).rejects.toThrowError('Invalid group id'); - expect(service.Findperdevicecertificatelog).toHaveBeenCalledWith(groupId, organizationId); - }); - - it('should handle error for invalid organization id', async () => { - const groupId = 'validGroupId'; - const organizationId = 'invalidOrganizationId'; - jest.spyOn(service, 'Findperdevicecertificatelog').mockRejectedValueOnce(new Error('Invalid organization id')); - - await expect(service.Findperdevicecertificatelog(groupId, organizationId)).rejects.toThrowError('Invalid organization id'); - expect(service.Findperdevicecertificatelog).toHaveBeenCalledWith(groupId, organizationId); - }); - }); - - describe('getCertifiedlogofDevices', ()=> { - it('should return old certificates when old reservation information is available', async () => { - // Mock user, filter DTO, and page number - const user: ILoggedInUser = { - id: 2, - organizationId: 2, - email: 'testsweya@gmail.com', - blockchainAccountAddress: undefined, - role: Role.OrganizationAdmin, - hasRole: function (...role: Role[]): boolean { - throw new Error('Function not implemented.'); - }, - ownerId: '', - hasOrganization: false, - //@ts-ignore - hasPermission: true, - api_user_id: 'apiuserId', - }; - const filterDto: FilterDTO = { - fuelCode: FuelCode.ES100, - deviceTypeCode: DevicetypeCode.TC110, - fromAmountread: 20, - toAmountread: 1500, - offTaker: OffTaker.Education, - start_date: '2020-01-01 00:00:000Z', - end_date: '2024-02-14 12:51:000Z', - country: 'India', - SDGBenefits: undefined, - }; - const pageNumber = 1; - - const getoldreservationinfo = { deviceGroups: [ - { - dg_id: 2, - name: 'secondreservation', - deviceIdsInt:[1,2], - internalCertificateId: [], - }, - { - dg_id: 3, - name: 'thirdreservation', - deviceIdsInt:[2,3], - internalCertificateId: [], - }, - { - dg_id: 4, - name: 'fourthreservation', - deviceIdsInt:[4,5], - internalCertificateId: [], - } - ] - }; - - const getnewreservationinfo = { deviceGroups: [] }; - - const getReservationInforDeveloperBsiseSpy = jest.spyOn(devicegroupService, 'getReservationInforDeveloperBsise').mockResolvedValueOnce(getnewreservationinfo); - const getoldReservationInforDeveloperBsiseSpy = jest.spyOn(devicegroupService, 'getoldReservationInforDeveloperBsise').mockResolvedValueOnce(getoldreservationinfo); - - // Mock getDeveloperfindreservationcertified method - const expectedCertificates = { certificatelog: [{ - certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), - certificate_issuance_enddate: new Date('2023-11-10T04:15:58.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '14f8bcd3-095b-4659-90d8-bbc7523d14b4', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 3 - }, - { - certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), - certificate_issuance_enddate: new Date('2023-11-09T04:15:58.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '37aa312a-405d-4e37-97f3-8af06a0b1e10', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 2 - }, - { - certificate_issuance_startdate: new Date('2022-11-26T11:01:00.000Z'), - certificate_issuance_enddate: new Date('2023-11-06T08:27:44.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '770d39fd-fbb3-4eb9-82df-260a740b5151', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 1 - },], currentpage: 1, totalPages: 1, totalCount: 1 }; - - const getDeveloperfindreservationcertifiedSpy = jest.spyOn(service, 'getDeveloperfindreservationcertified').mockResolvedValueOnce(expectedCertificates as unknown as CertificatelogResponse); - - const result = await service.getCertifiedlogofDevices(user, filterDto, pageNumber); - expect(getReservationInforDeveloperBsiseSpy).toHaveBeenCalledWith(user.organizationId, user.role, filterDto, pageNumber, user.api_user_id ); - expect(getoldReservationInforDeveloperBsiseSpy).toHaveBeenCalledWith(user.organizationId, user.role, filterDto, pageNumber, user.api_user_id ); - expect(result).toEqual(expectedCertificates); // Assert that expected certificates are returned - }); - - it('should return new certificates when new reservation information is available', async () => { - // Mock user, filter DTO, and page number - const user: ILoggedInUser = { - id: 2, - organizationId: 2, - email: 'testsweya@gmail.com', - blockchainAccountAddress: undefined, - role: Role.OrganizationAdmin, - hasRole: function (...role: Role[]): boolean { - throw new Error('Function not implemented.'); - }, - ownerId: '', - hasOrganization: false, - //@ts-ignore - hasPermission: true, - api_user_id: 'apiuserId', - }; - const filterDto: FilterDTO = { fuelCode: FuelCode.ES100, - deviceTypeCode: DevicetypeCode.TC110, - fromAmountread: 20, - toAmountread: 1500, - offTaker: OffTaker.Education, - start_date: '2020-01-01 00:00:000Z', - end_date: '2024-02-14 12:51:000Z', - country: 'India', - SDGBenefits: undefined, - }; - const pageNumber = 1; - - const getoldreservationinfo = { deviceGroups:[] }; - - const getnewreservationinfo = { deviceGroups: [{ - dg_id: 5, - name: 'secondreservation', - deviceIdsInt:[1,2], - internalCertificateId: [], - }, - { - dg_id: 6, - name: 'thirdreservation', - deviceIdsInt:[2,3], - internalCertificateId: [], - }, - { - dg_id: 7, - name: 'fourthreservation', - deviceIdsInt:[4,5], - internalCertificateId: [], - } - ] - }; - - // Mock getReservationInforDeveloperBsise and getoldReservationInforDeveloperBsise methods - jest.spyOn(devicegroupService, 'getReservationInforDeveloperBsise').mockResolvedValueOnce(getnewreservationinfo); - jest.spyOn(devicegroupService, 'getoldReservationInforDeveloperBsise').mockResolvedValueOnce(getoldreservationinfo); - - // Mock getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247 method - const expectedCertificates = { certificatelog: [{ - certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), - certificate_issuance_enddate: new Date('2023-11-10T04:15:58.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '14f8bcd3-095b-4659-90d8-bbc7523d14b4', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 3 - }, - { - certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), - certificate_issuance_enddate: new Date('2023-11-09T04:15:58.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '37aa312a-405d-4e37-97f3-8af06a0b1e10', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 2 - }, - { - certificate_issuance_startdate: new Date('2022-11-26T11:01:00.000Z'), - certificate_issuance_enddate: new Date('2023-11-06T08:27:44.000Z'), - readvalue_watthour: 10000, - certificateTransactionUID: '770d39fd-fbb3-4eb9-82df-260a740b5151', - //@ts-ignore - reservation_name: 'secondreservation', - externalId: 'Ext2', - blockchainCertificateId: 1 - },], currentpage: 1, totalPages: 1, totalCount: 1 }; - jest.spyOn(service, 'getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247').mockResolvedValueOnce(expectedCertificates as unknown as CertificatelogResponse); - - const result = await service.getCertifiedlogofDevices(user, filterDto, pageNumber); - - expect(result).toEqual(expectedCertificates); // Assert that expected certificates are returned - }); - - it('should return empty certificates when both old and new reservation information are unavailable', async () => { - // Mock user, filter DTO, and page number - const user: ILoggedInUser = { - id: 2, - organizationId: 2, - email: 'testsweya@gmail.com', - blockchainAccountAddress: undefined, - role: Role.OrganizationAdmin, - hasRole: function (...role: Role[]): boolean { - throw new Error('Function not implemented.'); - }, - ownerId: '', - hasOrganization: false, - //@ts-ignore - hasPermission: true, - api_user_id: 'apiuserId', - }; - const filterDto: FilterDTO = { - fuelCode: FuelCode.ES100, - deviceTypeCode: DevicetypeCode.TC110, - fromAmountread: 20, - toAmountread: 1500, - offTaker: OffTaker.Education, - start_date: '2020-01-01 00:00:000Z', - end_date: '2024-02-14 12:51:000Z', - country: 'India', - SDGBenefits: undefined, - }; - const pageNumber = 1; - - const getreservationinfo = { deviceGroups: []}; - - jest.spyOn(devicegroupService, 'getReservationInforDeveloperBsise').mockResolvedValueOnce(getreservationinfo); - jest.spyOn(devicegroupService, 'getoldReservationInforDeveloperBsise').mockResolvedValueOnce(getreservationinfo); - - const result = await service.getCertifiedlogofDevices(user, filterDto, pageNumber); - - expect(result).toEqual({ certificatelog: [], currentpage: 0, totalPages: 0, totalCount: 0 }); // Assert that empty certificates are returned - }); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { Repository } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { CheckCertificateIssueDateLogForDeviceEntity } from '../device/check_certificate_issue_date_log_for_device.entity'; +import { CertificateLogService } from './certificate-log.service'; +import { Certificate } from '@energyweb/issuer-api'; +import { CertificateReadModelEntity } from '@energyweb/origin-247-certificate/dist/js/src/offchain-certificate/repositories/CertificateReadModel/CertificateReadModel.entity'; +import { DeviceService } from '../device'; +import { DeviceGroupService } from '../device-group/device-group.service'; +import { Response } from 'express'; +import { ILoggedInUser } from '../../models/LoggedInUser'; +import { + DevicetypeCode, + FuelCode, + OffTaker, + PermissionString, + Role, +} from '../../utils/enums'; +import { FilterDTO } from './dto/filter.dto'; +import { CertificatelogResponse } from './dto'; + +describe('CertificateLogService', () => { + let service: CertificateLogService; + let repository: Repository; + let certificaterrepository: Repository; + let certificateReadModelEntity: Repository>; + let mockResponse: Partial; + let deviceService: DeviceService; + let devicegroupService: DeviceGroupService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + CertificateLogService, + { + provide: getRepositoryToken( + CheckCertificateIssueDateLogForDeviceEntity, + ), + useClass: Repository, + useValue: { + createQueryBuilder: jest.fn(() => ({ + select: jest.fn().mockReturnThis(), + addSelect: jest.fn().mockReturnThis(), + from: jest.fn().mockReturnThis(), + leftJoin: jest.fn().mockReturnThis(), + innerJoin: jest.fn().mockReturnThis(), + where: jest.fn().mockReturnThis(), + andWhere: jest.fn().mockReturnThis(), + getRawMany: jest.fn(), + })), + }, + }, + { + provide: getRepositoryToken(Certificate), + useClass: Repository, + }, + { + provide: getRepositoryToken(CertificateReadModelEntity), + useClass: Repository, + }, + { + provide: DeviceService, + useValue: {} as any, + }, + { + provide: DeviceGroupService, + useValue: { + getReservationInforDeveloperBsise: jest.fn(), + getoldReservationInforDeveloperBsise: jest.fn(), + } as any, + }, + ], + }).compile(); + + service = module.get(CertificateLogService); + repository = module.get< + Repository + >(getRepositoryToken(CheckCertificateIssueDateLogForDeviceEntity)); + certificaterrepository = module.get>( + getRepositoryToken(Certificate), + ); + certificateReadModelEntity = module.get< + Repository> + >(getRepositoryToken(CertificateReadModelEntity)); + deviceService = module.get(DeviceService); + devicegroupService = module.get(DeviceGroupService); + + mockResponse = { + setHeader: jest.fn(), + write: jest + .fn() + .mockImplementation((data, encoding, callback) => callback()), + end: jest.fn(), + }; + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); + + describe('createCSV', () => { + it('should create CSV file and send it as response', async () => { + const mockData: CheckCertificateIssueDateLogForDeviceEntity[] = [ + { + certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), + certificate_issuance_enddate: new Date('2023-11-10T04:15:58.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '14f8bcd3-095b-4659-90d8-bbc7523d14b4', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 3, + }, + { + certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), + certificate_issuance_enddate: new Date('2023-11-09T04:15:58.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '37aa312a-405d-4e37-97f3-8af06a0b1e10', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 2, + }, + { + certificate_issuance_startdate: new Date('2022-11-26T11:01:00.000Z'), + certificate_issuance_enddate: new Date('2023-11-06T08:27:44.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '770d39fd-fbb3-4eb9-82df-260a740b5151', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 1, + }, + ]; + + jest + .spyOn(service, 'Findperdevicecertificatelog') + .mockResolvedValue(mockData); + + await service.createCSV(mockResponse as Response, 1, 1, 'Certificates'); + + expect(mockResponse.setHeader).toHaveBeenCalledWith( + 'Content-Disposition', + 'attachment; filename=Certificates ' + + new Date().toLocaleDateString() + + '.csv', + ); + expect(mockResponse.setHeader).toHaveBeenCalledWith( + 'Content-Type', + 'text/csv', + ); + expect(mockResponse.write).toHaveBeenCalledTimes(1); + expect(mockResponse.end).toHaveBeenCalledTimes(1); + }); + + it('should handle errors and throw HttpException', async () => { + jest + .spyOn(service, 'Findperdevicecertificatelog') + .mockRejectedValue(new Error('Test error')); + + await expect( + service.createCSV(mockResponse as Response, 1, 1, 'Certificates'), + ).rejects.toThrowError('Devices log Not found'); + + expect(mockResponse.setHeader).not.toHaveBeenCalled(); + expect(mockResponse.write).not.toHaveBeenCalled(); + expect(mockResponse.end).not.toHaveBeenCalled(); + }); + }); + + describe('Findperdevicecertificatelog', () => { + it('should return certificate logs for the provided group and organization', async () => { + const groupId = 1; + const organizationId = 1; + + const expectedLogs: CheckCertificateIssueDateLogForDeviceEntity[] = [ + { + certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), + certificate_issuance_enddate: new Date('2023-11-10T04:15:58.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '14f8bcd3-095b-4659-90d8-bbc7523d14b4', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 3, + }, + { + certificate_issuance_startdate: new Date('2023-11-06T12:48:18.405Z'), + certificate_issuance_enddate: new Date('2023-11-09T04:15:58.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '37aa312a-405d-4e37-97f3-8af06a0b1e10', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 2, + }, + { + certificate_issuance_startdate: new Date('2022-11-26T11:01:00.000Z'), + certificate_issuance_enddate: new Date('2023-11-06T08:27:44.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '770d39fd-fbb3-4eb9-82df-260a740b5151', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 1, + }, + ]; + + jest + .spyOn(service, 'Findperdevicecertificatelog') + .mockResolvedValueOnce(expectedLogs); + + const result = await service.Findperdevicecertificatelog( + groupId, + organizationId, + ); + + expect(result).toEqual(expectedLogs); + expect(service.Findperdevicecertificatelog).toHaveBeenCalledWith( + groupId, + organizationId, + ); + }); + + it('should handle error for invalid group id', async () => { + const groupId = 'invalidGroupId'; + const organizationId = 'validOrganizationId'; + jest + .spyOn(service, 'Findperdevicecertificatelog') + .mockRejectedValueOnce(new Error('Invalid group id')); + + await expect( + service.Findperdevicecertificatelog(groupId, organizationId), + ).rejects.toThrowError('Invalid group id'); + expect(service.Findperdevicecertificatelog).toHaveBeenCalledWith( + groupId, + organizationId, + ); + }); + + it('should handle error for invalid organization id', async () => { + const groupId = 'validGroupId'; + const organizationId = 'invalidOrganizationId'; + jest + .spyOn(service, 'Findperdevicecertificatelog') + .mockRejectedValueOnce(new Error('Invalid organization id')); + + await expect( + service.Findperdevicecertificatelog(groupId, organizationId), + ).rejects.toThrowError('Invalid organization id'); + expect(service.Findperdevicecertificatelog).toHaveBeenCalledWith( + groupId, + organizationId, + ); + }); + }); + + describe('getCertifiedlogofDevices', () => { + it('should return old certificates when old reservation information is available', async () => { + // Mock user, filter DTO, and page number + const user: ILoggedInUser = { + id: 2, + organizationId: 2, + email: 'testsweya@gmail.com', + blockchainAccountAddress: undefined, + role: Role.OrganizationAdmin, + hasRole: function (...role: Role[]): boolean { + throw new Error('Function not implemented.'); + }, + ownerId: '', + hasOrganization: false, + //@ts-ignore + hasPermission: true, + api_user_id: 'apiuserId', + }; + const filterDto: FilterDTO = { + fuelCode: FuelCode.ES100, + deviceTypeCode: DevicetypeCode.TC110, + fromAmountread: 20, + toAmountread: 1500, + offTaker: OffTaker.Education, + start_date: '2020-01-01 00:00:000Z', + end_date: '2024-02-14 12:51:000Z', + country: 'India', + SDGBenefits: undefined, + }; + const pageNumber = 1; + + const getoldreservationinfo = { + deviceGroups: [ + { + dg_id: 2, + name: 'secondreservation', + deviceIdsInt: [1, 2], + internalCertificateId: [], + }, + { + dg_id: 3, + name: 'thirdreservation', + deviceIdsInt: [2, 3], + internalCertificateId: [], + }, + { + dg_id: 4, + name: 'fourthreservation', + deviceIdsInt: [4, 5], + internalCertificateId: [], + }, + ], + }; + + const getnewreservationinfo = { deviceGroups: [] }; + + const getReservationInforDeveloperBsiseSpy = jest + .spyOn(devicegroupService, 'getReservationInforDeveloperBsise') + .mockResolvedValueOnce(getnewreservationinfo); + const getoldReservationInforDeveloperBsiseSpy = jest + .spyOn(devicegroupService, 'getoldReservationInforDeveloperBsise') + .mockResolvedValueOnce(getoldreservationinfo); + + // Mock getDeveloperfindreservationcertified method + const expectedCertificates = { + certificatelog: [ + { + certificate_issuance_startdate: new Date( + '2023-11-06T12:48:18.405Z', + ), + certificate_issuance_enddate: new Date('2023-11-10T04:15:58.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '14f8bcd3-095b-4659-90d8-bbc7523d14b4', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 3, + }, + { + certificate_issuance_startdate: new Date( + '2023-11-06T12:48:18.405Z', + ), + certificate_issuance_enddate: new Date('2023-11-09T04:15:58.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '37aa312a-405d-4e37-97f3-8af06a0b1e10', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 2, + }, + { + certificate_issuance_startdate: new Date( + '2022-11-26T11:01:00.000Z', + ), + certificate_issuance_enddate: new Date('2023-11-06T08:27:44.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '770d39fd-fbb3-4eb9-82df-260a740b5151', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 1, + }, + ], + currentpage: 1, + totalPages: 1, + totalCount: 1, + }; + + const getDeveloperfindreservationcertifiedSpy = jest + .spyOn(service, 'getDeveloperfindreservationcertified') + .mockResolvedValueOnce( + expectedCertificates as unknown as CertificatelogResponse, + ); + + const result = await service.getCertifiedlogofDevices( + user, + filterDto, + pageNumber, + ); + expect(getReservationInforDeveloperBsiseSpy).toHaveBeenCalledWith( + user.organizationId, + user.role, + filterDto, + pageNumber, + user.api_user_id, + ); + expect(getoldReservationInforDeveloperBsiseSpy).toHaveBeenCalledWith( + user.organizationId, + user.role, + filterDto, + pageNumber, + user.api_user_id, + ); + expect(result).toEqual(expectedCertificates); // Assert that expected certificates are returned + }); + + it('should return new certificates when new reservation information is available', async () => { + // Mock user, filter DTO, and page number + const user: ILoggedInUser = { + id: 2, + organizationId: 2, + email: 'testsweya@gmail.com', + blockchainAccountAddress: undefined, + role: Role.OrganizationAdmin, + hasRole: function (...role: Role[]): boolean { + throw new Error('Function not implemented.'); + }, + ownerId: '', + hasOrganization: false, + //@ts-ignore + hasPermission: true, + api_user_id: 'apiuserId', + }; + const filterDto: FilterDTO = { + fuelCode: FuelCode.ES100, + deviceTypeCode: DevicetypeCode.TC110, + fromAmountread: 20, + toAmountread: 1500, + offTaker: OffTaker.Education, + start_date: '2020-01-01 00:00:000Z', + end_date: '2024-02-14 12:51:000Z', + country: 'India', + SDGBenefits: undefined, + }; + const pageNumber = 1; + + const getoldreservationinfo = { deviceGroups: [] }; + + const getnewreservationinfo = { + deviceGroups: [ + { + dg_id: 5, + name: 'secondreservation', + deviceIdsInt: [1, 2], + internalCertificateId: [], + }, + { + dg_id: 6, + name: 'thirdreservation', + deviceIdsInt: [2, 3], + internalCertificateId: [], + }, + { + dg_id: 7, + name: 'fourthreservation', + deviceIdsInt: [4, 5], + internalCertificateId: [], + }, + ], + }; + + // Mock getReservationInforDeveloperBsise and getoldReservationInforDeveloperBsise methods + jest + .spyOn(devicegroupService, 'getReservationInforDeveloperBsise') + .mockResolvedValueOnce(getnewreservationinfo); + jest + .spyOn(devicegroupService, 'getoldReservationInforDeveloperBsise') + .mockResolvedValueOnce(getoldreservationinfo); + + // Mock getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247 method + const expectedCertificates = { + certificatelog: [ + { + certificate_issuance_startdate: new Date( + '2023-11-06T12:48:18.405Z', + ), + certificate_issuance_enddate: new Date('2023-11-10T04:15:58.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '14f8bcd3-095b-4659-90d8-bbc7523d14b4', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 3, + }, + { + certificate_issuance_startdate: new Date( + '2023-11-06T12:48:18.405Z', + ), + certificate_issuance_enddate: new Date('2023-11-09T04:15:58.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '37aa312a-405d-4e37-97f3-8af06a0b1e10', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 2, + }, + { + certificate_issuance_startdate: new Date( + '2022-11-26T11:01:00.000Z', + ), + certificate_issuance_enddate: new Date('2023-11-06T08:27:44.000Z'), + readvalue_watthour: 10000, + certificateTransactionUID: '770d39fd-fbb3-4eb9-82df-260a740b5151', + //@ts-ignore + reservation_name: 'secondreservation', + externalId: 'Ext2', + blockchainCertificateId: 1, + }, + ], + currentpage: 1, + totalPages: 1, + totalCount: 1, + }; + jest + .spyOn( + service, + 'getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247', + ) + .mockResolvedValueOnce( + expectedCertificates as unknown as CertificatelogResponse, + ); + + const result = await service.getCertifiedlogofDevices( + user, + filterDto, + pageNumber, + ); + + expect(result).toEqual(expectedCertificates); // Assert that expected certificates are returned + }); + + it('should return empty certificates when both old and new reservation information are unavailable', async () => { + // Mock user, filter DTO, and page number + const user: ILoggedInUser = { + id: 2, + organizationId: 2, + email: 'testsweya@gmail.com', + blockchainAccountAddress: undefined, + role: Role.OrganizationAdmin, + hasRole: function (...role: Role[]): boolean { + throw new Error('Function not implemented.'); + }, + ownerId: '', + hasOrganization: false, + //@ts-ignore + hasPermission: true, + api_user_id: 'apiuserId', + }; + const filterDto: FilterDTO = { + fuelCode: FuelCode.ES100, + deviceTypeCode: DevicetypeCode.TC110, + fromAmountread: 20, + toAmountread: 1500, + offTaker: OffTaker.Education, + start_date: '2020-01-01 00:00:000Z', + end_date: '2024-02-14 12:51:000Z', + country: 'India', + SDGBenefits: undefined, + }; + const pageNumber = 1; + + const getreservationinfo = { deviceGroups: [] }; + + jest + .spyOn(devicegroupService, 'getReservationInforDeveloperBsise') + .mockResolvedValueOnce(getreservationinfo); + jest + .spyOn(devicegroupService, 'getoldReservationInforDeveloperBsise') + .mockResolvedValueOnce(getreservationinfo); + + const result = await service.getCertifiedlogofDevices( + user, + filterDto, + pageNumber, + ); + + expect(result).toEqual({ + certificatelog: [], + currentpage: 0, + totalPages: 0, + totalCount: 0, + }); // Assert that empty certificates are returned + }); + }); +}); diff --git a/apps/drec-api/src/pods/certificate-log/certificate-log.service.ts b/apps/drec-api/src/pods/certificate-log/certificate-log.service.ts index fdf4ab3e9..b5e3d9250 100755 --- a/apps/drec-api/src/pods/certificate-log/certificate-log.service.ts +++ b/apps/drec-api/src/pods/certificate-log/certificate-log.service.ts @@ -1,20 +1,30 @@ +import { Injectable, Logger, HttpException, HttpStatus } from '@nestjs/common'; +import { CheckCertificateIssueDateLogForDeviceEntity } from '../device/check_certificate_issue_date_log_for_device.entity'; import { - Injectable, - Logger, - HttpException, - HttpStatus, -} from '@nestjs/common'; -import { CheckCertificateIssueDateLogForDeviceEntity } from '../device/check_certificate_issue_date_log_for_device.entity' -import { getManager, Repository, IsNull, Not, Brackets, SelectQueryBuilder, EntityManager } from 'typeorm'; + getManager, + Repository, + IsNull, + Not, + Brackets, + SelectQueryBuilder, + EntityManager, +} from 'typeorm'; import { FilterDTO } from './dto/filter.dto'; import { InjectRepository } from '@nestjs/typeorm'; import { Device } from '../device/device.entity'; import { Certificate } from '@energyweb/issuer-api'; import { DeviceService } from '../device/device.service'; -import { CertificateNewWithPerDeviceLog, CertificateWithPerdevicelog, CertificatelogResponse } from './dto' +import { + CertificateNewWithPerDeviceLog, + CertificateWithPerdevicelog, + CertificatelogResponse, +} from './dto'; import { DeviceGroupService } from '../device-group/device-group.service'; -import { DeviceGroupDTO } from '../device-group/dto' -import { IGetAllCertificatesOptions, ICertificateReadModel } from '@energyweb/origin-247-certificate'; +import { DeviceGroupDTO } from '../device-group/dto'; +import { + IGetAllCertificatesOptions, + ICertificateReadModel, +} from '@energyweb/origin-247-certificate'; import { ICertificateMetadata } from '../../utils/types'; import { getLocalTimeZoneFromDevice } from '../../utils/localTimeDetailsForDevice'; import { CertificateReadModelEntity } from '@energyweb/origin-247-certificate/dist/js/src/offchain-certificate/repositories/CertificateReadModel/CertificateReadModel.entity'; @@ -26,22 +36,25 @@ import * as fs from 'fs'; import { Response } from 'express'; export interface newCertificate extends Certificate { - perDeviceCertificateLog: CheckCertificateIssueDateLogForDeviceEntity + perDeviceCertificateLog: CheckCertificateIssueDateLogForDeviceEntity; } @Injectable() export class CertificateLogService { private readonly logger = new Logger(CertificateLogService.name); constructor( - @InjectRepository(CheckCertificateIssueDateLogForDeviceEntity) private readonly repository: Repository, + @InjectRepository(CheckCertificateIssueDateLogForDeviceEntity) + private readonly repository: Repository, - @InjectRepository(Certificate) private readonly certificaterrepository: Repository, + @InjectRepository(Certificate) + private readonly certificaterrepository: Repository, - @InjectRepository(CertificateReadModelEntity) private readonly cretificatereadmoduleRepository, + @InjectRepository(CertificateReadModelEntity) + private readonly cretificatereadmoduleRepository, private deviceService: DeviceService, private devicegroupService: DeviceGroupService, - ) { } + ) {} public async find(): Promise { this.logger.verbose(`With in find`); @@ -49,13 +62,14 @@ export class CertificateLogService { return this.repository.find(); } - - public async findByGroupId(groupId: string): Promise { + public async findByGroupId( + groupId: string, + ): Promise { this.logger.verbose(`With in findByGroupId`); // const query = this.getFilteredQuery(filterDto); return this.repository.find({ where: { - groupId + groupId, }, }); } @@ -91,26 +105,30 @@ export class CertificateLogService { // return query; // } - async Findcertificatelog(filterDto: FilterDTO): Promise { + async Findcertificatelog( + filterDto: FilterDTO, + ): Promise { this.logger.verbose(`With in Findcertificatelog`); - const totalNumbers: any = getManager().createQueryBuilder() - .select("d.externalId", "externalId") - .addSelect("(COUNT(dl.id))", "total") - .from(CheckCertificateIssueDateLogForDeviceEntity, "dl") - .leftJoin(Device, "d", "dl.externalId = d.externalId") + const totalNumbers: any = getManager() + .createQueryBuilder() + .select('d.externalId', 'externalId') + .addSelect('(COUNT(dl.id))', 'total') + .from(CheckCertificateIssueDateLogForDeviceEntity, 'dl') + .leftJoin(Device, 'd', 'dl.externalId = d.externalId') .where('d.organizationId = :orgid', { orgid: 3 }) - .andWhere("dl.readvalue_watthour>0") - .groupBy("d.externalId"); + .andWhere('dl.readvalue_watthour>0') + .groupBy('d.externalId'); //console.log(totalExamNumbers.getQuery()) const devicelog = await totalNumbers.getRawMany(); //console.log(devicelog) return devicelog; - } - - async getCertificateFromOldOrNewUfinction(groupid: string, pageNumber?: number): Promise { + async getCertificateFromOldOrNewUfinction( + groupid: string, + pageNumber?: number, + ): Promise { this.logger.verbose(`With in getCertificateFromOldOrNewUfinction`); if (pageNumber === undefined || pageNumber === null) { pageNumber = 1; @@ -118,34 +136,35 @@ export class CertificateLogService { let page = pageNumber; // Specify the page number you want to retrieve const itemsPerPage = 20; // Specify the number of items per page - const [certifiedreservation, total] = await this.certificaterrepository.findAndCount({ - where: { - deviceId: groupid, - }, - order: { - createdAt: 'DESC', - }, - skip: (page - 1) * itemsPerPage, - take: itemsPerPage, - }); + const [certifiedreservation, total] = + await this.certificaterrepository.findAndCount({ + where: { + deviceId: groupid, + }, + order: { + createdAt: 'DESC', + }, + skip: (page - 1) * itemsPerPage, + take: itemsPerPage, + }); const totalPages = Math.ceil(total / itemsPerPage); let request: IGetAllCertificatesOptions = { //@ts-ignore - deviceId: parseInt(groupid) - } - - const certifiedreservation1: ICertificateReadModel[] = await this.cretificatereadmoduleRepository.find({ - where: { - deviceId: groupid, - }, - order: { - createdAt: 'DESC', - }, - skip: (page - 1) * itemsPerPage, // Calculate the number of items to skip based on the page number - take: itemsPerPage, // Specify the number of items to take per page + deviceId: parseInt(groupid), + }; - }); + const certifiedreservation1: ICertificateReadModel[] = + await this.cretificatereadmoduleRepository.find({ + where: { + deviceId: groupid, + }, + order: { + createdAt: 'DESC', + }, + skip: (page - 1) * itemsPerPage, // Calculate the number of items to skip based on the page number + take: itemsPerPage, // Specify the number of items to take per page + }); const total1 = await this.cretificatereadmoduleRepository.find({ where: { deviceId: groupid, @@ -154,7 +173,10 @@ export class CertificateLogService { const totalPages1 = Math.ceil(total1.length / itemsPerPage); if (certifiedreservation.length > 0) { - const logdata = await this.getfindreservationcertified(certifiedreservation, groupid); + const logdata = await this.getfindreservationcertified( + certifiedreservation, + groupid, + ); const response = { certificatelog: logdata, totalItems: total, @@ -162,10 +184,13 @@ export class CertificateLogService { totalPages: totalPages, }; - return response - + return response; } else if (certifiedreservation1.length > 0) { - const logdata1 = await this.getCertificatesUsingGroupIDVersionUpdateOrigin247(certifiedreservation1, groupid); + const logdata1 = + await this.getCertificatesUsingGroupIDVersionUpdateOrigin247( + certifiedreservation1, + groupid, + ); const response2 = { certificatelog: logdata1, totalItems: total1.length, @@ -173,28 +198,38 @@ export class CertificateLogService { totalPages: totalPages1, }; - return response2 + return response2; } } - async getfindreservationcertified(certifiedreservation: Certificate[], groupid: string): Promise { + async getfindreservationcertified( + certifiedreservation: Certificate[], + groupid: string, + ): Promise { this.logger.verbose(`With in getfindreservationcertified`); const res = await Promise.all( - certifiedreservation.map(async (certifiedlist: CertificateWithPerdevicelog) => { - certifiedlist.certificateStartDate = new Date(certifiedlist.generationStartTime * 1000).toISOString(); - certifiedlist.certificateEndDate = new Date(certifiedlist.generationEndTime * 1000).toISOString(); - certifiedlist.perDeviceCertificateLog = []; - - try { - JSON.parse(certifiedlist.metadata); - } - catch (e) { - this.logger.error(e, `certificate doesnt contains valid metadta ${certifiedlist}`); - return; - } - const obj = JSON.parse(certifiedlist.metadata); - //console.log("getdate", certifiedlist.generationStartTime, certifiedlist.generationEndTime) - /* Please see note below regarding generationStartTime + certifiedreservation.map( + async (certifiedlist: CertificateWithPerdevicelog) => { + certifiedlist.certificateStartDate = new Date( + certifiedlist.generationStartTime * 1000, + ).toISOString(); + certifiedlist.certificateEndDate = new Date( + certifiedlist.generationEndTime * 1000, + ).toISOString(); + certifiedlist.perDeviceCertificateLog = []; + + try { + JSON.parse(certifiedlist.metadata); + } catch (e) { + this.logger.error( + e, + `certificate doesnt contains valid metadta ${certifiedlist}`, + ); + return; + } + const obj = JSON.parse(certifiedlist.metadata); + //console.log("getdate", certifiedlist.generationStartTime, certifiedlist.generationEndTime) + /* Please see note below regarding generationStartTime node_modules\@energyweb\origin-247-certificate\dist\js\src\certificate.service.js async issue(params) { const command = { @@ -210,62 +245,95 @@ export class CertificateLogService { return this.mapCertificate(result); } */ - const devicereadstartdate = new Date((certifiedlist.generationStartTime - 1) * 1000);//as rounding when certificate is issued by EWFs package reference kept above and removing millseconds - const devicereadenddate = new Date((certifiedlist.generationEndTime + 1) * 1000);//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); - const devicelog = await this.getCheckCertificateIssueDateLogForDevice(parseInt(groupid), device.externalId, devicereadstartdate, devicereadenddate); - devicelog.forEach(async (singleDeviceLogEle) => { - singleDeviceLogEle.externalId = device.developerExternalId - singleDeviceLogEle['timezone'] = getLocalTimeZoneFromDevice(device.createdAt, device); - certifiedlist.perDeviceCertificateLog.push(singleDeviceLogEle); - - }); - - }) - ); - - return certifiedlist; - }), + const devicereadstartdate = new Date( + (certifiedlist.generationStartTime - 1) * 1000, + ); //as rounding when certificate is issued by EWFs package reference kept above and removing millseconds + const devicereadenddate = new Date( + (certifiedlist.generationEndTime + 1) * 1000, + ); //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); + const devicelog = + await this.getCheckCertificateIssueDateLogForDevice( + parseInt(groupid), + device.externalId, + devicereadstartdate, + devicereadenddate, + ); + devicelog.forEach(async (singleDeviceLogEle) => { + singleDeviceLogEle.externalId = device.developerExternalId; + singleDeviceLogEle['timezone'] = getLocalTimeZoneFromDevice( + device.createdAt, + device, + ); + certifiedlist.perDeviceCertificateLog.push(singleDeviceLogEle); + }); + }), + ); + + return certifiedlist; + }, + ), ); return res; } - async getCertificatesUsingGroupIDVersionUpdateOrigin247(certifiedreservation, groupid: string): Promise { - this.logger.verbose(`With in getCertificatesUsingGroupIDVersionUpdateOrigin247`); + async getCertificatesUsingGroupIDVersionUpdateOrigin247( + certifiedreservation, + groupid: string, + ): Promise { + this.logger.verbose( + `With in getCertificatesUsingGroupIDVersionUpdateOrigin247`, + ); // let request: IGetAllCertificatesOptions = { // deviceId: groupid // } // const certifiedreservation: ICertificateReadModel[] = await this.offChainCertificateService.getAll(request); - let certificatesInReservationWithLog: Array = []; - certifiedreservation.forEach(ele => certificatesInReservationWithLog.push({ ...ele, perDeviceCertificateLog: [], certificateStartDate: '', certificateEndDate: '' })); + let certificatesInReservationWithLog: Array = + []; + certifiedreservation.forEach((ele) => + certificatesInReservationWithLog.push({ + ...ele, + perDeviceCertificateLog: [], + certificateStartDate: '', + certificateEndDate: '', + }), + ); await Promise.all( - certifiedreservation.map(async (certifiedlist: ICertificateReadModel, index: number) => { - certificatesInReservationWithLog[index].certificateStartDate = new Date(certifiedlist.generationStartTime * 1000).toISOString(); - certificatesInReservationWithLog[index].certificateEndDate = new Date(certifiedlist.generationEndTime * 1000).toISOString(); - certificatesInReservationWithLog[index].perDeviceCertificateLog = []; - try { - if (typeof certifiedlist.metadata === "string") { - let data = JSON.parse(certifiedlist.metadata); + certifiedreservation.map( + async ( + certifiedlist: ICertificateReadModel, + index: number, + ) => { + certificatesInReservationWithLog[index].certificateStartDate = + new Date(certifiedlist.generationStartTime * 1000).toISOString(); + certificatesInReservationWithLog[index].certificateEndDate = new Date( + certifiedlist.generationEndTime * 1000, + ).toISOString(); + certificatesInReservationWithLog[index].perDeviceCertificateLog = []; + try { + if (typeof certifiedlist.metadata === 'string') { + let data = JSON.parse(certifiedlist.metadata); + } + } catch (e) { + this.logger.error( + e, + `certificate doesnt contains valid metadata ${certifiedlist}`, + ); + return; + } + let obj; + if (typeof certifiedlist.metadata === 'string') { + obj = JSON.parse(certifiedlist.metadata); + } else { + obj = certifiedlist.metadata; } - } - catch (e) { - this.logger.error(e, `certificate doesnt contains valid metadata ${certifiedlist}`); - return; - } - let obj; - if (typeof certifiedlist.metadata === "string") { - obj = JSON.parse(certifiedlist.metadata); - } - else { - obj = certifiedlist.metadata; - } - let certificateTransactionUID = obj.certificateTransactionUID; - //console.log("getdate", certifiedlist.generationStartTime, certifiedlist.generationEndTime) - /* Below note can be ignored for newer certificates as we added certificateTransactionUID which will overcome this issue as well + let certificateTransactionUID = obj.certificateTransactionUID; + //console.log("getdate", certifiedlist.generationStartTime, certifiedlist.generationEndTime) + /* Below note can be ignored for newer certificates as we added certificateTransactionUID which will overcome this issue as well Please see note below regarding generationStartTime node_modules\@energyweb\origin-247-certificate\dist\js\src\certificate.service.js async issue(params) { @@ -282,56 +350,84 @@ export class CertificateLogService { return this.mapCertificate(result); } */ - const devicereadstartdate = new Date((certifiedlist.generationStartTime - 1) * 1000);//as rounding when certificate is issued by EWFs package reference kept above and removing millseconds - const devicereadenddate = new Date((certifiedlist.generationEndTime + 1) * 1000);//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); - const devicelog = await this.getCheckCertificateIssueDateLogForDevice(parseInt(groupid), device.externalId, devicereadstartdate, devicereadenddate, certificateTransactionUID); - devicelog.forEach(singleDeviceLogEle => { - singleDeviceLogEle.externalId = device.developerExternalId - singleDeviceLogEle['timezone'] = getLocalTimeZoneFromDevice(device.createdAt, device); - - certificatesInReservationWithLog[index].perDeviceCertificateLog.push(singleDeviceLogEle); - }); - - return devicelog; - }) - ); - //console.log("perDeviceCertificateLog"); - return certificatesInReservationWithLog[index]; - }), + const devicereadstartdate = new Date( + (certifiedlist.generationStartTime - 1) * 1000, + ); //as rounding when certificate is issued by EWFs package reference kept above and removing millseconds + const devicereadenddate = new Date( + (certifiedlist.generationEndTime + 1) * 1000, + ); //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); + const devicelog = + await this.getCheckCertificateIssueDateLogForDevice( + parseInt(groupid), + device.externalId, + devicereadstartdate, + devicereadenddate, + certificateTransactionUID, + ); + devicelog.forEach((singleDeviceLogEle) => { + singleDeviceLogEle.externalId = device.developerExternalId; + singleDeviceLogEle['timezone'] = getLocalTimeZoneFromDevice( + device.createdAt, + device, + ); + + certificatesInReservationWithLog[ + index + ].perDeviceCertificateLog.push(singleDeviceLogEle); + }); + + return devicelog; + }), + ); + //console.log("perDeviceCertificateLog"); + return certificatesInReservationWithLog[index]; + }, + ), ); return certificatesInReservationWithLog; } - public async getCheckCertificateIssueDateLogForDevice(groupId: number, deviceid: string, + public async getCheckCertificateIssueDateLogForDevice( + groupId: number, + deviceid: string, startDate: Date, - endDate: Date, certificateTransactionUID?: string): Promise { + endDate: Date, + certificateTransactionUID?: string, + ): Promise { this.logger.verbose(`With in getCheckCertificateIssueDateLogForDevice`); try { let devicelog; if (certificateTransactionUID) { - devicelog = await this.getDevicelogFromTransactionUID(groupId, deviceid, certificateTransactionUID); + devicelog = await this.getDevicelogFromTransactionUID( + groupId, + deviceid, + certificateTransactionUID, + ); return devicelog; - } - else { - const query = this.getdevicelogFilteredQueryWithGroupID(groupId, deviceid, + } else { + const query = this.getdevicelogFilteredQueryWithGroupID( + groupId, + deviceid, startDate, - endDate); + endDate, + ); devicelog = await query.getRawMany(); } const reservedevices = await devicelog.map((s: any) => { const item: any = { id: s.issuelog_id, - certificate_issuance_startdate: s.issuelog_certificate_issuance_startdate, + certificate_issuance_startdate: + s.issuelog_certificate_issuance_startdate, certificate_issuance_enddate: s.issuelog_certificate_issuance_enddate, readvalue_watthour: s.issuelog_readvalue_watthour, status: s.issuelog_status, // deviceid: s.issuelog_externalId, - groupId: s.issuelog_groupId + groupId: s.issuelog_groupId, }; return item; }); @@ -340,68 +436,93 @@ export class CertificateLogService { this.logger.error(`Failed to retrieve device`, error.stack); } } - private getdevicelogFilteredQueryWithGroupID(groupId: number, deviceid: string, + private getdevicelogFilteredQueryWithGroupID( + groupId: number, + deviceid: string, startDate: Date, - endDate: Date): SelectQueryBuilder { + endDate: Date, + ): SelectQueryBuilder { this.logger.verbose(`With in getdevicelogFilteredQueryWithGroupID`); const query = this.repository - .createQueryBuilder("issuelog"). - where("issuelog.externalId = :deviceid", { deviceid: deviceid }) + .createQueryBuilder('issuelog') + .where('issuelog.externalId = :deviceid', { deviceid: deviceid }) .andWhere( new Brackets((db) => { db.where( new Brackets((db1) => { - db1.where("issuelog.certificate_issuance_startdate BETWEEN :DeviceReadingStartDate1 AND :DeviceReadingEndDate1", { DeviceReadingStartDate1: startDate, DeviceReadingEndDate1: endDate }) - .orWhere("issuelog.certificate_issuance_startdate = :DeviceReadingStartDate", { DeviceReadingStartDate: startDate }) - }) - ) - .andWhere( - new Brackets((db2) => { - db2.where("issuelog.certificate_issuance_enddate BETWEEN :DeviceReadingStartDate2 AND :DeviceReadingEndDate2", { DeviceReadingStartDate2: startDate, DeviceReadingEndDate2: endDate }) - .orWhere("issuelog.certificate_issuance_enddate = :DeviceReadingEndDate ", { DeviceReadingEndDate: endDate }) - }) - ) + db1 + .where( + 'issuelog.certificate_issuance_startdate BETWEEN :DeviceReadingStartDate1 AND :DeviceReadingEndDate1', + { + DeviceReadingStartDate1: startDate, + DeviceReadingEndDate1: endDate, + }, + ) + .orWhere( + 'issuelog.certificate_issuance_startdate = :DeviceReadingStartDate', + { DeviceReadingStartDate: startDate }, + ); + }), + ).andWhere( + new Brackets((db2) => { + db2 + .where( + 'issuelog.certificate_issuance_enddate BETWEEN :DeviceReadingStartDate2 AND :DeviceReadingEndDate2', + { + DeviceReadingStartDate2: startDate, + DeviceReadingEndDate2: endDate, + }, + ) + .orWhere( + 'issuelog.certificate_issuance_enddate = :DeviceReadingEndDate ', + { DeviceReadingEndDate: endDate }, + ); + }), + ); }), ) - .andWhere("issuelog.groupId = :groupId", { groupId: groupId }) + .andWhere('issuelog.groupId = :groupId', { groupId: groupId }); return query; } - private getDevicelogFromTransactionUID(groupId: number, deviceId: string, - certificateTransactionUID: string + private getDevicelogFromTransactionUID( + groupId: number, + deviceId: string, + certificateTransactionUID: string, ): Promise { this.logger.verbose(`With in getDevicelogFromTransactionUID`); - return this.repository.find( - { - where: { - groupId: groupId, - externalId: deviceId, - certificateTransactionUID: certificateTransactionUID - } - }) - + return this.repository.find({ + where: { + groupId: groupId, + externalId: deviceId, + certificateTransactionUID: certificateTransactionUID, + }, + }); } - - async getCertificaterForRedemptionRepot(groupid: string): Promise { + async getCertificaterForRedemptionRepot( + groupid: string, + ): Promise { this.logger.verbose(`With in getCertificaterForRedemptionRepot`); - const certifiedreservation = await this.certificaterrepository.find( - { - where: { - deviceId: groupid, - claims: Not(IsNull()) - } - }) + const certifiedreservation = await this.certificaterrepository.find({ + where: { + deviceId: groupid, + claims: Not(IsNull()), + }, + }); return certifiedreservation; } async getCertificateRedemptionReport(buyerId: number): Promise { this.logger.verbose(`With in getCertificateRedemptionReport`); - const devicegroups = await this.devicegroupService.getBuyerDeviceGroups(buyerId); + const devicegroups = + await this.devicegroupService.getBuyerDeviceGroups(buyerId); //console.log(devicegroups); const myredme = []; const res = await Promise.all( devicegroups.map(async (devicegroup: DeviceGroupDTO) => { - const cert = await this.getCertificaterForRedemptionRepot(devicegroup.id.toString()); + const cert = await this.getCertificaterForRedemptionRepot( + devicegroup.id.toString(), + ); //console.log(cert) const res1 = await Promise.all( cert.map(async (claimcertificate: Certificate) => { @@ -418,30 +539,43 @@ export class CertificateLogService { country: devicegroup?.countryCode.toString().split(','), capacityRange: devicegroup?.capacityRange, // installations: devicegroup?.installationConfigurations ? devicegroup?.installationConfigurations.join().replace(',', ', ') : '', - offTakers: devicegroup?.offTakers.join().replace(',', ' ,').toString().split(','), + offTakers: devicegroup?.offTakers + .join() + .replace(',', ' ,') + .toString() + .split(','), // sectors: devicegroup?.sectors ? devicegroup?.sectors.join().replace(',', ', ') : '', commissioningDateRange: devicegroup?.commissioningDateRange - .join().replace(',', ', '), + .join() + .replace(',', ', '), //standardCompliance: devicegroup?.standardCompliance, - redemptionDate: claims.claimData.periodStartDate.substring(claims.claimData.periodStartDate.indexOf(":") + 1), + redemptionDate: claims.claimData.periodStartDate.substring( + claims.claimData.periodStartDate.indexOf(':') + 1, + ), certifiedEnergy: claims.value / 10 ** 6, - beneficiary: claims.claimData.beneficiary.substring(claims.claimData.beneficiary.indexOf(":") + 1), - beneficiary_address: claims.claimData.location.substring(claims.claimData.location.indexOf(":") + 1), - claimCoiuntryCode: claims.claimData.countryCode.substring(claims.claimData.countryCode.indexOf(":") + 1), - purpose: claims.claimData.purpose.substring(claims.claimData.purpose.indexOf(":") + 1) + beneficiary: claims.claimData.beneficiary.substring( + claims.claimData.beneficiary.indexOf(':') + 1, + ), + beneficiary_address: claims.claimData.location.substring( + claims.claimData.location.indexOf(':') + 1, + ), + claimCoiuntryCode: claims.claimData.countryCode.substring( + claims.claimData.countryCode.indexOf(':') + 1, + ), + purpose: claims.claimData.purpose.substring( + claims.claimData.purpose.indexOf(':') + 1, + ), }); }), ); }), ); - }), ); //console.log(res); return myredme; } - // async getmissingtoken() { // const grouploglist = grouplog; // // console.log(grouploglist); @@ -473,14 +607,11 @@ export class CertificateLogService { // }); // } - // }); // console.log(missingtoken); // return missingtoken // } - - // async getsCertificateReadModule(userOrgId: string, generationStartTime, generationEndTime, pageNumber: number) { // if (pageNumber <= 0) { // throw new HttpException('Invalid page number', HttpStatus.BAD_REQUEST); @@ -532,7 +663,14 @@ export class CertificateLogService { // } // @Cron(CronExpression.EVERY_30_SECONDS) - async getsCertificateReadModule(userOrgId: string, pageNumber: number, deviceFilter: deviceFilterDTO, generationStartTime?: string, generationEndTime?: string, targetVolumeCertificateGenerationRequestedInMegaWattHour?: number) { + async getsCertificateReadModule( + userOrgId: string, + pageNumber: number, + deviceFilter: deviceFilterDTO, + generationStartTime?: string, + generationEndTime?: string, + targetVolumeCertificateGenerationRequestedInMegaWattHour?: number, + ) { this.logger.verbose(`With in getsCertificateReadModule`); const pageSize = 3; @@ -542,7 +680,8 @@ export class CertificateLogService { const skip = (pageNumber - 1) * pageSize; - let queryBuilder = this.cretificatereadmoduleRepository.createQueryBuilder('crm') + let queryBuilder = this.cretificatereadmoduleRepository + .createQueryBuilder('crm') .innerJoin(DeviceGroup, 'dg', 'crm.deviceId = dg.id::text') .andWhere('dg.organizationId = :userOrgId', { userOrgId }) .skip(skip) @@ -551,26 +690,43 @@ export class CertificateLogService { const startTimestamp = new Date(generationStartTime).getTime() / 1000; const endTimestamp = new Date(generationEndTime).getTime() / 1000; - queryBuilder = queryBuilder.andWhere('crm.generationStartTime <= :endTimestamp', { endTimestamp }) - .andWhere('crm.generationEndTime >= :startTimestamp', { startTimestamp }); + queryBuilder = queryBuilder + .andWhere('crm.generationStartTime <= :endTimestamp', { endTimestamp }) + .andWhere('crm.generationEndTime >= :startTimestamp', { + startTimestamp, + }); } else if (generationStartTime) { const startTimestamp = new Date(generationStartTime).getTime() / 1000; - queryBuilder = queryBuilder.andWhere('crm.generationStartTime <= :startTimestamp', { startTimestamp }); + queryBuilder = queryBuilder.andWhere( + 'crm.generationStartTime <= :startTimestamp', + { startTimestamp }, + ); } else if (generationEndTime) { const endTimestamp = new Date(generationEndTime).getTime() / 1000; - queryBuilder = queryBuilder.andWhere('crm.generationEndTime >= :endTimestamp', { endTimestamp }); + queryBuilder = queryBuilder.andWhere( + 'crm.generationEndTime >= :endTimestamp', + { endTimestamp }, + ); } - if (targetVolumeCertificateGenerationRequestedInMegaWattHour !== undefined) { - queryBuilder = queryBuilder.andWhere('dg.targetVolumeCertificateGenerationRequestedInMegaWattHour <= :targetVolume', { targetVolume: targetVolumeCertificateGenerationRequestedInMegaWattHour }); + if ( + targetVolumeCertificateGenerationRequestedInMegaWattHour !== undefined + ) { + queryBuilder = queryBuilder.andWhere( + 'dg.targetVolumeCertificateGenerationRequestedInMegaWattHour <= :targetVolume', + { + targetVolume: + targetVolumeCertificateGenerationRequestedInMegaWattHour, + }, + ); } - this.logger.debug("BEFORE QUERY:::::::::::::::::::::" + new Date()); + this.logger.debug('BEFORE QUERY:::::::::::::::::::::' + new Date()); const results = await queryBuilder.getRawMany(); const count = await queryBuilder.getCount(); - this.logger.debug("AFTER QUERY:::::::::::::::::::::" + new Date()); + this.logger.debug('AFTER QUERY:::::::::::::::::::::' + new Date()); const totalPages = Math.ceil(count / pageSize); @@ -593,303 +749,465 @@ export class CertificateLogService { totalCount: count, }; } - // add function for check the last end certified log in active reservation time + // add function for check the last end certified log in active reservation time async getLastCertifiedDevicelogBYgroupId( - groupId: number, deviceId: string + groupId: number, + deviceId: string, ): Promise { this.logger.verbose(`With in getLastCertifiedDevicelogBYgroupId`); - return this.repository.findOne( - { - where: { - groupId: groupId, - deviceid: deviceId, - - }, - order: { - certificate_issuance_enddate: 'DESC' - } - }) + return this.repository.findOne({ + where: { + groupId: groupId, + deviceid: deviceId, + }, + order: { + certificate_issuance_enddate: 'DESC', + }, + }); } //add function to get the certified log which device of developer added in reservation for developer - async getCertifiedlogofDevices(user: ILoggedInUser, filterDto: FilterDTO, pageNumber) { + async getCertifiedlogofDevices( + user: ILoggedInUser, + filterDto: FilterDTO, + pageNumber, + ) { this.logger.verbose(`With in getCertifiedlogofDevices`); - const getnewreservationinfo = await this.devicegroupService.getReservationInforDeveloperBsise(user.organizationId, user.role, filterDto, pageNumber, user.api_user_id) - this.logger.debug("getnewreservationinfo", getnewreservationinfo.deviceGroups.length); - const getoldreservationinfo = await this.devicegroupService.getoldReservationInforDeveloperBsise(user.organizationId, user.role, filterDto, pageNumber, user.api_user_id) - this.logger.debug("getoldreservationinfo", getoldreservationinfo.deviceGroups.length); + const getnewreservationinfo = + await this.devicegroupService.getReservationInforDeveloperBsise( + user.organizationId, + user.role, + filterDto, + pageNumber, + user.api_user_id, + ); + this.logger.debug( + 'getnewreservationinfo', + getnewreservationinfo.deviceGroups.length, + ); + const getoldreservationinfo = + await this.devicegroupService.getoldReservationInforDeveloperBsise( + user.organizationId, + user.role, + filterDto, + pageNumber, + user.api_user_id, + ); + this.logger.debug( + 'getoldreservationinfo', + getoldreservationinfo.deviceGroups.length, + ); let oldcertificates; if (getoldreservationinfo.deviceGroups.length > 0) { // oldcertificates= await this.getDeveloperfindreservationcertified(getoldreservationinfo, user.role); - return this.getDeveloperfindreservationcertified(getoldreservationinfo, user.role); + return this.getDeveloperfindreservationcertified( + getoldreservationinfo, + user.role, + ); } let newcertificates; if (getnewreservationinfo.deviceGroups.length > 0) { // newcertificates = await this.getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247(getnewreservationinfo, user.role); - this.logger.debug("Line No: 580"); - return this.getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247(getnewreservationinfo, user.role); + this.logger.debug('Line No: 580'); + return this.getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247( + getnewreservationinfo, + user.role, + ); } // const final= [...oldcertificates.certificatelog, ...newcertificates.certificatelog] return { certificatelog: [], currentpage: 0, totalPages: 0, - totalCount: 0 - } + totalCount: 0, + }; } - - - async getDeveloperfindreservationcertified(certifiedreservation, role): Promise { - + async getDeveloperfindreservationcertified( + certifiedreservation, + role, + ): Promise { let finalcertificatesInReservationWithLog: Array = []; this.logger.verbose(`With in getDeveloperfindreservationcertified`); await Promise.all( - certifiedreservation.deviceGroups.map(async (group: any, index: number) => { - let newq = await this.certificaterrepository - .createQueryBuilder('issuar') - .where(`issuar.id IN (${JSON.stringify(group.internalCertificateId).replace(/[\[\]]/g, '')})`) - - const groupedDatasql = await newq.getQuery(); - this.logger.debug(groupedDatasql); - const result = await newq.getMany(); - // console.log(result) - const res = await Promise.all( - result.map(async (certifiedlist: CertificateWithPerdevicelog) => { - - certifiedlist.certificateStartDate = new Date(certifiedlist.generationStartTime * 1000).toISOString(); - certifiedlist.certificateEndDate = new Date(certifiedlist.generationEndTime * 1000).toISOString(); - certifiedlist.perDeviceCertificateLog = []; + certifiedreservation.deviceGroups.map( + async (group: any, index: number) => { + let newq = await this.certificaterrepository + .createQueryBuilder('issuar') + .where( + `issuar.id IN (${JSON.stringify(group.internalCertificateId).replace(/[\[\]]/g, '')})`, + ); - try { - JSON.parse(certifiedlist.metadata); - } - catch (e) { - this.logger.error(e, `certificate doesnt contains valid metadta ${certifiedlist}`); - return; - } - const obj = JSON.parse(certifiedlist.metadata); - - const devicereadstartdate = new Date((certifiedlist.generationStartTime - 1) * 1000);//as rounding when certificate is issued by EWFs package reference kept above and removing millseconds - const devicereadenddate = new Date((certifiedlist.generationEndTime + 1) * 1000);//going back 1 second in start and going forward 1 second in end - //console.log("changegetdate", devicereadstartdate, devicereadenddate) - await Promise.all( - obj.deviceIds.map(async (deviceid: number) => { - - const device = await this.deviceService.findOne(deviceid); - - let devicelog; - if (role === 'OrganizationAdmin') { - if (group.developerdeviceIds.find(ele => ele === deviceid)) { - this.logger.log("oldlog exist in developer"); - const devicelog = await this.getCheckCertificateIssueDateLogForDevice(parseInt(group.dg_id), device.externalId, devicereadstartdate, devicereadenddate); - devicelog.forEach(singleDeviceLogEle => { - singleDeviceLogEle.externalId = device.developerExternalId - singleDeviceLogEle['deviceId'] = device.id - // if (device.timezone != null) { - // singleDeviceLogEle['timezone'] = device.timezone - // } - singleDeviceLogEle['timezone'] = getLocalTimeZoneFromDevice(device.createdAt, device); - certifiedlist.perDeviceCertificateLog.push(singleDeviceLogEle); - }); + const groupedDatasql = await newq.getQuery(); + this.logger.debug(groupedDatasql); + const result = await newq.getMany(); + // console.log(result) + const res = await Promise.all( + result.map(async (certifiedlist: CertificateWithPerdevicelog) => { + certifiedlist.certificateStartDate = new Date( + certifiedlist.generationStartTime * 1000, + ).toISOString(); + certifiedlist.certificateEndDate = new Date( + certifiedlist.generationEndTime * 1000, + ).toISOString(); + certifiedlist.perDeviceCertificateLog = []; + + try { + JSON.parse(certifiedlist.metadata); + } catch (e) { + this.logger.error( + e, + `certificate doesnt contains valid metadta ${certifiedlist}`, + ); + return; + } + const obj = JSON.parse(certifiedlist.metadata); + + const devicereadstartdate = new Date( + (certifiedlist.generationStartTime - 1) * 1000, + ); //as rounding when certificate is issued by EWFs package reference kept above and removing millseconds + const devicereadenddate = new Date( + (certifiedlist.generationEndTime + 1) * 1000, + ); //going back 1 second in start and going forward 1 second in end + //console.log("changegetdate", devicereadstartdate, devicereadenddate) + await Promise.all( + obj.deviceIds.map(async (deviceid: number) => { + const device = await this.deviceService.findOne(deviceid); + + let devicelog; + if (role === 'OrganizationAdmin') { + if ( + group.developerdeviceIds.find((ele) => ele === deviceid) + ) { + this.logger.log('oldlog exist in developer'); + const devicelog = + await this.getCheckCertificateIssueDateLogForDevice( + parseInt(group.dg_id), + device.externalId, + devicereadstartdate, + devicereadenddate, + ); + devicelog.forEach((singleDeviceLogEle) => { + singleDeviceLogEle.externalId = + device.developerExternalId; + singleDeviceLogEle['deviceId'] = device.id; + // if (device.timezone != null) { + // singleDeviceLogEle['timezone'] = device.timezone + // } + singleDeviceLogEle['timezone'] = + getLocalTimeZoneFromDevice(device.createdAt, device); + certifiedlist.perDeviceCertificateLog.push( + singleDeviceLogEle, + ); + }); + } else { + this.logger.log("oldlog doesn't exist in developer"); + let totalvalue; + const devicelog = + await this.getCheckCertificateIssueDateLogForDevice( + parseInt(group.dg_id), + device.externalId, + devicereadstartdate, + devicereadenddate, + ); + if (devicelog.length > 0) { + const totalReadValue = devicelog.reduce( + (accumulator, currentValue) => + accumulator + currentValue.readvalue_watthour, + 0, + ); + devicelog[0].readvalue_watthour = totalReadValue; + devicelog[0].externalId = 'Other Devices'; + devicelog[0]['deviceId'] = 0; + devicelog['timezone'] = getLocalTimeZoneFromDevice( + device.createdAt, + device, + ); + certifiedlist.perDeviceCertificateLog.push( + devicelog[0], + ); + } + } } - else { - this.logger.log("oldlog doesn't exist in developer"); - let totalvalue; - const devicelog = await this.getCheckCertificateIssueDateLogForDevice(parseInt(group.dg_id), device.externalId, devicereadstartdate, devicereadenddate); - if (devicelog.length > 0) { - const totalReadValue = devicelog.reduce( - (accumulator, currentValue) => accumulator + currentValue.readvalue_watthour, - 0, + if (role === 'Buyer') { + devicelog = + await this.getCheckCertificateIssueDateLogForDevice( + parseInt(group.dg_id), + device.externalId, + devicereadstartdate, + devicereadenddate, ); - devicelog[0].readvalue_watthour = totalReadValue; - devicelog[0].externalId = 'Other Devices'; - devicelog[0]['deviceId'] = 0 - devicelog['timezone'] = getLocalTimeZoneFromDevice(device.createdAt, device); - certifiedlist.perDeviceCertificateLog.push(devicelog[0]) - - } - + devicelog.forEach((singleDeviceLogEle) => { + singleDeviceLogEle.externalId = + device.developerExternalId; + singleDeviceLogEle['deviceId'] = device.id; + singleDeviceLogEle['timezone'] = + getLocalTimeZoneFromDevice(device.createdAt, device); + certifiedlist.perDeviceCertificateLog.push( + singleDeviceLogEle, + ); + }); } - } - if (role === 'Buyer') { - - devicelog = await this.getCheckCertificateIssueDateLogForDevice(parseInt(group.dg_id), device.externalId, devicereadstartdate, devicereadenddate); - devicelog.forEach(singleDeviceLogEle => { - singleDeviceLogEle.externalId = device.developerExternalId - singleDeviceLogEle['deviceId'] = device.id - singleDeviceLogEle['timezone'] = getLocalTimeZoneFromDevice(device.createdAt, device); - certifiedlist.perDeviceCertificateLog.push(singleDeviceLogEle); - }); - } - // return devicelog; - }) - ); - finalcertificatesInReservationWithLog.push(certifiedlist) - return certifiedlist; - }), - ); + // return devicelog; + }), + ); + finalcertificatesInReservationWithLog.push(certifiedlist); + return certifiedlist; + }), + ); - return res; - }) - ) + return res; + }, + ), + ); const response = { certificatelog: finalcertificatesInReservationWithLog, currentpage: certifiedreservation.pageNumber, totalPages: certifiedreservation.totalPages, - totalCount: certifiedreservation.totalCount - } + totalCount: certifiedreservation.totalCount, + }; return response; //return finalcertificatesInReservationWithLog } - async getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247(getreservationinfo, role): Promise { - this.logger.verbose(`With in getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247`); + async getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247( + getreservationinfo, + role, + ): Promise { + this.logger.verbose( + `With in getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247`, + ); let finalcertificatesInReservationWithLog: Array = []; await Promise.all( getreservationinfo.deviceGroups.map(async (group: any, index: number) => { - let newq = await this.cretificatereadmoduleRepository .createQueryBuilder('crm') - .where(`crm.internalCertificateId IN (${JSON.stringify(group.internalCertificateId).replace(/[\[\]]/g, '')})`) + .where( + `crm.internalCertificateId IN (${JSON.stringify(group.internalCertificateId).replace(/[\[\]]/g, '')})`, + ); const groupedDatasql = await newq.getQuery(); this.logger.debug(groupedDatasql); const result = await newq.getMany(); // console.log(result) - let certificatesInReservationWithLog: Array = []; - result.forEach(ele => certificatesInReservationWithLog.push({ ...ele, perDeviceCertificateLog: [], certificateStartDate: '', certificateEndDate: '' })); + let certificatesInReservationWithLog: Array = + []; + result.forEach((ele) => + certificatesInReservationWithLog.push({ + ...ele, + perDeviceCertificateLog: [], + certificateStartDate: '', + certificateEndDate: '', + }), + ); await Promise.all( - result.map(async (certifiedlist: ICertificateReadModel, index: number) => { - certificatesInReservationWithLog[index].certificateStartDate = new Date(certifiedlist.generationStartTime * 1000).toISOString(); - certificatesInReservationWithLog[index].certificateEndDate = new Date(certifiedlist.generationEndTime * 1000).toISOString(); - certificatesInReservationWithLog[index].perDeviceCertificateLog = []; - try { - if (typeof certifiedlist.metadata === "string") { - let data = JSON.parse(certifiedlist.metadata); + result.map( + async ( + certifiedlist: ICertificateReadModel, + index: number, + ) => { + certificatesInReservationWithLog[index].certificateStartDate = + new Date( + certifiedlist.generationStartTime * 1000, + ).toISOString(); + certificatesInReservationWithLog[index].certificateEndDate = + new Date(certifiedlist.generationEndTime * 1000).toISOString(); + certificatesInReservationWithLog[index].perDeviceCertificateLog = + []; + try { + if (typeof certifiedlist.metadata === 'string') { + let data = JSON.parse(certifiedlist.metadata); + } + } catch (e) { + this.logger.error( + e, + `certificate doesnt contains valid metadata ${certifiedlist}`, + ); + return; } - } - catch (e) { - this.logger.error(e, `certificate doesnt contains valid metadata ${certifiedlist}`); - return; - } - let obj; - if (typeof certifiedlist.metadata === "string") { - obj = JSON.parse(certifiedlist.metadata); - } - else { - obj = certifiedlist.metadata; - } - let certificateTransactionUID = obj.certificateTransactionUID; - const devicereadstartdate = new Date((certifiedlist.generationStartTime - 1) * 1000);//as rounding when certificate is issued by EWFs package reference kept above and removing millseconds - const devicereadenddate = new Date((certifiedlist.generationEndTime + 1) * 1000);//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); - let devicelog; - if (role === 'OrganizationAdmin') { - if (group.developerdeviceIds.find(ele => ele === deviceid)) { - - devicelog = await this.getCheckCertificateIssueDateLogForDevice(parseInt(group.dg_id), device.externalId, devicereadstartdate, devicereadenddate, certificateTransactionUID); - devicelog.forEach(singleDeviceLogEle => { - singleDeviceLogEle.externalId = device.developerExternalId - singleDeviceLogEle['deviceId'] = device.id - singleDeviceLogEle['timezone'] = getLocalTimeZoneFromDevice(device.createdAt, device); - - certificatesInReservationWithLog[index].perDeviceCertificateLog.push(singleDeviceLogEle); - }); + let obj; + if (typeof certifiedlist.metadata === 'string') { + obj = JSON.parse(certifiedlist.metadata); + } else { + obj = certifiedlist.metadata; + } + let certificateTransactionUID = obj.certificateTransactionUID; + const devicereadstartdate = new Date( + (certifiedlist.generationStartTime - 1) * 1000, + ); //as rounding when certificate is issued by EWFs package reference kept above and removing millseconds + const devicereadenddate = new Date( + (certifiedlist.generationEndTime + 1) * 1000, + ); //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); + let devicelog; + if (role === 'OrganizationAdmin') { + if ( + group.developerdeviceIds.find((ele) => ele === deviceid) + ) { + devicelog = + await this.getCheckCertificateIssueDateLogForDevice( + parseInt(group.dg_id), + device.externalId, + devicereadstartdate, + devicereadenddate, + certificateTransactionUID, + ); + devicelog.forEach((singleDeviceLogEle) => { + singleDeviceLogEle.externalId = + device.developerExternalId; + singleDeviceLogEle['deviceId'] = device.id; + singleDeviceLogEle['timezone'] = + getLocalTimeZoneFromDevice(device.createdAt, device); + + certificatesInReservationWithLog[ + index + ].perDeviceCertificateLog.push(singleDeviceLogEle); + }); + } else { + devicelog = + await this.getCheckCertificateIssueDateLogForDevice( + parseInt(group.dg_id), + device.externalId, + devicereadstartdate, + devicereadenddate, + certificateTransactionUID, + ); + if (devicelog.length > 0) { + const totalReadValue = devicelog.reduce( + (accumulator, currentValue) => + accumulator + currentValue.readvalue_watthour, + 0, + ); + devicelog[0].readvalue_watthour = totalReadValue; + devicelog[0].externalId = 'Other Devices'; + devicelog[0]['deviceId'] = 0; + devicelog['timezone'] = getLocalTimeZoneFromDevice( + device.createdAt, + device, + ); + certificatesInReservationWithLog[ + index + ].perDeviceCertificateLog.push(devicelog[0]); + } + } } - else { - devicelog = await this.getCheckCertificateIssueDateLogForDevice(parseInt(group.dg_id), device.externalId, devicereadstartdate, devicereadenddate, certificateTransactionUID); - if (devicelog.length > 0) { - const totalReadValue = devicelog.reduce( - (accumulator, currentValue) => accumulator + currentValue.readvalue_watthour, - 0, + if (role === 'Buyer' || role === Role.ApiUser) { + devicelog = + await this.getCheckCertificateIssueDateLogForDevice( + parseInt(group.dg_id), + device.externalId, + devicereadstartdate, + devicereadenddate, + certificateTransactionUID, ); - devicelog[0].readvalue_watthour = totalReadValue; - devicelog[0].externalId = 'Other Devices' - devicelog[0]['deviceId'] = 0 - devicelog['timezone'] = getLocalTimeZoneFromDevice(device.createdAt, device); - certificatesInReservationWithLog[index].perDeviceCertificateLog.push(devicelog[0]) - } + devicelog.forEach((singleDeviceLogEle) => { + singleDeviceLogEle.externalId = + device.developerExternalId; + singleDeviceLogEle['deviceId'] = device.id; + singleDeviceLogEle['timezone'] = + getLocalTimeZoneFromDevice(device.createdAt, device); + certificatesInReservationWithLog[ + index + ].perDeviceCertificateLog.push(singleDeviceLogEle); + }); } - } - if (role === 'Buyer' || role === Role.ApiUser) { - devicelog = await this.getCheckCertificateIssueDateLogForDevice(parseInt(group.dg_id), device.externalId, devicereadstartdate, devicereadenddate, certificateTransactionUID); - devicelog.forEach(singleDeviceLogEle => { - singleDeviceLogEle.externalId = device.developerExternalId - singleDeviceLogEle['deviceId'] = device.id - singleDeviceLogEle['timezone'] = getLocalTimeZoneFromDevice(device.createdAt, device); - certificatesInReservationWithLog[index].perDeviceCertificateLog.push(singleDeviceLogEle); - }); - } - return devicelog; - }) - ); - finalcertificatesInReservationWithLog.push(certificatesInReservationWithLog[index]) - return certificatesInReservationWithLog[index]; - }), + return devicelog; + }), + ); + finalcertificatesInReservationWithLog.push( + certificatesInReservationWithLog[index], + ); + return certificatesInReservationWithLog[index]; + }, + ), ); - }) - ) + }), + ); const response = { certificatelog: finalcertificatesInReservationWithLog, currentpage: getreservationinfo.pageNumber, totalPages: getreservationinfo.totalPages, - totalCount: getreservationinfo.totalCount - } + totalCount: getreservationinfo.totalCount, + }; return response; //return finalcertificatesInReservationWithLog } /**Create new function to get the certifcate log of perdevice */ - async Findperdevicecertificatelog(groupId, organizationId): Promise { + async Findperdevicecertificatelog( + groupId, + organizationId, + ): Promise { this.logger.verbose(`With in Findcertificatelog`); - const totalNumbers: any = getManager().createQueryBuilder() - .select("d.developerExternalId", "externalId") - .addSelect("dg.name", "reservation_name") - .addSelect("dl.certificate_issuance_startdate", "certificate_issuance_startdate") - .addSelect("dl.certificate_issuance_enddate", "certificate_issuance_enddate") - .addSelect("dl.readvalue_watthour", "readvalue_watthour") - .addSelect("dl.certificateTransactionUID", "certificateTransactionUID") - .addSelect("crm.blockchainCertificateId", "blockchainCertificateId") - .from(CheckCertificateIssueDateLogForDeviceEntity, "dl") - .leftJoin(DeviceGroup, "dg", "dl.groupId = dg.id") - .leftJoin(Device, "d", "dl.externalId = d.externalId") + const totalNumbers: any = getManager() + .createQueryBuilder() + .select('d.developerExternalId', 'externalId') + .addSelect('dg.name', 'reservation_name') + .addSelect( + 'dl.certificate_issuance_startdate', + 'certificate_issuance_startdate', + ) + .addSelect( + 'dl.certificate_issuance_enddate', + 'certificate_issuance_enddate', + ) + .addSelect('dl.readvalue_watthour', 'readvalue_watthour') + .addSelect('dl.certificateTransactionUID', 'certificateTransactionUID') + .addSelect('crm.blockchainCertificateId', 'blockchainCertificateId') + .from(CheckCertificateIssueDateLogForDeviceEntity, 'dl') + .leftJoin(DeviceGroup, 'dg', 'dl.groupId = dg.id') + .leftJoin(Device, 'd', 'dl.externalId = d.externalId') .innerJoin( CertificateReadModelEntity, 'crm', - 'dl.certificateTransactionUID = (crm.metadata::jsonb)->>\'certificateTransactionUID\'' + "dl.certificateTransactionUID = (crm.metadata::jsonb)->>'certificateTransactionUID'", ) .where('dl.groupId = :groupId', { groupId: groupId }) - .andWhere('dg.organizationId = :organizationId', { organizationId: organizationId }) - .andWhere("dl.readvalue_watthour>0"); + .andWhere('dg.organizationId = :organizationId', { + organizationId: organizationId, + }) + .andWhere('dl.readvalue_watthour>0'); //console.log(totalExamNumbers.getQuery()) const devicelog = await totalNumbers.getRawMany(); //console.log(devicelog) return devicelog; - } - - async createCSV(res: Response, groupId: number, organizationId: number, name: string) { + async createCSV( + res: Response, + groupId: number, + organizationId: number, + name: string, + ) { try { - const data = await this.Findperdevicecertificatelog(groupId, organizationId); + const data = await this.Findperdevicecertificatelog( + groupId, + organizationId, + ); this.logger.error(`Error generating CSV: ${data[0]}`); const headers = Object.keys(data[0]); - if(headers!==undefined){ - res.setHeader('Content-Disposition', 'attachment; filename=' + name + ' ' + new Date().toLocaleDateString() + '.csv'); - res.setHeader('Content-Type', 'text/csv'); - const csvString = `${headers.join(',')}\n${data.map(obj => headers.map(key => obj[key]).join(',')).join('\n')}`; - // Stream the CSV string to the response - res.write(csvString, 'utf-8', () => { - this.logger.log('The CSV file streamed successfully!'); - res.end(); - }); - } + if (headers !== undefined) { + res.setHeader( + 'Content-Disposition', + 'attachment; filename=' + + name + + ' ' + + new Date().toLocaleDateString() + + '.csv', + ); + res.setHeader('Content-Type', 'text/csv'); + const csvString = `${headers.join(',')}\n${data.map((obj) => headers.map((key) => obj[key]).join(',')).join('\n')}`; + // Stream the CSV string to the response + res.write(csvString, 'utf-8', () => { + this.logger.log('The CSV file streamed successfully!'); + res.end(); + }); + } } catch (error) { this.logger.error(`Error generating CSV: ${error.message}`); //res.status(500).send('Internal Server Error'); @@ -897,5 +1215,4 @@ export class CertificateLogService { } //return `CSV file generated at ${filePath}`; } - } diff --git a/apps/drec-api/src/pods/certificate-log/dto/certificatewithdevicelog.dto.ts b/apps/drec-api/src/pods/certificate-log/dto/certificatewithdevicelog.dto.ts index 347ae3292..6d48edfa7 100755 --- a/apps/drec-api/src/pods/certificate-log/dto/certificatewithdevicelog.dto.ts +++ b/apps/drec-api/src/pods/certificate-log/dto/certificatewithdevicelog.dto.ts @@ -1,34 +1,33 @@ - import { Certificate } from '@energyweb/issuer-api'; import { CheckCertificateIssueDateLogForDeviceEntity } from '../../device/check_certificate_issue_date_log_for_device.entity'; import { ICertificateReadModel } from '@energyweb/origin-247-certificate'; import { ICertificateMetadata } from '../../../utils/types'; export class CertificateWithPerdevicelog extends Certificate { - id: number; - deviceId: string; - generationStartTime: number; - generationEndTime: number; - certificateStartDate:string; - certificateEndDate:string; - creationTime: number; - perDeviceCertificateLog: CheckCertificateIssueDateLogForDeviceEntity[]; - metadata:string; - + id: number; + deviceId: string; + generationStartTime: number; + generationEndTime: number; + certificateStartDate: string; + certificateEndDate: string; + creationTime: number; + perDeviceCertificateLog: CheckCertificateIssueDateLogForDeviceEntity[]; + metadata: string; } -export interface CertificateNewWithPerDeviceLog extends ICertificateReadModel{} +export interface CertificateNewWithPerDeviceLog + extends ICertificateReadModel {} -export class CertificateNewWithPerDeviceLog -{ - certificateStartDate:string; - certificateEndDate:string; - perDeviceCertificateLog: CheckCertificateIssueDateLogForDeviceEntity[]; +export class CertificateNewWithPerDeviceLog { + certificateStartDate: string; + certificateEndDate: string; + perDeviceCertificateLog: CheckCertificateIssueDateLogForDeviceEntity[]; } -export class CertificatelogResponse{ - certificatelog: CertificateNewWithPerDeviceLog[]| CertificateWithPerdevicelog[]; - totalPages: number; - totalCount: number; - +export class CertificatelogResponse { + certificatelog: + | CertificateNewWithPerDeviceLog[] + | CertificateWithPerdevicelog[]; + totalPages: number; + totalCount: number; } diff --git a/apps/drec-api/src/pods/certificate-log/dto/filter.dto.ts b/apps/drec-api/src/pods/certificate-log/dto/filter.dto.ts index 2a6586c70..c58d93581 100755 --- a/apps/drec-api/src/pods/certificate-log/dto/filter.dto.ts +++ b/apps/drec-api/src/pods/certificate-log/dto/filter.dto.ts @@ -1,7 +1,6 @@ import { IsOptional } from 'class-validator'; import { ApiPropertyOptional, ApiProperty } from '@nestjs/swagger'; - import { IsNotEmpty, IsString } from 'class-validator'; import { Installation, @@ -10,16 +9,24 @@ import { StandardCompliance, FuelCode, DevicetypeCode, - SDGBenefitsList + SDGBenefitsList, } from '../../../utils/enums'; export class FilterDTO { @IsOptional() - @ApiPropertyOptional({ type: FuelCode, description: 'Fuel Code', enum: FuelCode }) + @ApiPropertyOptional({ + type: FuelCode, + description: 'Fuel Code', + enum: FuelCode, + }) fuelCode: FuelCode; @IsOptional() - @ApiPropertyOptional({ type: DevicetypeCode, description: 'Device Type Code', enum: DevicetypeCode }) + @ApiPropertyOptional({ + type: DevicetypeCode, + description: 'Device Type Code', + enum: DevicetypeCode, + }) deviceTypeCode: DevicetypeCode; @IsOptional() @@ -28,7 +35,7 @@ export class FilterDTO { description: 'Amount Read from ', }) fromAmountread: number; - + @IsOptional() @ApiPropertyOptional({ type: Number, @@ -59,26 +66,19 @@ export class FilterDTO { @ApiPropertyOptional({ description: 'SDG Benefit', enum: SDGBenefitsList, - isArray: true + isArray: true, }) SDGBenefits?: string[] | undefined; - } export class GroupIDBasedFilteringDTO { - @IsOptional() @ApiPropertyOptional({ description: 'Group Id' }) groupId: string; - - } export class AmountFormattingDTO { - @ApiProperty({ type: String }) @IsString() amount: string; - - } diff --git a/apps/drec-api/src/pods/certificate-log/dto/index.ts b/apps/drec-api/src/pods/certificate-log/dto/index.ts index 156cd6747..2f639652c 100755 --- a/apps/drec-api/src/pods/certificate-log/dto/index.ts +++ b/apps/drec-api/src/pods/certificate-log/dto/index.ts @@ -1,2 +1,2 @@ export * from './filter.dto'; -export * from './certificatewithdevicelog.dto' \ No newline at end of file +export * from './certificatewithdevicelog.dto'; diff --git a/apps/drec-api/src/pods/certificate-log/grouplog.ts b/apps/drec-api/src/pods/certificate-log/grouplog.ts index 9f1e0a2e6..8c39b24ed 100755 --- a/apps/drec-api/src/pods/certificate-log/grouplog.ts +++ b/apps/drec-api/src/pods/certificate-log/grouplog.ts @@ -1,5293 +1,5700 @@ -export const grouplog = [ - { - "id": 1, - "groupid": 1, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-21 03:45:36+00", - "certificate_issuance_enddate": "2022-10-19 05:45:36+00", - "readvalue_watthour": 34568, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"1\",\"energyValue\":\"34568\",\"fromTime\":\"2022-08-21T03:45:36.000Z\",\"toTime\":\"2022-10-19T05:45:36.000Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"66b1de11-53d2-4725-b1ab-31be05de4e69\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[4],\"groupId\":\"1\"}}", - "createdAt": "2022-12-23 10:06:31.618025+00", - "updatedAt": "2022-12-23 10:06:31.618025+00", - "countryCode": "IND" - }, - { - "id": 2, - "groupid": 2, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-23 05:05:36+00", - "certificate_issuance_enddate": "2022-12-23 04:55:36+00", - "readvalue_watthour": 632487004, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"2\",\"energyValue\":\"632487004\",\"fromTime\":\"2022-04-23T05:05:36.000Z\",\"toTime\":\"2022-12-23T04:55:36.000Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"bd9764b7-ecd9-4c75-b775-a0026c8fb15c\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[3],\"groupId\":\"2\"}}", - "createdAt": "2022-12-23 10:27:31.916857+00", - "updatedAt": "2022-12-23 10:27:31.916857+00", - "countryCode": "IND" - }, - { - "id": 3, - "groupid": 3, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-21 03:45:36+00", - "certificate_issuance_enddate": "2022-09-19 05:45:36+00", - "readvalue_watthour": 45678, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"3\",\"energyValue\":\"45678\",\"fromTime\":\"2022-03-21T03:45:36.000Z\",\"toTime\":\"2022-09-19T05:45:36.000Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c68956ad-be63-410b-bc23-9dde483bdbd6\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[1],\"groupId\":\"3\"}}", - "createdAt": "2022-12-23 10:28:02.40802+00", - "updatedAt": "2022-12-23 10:28:02.40802+00", - "countryCode": "IND" - }, - { - "id": 4, - "groupid": 2, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 05:05:36.859+00", - "certificate_issuance_enddate": "2022-12-23 06:00:36.859+00", - "readvalue_watthour": 178000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"2\",\"energyValue\":\"178000\",\"fromTime\":\"2022-12-23T05:05:36.859Z\",\"toTime\":\"2022-12-23T06:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"bd9764b7-ecd9-4c75-b775-a0026c8fb15c\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[3],\"groupId\":\"2\"}}", - "createdAt": "2022-12-23 10:28:03.025039+00", - "updatedAt": "2022-12-23 10:28:03.025039+00", - "countryCode": "IND" - }, - { - "id": 5, - "groupid": 3, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 09:30:36.888+00", - "certificate_issuance_enddate": "2022-12-23 09:40:36.888+00", - "readvalue_watthour": 56000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"3\",\"energyValue\":\"56000\",\"fromTime\":\"2022-12-23T09:30:36.888Z\",\"toTime\":\"2022-12-23T09:40:36.888Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c68956ad-be63-410b-bc23-9dde483bdbd6\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[1],\"groupId\":\"3\"}}", - "createdAt": "2022-12-23 10:28:03.310862+00", - "updatedAt": "2022-12-23 10:28:03.310862+00", - "countryCode": "IND" - }, - { - "id": 6, - "groupid": 2, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 05:20:36.859+00", - "certificate_issuance_enddate": "2022-12-23 06:00:36.859+00", - "readvalue_watthour": 7000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"2\",\"energyValue\":\"7000\",\"fromTime\":\"2022-12-23T05:20:36.859Z\",\"toTime\":\"2022-12-23T06:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"bd9764b7-ecd9-4c75-b775-a0026c8fb15c\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[5],\"groupId\":\"2\"}}", - "createdAt": "2022-12-23 10:28:03.607641+00", - "updatedAt": "2022-12-23 10:28:03.607641+00", - "countryCode": "ARG" - }, - { - "id": 7, - "groupid": 2, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-23 05:15:36+00", - "certificate_issuance_enddate": "2022-12-23 05:15:36+00", - "readvalue_watthour": 8676454, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"2\",\"energyValue\":\"8676454\",\"fromTime\":\"2022-05-23T05:15:36.000Z\",\"toTime\":\"2022-12-23T05:15:36.000Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"bd9764b7-ecd9-4c75-b775-a0026c8fb15c\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[5],\"groupId\":\"2\"}}", - "createdAt": "2022-12-23 10:37:01.72182+00", - "updatedAt": "2022-12-23 10:37:01.72182+00", - "countryCode": "ARG" - }, - { - "id": 8, - "groupid": 4, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-20 09:30:36+00", - "certificate_issuance_enddate": "2022-10-20 09:30:36+00", - "readvalue_watthour": 6554554, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"4\",\"energyValue\":\"6554554\",\"fromTime\":\"2022-04-20T09:30:36.000Z\",\"toTime\":\"2022-10-20T09:30:36.000Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"784afc65-333d-45f2-a042-99f8ee3c7fe9\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[2],\"groupId\":\"4\"}}", - "createdAt": "2022-12-23 10:38:32.007145+00", - "updatedAt": "2022-12-23 10:38:32.007145+00", - "countryCode": "IND" - }, - { - "id": 9, - "groupid": 4, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-10-20 09:31:36+00", - "certificate_issuance_enddate": "2022-12-23 04:29:36+00", - "readvalue_watthour": 6550900, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"4\",\"energyValue\":\"6550900\",\"fromTime\":\"2022-10-20T09:31:36.000Z\",\"toTime\":\"2022-12-23T04:29:36.000Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"784afc65-333d-45f2-a042-99f8ee3c7fe9\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[2],\"groupId\":\"4\"}}", - "createdAt": "2022-12-23 10:38:32.41259+00", - "updatedAt": "2022-12-23 10:38:32.41259+00", - "countryCode": "IND" - }, - { - "id": 10, - "groupid": 4, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 04:31:36.859+00", - "certificate_issuance_enddate": "2022-12-23 05:00:36.859+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"4\",\"energyValue\":\"1000\",\"fromTime\":\"2022-12-23T04:31:36.859Z\",\"toTime\":\"2022-12-23T05:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"784afc65-333d-45f2-a042-99f8ee3c7fe9\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[2],\"groupId\":\"4\"}}", - "createdAt": "2022-12-23 10:39:02.335982+00", - "updatedAt": "2022-12-23 10:39:02.335982+00", - "countryCode": "IND" - }, - { - "id": 11, - "groupid": 4, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 05:00:36.859+00", - "certificate_issuance_enddate": "2022-12-23 06:00:36.859+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"4\",\"energyValue\":\"1000\",\"fromTime\":\"2022-12-23T05:00:36.859Z\",\"toTime\":\"2022-12-23T06:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"784afc65-333d-45f2-a042-99f8ee3c7fe9\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[2],\"groupId\":\"4\"}}", - "createdAt": "2022-12-23 10:39:32.607685+00", - "updatedAt": "2022-12-23 10:39:32.607685+00", - "countryCode": "IND" - }, - { - "id": 12, - "groupid": 4, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 06:00:36.859+00", - "certificate_issuance_enddate": "2022-12-23 07:00:36.859+00", - "readvalue_watthour": 188000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"4\",\"energyValue\":\"188000\",\"fromTime\":\"2022-12-23T06:00:36.859Z\",\"toTime\":\"2022-12-23T07:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"784afc65-333d-45f2-a042-99f8ee3c7fe9\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[3,2],\"groupId\":\"4\"}}", - "createdAt": "2022-12-23 10:40:02.62098+00", - "updatedAt": "2022-12-23 10:40:02.62098+00", - "countryCode": "IND" - }, - { - "id": 13, - "groupid": 4, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 06:00:36.859+00", - "certificate_issuance_enddate": "2022-12-23 07:00:36.859+00", - "readvalue_watthour": 11000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"4\",\"energyValue\":\"11000\",\"fromTime\":\"2022-12-23T06:00:36.859Z\",\"toTime\":\"2022-12-23T07:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"784afc65-333d-45f2-a042-99f8ee3c7fe9\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[5],\"groupId\":\"4\"}}", - "createdAt": "2022-12-23 10:40:02.714584+00", - "updatedAt": "2022-12-23 10:40:02.714584+00", - "countryCode": "ARG" - }, - { - "id": 14, - "groupid": 5, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 06:30:36.859+00", - "certificate_issuance_enddate": "2022-12-23 08:00:36.859+00", - "readvalue_watthour": 12000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"5\",\"energyValue\":\"12000\",\"fromTime\":\"2022-12-23T06:30:36.859Z\",\"toTime\":\"2022-12-23T08:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"130a8a50-b037-414e-a32e-ca4413b650f6\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[3,2],\"groupId\":\"5\"}}", - "createdAt": "2022-12-23 11:34:02.111893+00", - "updatedAt": "2022-12-23 11:34:02.111893+00", - "countryCode": "IND" - }, - { - "id": 15, - "groupid": 5, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 07:00:36.859+00", - "certificate_issuance_enddate": "2022-12-23 08:00:36.859+00", - "readvalue_watthour": 10000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"5\",\"energyValue\":\"10000\",\"fromTime\":\"2022-12-23T07:00:36.859Z\",\"toTime\":\"2022-12-23T08:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"130a8a50-b037-414e-a32e-ca4413b650f6\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[5],\"groupId\":\"5\"}}", - "createdAt": "2022-12-23 11:34:02.509537+00", - "updatedAt": "2022-12-23 11:34:02.509537+00", - "countryCode": "ARG" - }, - { - "id": 16, - "groupid": 6, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-12 03:45:36+00", - "certificate_issuance_enddate": "2022-10-03 05:45:36+00", - "readvalue_watthour": 67898, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"6\",\"energyValue\":\"67898\",\"fromTime\":\"2022-06-12T03:45:36.000Z\",\"toTime\":\"2022-10-03T05:45:36.000Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"4692b40a-ca9a-4fe5-88ca-cab3d076a71a\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[6],\"groupId\":\"6\"}}", - "createdAt": "2022-12-23 11:53:32.111234+00", - "updatedAt": "2022-12-23 11:53:32.111234+00", - "countryCode": "AFG" - }, - { - "id": 17, - "groupid": 6, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-12 03:45:36+00", - "certificate_issuance_enddate": "2022-12-22 05:45:36+00", - "readvalue_watthour": 98766, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"6\",\"energyValue\":\"98766\",\"fromTime\":\"2022-04-12T03:45:36.000Z\",\"toTime\":\"2022-12-22T05:45:36.000Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"4692b40a-ca9a-4fe5-88ca-cab3d076a71a\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[8],\"groupId\":\"6\"}}", - "createdAt": "2022-12-23 11:53:32.206726+00", - "updatedAt": "2022-12-23 11:53:32.206726+00", - "countryCode": "BOL" - }, - { - "id": 18, - "groupid": 6, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-12 07:45:36+00", - "certificate_issuance_enddate": "2022-11-23 09:45:36+00", - "readvalue_watthour": 39876, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"6\",\"energyValue\":\"39876\",\"fromTime\":\"2022-05-12T07:45:36.000Z\",\"toTime\":\"2022-11-23T09:45:36.000Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"4692b40a-ca9a-4fe5-88ca-cab3d076a71a\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[7],\"groupId\":\"6\"}}", - "createdAt": "2022-12-23 11:53:36.117584+00", - "updatedAt": "2022-12-23 11:53:36.117584+00", - "countryCode": "ALB" - }, - { - "id": 19, - "groupid": 6, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 11:14:36+00", - "certificate_issuance_enddate": "2022-12-23 11:16:36.985+00", - "readvalue_watthour": 56000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"6\",\"energyValue\":\"56000\",\"fromTime\":\"2022-12-23T11:14:36.000Z\",\"toTime\":\"2022-12-23T11:16:36.985Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"4692b40a-ca9a-4fe5-88ca-cab3d076a71a\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[7],\"groupId\":\"6\"}}", - "createdAt": "2022-12-23 11:54:02.346565+00", - "updatedAt": "2022-12-23 11:54:02.346565+00", - "countryCode": "ALB" - }, - { - "id": 20, - "groupid": 6, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 11:12:36.888+00", - "certificate_issuance_enddate": "2022-12-23 11:14:36.888+00", - "readvalue_watthour": 2000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"6\",\"energyValue\":\"2000\",\"fromTime\":\"2022-12-23T11:12:36.888Z\",\"toTime\":\"2022-12-23T11:14:36.888Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"4692b40a-ca9a-4fe5-88ca-cab3d076a71a\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[6],\"groupId\":\"6\"}}", - "createdAt": "2022-12-23 11:54:02.529822+00", - "updatedAt": "2022-12-23 11:54:02.529822+00", - "countryCode": "AFG" - }, - { - "id": 31, - "groupid": 8, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 08:00:36.859+00", - "certificate_issuance_enddate": "2022-12-23 08:30:36.859+00", - "readvalue_watthour": 15000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"8\",\"energyValue\":\"15000\",\"fromTime\":\"2022-12-23T08:00:36.859Z\",\"toTime\":\"2022-12-23T08:30:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"ab3a7235-7076-448b-84b1-499579f9c646\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[5],\"groupId\":\"8\"}}", - "createdAt": "2022-12-26 11:01:02.21186+00", - "updatedAt": "2022-12-26 11:01:02.21186+00", - "countryCode": "ARG" - }, - { - "id": 32, - "groupid": 8, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 08:30:36.859+00", - "certificate_issuance_enddate": "2022-12-23 09:30:36.859+00", - "readvalue_watthour": 20000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"8\",\"energyValue\":\"20000\",\"fromTime\":\"2022-12-23T08:30:36.859Z\",\"toTime\":\"2022-12-23T09:30:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"ab3a7235-7076-448b-84b1-499579f9c646\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[5],\"groupId\":\"8\"}}", - "createdAt": "2022-12-26 11:01:36.312025+00", - "updatedAt": "2022-12-26 11:01:36.312025+00", - "countryCode": "ARG" - }, - { - "id": 33, - "groupid": 8, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 08:00:36.859+00", - "certificate_issuance_enddate": "2022-12-23 09:30:36.859+00", - "readvalue_watthour": 40000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"8\",\"energyValue\":\"40000\",\"fromTime\":\"2022-12-23T08:00:36.859Z\",\"toTime\":\"2022-12-23T09:30:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"ab3a7235-7076-448b-84b1-499579f9c646\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[3],\"groupId\":\"8\"}}", - "createdAt": "2022-12-26 11:01:37.210788+00", - "updatedAt": "2022-12-26 11:01:37.210788+00", - "countryCode": "IND" - }, - { - "id": 34, - "groupid": 8, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 09:30:36.859+00", - "certificate_issuance_enddate": "2022-12-23 10:00:36.859+00", - "readvalue_watthour": 29000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"8\",\"energyValue\":\"29000\",\"fromTime\":\"2022-12-23T09:30:36.859Z\",\"toTime\":\"2022-12-23T10:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"ab3a7235-7076-448b-84b1-499579f9c646\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[5],\"groupId\":\"8\"}}", - "createdAt": "2022-12-26 11:02:02.124335+00", - "updatedAt": "2022-12-26 11:02:02.124335+00", - "countryCode": "ARG" - }, - { - "id": 35, - "groupid": 8, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 09:30:36.859+00", - "certificate_issuance_enddate": "2022-12-23 10:30:36.859+00", - "readvalue_watthour": 178000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"8\",\"energyValue\":\"178000\",\"fromTime\":\"2022-12-23T09:30:36.859Z\",\"toTime\":\"2022-12-23T10:30:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"ab3a7235-7076-448b-84b1-499579f9c646\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[3],\"groupId\":\"8\"}}", - "createdAt": "2022-12-26 11:02:02.219591+00", - "updatedAt": "2022-12-26 11:02:02.219591+00", - "countryCode": "IND" - }, - { - "id": 36, - "groupid": 8, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 10:00:36.859+00", - "certificate_issuance_enddate": "2022-12-23 11:00:36.859+00", - "readvalue_watthour": 565000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"8\",\"energyValue\":\"565000\",\"fromTime\":\"2022-12-23T10:00:36.859Z\",\"toTime\":\"2022-12-23T11:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"ab3a7235-7076-448b-84b1-499579f9c646\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[5],\"groupId\":\"8\"}}", - "createdAt": "2022-12-26 11:02:32.715359+00", - "updatedAt": "2022-12-26 11:02:32.715359+00", - "countryCode": "ARG" - }, - { - "id": 37, - "groupid": 8, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 10:30:36.859+00", - "certificate_issuance_enddate": "2022-12-23 11:30:36.859+00", - "readvalue_watthour": 178000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"8\",\"energyValue\":\"178000\",\"fromTime\":\"2022-12-23T10:30:36.859Z\",\"toTime\":\"2022-12-23T11:30:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"ab3a7235-7076-448b-84b1-499579f9c646\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[3],\"groupId\":\"8\"}}", - "createdAt": "2022-12-26 11:02:33.407951+00", - "updatedAt": "2022-12-26 11:02:33.407951+00", - "countryCode": "IND" - }, - { - "id": 38, - "groupid": 8, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 11:00:36.859+00", - "certificate_issuance_enddate": "2022-12-23 12:00:36.859+00", - "readvalue_watthour": 565000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"8\",\"energyValue\":\"565000\",\"fromTime\":\"2022-12-23T11:00:36.859Z\",\"toTime\":\"2022-12-23T12:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"ab3a7235-7076-448b-84b1-499579f9c646\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[5],\"groupId\":\"8\"}}", - "createdAt": "2022-12-26 11:03:02.518571+00", - "updatedAt": "2022-12-26 11:03:02.518571+00", - "countryCode": "ARG" - }, - { - "id": 39, - "groupid": 8, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 11:30:36.859+00", - "certificate_issuance_enddate": "2022-12-23 12:00:36.859+00", - "readvalue_watthour": 57000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"8\",\"energyValue\":\"57000\",\"fromTime\":\"2022-12-23T11:30:36.859Z\",\"toTime\":\"2022-12-23T12:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"ab3a7235-7076-448b-84b1-499579f9c646\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[3],\"groupId\":\"8\"}}", - "createdAt": "2022-12-26 11:03:02.608656+00", - "updatedAt": "2022-12-26 11:03:02.608656+00", - "countryCode": "IND" - }, - { - "id": 40, - "groupid": 8, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-23 12:00:36.859+00", - "certificate_issuance_enddate": "2022-12-23 13:00:36.859+00", - "readvalue_watthour": 967000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"8\",\"energyValue\":\"967000\",\"fromTime\":\"2022-12-23T12:00:36.859Z\",\"toTime\":\"2022-12-23T13:00:36.859Z\",\"toAddress\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"userId\":\"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"ab3a7235-7076-448b-84b1-499579f9c646\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[5],\"groupId\":\"8\"}}", - "createdAt": "2022-12-26 11:03:31.738768+00", - "updatedAt": "2022-12-26 11:03:31.738768+00", - "countryCode": "ARG" - }, - { - "id": 41, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 7159100, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"7159100\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.213299+00", - "updatedAt": "2023-01-21 18:58:35.213299+00", - "countryCode": "IND" - }, - { - "id": 42, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 5066000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"5066000\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.218668+00", - "updatedAt": "2023-01-21 18:58:35.218668+00", - "countryCode": "IND" - }, - { - "id": 43, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-31 18:30:01+00", - "certificate_issuance_enddate": "2022-04-30 18:29:59+00", - "readvalue_watthour": 2003700, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2003700\",\"fromTime\":\"2022-03-31T18:30:01.000Z\",\"toTime\":\"2022-04-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.309387+00", - "updatedAt": "2023-01-21 18:58:35.309387+00", - "countryCode": "IND" - }, - { - "id": 44, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-30 18:30:01+00", - "certificate_issuance_enddate": "2022-05-31 18:29:59+00", - "readvalue_watthour": 5611700, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"5611700\",\"fromTime\":\"2022-04-30T18:30:01.000Z\",\"toTime\":\"2022-05-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.313989+00", - "updatedAt": "2023-01-21 18:58:35.313989+00", - "countryCode": "IND" - }, - { - "id": 45, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-02-28 18:30:01+00", - "certificate_issuance_enddate": "2022-03-31 18:29:59+00", - "readvalue_watthour": 5977900, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"5977900\",\"fromTime\":\"2022-02-28T18:30:01.000Z\",\"toTime\":\"2022-03-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.316983+00", - "updatedAt": "2023-01-21 18:58:35.316983+00", - "countryCode": "IND" - }, - { - "id": 46, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-31 18:30:01+00", - "certificate_issuance_enddate": "2022-06-30 18:29:59+00", - "readvalue_watthour": 6526800, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"6526800\",\"fromTime\":\"2022-05-31T18:30:01.000Z\",\"toTime\":\"2022-06-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.408985+00", - "updatedAt": "2023-01-21 18:58:35.408985+00", - "countryCode": "IND" - }, - { - "id": 47, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-31 18:30:01+00", - "certificate_issuance_enddate": "2022-08-31 18:29:59+00", - "readvalue_watthour": 5187100, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"5187100\",\"fromTime\":\"2022-07-31T18:30:01.000Z\",\"toTime\":\"2022-08-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.414482+00", - "updatedAt": "2023-01-21 18:58:35.414482+00", - "countryCode": "IND" - }, - { - "id": 48, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-31 18:30:01+00", - "certificate_issuance_enddate": "2022-04-30 18:29:59+00", - "readvalue_watthour": 2513300, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2513300\",\"fromTime\":\"2022-03-31T18:30:01.000Z\",\"toTime\":\"2022-04-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.508949+00", - "updatedAt": "2023-01-21 18:58:35.508949+00", - "countryCode": "IND" - }, - { - "id": 49, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-02-28 18:30:01+00", - "certificate_issuance_enddate": "2022-03-31 18:29:59+00", - "readvalue_watthour": 2677400, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2677400\",\"fromTime\":\"2022-02-28T18:30:01.000Z\",\"toTime\":\"2022-03-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.514174+00", - "updatedAt": "2023-01-21 18:58:35.514174+00", - "countryCode": "IND" - }, - { - "id": 50, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-30 18:30:01+00", - "certificate_issuance_enddate": "2022-05-31 18:29:59+00", - "readvalue_watthour": 2048800, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2048800\",\"fromTime\":\"2022-04-30T18:30:01.000Z\",\"toTime\":\"2022-05-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.519281+00", - "updatedAt": "2023-01-21 18:58:35.519281+00", - "countryCode": "IND" - }, - { - "id": 51, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-31 18:30:01+00", - "certificate_issuance_enddate": "2022-06-30 18:29:59+00", - "readvalue_watthour": 1752300, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"1752300\",\"fromTime\":\"2022-05-31T18:30:01.000Z\",\"toTime\":\"2022-06-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.610697+00", - "updatedAt": "2023-01-21 18:58:35.610697+00", - "countryCode": "IND" - }, - { - "id": 52, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-30 18:30:01+00", - "certificate_issuance_enddate": "2022-07-31 18:29:59+00", - "readvalue_watthour": 1877100, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"1877100\",\"fromTime\":\"2022-06-30T18:30:01.000Z\",\"toTime\":\"2022-07-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.713298+00", - "updatedAt": "2023-01-21 18:58:35.713298+00", - "countryCode": "IND" - }, - { - "id": 53, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-31 18:30:01+00", - "certificate_issuance_enddate": "2022-08-31 18:29:59+00", - "readvalue_watthour": 2109800, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2109800\",\"fromTime\":\"2022-07-31T18:30:01.000Z\",\"toTime\":\"2022-08-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.717329+00", - "updatedAt": "2023-01-21 18:58:35.717329+00", - "countryCode": "IND" - }, - { - "id": 54, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 2479800, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2479800\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.81087+00", - "updatedAt": "2023-01-21 18:58:35.81087+00", - "countryCode": "IND" - }, - { - "id": 55, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 2062100, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2062100\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.81442+00", - "updatedAt": "2023-01-21 18:58:35.81442+00", - "countryCode": "IND" - }, - { - "id": 56, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-16 18:30:02+00", - "certificate_issuance_enddate": "2022-04-30 18:29:59+00", - "readvalue_watthour": 4672000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"4672000\",\"fromTime\":\"2022-04-16T18:30:02.000Z\",\"toTime\":\"2022-04-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.911646+00", - "updatedAt": "2023-01-21 18:58:35.911646+00", - "countryCode": "IND" - }, - { - "id": 57, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-30 18:30:01+00", - "certificate_issuance_enddate": "2022-05-31 18:29:59+00", - "readvalue_watthour": 8324000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"8324000\",\"fromTime\":\"2022-04-30T18:30:01.000Z\",\"toTime\":\"2022-05-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.914981+00", - "updatedAt": "2023-01-21 18:58:35.914981+00", - "countryCode": "IND" - }, - { - "id": 58, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-31 18:30:01+00", - "certificate_issuance_enddate": "2022-06-30 18:29:59+00", - "readvalue_watthour": 9192000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"9192000\",\"fromTime\":\"2022-05-31T18:30:01.000Z\",\"toTime\":\"2022-06-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:35.917157+00", - "updatedAt": "2023-01-21 18:58:35.917157+00", - "countryCode": "IND" - }, - { - "id": 59, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-30 18:30:01+00", - "certificate_issuance_enddate": "2022-07-31 18:29:59+00", - "readvalue_watthour": 5458300, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"5458300\",\"fromTime\":\"2022-06-30T18:30:01.000Z\",\"toTime\":\"2022-07-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:36.008051+00", - "updatedAt": "2023-01-21 18:58:36.008051+00", - "countryCode": "IND" - }, - { - "id": 60, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-30 18:30:01+00", - "certificate_issuance_enddate": "2022-07-31 18:29:59+00", - "readvalue_watthour": 7879700, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"7879700\",\"fromTime\":\"2022-06-30T18:30:01.000Z\",\"toTime\":\"2022-07-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:36.412057+00", - "updatedAt": "2023-01-21 18:58:36.412057+00", - "countryCode": "IND" - }, - { - "id": 61, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-31 18:30:01+00", - "certificate_issuance_enddate": "2022-08-31 18:29:59+00", - "readvalue_watthour": 8845500, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"8845500\",\"fromTime\":\"2022-07-31T18:30:01.000Z\",\"toTime\":\"2022-08-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:36.414975+00", - "updatedAt": "2023-01-21 18:58:36.414975+00", - "countryCode": "IND" - }, - { - "id": 62, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 10755300, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"10755300\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:36.41832+00", - "updatedAt": "2023-01-21 18:58:36.41832+00", - "countryCode": "IND" - }, - { - "id": 63, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 11089500, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"11089500\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:36.525155+00", - "updatedAt": "2023-01-21 18:58:36.525155+00", - "countryCode": "IND" - }, - { - "id": 64, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-10-31 18:30:01+00", - "certificate_issuance_enddate": "2022-11-30 18:29:59+00", - "readvalue_watthour": 9646300, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"9646300\",\"fromTime\":\"2022-10-31T18:30:01.000Z\",\"toTime\":\"2022-11-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:36.61797+00", - "updatedAt": "2023-01-21 18:58:36.61797+00", - "countryCode": "IND" - }, - { - "id": 65, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-11-30 18:30:01+00", - "certificate_issuance_enddate": "2022-12-14 18:29:59+00", - "readvalue_watthour": 3937500, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"3937500\",\"fromTime\":\"2022-11-30T18:30:01.000Z\",\"toTime\":\"2022-12-14T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:36.808163+00", - "updatedAt": "2023-01-21 18:58:36.808163+00", - "countryCode": "IND" - }, - { - "id": 66, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-30 18:30:01+00", - "certificate_issuance_enddate": "2022-05-31 18:29:59+00", - "readvalue_watthour": 15322600, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"15322600\",\"fromTime\":\"2022-04-30T18:30:01.000Z\",\"toTime\":\"2022-05-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:41.209754+00", - "updatedAt": "2023-01-21 18:58:41.209754+00", - "countryCode": "IND" - }, - { - "id": 67, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-31 18:30:01+00", - "certificate_issuance_enddate": "2022-06-30 18:29:59+00", - "readvalue_watthour": 11984500, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"11984500\",\"fromTime\":\"2022-05-31T18:30:01.000Z\",\"toTime\":\"2022-06-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:41.214329+00", - "updatedAt": "2023-01-21 18:58:41.214329+00", - "countryCode": "IND" - }, - { - "id": 68, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-30 18:30:01+00", - "certificate_issuance_enddate": "2022-07-31 18:29:59+00", - "readvalue_watthour": 8300600, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"8300600\",\"fromTime\":\"2022-06-30T18:30:01.000Z\",\"toTime\":\"2022-07-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:41.308242+00", - "updatedAt": "2023-01-21 18:58:41.308242+00", - "countryCode": "IND" - }, - { - "id": 69, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-31 18:30:01+00", - "certificate_issuance_enddate": "2022-04-30 18:29:59+00", - "readvalue_watthour": 14820700, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"14820700\",\"fromTime\":\"2022-03-31T18:30:01.000Z\",\"toTime\":\"2022-04-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:41.3112+00", - "updatedAt": "2023-01-21 18:58:41.3112+00", - "countryCode": "IND" - }, - { - "id": 70, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-31 18:30:01+00", - "certificate_issuance_enddate": "2022-08-31 18:29:59+00", - "readvalue_watthour": 9716000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"9716000\",\"fromTime\":\"2022-07-31T18:30:01.000Z\",\"toTime\":\"2022-08-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:41.41318+00", - "updatedAt": "2023-01-21 18:58:41.41318+00", - "countryCode": "IND" - }, - { - "id": 71, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 9542000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"9542000\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:41.418586+00", - "updatedAt": "2023-01-21 18:58:41.418586+00", - "countryCode": "IND" - }, - { - "id": 72, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 11456000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"11456000\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:41.50889+00", - "updatedAt": "2023-01-21 18:58:41.50889+00", - "countryCode": "IND" - }, - { - "id": 73, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-02-28 18:30:01+00", - "certificate_issuance_enddate": "2022-03-31 18:29:59+00", - "readvalue_watthour": 14272300, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"14272300\",\"fromTime\":\"2022-02-28T18:30:01.000Z\",\"toTime\":\"2022-03-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:41.520627+00", - "updatedAt": "2023-01-21 18:58:41.520627+00", - "countryCode": "IND" - }, - { - "id": 74, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-31 18:30:01+00", - "certificate_issuance_enddate": "2022-06-30 18:29:59+00", - "readvalue_watthour": 2675900, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2675900\",\"fromTime\":\"2022-05-31T18:30:01.000Z\",\"toTime\":\"2022-06-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:43.01055+00", - "updatedAt": "2023-01-21 18:58:43.01055+00", - "countryCode": "IND" - }, - { - "id": 75, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-30 18:30:01+00", - "certificate_issuance_enddate": "2022-07-31 18:29:59+00", - "readvalue_watthour": 2710100, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2710100\",\"fromTime\":\"2022-06-30T18:30:01.000Z\",\"toTime\":\"2022-07-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:43.015235+00", - "updatedAt": "2023-01-21 18:58:43.015235+00", - "countryCode": "IND" - }, - { - "id": 76, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-02-28 18:30:01+00", - "certificate_issuance_enddate": "2022-03-31 18:29:59+00", - "readvalue_watthour": 2577200, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2577200\",\"fromTime\":\"2022-02-28T18:30:01.000Z\",\"toTime\":\"2022-03-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:43.017396+00", - "updatedAt": "2023-01-21 18:58:43.017396+00", - "countryCode": "IND" - }, - { - "id": 77, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-31 18:30:01+00", - "certificate_issuance_enddate": "2022-04-30 18:29:59+00", - "readvalue_watthour": 1801700, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"1801700\",\"fromTime\":\"2022-03-31T18:30:01.000Z\",\"toTime\":\"2022-04-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:43.018398+00", - "updatedAt": "2023-01-21 18:58:43.018398+00", - "countryCode": "IND" - }, - { - "id": 78, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-31 18:30:01+00", - "certificate_issuance_enddate": "2022-08-31 18:29:59+00", - "readvalue_watthour": 3078900, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"3078900\",\"fromTime\":\"2022-07-31T18:30:01.000Z\",\"toTime\":\"2022-08-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:43.111457+00", - "updatedAt": "2023-01-21 18:58:43.111457+00", - "countryCode": "IND" - }, - { - "id": 79, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-30 18:30:01+00", - "certificate_issuance_enddate": "2022-05-31 18:29:59+00", - "readvalue_watthour": 2777900, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"2777900\",\"fromTime\":\"2022-04-30T18:30:01.000Z\",\"toTime\":\"2022-05-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:43.112978+00", - "updatedAt": "2023-01-21 18:58:43.112978+00", - "countryCode": "IND" - }, - { - "id": 80, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 3547000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"3547000\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:43.110017+00", - "updatedAt": "2023-01-21 18:58:43.110017+00", - "countryCode": "IND" - }, - { - "id": 81, - "groupid": 9, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 3521300, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"9\",\"energyValue\":\"3521300\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}}", - "createdAt": "2023-01-21 18:58:43.214033+00", - "updatedAt": "2023-01-21 18:58:43.214033+00", - "countryCode": "IND" - }, - { - "id": 82, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 1098000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1098000\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.109068+00", - "updatedAt": "2023-01-21 19:01:33.109068+00", - "countryCode": "IND" - }, - { - "id": 83, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 1178000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1178000\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.117903+00", - "updatedAt": "2023-01-21 19:01:33.117903+00", - "countryCode": "IND" - }, - { - "id": 84, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-02-28 18:30:02+00", - "certificate_issuance_enddate": "2022-03-31 18:29:59+00", - "readvalue_watthour": 991000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"991000\",\"fromTime\":\"2022-02-28T18:30:02.000Z\",\"toTime\":\"2022-03-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.208198+00", - "updatedAt": "2023-01-21 19:01:33.208198+00", - "countryCode": "IND" - }, - { - "id": 85, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-31 18:30:01+00", - "certificate_issuance_enddate": "2022-04-30 18:29:59+00", - "readvalue_watthour": 1080000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1080000\",\"fromTime\":\"2022-03-31T18:30:01.000Z\",\"toTime\":\"2022-04-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.212906+00", - "updatedAt": "2023-01-21 19:01:33.212906+00", - "countryCode": "IND" - }, - { - "id": 86, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-10-31 18:30:01+00", - "certificate_issuance_enddate": "2022-11-30 18:29:59+00", - "readvalue_watthour": 1107000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1107000\",\"fromTime\":\"2022-10-31T18:30:01.000Z\",\"toTime\":\"2022-11-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.3088+00", - "updatedAt": "2023-01-21 19:01:33.3088+00", - "countryCode": "IND" - }, - { - "id": 87, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-11-30 18:30:01+00", - "certificate_issuance_enddate": "2022-12-31 18:29:59+00", - "readvalue_watthour": 1317000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1317000\",\"fromTime\":\"2022-11-30T18:30:01.000Z\",\"toTime\":\"2022-12-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.313606+00", - "updatedAt": "2023-01-21 19:01:33.313606+00", - "countryCode": "IND" - }, - { - "id": 88, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-30 18:30:01+00", - "certificate_issuance_enddate": "2022-05-31 18:29:59+00", - "readvalue_watthour": 1161000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1161000\",\"fromTime\":\"2022-04-30T18:30:01.000Z\",\"toTime\":\"2022-05-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.316625+00", - "updatedAt": "2023-01-21 19:01:33.316625+00", - "countryCode": "IND" - }, - { - "id": 89, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-30 18:30:01+00", - "certificate_issuance_enddate": "2022-05-31 18:29:59+00", - "readvalue_watthour": 1075000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1075000\",\"fromTime\":\"2022-04-30T18:30:01.000Z\",\"toTime\":\"2022-05-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.412876+00", - "updatedAt": "2023-01-21 19:01:33.412876+00", - "countryCode": "IND" - }, - { - "id": 90, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-31 18:30:01+00", - "certificate_issuance_enddate": "2022-06-30 18:29:59+00", - "readvalue_watthour": 1017000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1017000\",\"fromTime\":\"2022-05-31T18:30:01.000Z\",\"toTime\":\"2022-06-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.51187+00", - "updatedAt": "2023-01-21 19:01:33.51187+00", - "countryCode": "IND" - }, - { - "id": 91, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-02-28 18:30:02+00", - "certificate_issuance_enddate": "2022-03-31 18:29:59+00", - "readvalue_watthour": 968000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"968000\",\"fromTime\":\"2022-02-28T18:30:02.000Z\",\"toTime\":\"2022-03-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.514339+00", - "updatedAt": "2023-01-21 19:01:33.514339+00", - "countryCode": "IND" - }, - { - "id": 92, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-31 18:30:01+00", - "certificate_issuance_enddate": "2022-04-30 18:29:59+00", - "readvalue_watthour": 1062000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1062000\",\"fromTime\":\"2022-03-31T18:30:01.000Z\",\"toTime\":\"2022-04-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.517592+00", - "updatedAt": "2023-01-21 19:01:33.517592+00", - "countryCode": "IND" - }, - { - "id": 93, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-31 18:30:01+00", - "certificate_issuance_enddate": "2022-08-31 18:29:59+00", - "readvalue_watthour": 1077000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1077000\",\"fromTime\":\"2022-07-31T18:30:01.000Z\",\"toTime\":\"2022-08-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.612675+00", - "updatedAt": "2023-01-21 19:01:33.612675+00", - "countryCode": "IND" - }, - { - "id": 94, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-30 18:30:01+00", - "certificate_issuance_enddate": "2022-07-31 18:29:59+00", - "readvalue_watthour": 1175000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1175000\",\"fromTime\":\"2022-06-30T18:30:01.000Z\",\"toTime\":\"2022-07-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.709102+00", - "updatedAt": "2023-01-21 19:01:33.709102+00", - "countryCode": "IND" - }, - { - "id": 95, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-31 18:30:01+00", - "certificate_issuance_enddate": "2022-08-31 18:29:59+00", - "readvalue_watthour": 1078000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1078000\",\"fromTime\":\"2022-07-31T18:30:01.000Z\",\"toTime\":\"2022-08-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.814371+00", - "updatedAt": "2023-01-21 19:01:33.814371+00", - "countryCode": "IND" - }, - { - "id": 96, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-31 18:30:01+00", - "certificate_issuance_enddate": "2022-06-30 18:29:59+00", - "readvalue_watthour": 1028000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1028000\",\"fromTime\":\"2022-05-31T18:30:01.000Z\",\"toTime\":\"2022-06-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.912382+00", - "updatedAt": "2023-01-21 19:01:33.912382+00", - "countryCode": "IND" - }, - { - "id": 97, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-30 18:30:01+00", - "certificate_issuance_enddate": "2022-07-31 18:29:59+00", - "readvalue_watthour": 1033000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1033000\",\"fromTime\":\"2022-06-30T18:30:01.000Z\",\"toTime\":\"2022-07-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:33.919121+00", - "updatedAt": "2023-01-21 19:01:33.919121+00", - "countryCode": "IND" - }, - { - "id": 98, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 1321000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1321000\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.01005+00", - "updatedAt": "2023-01-21 19:01:34.01005+00", - "countryCode": "IND" - }, - { - "id": 99, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 1284000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1284000\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.020352+00", - "updatedAt": "2023-01-21 19:01:34.020352+00", - "countryCode": "IND" - }, - { - "id": 100, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-10-31 18:30:01+00", - "certificate_issuance_enddate": "2022-11-30 18:29:59+00", - "readvalue_watthour": 1151000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1151000\",\"fromTime\":\"2022-10-31T18:30:01.000Z\",\"toTime\":\"2022-11-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.112324+00", - "updatedAt": "2023-01-21 19:01:34.112324+00", - "countryCode": "IND" - }, - { - "id": 101, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-11-30 18:30:01+00", - "certificate_issuance_enddate": "2022-12-31 18:29:59+00", - "readvalue_watthour": 1320000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1320000\",\"fromTime\":\"2022-11-30T18:30:01.000Z\",\"toTime\":\"2022-12-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.115154+00", - "updatedAt": "2023-01-21 19:01:34.115154+00", - "countryCode": "IND" - }, - { - "id": 102, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-02 18:30:02+00", - "certificate_issuance_enddate": "2022-03-31 18:29:59+00", - "readvalue_watthour": 1472000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1472000\",\"fromTime\":\"2022-03-02T18:30:02.000Z\",\"toTime\":\"2022-03-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.211818+00", - "updatedAt": "2023-01-21 19:01:34.211818+00", - "countryCode": "IND" - }, - { - "id": 103, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-31 18:30:01+00", - "certificate_issuance_enddate": "2022-04-30 18:29:59+00", - "readvalue_watthour": 1529000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1529000\",\"fromTime\":\"2022-03-31T18:30:01.000Z\",\"toTime\":\"2022-04-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.212546+00", - "updatedAt": "2023-01-21 19:01:34.212546+00", - "countryCode": "IND" - }, - { - "id": 104, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 2211000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"2211000\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.312497+00", - "updatedAt": "2023-01-21 19:01:34.312497+00", - "countryCode": "IND" - }, - { - "id": 105, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 2183000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"2183000\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.511741+00", - "updatedAt": "2023-01-21 19:01:34.511741+00", - "countryCode": "IND" - }, - { - "id": 106, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-10-31 18:30:01+00", - "certificate_issuance_enddate": "2022-11-30 18:29:59+00", - "readvalue_watthour": 2439000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"2439000\",\"fromTime\":\"2022-10-31T18:30:01.000Z\",\"toTime\":\"2022-11-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.609364+00", - "updatedAt": "2023-01-21 19:01:34.609364+00", - "countryCode": "IND" - }, - { - "id": 107, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-11-30 18:30:01+00", - "certificate_issuance_enddate": "2022-12-31 18:29:59+00", - "readvalue_watthour": 2304000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"2304000\",\"fromTime\":\"2022-11-30T18:30:01.000Z\",\"toTime\":\"2022-12-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.618824+00", - "updatedAt": "2023-01-21 19:01:34.618824+00", - "countryCode": "IND" - }, - { - "id": 108, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-31 18:30:01+00", - "certificate_issuance_enddate": "2022-06-30 18:29:59+00", - "readvalue_watthour": 1628000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1628000\",\"fromTime\":\"2022-05-31T18:30:01.000Z\",\"toTime\":\"2022-06-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.710688+00", - "updatedAt": "2023-01-21 19:01:34.710688+00", - "countryCode": "IND" - }, - { - "id": 109, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-04-30 18:30:01+00", - "certificate_issuance_enddate": "2022-05-31 18:29:59+00", - "readvalue_watthour": 1760000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"1760000\",\"fromTime\":\"2022-04-30T18:30:01.000Z\",\"toTime\":\"2022-05-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.810092+00", - "updatedAt": "2023-01-21 19:01:34.810092+00", - "countryCode": "IND" - }, - { - "id": 110, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-30 18:30:01+00", - "certificate_issuance_enddate": "2022-07-31 18:29:59+00", - "readvalue_watthour": 2237000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"2237000\",\"fromTime\":\"2022-06-30T18:30:01.000Z\",\"toTime\":\"2022-07-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.815828+00", - "updatedAt": "2023-01-21 19:01:34.815828+00", - "countryCode": "IND" - }, - { - "id": 111, - "groupid": 10, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-31 18:30:01+00", - "certificate_issuance_enddate": "2022-08-31 18:29:59+00", - "readvalue_watthour": 2463000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"10\",\"energyValue\":\"2463000\",\"fromTime\":\"2022-07-31T18:30:01.000Z\",\"toTime\":\"2022-08-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}}", - "createdAt": "2023-01-21 19:01:34.915391+00", - "updatedAt": "2023-01-21 19:01:34.915391+00", - "countryCode": "IND" - }, - { - "id": 112, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-14 00:00:00+00", - "certificate_issuance_enddate": "2023-01-16 09:00:00+00", - "readvalue_watthour": 74545344, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"74545344\",\"fromTime\":\"2022-03-14T00:00:00.000Z\",\"toTime\":\"2023-01-16T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 04:58:03.607617+00", - "updatedAt": "2023-01-27 04:58:03.607617+00", - "countryCode": "IND" - }, - { - "id": 113, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-14 00:00:00+00", - "certificate_issuance_enddate": "2023-01-16 09:00:00+00", - "readvalue_watthour": 78922632, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"78922632\",\"fromTime\":\"2022-03-14T00:00:00.000Z\",\"toTime\":\"2023-01-16T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 04:58:04.716641+00", - "updatedAt": "2023-01-27 04:58:04.716641+00", - "countryCode": "IND" - }, - { - "id": 114, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-14 00:00:00+00", - "certificate_issuance_enddate": "2023-01-15 23:59:59+00", - "readvalue_watthour": 79136096, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"79136096\",\"fromTime\":\"2022-03-14T00:00:00.000Z\",\"toTime\":\"2023-01-15T23:59:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 04:58:05.706885+00", - "updatedAt": "2023-01-27 04:58:05.706885+00", - "countryCode": "IND" - }, - { - "id": 115, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-18 10:25:00+00", - "certificate_issuance_enddate": "2023-01-19 10:00:00+00", - "readvalue_watthour": 862000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"862000\",\"fromTime\":\"2023-01-18T10:25:00.000Z\",\"toTime\":\"2023-01-19T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 05:00:06.108474+00", - "updatedAt": "2023-01-27 05:00:06.108474+00", - "countryCode": "IND" - }, - { - "id": 116, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-19 10:00:00+00", - "certificate_issuance_enddate": "2023-01-20 10:00:00+00", - "readvalue_watthour": 823000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"823000\",\"fromTime\":\"2023-01-19T10:00:00.000Z\",\"toTime\":\"2023-01-20T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 05:00:32.509333+00", - "updatedAt": "2023-01-27 05:00:32.509333+00", - "countryCode": "IND" - }, - { - "id": 117, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-20 10:00:00+00", - "certificate_issuance_enddate": "2023-01-21 10:00:00+00", - "readvalue_watthour": 877000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"877000\",\"fromTime\":\"2023-01-20T10:00:00.000Z\",\"toTime\":\"2023-01-21T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 05:01:03.613682+00", - "updatedAt": "2023-01-27 05:01:03.613682+00", - "countryCode": "IND" - }, - { - "id": 118, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-21 10:00:00+00", - "certificate_issuance_enddate": "2023-01-22 10:00:00+00", - "readvalue_watthour": 723000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"723000\",\"fromTime\":\"2023-01-21T10:00:00.000Z\",\"toTime\":\"2023-01-22T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 05:01:31.811882+00", - "updatedAt": "2023-01-27 05:01:31.811882+00", - "countryCode": "IND" - }, - { - "id": 119, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-22 10:00:00+00", - "certificate_issuance_enddate": "2023-01-23 10:00:00+00", - "readvalue_watthour": 910000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"910000\",\"fromTime\":\"2023-01-22T10:00:00.000Z\",\"toTime\":\"2023-01-23T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 05:02:02.114774+00", - "updatedAt": "2023-01-27 05:02:02.114774+00", - "countryCode": "IND" - }, - { - "id": 120, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-23 10:00:00+00", - "certificate_issuance_enddate": "2023-01-24 10:00:00+00", - "readvalue_watthour": 1047000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"1047000\",\"fromTime\":\"2023-01-23T10:00:00.000Z\",\"toTime\":\"2023-01-24T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 05:02:33.216004+00", - "updatedAt": "2023-01-27 05:02:33.216004+00", - "countryCode": "IND" - }, - { - "id": 121, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-24 10:00:00+00", - "certificate_issuance_enddate": "2023-01-25 10:00:00+00", - "readvalue_watthour": 1066000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"1066000\",\"fromTime\":\"2023-01-24T10:00:00.000Z\",\"toTime\":\"2023-01-25T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 05:03:04.810135+00", - "updatedAt": "2023-01-27 05:03:04.810135+00", - "countryCode": "IND" - }, - { - "id": 122, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-25 10:00:00+00", - "certificate_issuance_enddate": "2023-01-26 10:00:00+00", - "readvalue_watthour": 1077000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"1077000\",\"fromTime\":\"2023-01-25T10:00:00.000Z\",\"toTime\":\"2023-01-26T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 05:03:32.107635+00", - "updatedAt": "2023-01-27 05:03:32.107635+00", - "countryCode": "IND" - }, - { - "id": 123, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-26 10:00:00+00", - "certificate_issuance_enddate": "2023-01-27 10:00:00+00", - "readvalue_watthour": 1154000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"1154000\",\"fromTime\":\"2023-01-26T10:00:00.000Z\",\"toTime\":\"2023-01-27T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-27 10:03:32.326541+00", - "updatedAt": "2023-01-27 10:03:32.326541+00", - "countryCode": "IND" - }, - { - "id": 124, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-27 10:00:00+00", - "certificate_issuance_enddate": "2023-01-28 10:00:00+00", - "readvalue_watthour": 1093000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"1093000\",\"fromTime\":\"2023-01-27T10:00:00.000Z\",\"toTime\":\"2023-01-28T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-28 10:03:32.811607+00", - "updatedAt": "2023-01-28 10:03:32.811607+00", - "countryCode": "IND" - }, - { - "id": 125, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-28 10:00:00+00", - "certificate_issuance_enddate": "2023-01-29 10:00:00+00", - "readvalue_watthour": 752000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"752000\",\"fromTime\":\"2023-01-28T10:00:00.000Z\",\"toTime\":\"2023-01-29T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-29 10:03:35.026095+00", - "updatedAt": "2023-01-29 10:03:35.026095+00", - "countryCode": "IND" - }, - { - "id": 126, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-29 10:00:00+00", - "certificate_issuance_enddate": "2023-01-30 10:00:00+00", - "readvalue_watthour": 529000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"529000\",\"fromTime\":\"2023-01-29T10:00:00.000Z\",\"toTime\":\"2023-01-30T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-01-30 10:03:32.016655+00", - "updatedAt": "2023-01-30 10:03:32.016655+00", - "countryCode": "IND" - }, - { - "id": 127, - "groupid": 11, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-01-31 10:00:00+00", - "certificate_issuance_enddate": "2023-01-31 23:55:00+00", - "readvalue_watthour": 72000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"11\",\"energyValue\":\"72000\",\"fromTime\":\"2023-01-31T10:00:00.000Z\",\"toTime\":\"2023-01-31T23:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}}", - "createdAt": "2023-02-01 00:00:32.709674+00", - "updatedAt": "2023-02-01 00:00:32.709674+00", - "countryCode": "IND" - }, - { - "id": 128, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 16336400, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"16336400\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:34.710806+00", - "updatedAt": "2023-02-01 18:29:34.710806+00", - "countryCode": "IND" - }, - { - "id": 129, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-10-31 18:30:01+00", - "certificate_issuance_enddate": "2022-11-30 18:29:59+00", - "readvalue_watthour": 5656000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"5656000\",\"fromTime\":\"2022-10-31T18:30:01.000Z\",\"toTime\":\"2022-11-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[207],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.006969+00", - "updatedAt": "2023-02-01 18:29:35.006969+00", - "countryCode": "IND" - }, - { - "id": 130, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-10-31 18:30:01+00", - "certificate_issuance_enddate": "2022-11-30 18:29:59+00", - "readvalue_watthour": 11563100, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"11563100\",\"fromTime\":\"2022-10-31T18:30:01.000Z\",\"toTime\":\"2022-11-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:34.914183+00", - "updatedAt": "2023-02-01 18:29:34.914183+00", - "countryCode": "IND" - }, - { - "id": 131, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-11-30 18:30:01+00", - "certificate_issuance_enddate": "2022-12-31 18:29:59+00", - "readvalue_watthour": 9056700, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"9056700\",\"fromTime\":\"2022-11-30T18:30:01.000Z\",\"toTime\":\"2022-12-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.019804+00", - "updatedAt": "2023-02-01 18:29:35.019804+00", - "countryCode": "IND" - }, - { - "id": 132, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 14118500, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"14118500\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.01986+00", - "updatedAt": "2023-02-01 18:29:35.01986+00", - "countryCode": "IND" - }, - { - "id": 133, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-11-30 18:30:01+00", - "certificate_issuance_enddate": "2022-12-31 18:29:59+00", - "readvalue_watthour": 5812000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"5812000\",\"fromTime\":\"2022-11-30T18:30:01.000Z\",\"toTime\":\"2022-12-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[207],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.109288+00", - "updatedAt": "2023-02-01 18:29:35.109288+00", - "countryCode": "IND" - }, - { - "id": 134, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 3947000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"3947000\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[206],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.211286+00", - "updatedAt": "2023-02-01 18:29:35.211286+00", - "countryCode": "IND" - }, - { - "id": 135, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 4111000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"4111000\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[206],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.224275+00", - "updatedAt": "2023-02-01 18:29:35.224275+00", - "countryCode": "IND" - }, - { - "id": 136, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-10-31 18:30:01+00", - "certificate_issuance_enddate": "2022-11-30 18:29:59+00", - "readvalue_watthour": 3920000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"3920000\",\"fromTime\":\"2022-10-31T18:30:01.000Z\",\"toTime\":\"2022-11-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[206],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.311178+00", - "updatedAt": "2023-02-01 18:29:35.311178+00", - "countryCode": "IND" - }, - { - "id": 137, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-11-30 18:30:01+00", - "certificate_issuance_enddate": "2022-12-31 18:29:59+00", - "readvalue_watthour": 3923000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"3923000\",\"fromTime\":\"2022-11-30T18:30:01.000Z\",\"toTime\":\"2022-12-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[206],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.31503+00", - "updatedAt": "2023-02-01 18:29:35.31503+00", - "countryCode": "IND" - }, - { - "id": 138, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-19 18:30:02+00", - "certificate_issuance_enddate": "2022-06-30 18:29:59+00", - "readvalue_watthour": 3147100, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"3147100\",\"fromTime\":\"2022-06-19T18:30:02.000Z\",\"toTime\":\"2022-06-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.509332+00", - "updatedAt": "2023-02-01 18:29:35.509332+00", - "countryCode": "IND" - }, - { - "id": 139, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-31 18:30:01+00", - "certificate_issuance_enddate": "2022-08-31 18:29:59+00", - "readvalue_watthour": 16125200, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"16125200\",\"fromTime\":\"2022-07-31T18:30:01.000Z\",\"toTime\":\"2022-08-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.513581+00", - "updatedAt": "2023-02-01 18:29:35.513581+00", - "countryCode": "IND" - }, - { - "id": 140, - "groupid": 12, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-30 18:30:01+00", - "certificate_issuance_enddate": "2022-07-31 18:29:59+00", - "readvalue_watthour": 12173900, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"12\",\"energyValue\":\"12173900\",\"fromTime\":\"2022-06-30T18:30:01.000Z\",\"toTime\":\"2022-07-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}}", - "createdAt": "2023-02-01 18:29:35.908009+00", - "updatedAt": "2023-02-01 18:29:35.908009+00", - "countryCode": "IND" - }, - { - "id": 141, - "groupid": 13, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-31 18:30:01+00", - "certificate_issuance_enddate": "2022-08-31 18:29:59+00", - "readvalue_watthour": 3205000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"13\",\"energyValue\":\"3205000\",\"fromTime\":\"2022-07-31T18:30:01.000Z\",\"toTime\":\"2022-08-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"0a5ce04e-bb3f-4306-9665-2a165ebe45e1\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"13\"}}", - "createdAt": "2023-02-03 10:17:33.314144+00", - "updatedAt": "2023-02-03 10:17:33.314144+00", - "countryCode": "IND" - }, - { - "id": 142, - "groupid": 13, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-08-31 18:30:01+00", - "certificate_issuance_enddate": "2022-09-30 18:29:59+00", - "readvalue_watthour": 3247000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"13\",\"energyValue\":\"3247000\",\"fromTime\":\"2022-08-31T18:30:01.000Z\",\"toTime\":\"2022-09-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"0a5ce04e-bb3f-4306-9665-2a165ebe45e1\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"13\"}}", - "createdAt": "2023-02-03 10:17:33.314226+00", - "updatedAt": "2023-02-03 10:17:33.314226+00", - "countryCode": "IND" - }, - { - "id": 143, - "groupid": 13, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-11-30 18:30:01+00", - "certificate_issuance_enddate": "2022-12-31 18:29:59+00", - "readvalue_watthour": 1617000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"13\",\"energyValue\":\"1617000\",\"fromTime\":\"2022-11-30T18:30:01.000Z\",\"toTime\":\"2022-12-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"0a5ce04e-bb3f-4306-9665-2a165ebe45e1\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"13\"}}", - "createdAt": "2023-02-03 10:17:33.31668+00", - "updatedAt": "2023-02-03 10:17:33.31668+00", - "countryCode": "IND" - }, - { - "id": 144, - "groupid": 13, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-10-31 18:30:01+00", - "certificate_issuance_enddate": "2022-11-30 18:29:59+00", - "readvalue_watthour": 2312000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"13\",\"energyValue\":\"2312000\",\"fromTime\":\"2022-10-31T18:30:01.000Z\",\"toTime\":\"2022-11-30T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"0a5ce04e-bb3f-4306-9665-2a165ebe45e1\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"13\"}}", - "createdAt": "2023-02-03 10:17:33.319522+00", - "updatedAt": "2023-02-03 10:17:33.319522+00", - "countryCode": "IND" - }, - { - "id": 145, - "groupid": 13, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-30 18:30:01+00", - "certificate_issuance_enddate": "2022-10-31 18:29:59+00", - "readvalue_watthour": 2803000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"13\",\"energyValue\":\"2803000\",\"fromTime\":\"2022-09-30T18:30:01.000Z\",\"toTime\":\"2022-10-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"0a5ce04e-bb3f-4306-9665-2a165ebe45e1\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"13\"}}", - "createdAt": "2023-02-03 10:17:33.318088+00", - "updatedAt": "2023-02-03 10:17:33.318088+00", - "countryCode": "IND" - }, - { - "id": 146, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 00:40:00+00", - "certificate_issuance_enddate": "2023-02-01 02:00:00+00", - "readvalue_watthour": 2000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"2000\",\"fromTime\":\"2023-02-01T00:40:00.000Z\",\"toTime\":\"2023-02-01T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:31:32.42693+00", - "updatedAt": "2023-02-03 10:31:32.42693+00", - "countryCode": "IND" - }, - { - "id": 147, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 02:00:00+00", - "certificate_issuance_enddate": "2023-02-01 03:00:00+00", - "readvalue_watthour": 12000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"12000\",\"fromTime\":\"2023-02-01T02:00:00.000Z\",\"toTime\":\"2023-02-01T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:32:02.914406+00", - "updatedAt": "2023-02-03 10:32:02.914406+00", - "countryCode": "IND" - }, - { - "id": 148, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 03:00:00+00", - "certificate_issuance_enddate": "2023-02-01 04:00:00+00", - "readvalue_watthour": 56000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"56000\",\"fromTime\":\"2023-02-01T03:00:00.000Z\",\"toTime\":\"2023-02-01T04:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:32:32.938132+00", - "updatedAt": "2023-02-03 10:32:32.938132+00", - "countryCode": "IND" - }, - { - "id": 149, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 04:00:00+00", - "certificate_issuance_enddate": "2023-02-01 05:00:00+00", - "readvalue_watthour": 114000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"114000\",\"fromTime\":\"2023-02-01T04:00:00.000Z\",\"toTime\":\"2023-02-01T05:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:33:02.623574+00", - "updatedAt": "2023-02-03 10:33:02.623574+00", - "countryCode": "IND" - }, - { - "id": 150, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 05:00:00+00", - "certificate_issuance_enddate": "2023-02-01 06:00:00+00", - "readvalue_watthour": 139000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"139000\",\"fromTime\":\"2023-02-01T05:00:00.000Z\",\"toTime\":\"2023-02-01T06:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:33:32.519959+00", - "updatedAt": "2023-02-03 10:33:32.519959+00", - "countryCode": "IND" - }, - { - "id": 151, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 06:00:00+00", - "certificate_issuance_enddate": "2023-02-01 07:00:00+00", - "readvalue_watthour": 157000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"157000\",\"fromTime\":\"2023-02-01T06:00:00.000Z\",\"toTime\":\"2023-02-01T07:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:34:02.713251+00", - "updatedAt": "2023-02-03 10:34:02.713251+00", - "countryCode": "IND" - }, - { - "id": 152, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 07:00:00+00", - "certificate_issuance_enddate": "2023-02-01 08:00:00+00", - "readvalue_watthour": 157000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"157000\",\"fromTime\":\"2023-02-01T07:00:00.000Z\",\"toTime\":\"2023-02-01T08:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:34:32.620028+00", - "updatedAt": "2023-02-03 10:34:32.620028+00", - "countryCode": "IND" - }, - { - "id": 153, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 08:00:00+00", - "certificate_issuance_enddate": "2023-02-01 09:00:00+00", - "readvalue_watthour": 134000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"134000\",\"fromTime\":\"2023-02-01T08:00:00.000Z\",\"toTime\":\"2023-02-01T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:35:02.82912+00", - "updatedAt": "2023-02-03 10:35:02.82912+00", - "countryCode": "IND" - }, - { - "id": 154, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 09:00:00+00", - "certificate_issuance_enddate": "2023-02-01 10:00:00+00", - "readvalue_watthour": 97000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"97000\",\"fromTime\":\"2023-02-01T09:00:00.000Z\",\"toTime\":\"2023-02-01T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:35:32.316738+00", - "updatedAt": "2023-02-03 10:35:32.316738+00", - "countryCode": "IND" - }, - { - "id": 155, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 10:00:00+00", - "certificate_issuance_enddate": "2023-02-01 11:00:00+00", - "readvalue_watthour": 57000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"57000\",\"fromTime\":\"2023-02-01T10:00:00.000Z\",\"toTime\":\"2023-02-01T11:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:36:02.336257+00", - "updatedAt": "2023-02-03 10:36:02.336257+00", - "countryCode": "IND" - }, - { - "id": 156, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 11:00:00+00", - "certificate_issuance_enddate": "2023-02-01 12:00:00+00", - "readvalue_watthour": 20000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"20000\",\"fromTime\":\"2023-02-01T11:00:00.000Z\",\"toTime\":\"2023-02-01T12:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:36:32.21486+00", - "updatedAt": "2023-02-03 10:36:32.21486+00", - "countryCode": "IND" - }, - { - "id": 157, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 12:00:00+00", - "certificate_issuance_enddate": "2023-02-01 13:00:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-01T12:00:00.000Z\",\"toTime\":\"2023-02-01T13:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:37:02.644221+00", - "updatedAt": "2023-02-03 10:37:02.644221+00", - "countryCode": "IND" - }, - { - "id": 158, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-01 22:45:00+00", - "certificate_issuance_enddate": "2023-02-02 00:00:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-01T22:45:00.000Z\",\"toTime\":\"2023-02-02T00:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:42:31.610621+00", - "updatedAt": "2023-02-03 10:42:31.610621+00", - "countryCode": "IND" - }, - { - "id": 159, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 00:45:00+00", - "certificate_issuance_enddate": "2023-02-02 02:00:00+00", - "readvalue_watthour": 6000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"6000\",\"fromTime\":\"2023-02-02T00:45:00.000Z\",\"toTime\":\"2023-02-02T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:43:31.916064+00", - "updatedAt": "2023-02-03 10:43:31.916064+00", - "countryCode": "IND" - }, - { - "id": 160, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 02:00:00+00", - "certificate_issuance_enddate": "2023-02-02 03:00:00+00", - "readvalue_watthour": 32000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"32000\",\"fromTime\":\"2023-02-02T02:00:00.000Z\",\"toTime\":\"2023-02-02T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:44:01.923366+00", - "updatedAt": "2023-02-03 10:44:01.923366+00", - "countryCode": "IND" - }, - { - "id": 161, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 03:00:00+00", - "certificate_issuance_enddate": "2023-02-02 04:00:00+00", - "readvalue_watthour": 60000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"60000\",\"fromTime\":\"2023-02-02T03:00:00.000Z\",\"toTime\":\"2023-02-02T04:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:44:31.610514+00", - "updatedAt": "2023-02-03 10:44:31.610514+00", - "countryCode": "IND" - }, - { - "id": 162, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 04:00:00+00", - "certificate_issuance_enddate": "2023-02-02 05:00:00+00", - "readvalue_watthour": 114000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"114000\",\"fromTime\":\"2023-02-02T04:00:00.000Z\",\"toTime\":\"2023-02-02T05:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:45:01.981585+00", - "updatedAt": "2023-02-03 10:45:01.981585+00", - "countryCode": "IND" - }, - { - "id": 163, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 05:00:00+00", - "certificate_issuance_enddate": "2023-02-02 06:00:00+00", - "readvalue_watthour": 138000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"138000\",\"fromTime\":\"2023-02-02T05:00:00.000Z\",\"toTime\":\"2023-02-02T06:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:45:32.314129+00", - "updatedAt": "2023-02-03 10:45:32.314129+00", - "countryCode": "IND" - }, - { - "id": 164, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 06:00:00+00", - "certificate_issuance_enddate": "2023-02-02 07:00:00+00", - "readvalue_watthour": 150000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"150000\",\"fromTime\":\"2023-02-02T06:00:00.000Z\",\"toTime\":\"2023-02-02T07:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:46:02.714385+00", - "updatedAt": "2023-02-03 10:46:02.714385+00", - "countryCode": "IND" - }, - { - "id": 165, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 06:55:00+00", - "certificate_issuance_enddate": "2023-02-02 08:00:00+00", - "readvalue_watthour": 154000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"154000\",\"fromTime\":\"2023-02-02T06:55:00.000Z\",\"toTime\":\"2023-02-02T08:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:46:31.808269+00", - "updatedAt": "2023-02-03 10:46:31.808269+00", - "countryCode": "IND" - }, - { - "id": 166, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 08:00:00+00", - "certificate_issuance_enddate": "2023-02-02 09:00:00+00", - "readvalue_watthour": 137000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"137000\",\"fromTime\":\"2023-02-02T08:00:00.000Z\",\"toTime\":\"2023-02-02T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:47:01.813651+00", - "updatedAt": "2023-02-03 10:47:01.813651+00", - "countryCode": "IND" - }, - { - "id": 167, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 09:00:00+00", - "certificate_issuance_enddate": "2023-02-02 10:00:00+00", - "readvalue_watthour": 102000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"102000\",\"fromTime\":\"2023-02-02T09:00:00.000Z\",\"toTime\":\"2023-02-02T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:47:32.009263+00", - "updatedAt": "2023-02-03 10:47:32.009263+00", - "countryCode": "IND" - }, - { - "id": 168, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 10:00:00+00", - "certificate_issuance_enddate": "2023-02-02 11:00:00+00", - "readvalue_watthour": 55000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"55000\",\"fromTime\":\"2023-02-02T10:00:00.000Z\",\"toTime\":\"2023-02-02T11:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:48:02.719068+00", - "updatedAt": "2023-02-03 10:48:02.719068+00", - "countryCode": "IND" - }, - { - "id": 169, - "groupid": 15, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-30 18:30:01+00", - "certificate_issuance_enddate": "2022-07-31 18:29:59+00", - "readvalue_watthour": 2431000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"15\",\"energyValue\":\"2431000\",\"fromTime\":\"2022-06-30T18:30:01.000Z\",\"toTime\":\"2022-07-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"95c6ed07-4001-478e-a5b8-119aa0101f10\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"15\"}}", - "createdAt": "2023-02-03 10:48:32.311538+00", - "updatedAt": "2023-02-03 10:48:32.311538+00", - "countryCode": "IND" - }, - { - "id": 170, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 11:00:00+00", - "certificate_issuance_enddate": "2023-02-02 12:00:00+00", - "readvalue_watthour": 16000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"16000\",\"fromTime\":\"2023-02-02T11:00:00.000Z\",\"toTime\":\"2023-02-02T12:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:48:32.633315+00", - "updatedAt": "2023-02-03 10:48:32.633315+00", - "countryCode": "IND" - }, - { - "id": 171, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 12:00:00+00", - "certificate_issuance_enddate": "2023-02-02 12:40:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-02T12:00:00.000Z\",\"toTime\":\"2023-02-02T12:40:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:49:02.309781+00", - "updatedAt": "2023-02-03 10:49:02.309781+00", - "countryCode": "IND" - }, - { - "id": 172, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-02 13:55:00+00", - "certificate_issuance_enddate": "2023-02-02 15:00:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-02T13:55:00.000Z\",\"toTime\":\"2023-02-02T15:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:50:03.008612+00", - "updatedAt": "2023-02-03 10:50:03.008612+00", - "countryCode": "IND" - }, - { - "id": 173, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 00:40:00+00", - "certificate_issuance_enddate": "2023-02-03 02:00:00+00", - "readvalue_watthour": 6000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"6000\",\"fromTime\":\"2023-02-03T00:40:00.000Z\",\"toTime\":\"2023-02-03T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:55:32.108756+00", - "updatedAt": "2023-02-03 10:55:32.108756+00", - "countryCode": "IND" - }, - { - "id": 174, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 02:00:00+00", - "certificate_issuance_enddate": "2023-02-03 03:00:00+00", - "readvalue_watthour": 31000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"31000\",\"fromTime\":\"2023-02-03T02:00:00.000Z\",\"toTime\":\"2023-02-03T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:56:03.320877+00", - "updatedAt": "2023-02-03 10:56:03.320877+00", - "countryCode": "IND" - }, - { - "id": 175, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 03:00:00+00", - "certificate_issuance_enddate": "2023-02-03 04:00:00+00", - "readvalue_watthour": 75000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"75000\",\"fromTime\":\"2023-02-03T03:00:00.000Z\",\"toTime\":\"2023-02-03T04:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:56:32.311785+00", - "updatedAt": "2023-02-03 10:56:32.311785+00", - "countryCode": "IND" - }, - { - "id": 176, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 04:00:00+00", - "certificate_issuance_enddate": "2023-02-03 05:00:00+00", - "readvalue_watthour": 120000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"120000\",\"fromTime\":\"2023-02-03T04:00:00.000Z\",\"toTime\":\"2023-02-03T05:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:57:02.241373+00", - "updatedAt": "2023-02-03 10:57:02.241373+00", - "countryCode": "IND" - }, - { - "id": 177, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 05:00:00+00", - "certificate_issuance_enddate": "2023-02-03 06:00:00+00", - "readvalue_watthour": 142000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"142000\",\"fromTime\":\"2023-02-03T05:00:00.000Z\",\"toTime\":\"2023-02-03T06:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:57:32.609744+00", - "updatedAt": "2023-02-03 10:57:32.609744+00", - "countryCode": "IND" - }, - { - "id": 178, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 06:00:00+00", - "certificate_issuance_enddate": "2023-02-03 07:00:00+00", - "readvalue_watthour": 163000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"163000\",\"fromTime\":\"2023-02-03T06:00:00.000Z\",\"toTime\":\"2023-02-03T07:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:58:03.056922+00", - "updatedAt": "2023-02-03 10:58:03.056922+00", - "countryCode": "IND" - }, - { - "id": 179, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 07:00:00+00", - "certificate_issuance_enddate": "2023-02-03 08:00:00+00", - "readvalue_watthour": 106000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"106000\",\"fromTime\":\"2023-02-03T07:00:00.000Z\",\"toTime\":\"2023-02-03T08:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:58:32.713036+00", - "updatedAt": "2023-02-03 10:58:32.713036+00", - "countryCode": "IND" - }, - { - "id": 180, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 07:50:00+00", - "certificate_issuance_enddate": "2023-02-03 09:00:00+00", - "readvalue_watthour": 91000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"91000\",\"fromTime\":\"2023-02-03T07:50:00.000Z\",\"toTime\":\"2023-02-03T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:59:02.50932+00", - "updatedAt": "2023-02-03 10:59:02.50932+00", - "countryCode": "IND" - }, - { - "id": 181, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 08:55:00+00", - "certificate_issuance_enddate": "2023-02-03 10:00:00+00", - "readvalue_watthour": 69000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"69000\",\"fromTime\":\"2023-02-03T08:55:00.000Z\",\"toTime\":\"2023-02-03T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 10:59:32.613515+00", - "updatedAt": "2023-02-03 10:59:32.613515+00", - "countryCode": "IND" - }, - { - "id": 182, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 10:00:00+00", - "certificate_issuance_enddate": "2023-02-03 10:55:00+00", - "readvalue_watthour": 53000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"53000\",\"fromTime\":\"2023-02-03T10:00:00.000Z\",\"toTime\":\"2023-02-03T10:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 11:00:32.308736+00", - "updatedAt": "2023-02-03 11:00:32.308736+00", - "countryCode": "IND" - }, - { - "id": 183, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 11:00:00+00", - "certificate_issuance_enddate": "2023-02-03 11:55:00+00", - "readvalue_watthour": 20000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"20000\",\"fromTime\":\"2023-02-03T11:00:00.000Z\",\"toTime\":\"2023-02-03T11:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 12:00:32.021111+00", - "updatedAt": "2023-02-03 12:00:32.021111+00", - "countryCode": "IND" - }, - { - "id": 184, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 12:00:00+00", - "certificate_issuance_enddate": "2023-02-03 12:50:00+00", - "readvalue_watthour": 2000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"2000\",\"fromTime\":\"2023-02-03T12:00:00.000Z\",\"toTime\":\"2023-02-03T12:50:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-03 13:00:32.208085+00", - "updatedAt": "2023-02-03 13:00:32.208085+00", - "countryCode": "IND" - }, - { - "id": 185, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-03 22:50:00+00", - "certificate_issuance_enddate": "2023-02-03 23:55:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-03T22:50:00.000Z\",\"toTime\":\"2023-02-03T23:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 00:00:32.423614+00", - "updatedAt": "2023-02-04 00:00:32.423614+00", - "countryCode": "IND" - }, - { - "id": 186, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 00:45:00+00", - "certificate_issuance_enddate": "2023-02-04 01:55:00+00", - "readvalue_watthour": 4000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"4000\",\"fromTime\":\"2023-02-04T00:45:00.000Z\",\"toTime\":\"2023-02-04T01:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 02:00:32.509567+00", - "updatedAt": "2023-02-04 02:00:32.509567+00", - "countryCode": "IND" - }, - { - "id": 187, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 02:00:00+00", - "certificate_issuance_enddate": "2023-02-04 02:55:00+00", - "readvalue_watthour": 32000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"32000\",\"fromTime\":\"2023-02-04T02:00:00.000Z\",\"toTime\":\"2023-02-04T02:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 03:00:32.625015+00", - "updatedAt": "2023-02-04 03:00:32.625015+00", - "countryCode": "IND" - }, - { - "id": 188, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 03:00:00+00", - "certificate_issuance_enddate": "2023-02-04 03:55:00+00", - "readvalue_watthour": 74000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"74000\",\"fromTime\":\"2023-02-04T03:00:00.000Z\",\"toTime\":\"2023-02-04T03:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 04:00:33.611064+00", - "updatedAt": "2023-02-04 04:00:33.611064+00", - "countryCode": "IND" - }, - { - "id": 189, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 04:00:00+00", - "certificate_issuance_enddate": "2023-02-04 04:55:00+00", - "readvalue_watthour": 112000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"112000\",\"fromTime\":\"2023-02-04T04:00:00.000Z\",\"toTime\":\"2023-02-04T04:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 05:00:32.709617+00", - "updatedAt": "2023-02-04 05:00:32.709617+00", - "countryCode": "IND" - }, - { - "id": 190, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 05:00:00+00", - "certificate_issuance_enddate": "2023-02-04 05:55:00+00", - "readvalue_watthour": 139000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"139000\",\"fromTime\":\"2023-02-04T05:00:00.000Z\",\"toTime\":\"2023-02-04T05:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 06:00:32.813502+00", - "updatedAt": "2023-02-04 06:00:32.813502+00", - "countryCode": "IND" - }, - { - "id": 191, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 06:00:00+00", - "certificate_issuance_enddate": "2023-02-04 06:55:00+00", - "readvalue_watthour": 154000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"154000\",\"fromTime\":\"2023-02-04T06:00:00.000Z\",\"toTime\":\"2023-02-04T06:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 07:00:32.318602+00", - "updatedAt": "2023-02-04 07:00:32.318602+00", - "countryCode": "IND" - }, - { - "id": 192, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 07:00:00+00", - "certificate_issuance_enddate": "2023-02-04 07:55:00+00", - "readvalue_watthour": 156000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"156000\",\"fromTime\":\"2023-02-04T07:00:00.000Z\",\"toTime\":\"2023-02-04T07:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 08:00:32.112994+00", - "updatedAt": "2023-02-04 08:00:32.112994+00", - "countryCode": "IND" - }, - { - "id": 193, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-06 00:31:00+00", - "certificate_issuance_enddate": "2023-01-21 18:29:59+00", - "readvalue_watthour": 715063, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"715063\",\"fromTime\":\"2022-05-06T00:31:00.000Z\",\"toTime\":\"2023-01-21T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[218],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:06.80854+00", - "updatedAt": "2023-02-04 08:49:06.80854+00", - "countryCode": "IND" - }, - { - "id": 194, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-19 00:30:00+00", - "certificate_issuance_enddate": "2023-01-16 18:29:59+00", - "readvalue_watthour": 667217, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"667217\",\"fromTime\":\"2022-07-19T00:30:00.000Z\",\"toTime\":\"2023-01-16T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[212],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:07.613071+00", - "updatedAt": "2023-02-04 08:49:07.613071+00", - "countryCode": "IND" - }, - { - "id": 195, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-07 00:31:00+00", - "certificate_issuance_enddate": "2023-01-21 18:29:59+00", - "readvalue_watthour": 1050064, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1050064\",\"fromTime\":\"2022-06-07T00:31:00.000Z\",\"toTime\":\"2023-01-21T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[219],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:07.709626+00", - "updatedAt": "2023-02-04 08:49:07.709626+00", - "countryCode": "IND" - }, - { - "id": 196, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-14 00:31:00+00", - "certificate_issuance_enddate": "2023-01-27 18:29:59+00", - "readvalue_watthour": 2566955, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"2566955\",\"fromTime\":\"2022-03-14T00:31:00.000Z\",\"toTime\":\"2023-01-27T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[220],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:07.712647+00", - "updatedAt": "2023-02-04 08:49:07.712647+00", - "countryCode": "IND" - }, - { - "id": 197, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-04 00:31:00+00", - "certificate_issuance_enddate": "2023-01-31 18:29:59+00", - "readvalue_watthour": 1175658, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1175658\",\"fromTime\":\"2022-03-04T00:31:00.000Z\",\"toTime\":\"2023-01-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[228],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:07.809244+00", - "updatedAt": "2023-02-04 08:49:07.809244+00", - "countryCode": "IND" - }, - { - "id": 198, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-02-25 00:31:00+00", - "certificate_issuance_enddate": "2023-01-21 18:29:59+00", - "readvalue_watthour": 1588159, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1588159\",\"fromTime\":\"2022-02-25T00:31:00.000Z\",\"toTime\":\"2023-01-21T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[226],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:07.814287+00", - "updatedAt": "2023-02-04 08:49:07.814287+00", - "countryCode": "IND" - }, - { - "id": 199, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-25 00:31:00+00", - "certificate_issuance_enddate": "2023-01-24 18:29:59+00", - "readvalue_watthour": 890473, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"890473\",\"fromTime\":\"2022-06-25T00:31:00.000Z\",\"toTime\":\"2023-01-24T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[213],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:08.007744+00", - "updatedAt": "2023-02-04 08:49:08.007744+00", - "countryCode": "IND" - }, - { - "id": 200, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-10 00:31:00+00", - "certificate_issuance_enddate": "2023-01-24 18:29:59+00", - "readvalue_watthour": 525381, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"525381\",\"fromTime\":\"2022-07-10T00:31:00.000Z\",\"toTime\":\"2023-01-24T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[214],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:08.208586+00", - "updatedAt": "2023-02-04 08:49:08.208586+00", - "countryCode": "IND" - }, - { - "id": 201, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-07-09 00:31:00+00", - "certificate_issuance_enddate": "2023-01-23 18:29:59+00", - "readvalue_watthour": 1422460, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1422460\",\"fromTime\":\"2022-07-09T00:31:00.000Z\",\"toTime\":\"2023-01-23T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[216],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:08.511822+00", - "updatedAt": "2023-02-04 08:49:08.511822+00", - "countryCode": "IND" - }, - { - "id": 202, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-10-29 00:31:00+00", - "certificate_issuance_enddate": "2023-01-18 18:29:59+00", - "readvalue_watthour": 182151, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"182151\",\"fromTime\":\"2022-10-29T00:31:00.000Z\",\"toTime\":\"2023-01-18T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[217],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:08.611254+00", - "updatedAt": "2023-02-04 08:49:08.611254+00", - "countryCode": "IND" - }, - { - "id": 203, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-02-22 00:31:00+00", - "certificate_issuance_enddate": "2023-01-20 18:29:59+00", - "readvalue_watthour": 1235593, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1235593\",\"fromTime\":\"2022-02-22T00:31:00.000Z\",\"toTime\":\"2023-01-20T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[221],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:08.810611+00", - "updatedAt": "2023-02-04 08:49:08.810611+00", - "countryCode": "IND" - }, - { - "id": 204, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-02-16 00:31:00+00", - "certificate_issuance_enddate": "2023-01-20 18:29:59+00", - "readvalue_watthour": 1791330, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1791330\",\"fromTime\":\"2022-02-16T00:31:00.000Z\",\"toTime\":\"2023-01-20T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[222],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:08.914392+00", - "updatedAt": "2023-02-04 08:49:08.914392+00", - "countryCode": "IND" - }, - { - "id": 205, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-01 00:31:00+00", - "certificate_issuance_enddate": "2023-01-20 18:29:59+00", - "readvalue_watthour": 1256659, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1256659\",\"fromTime\":\"2022-03-01T00:31:00.000Z\",\"toTime\":\"2023-01-20T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[223],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:09.109319+00", - "updatedAt": "2023-02-04 08:49:09.109319+00", - "countryCode": "IND" - }, - { - "id": 206, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-02 00:31:00+00", - "certificate_issuance_enddate": "2023-01-20 18:29:59+00", - "readvalue_watthour": 1550926, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1550926\",\"fromTime\":\"2022-03-02T00:31:00.000Z\",\"toTime\":\"2023-01-20T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[224],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:09.207456+00", - "updatedAt": "2023-02-04 08:49:09.207456+00", - "countryCode": "IND" - }, - { - "id": 207, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-02-25 00:31:00+00", - "certificate_issuance_enddate": "2023-01-21 18:29:59+00", - "readvalue_watthour": 2067802, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"2067802\",\"fromTime\":\"2022-02-25T00:31:00.000Z\",\"toTime\":\"2023-01-21T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[225],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:09.211625+00", - "updatedAt": "2023-02-04 08:49:09.211625+00", - "countryCode": "IND" - }, - { - "id": 208, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-05-06 00:31:00+00", - "certificate_issuance_enddate": "2023-01-21 18:29:59+00", - "readvalue_watthour": 1359759, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1359759\",\"fromTime\":\"2022-05-06T00:31:00.000Z\",\"toTime\":\"2023-01-21T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[230],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:09.309674+00", - "updatedAt": "2023-02-04 08:49:09.309674+00", - "countryCode": "IND" - }, - { - "id": 209, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-03-04 00:31:00+00", - "certificate_issuance_enddate": "2023-01-27 18:29:59+00", - "readvalue_watthour": 756124, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"756124\",\"fromTime\":\"2022-03-04T00:31:00.000Z\",\"toTime\":\"2023-01-27T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[227],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:09.313023+00", - "updatedAt": "2023-02-04 08:49:09.313023+00", - "countryCode": "IND" - }, - { - "id": 210, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-07 00:31:00+00", - "certificate_issuance_enddate": "2023-01-20 18:29:59+00", - "readvalue_watthour": 1012799, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1012799\",\"fromTime\":\"2022-06-07T00:31:00.000Z\",\"toTime\":\"2023-01-20T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[231],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:09.409084+00", - "updatedAt": "2023-02-04 08:49:09.409084+00", - "countryCode": "IND" - }, - { - "id": 211, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-06-07 00:31:00+00", - "certificate_issuance_enddate": "2023-01-20 18:29:59+00", - "readvalue_watthour": 1137486, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"1137486\",\"fromTime\":\"2022-06-07T00:31:00.000Z\",\"toTime\":\"2023-01-20T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[232],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:09.415343+00", - "updatedAt": "2023-02-04 08:49:09.415343+00", - "countryCode": "IND" - }, - { - "id": 212, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-20 00:31:00+00", - "certificate_issuance_enddate": "2023-01-19 18:29:59+00", - "readvalue_watthour": 710356, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"710356\",\"fromTime\":\"2022-09-20T00:31:00.000Z\",\"toTime\":\"2023-01-19T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[233],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:09.418874+00", - "updatedAt": "2023-02-04 08:49:09.418874+00", - "countryCode": "IND" - }, - { - "id": 213, - "groupid": 16, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-09-20 00:31:00+00", - "certificate_issuance_enddate": "2023-01-23 18:29:59+00", - "readvalue_watthour": 503212, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"16\",\"energyValue\":\"503212\",\"fromTime\":\"2022-09-20T00:31:00.000Z\",\"toTime\":\"2023-01-23T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[234],\"groupId\":\"16\"}}", - "createdAt": "2023-02-04 08:49:09.510845+00", - "updatedAt": "2023-02-04 08:49:09.510845+00", - "countryCode": "IND" - }, - { - "id": 214, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 08:00:00+00", - "certificate_issuance_enddate": "2023-02-04 08:55:00+00", - "readvalue_watthour": 137000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"137000\",\"fromTime\":\"2023-02-04T08:00:00.000Z\",\"toTime\":\"2023-02-04T08:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 09:00:33.220692+00", - "updatedAt": "2023-02-04 09:00:33.220692+00", - "countryCode": "IND" - }, - { - "id": 215, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 09:00:00+00", - "certificate_issuance_enddate": "2023-02-04 09:55:00+00", - "readvalue_watthour": 105000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"105000\",\"fromTime\":\"2023-02-04T09:00:00.000Z\",\"toTime\":\"2023-02-04T09:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 10:00:33.207464+00", - "updatedAt": "2023-02-04 10:00:33.207464+00", - "countryCode": "IND" - }, - { - "id": 216, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 10:00:00+00", - "certificate_issuance_enddate": "2023-02-04 10:55:00+00", - "readvalue_watthour": 66000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"66000\",\"fromTime\":\"2023-02-04T10:00:00.000Z\",\"toTime\":\"2023-02-04T10:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 11:00:32.711105+00", - "updatedAt": "2023-02-04 11:00:32.711105+00", - "countryCode": "IND" - }, - { - "id": 217, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 11:00:00+00", - "certificate_issuance_enddate": "2023-02-04 11:55:00+00", - "readvalue_watthour": 24000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"24000\",\"fromTime\":\"2023-02-04T11:00:00.000Z\",\"toTime\":\"2023-02-04T11:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 12:00:32.81314+00", - "updatedAt": "2023-02-04 12:00:32.81314+00", - "countryCode": "IND" - }, - { - "id": 218, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-04 11:55:00+00", - "certificate_issuance_enddate": "2023-02-04 12:55:00+00", - "readvalue_watthour": 3000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"3000\",\"fromTime\":\"2023-02-04T11:55:00.000Z\",\"toTime\":\"2023-02-04T12:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-04 13:00:33.017559+00", - "updatedAt": "2023-02-04 13:00:33.017559+00", - "countryCode": "IND" - }, - { - "id": 219, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 00:40:00+00", - "certificate_issuance_enddate": "2023-02-05 01:55:00+00", - "readvalue_watthour": 5000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"5000\",\"fromTime\":\"2023-02-05T00:40:00.000Z\",\"toTime\":\"2023-02-05T01:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 02:00:32.212273+00", - "updatedAt": "2023-02-05 02:00:32.212273+00", - "countryCode": "IND" - }, - { - "id": 220, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 02:00:00+00", - "certificate_issuance_enddate": "2023-02-05 02:55:00+00", - "readvalue_watthour": 33000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"33000\",\"fromTime\":\"2023-02-05T02:00:00.000Z\",\"toTime\":\"2023-02-05T02:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 03:00:32.506747+00", - "updatedAt": "2023-02-05 03:00:32.506747+00", - "countryCode": "IND" - }, - { - "id": 221, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 03:00:00+00", - "certificate_issuance_enddate": "2023-02-05 03:55:00+00", - "readvalue_watthour": 71000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"71000\",\"fromTime\":\"2023-02-05T03:00:00.000Z\",\"toTime\":\"2023-02-05T03:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 04:00:32.612582+00", - "updatedAt": "2023-02-05 04:00:32.612582+00", - "countryCode": "IND" - }, - { - "id": 222, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 04:00:00+00", - "certificate_issuance_enddate": "2023-02-05 04:55:00+00", - "readvalue_watthour": 105000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"105000\",\"fromTime\":\"2023-02-05T04:00:00.000Z\",\"toTime\":\"2023-02-05T04:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 05:00:32.509482+00", - "updatedAt": "2023-02-05 05:00:32.509482+00", - "countryCode": "IND" - }, - { - "id": 223, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 04:55:00+00", - "certificate_issuance_enddate": "2023-02-05 05:55:00+00", - "readvalue_watthour": 141000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"141000\",\"fromTime\":\"2023-02-05T04:55:00.000Z\",\"toTime\":\"2023-02-05T05:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 06:00:32.615283+00", - "updatedAt": "2023-02-05 06:00:32.615283+00", - "countryCode": "IND" - }, - { - "id": 224, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 05:55:00+00", - "certificate_issuance_enddate": "2023-02-05 06:55:00+00", - "readvalue_watthour": 148000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"148000\",\"fromTime\":\"2023-02-05T05:55:00.000Z\",\"toTime\":\"2023-02-05T06:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 07:00:32.220717+00", - "updatedAt": "2023-02-05 07:00:32.220717+00", - "countryCode": "IND" - }, - { - "id": 225, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 07:00:00+00", - "certificate_issuance_enddate": "2023-02-05 07:55:00+00", - "readvalue_watthour": 151000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"151000\",\"fromTime\":\"2023-02-05T07:00:00.000Z\",\"toTime\":\"2023-02-05T07:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 08:00:33.009528+00", - "updatedAt": "2023-02-05 08:00:33.009528+00", - "countryCode": "IND" - }, - { - "id": 226, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 08:00:00+00", - "certificate_issuance_enddate": "2023-02-05 08:55:00+00", - "readvalue_watthour": 117000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"117000\",\"fromTime\":\"2023-02-05T08:00:00.000Z\",\"toTime\":\"2023-02-05T08:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 09:00:32.613953+00", - "updatedAt": "2023-02-05 09:00:32.613953+00", - "countryCode": "IND" - }, - { - "id": 227, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 09:00:00+00", - "certificate_issuance_enddate": "2023-02-05 09:55:00+00", - "readvalue_watthour": 103000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"103000\",\"fromTime\":\"2023-02-05T09:00:00.000Z\",\"toTime\":\"2023-02-05T09:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 10:00:32.511769+00", - "updatedAt": "2023-02-05 10:00:32.511769+00", - "countryCode": "IND" - }, - { - "id": 228, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 10:00:00+00", - "certificate_issuance_enddate": "2023-02-05 10:55:00+00", - "readvalue_watthour": 55000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"55000\",\"fromTime\":\"2023-02-05T10:00:00.000Z\",\"toTime\":\"2023-02-05T10:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 11:00:32.213753+00", - "updatedAt": "2023-02-05 11:00:32.213753+00", - "countryCode": "IND" - }, - { - "id": 229, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 11:00:00+00", - "certificate_issuance_enddate": "2023-02-05 11:55:00+00", - "readvalue_watthour": 21000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"21000\",\"fromTime\":\"2023-02-05T11:00:00.000Z\",\"toTime\":\"2023-02-05T11:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 12:00:33.013501+00", - "updatedAt": "2023-02-05 12:00:33.013501+00", - "countryCode": "IND" - }, - { - "id": 230, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 12:00:00+00", - "certificate_issuance_enddate": "2023-02-05 12:55:00+00", - "readvalue_watthour": 2000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"2000\",\"fromTime\":\"2023-02-05T12:00:00.000Z\",\"toTime\":\"2023-02-05T12:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 13:00:32.634831+00", - "updatedAt": "2023-02-05 13:00:32.634831+00", - "countryCode": "IND" - }, - { - "id": 231, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-05 21:45:00+00", - "certificate_issuance_enddate": "2023-02-05 22:55:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-05T21:45:00.000Z\",\"toTime\":\"2023-02-05T22:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-05 23:00:32.610542+00", - "updatedAt": "2023-02-05 23:00:32.610542+00", - "countryCode": "IND" - }, - { - "id": 232, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 00:40:00+00", - "certificate_issuance_enddate": "2023-02-06 01:55:00+00", - "readvalue_watthour": 4000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"4000\",\"fromTime\":\"2023-02-06T00:40:00.000Z\",\"toTime\":\"2023-02-06T01:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 02:00:31.912175+00", - "updatedAt": "2023-02-06 02:00:31.912175+00", - "countryCode": "IND" - }, - { - "id": 233, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 02:00:00+00", - "certificate_issuance_enddate": "2023-02-06 02:55:00+00", - "readvalue_watthour": 33000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"33000\",\"fromTime\":\"2023-02-06T02:00:00.000Z\",\"toTime\":\"2023-02-06T02:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 03:00:35.107819+00", - "updatedAt": "2023-02-06 03:00:35.107819+00", - "countryCode": "IND" - }, - { - "id": 234, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 03:00:00+00", - "certificate_issuance_enddate": "2023-02-06 03:55:00+00", - "readvalue_watthour": 67000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"67000\",\"fromTime\":\"2023-02-06T03:00:00.000Z\",\"toTime\":\"2023-02-06T03:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 04:00:33.407299+00", - "updatedAt": "2023-02-06 04:00:33.407299+00", - "countryCode": "IND" - }, - { - "id": 235, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 04:00:00+00", - "certificate_issuance_enddate": "2023-02-06 04:55:00+00", - "readvalue_watthour": 102000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"102000\",\"fromTime\":\"2023-02-06T04:00:00.000Z\",\"toTime\":\"2023-02-06T04:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 05:00:33.017248+00", - "updatedAt": "2023-02-06 05:00:33.017248+00", - "countryCode": "IND" - }, - { - "id": 236, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 05:00:00+00", - "certificate_issuance_enddate": "2023-02-06 05:55:00+00", - "readvalue_watthour": 141000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"141000\",\"fromTime\":\"2023-02-06T05:00:00.000Z\",\"toTime\":\"2023-02-06T05:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 06:00:32.709168+00", - "updatedAt": "2023-02-06 06:00:32.709168+00", - "countryCode": "IND" - }, - { - "id": 237, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 06:00:00+00", - "certificate_issuance_enddate": "2023-02-06 06:55:00+00", - "readvalue_watthour": 144000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"144000\",\"fromTime\":\"2023-02-06T06:00:00.000Z\",\"toTime\":\"2023-02-06T06:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 07:00:33.108454+00", - "updatedAt": "2023-02-06 07:00:33.108454+00", - "countryCode": "IND" - }, - { - "id": 238, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 07:00:00+00", - "certificate_issuance_enddate": "2023-02-06 07:55:00+00", - "readvalue_watthour": 149000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"149000\",\"fromTime\":\"2023-02-06T07:00:00.000Z\",\"toTime\":\"2023-02-06T07:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 08:00:32.714917+00", - "updatedAt": "2023-02-06 08:00:32.714917+00", - "countryCode": "IND" - }, - { - "id": 239, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 08:00:00+00", - "certificate_issuance_enddate": "2023-02-06 08:55:00+00", - "readvalue_watthour": 140000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"140000\",\"fromTime\":\"2023-02-06T08:00:00.000Z\",\"toTime\":\"2023-02-06T08:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 09:00:32.91881+00", - "updatedAt": "2023-02-06 09:00:32.91881+00", - "countryCode": "IND" - }, - { - "id": 240, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 09:00:00+00", - "certificate_issuance_enddate": "2023-02-06 09:55:00+00", - "readvalue_watthour": 98000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"98000\",\"fromTime\":\"2023-02-06T09:00:00.000Z\",\"toTime\":\"2023-02-06T09:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 10:00:34.717611+00", - "updatedAt": "2023-02-06 10:00:34.717611+00", - "countryCode": "IND" - }, - { - "id": 241, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 10:00:00+00", - "certificate_issuance_enddate": "2023-02-06 10:55:00+00", - "readvalue_watthour": 60000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"60000\",\"fromTime\":\"2023-02-06T10:00:00.000Z\",\"toTime\":\"2023-02-06T10:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 11:00:33.30878+00", - "updatedAt": "2023-02-06 11:00:33.30878+00", - "countryCode": "IND" - }, - { - "id": 242, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 11:00:00+00", - "certificate_issuance_enddate": "2023-02-06 11:55:00+00", - "readvalue_watthour": 22000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"22000\",\"fromTime\":\"2023-02-06T11:00:00.000Z\",\"toTime\":\"2023-02-06T11:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 12:00:32.917498+00", - "updatedAt": "2023-02-06 12:00:32.917498+00", - "countryCode": "IND" - }, - { - "id": 243, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-06 12:00:00+00", - "certificate_issuance_enddate": "2023-02-06 12:35:00+00", - "readvalue_watthour": 2000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"2000\",\"fromTime\":\"2023-02-06T12:00:00.000Z\",\"toTime\":\"2023-02-06T12:35:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-06 13:00:32.511225+00", - "updatedAt": "2023-02-06 13:00:32.511225+00", - "countryCode": "IND" - }, - { - "id": 244, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 00:45:00+00", - "certificate_issuance_enddate": "2023-02-07 01:55:00+00", - "readvalue_watthour": 5000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"5000\",\"fromTime\":\"2023-02-07T00:45:00.000Z\",\"toTime\":\"2023-02-07T01:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 02:00:32.115526+00", - "updatedAt": "2023-02-07 02:00:32.115526+00", - "countryCode": "IND" - }, - { - "id": 245, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 02:00:00+00", - "certificate_issuance_enddate": "2023-02-07 02:55:00+00", - "readvalue_watthour": 34000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"34000\",\"fromTime\":\"2023-02-07T02:00:00.000Z\",\"toTime\":\"2023-02-07T02:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 03:00:32.715513+00", - "updatedAt": "2023-02-07 03:00:32.715513+00", - "countryCode": "IND" - }, - { - "id": 246, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 03:00:00+00", - "certificate_issuance_enddate": "2023-02-07 03:55:00+00", - "readvalue_watthour": 73000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"73000\",\"fromTime\":\"2023-02-07T03:00:00.000Z\",\"toTime\":\"2023-02-07T03:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 04:00:32.91131+00", - "updatedAt": "2023-02-07 04:00:32.91131+00", - "countryCode": "IND" - }, - { - "id": 247, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 04:00:00+00", - "certificate_issuance_enddate": "2023-02-07 04:55:00+00", - "readvalue_watthour": 103000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"103000\",\"fromTime\":\"2023-02-07T04:00:00.000Z\",\"toTime\":\"2023-02-07T04:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 05:00:32.523234+00", - "updatedAt": "2023-02-07 05:00:32.523234+00", - "countryCode": "IND" - }, - { - "id": 248, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 05:00:00+00", - "certificate_issuance_enddate": "2023-02-07 05:55:00+00", - "readvalue_watthour": 141000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"141000\",\"fromTime\":\"2023-02-07T05:00:00.000Z\",\"toTime\":\"2023-02-07T05:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 06:00:32.718138+00", - "updatedAt": "2023-02-07 06:00:32.718138+00", - "countryCode": "IND" - }, - { - "id": 249, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 06:00:00+00", - "certificate_issuance_enddate": "2023-02-07 06:55:00+00", - "readvalue_watthour": 151000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"151000\",\"fromTime\":\"2023-02-07T06:00:00.000Z\",\"toTime\":\"2023-02-07T06:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 07:00:32.520071+00", - "updatedAt": "2023-02-07 07:00:32.520071+00", - "countryCode": "IND" - }, - { - "id": 250, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 07:00:00+00", - "certificate_issuance_enddate": "2023-02-07 07:55:00+00", - "readvalue_watthour": 136000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"136000\",\"fromTime\":\"2023-02-07T07:00:00.000Z\",\"toTime\":\"2023-02-07T07:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 08:00:32.021667+00", - "updatedAt": "2023-02-07 08:00:32.021667+00", - "countryCode": "IND" - }, - { - "id": 251, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 08:00:00+00", - "certificate_issuance_enddate": "2023-02-07 08:55:00+00", - "readvalue_watthour": 124000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"124000\",\"fromTime\":\"2023-02-07T08:00:00.000Z\",\"toTime\":\"2023-02-07T08:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 09:00:32.618056+00", - "updatedAt": "2023-02-07 09:00:32.618056+00", - "countryCode": "IND" - }, - { - "id": 252, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 09:00:00+00", - "certificate_issuance_enddate": "2023-02-07 09:55:00+00", - "readvalue_watthour": 100000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"100000\",\"fromTime\":\"2023-02-07T09:00:00.000Z\",\"toTime\":\"2023-02-07T09:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 10:00:32.707136+00", - "updatedAt": "2023-02-07 10:00:32.707136+00", - "countryCode": "IND" - }, - { - "id": 253, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 10:00:00+00", - "certificate_issuance_enddate": "2023-02-07 10:55:00+00", - "readvalue_watthour": 67000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"67000\",\"fromTime\":\"2023-02-07T10:00:00.000Z\",\"toTime\":\"2023-02-07T10:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 11:00:32.516584+00", - "updatedAt": "2023-02-07 11:00:32.516584+00", - "countryCode": "IND" - }, - { - "id": 254, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 11:00:00+00", - "certificate_issuance_enddate": "2023-02-07 11:55:00+00", - "readvalue_watthour": 27000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"27000\",\"fromTime\":\"2023-02-07T11:00:00.000Z\",\"toTime\":\"2023-02-07T11:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 12:00:32.109999+00", - "updatedAt": "2023-02-07 12:00:32.109999+00", - "countryCode": "IND" - }, - { - "id": 255, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-07 12:00:00+00", - "certificate_issuance_enddate": "2023-02-07 12:35:00+00", - "readvalue_watthour": 2000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"2000\",\"fromTime\":\"2023-02-07T12:00:00.000Z\",\"toTime\":\"2023-02-07T12:35:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-07 13:00:32.616885+00", - "updatedAt": "2023-02-07 13:00:32.616885+00", - "countryCode": "IND" - }, - { - "id": 256, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 00:50:00+00", - "certificate_issuance_enddate": "2023-02-08 01:55:00+00", - "readvalue_watthour": 5000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"5000\",\"fromTime\":\"2023-02-08T00:50:00.000Z\",\"toTime\":\"2023-02-08T01:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 02:00:32.716963+00", - "updatedAt": "2023-02-08 02:00:32.716963+00", - "countryCode": "IND" - }, - { - "id": 257, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 02:00:00+00", - "certificate_issuance_enddate": "2023-02-08 02:55:00+00", - "readvalue_watthour": 31000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"31000\",\"fromTime\":\"2023-02-08T02:00:00.000Z\",\"toTime\":\"2023-02-08T02:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 03:00:32.915916+00", - "updatedAt": "2023-02-08 03:00:32.915916+00", - "countryCode": "IND" - }, - { - "id": 258, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 03:00:00+00", - "certificate_issuance_enddate": "2023-02-08 03:55:00+00", - "readvalue_watthour": 71000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"71000\",\"fromTime\":\"2023-02-08T03:00:00.000Z\",\"toTime\":\"2023-02-08T03:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 04:00:32.113023+00", - "updatedAt": "2023-02-08 04:00:32.113023+00", - "countryCode": "IND" - }, - { - "id": 259, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 04:00:00+00", - "certificate_issuance_enddate": "2023-02-08 04:55:00+00", - "readvalue_watthour": 109000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"109000\",\"fromTime\":\"2023-02-08T04:00:00.000Z\",\"toTime\":\"2023-02-08T04:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 05:00:32.109458+00", - "updatedAt": "2023-02-08 05:00:32.109458+00", - "countryCode": "IND" - }, - { - "id": 260, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 05:00:00+00", - "certificate_issuance_enddate": "2023-02-08 05:55:00+00", - "readvalue_watthour": 140000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"140000\",\"fromTime\":\"2023-02-08T05:00:00.000Z\",\"toTime\":\"2023-02-08T05:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 06:00:32.212049+00", - "updatedAt": "2023-02-08 06:00:32.212049+00", - "countryCode": "IND" - }, - { - "id": 261, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 06:00:00+00", - "certificate_issuance_enddate": "2023-02-08 06:55:00+00", - "readvalue_watthour": 146000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"146000\",\"fromTime\":\"2023-02-08T06:00:00.000Z\",\"toTime\":\"2023-02-08T06:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 07:00:32.321027+00", - "updatedAt": "2023-02-08 07:00:32.321027+00", - "countryCode": "IND" - }, - { - "id": 262, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 07:00:00+00", - "certificate_issuance_enddate": "2023-02-08 07:55:00+00", - "readvalue_watthour": 147000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"147000\",\"fromTime\":\"2023-02-08T07:00:00.000Z\",\"toTime\":\"2023-02-08T07:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 08:00:32.809136+00", - "updatedAt": "2023-02-08 08:00:32.809136+00", - "countryCode": "IND" - }, - { - "id": 263, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 08:00:00+00", - "certificate_issuance_enddate": "2023-02-08 08:55:00+00", - "readvalue_watthour": 130000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"130000\",\"fromTime\":\"2023-02-08T08:00:00.000Z\",\"toTime\":\"2023-02-08T08:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 09:00:32.41981+00", - "updatedAt": "2023-02-08 09:00:32.41981+00", - "countryCode": "IND" - }, - { - "id": 264, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 09:00:00+00", - "certificate_issuance_enddate": "2023-02-08 09:55:00+00", - "readvalue_watthour": 103000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"103000\",\"fromTime\":\"2023-02-08T09:00:00.000Z\",\"toTime\":\"2023-02-08T09:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 10:00:32.313169+00", - "updatedAt": "2023-02-08 10:00:32.313169+00", - "countryCode": "IND" - }, - { - "id": 265, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 10:00:00+00", - "certificate_issuance_enddate": "2023-02-08 10:55:00+00", - "readvalue_watthour": 62000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"62000\",\"fromTime\":\"2023-02-08T10:00:00.000Z\",\"toTime\":\"2023-02-08T10:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 11:00:32.907894+00", - "updatedAt": "2023-02-08 11:00:32.907894+00", - "countryCode": "IND" - }, - { - "id": 266, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 10:55:00+00", - "certificate_issuance_enddate": "2023-02-08 11:55:00+00", - "readvalue_watthour": 20000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"20000\",\"fromTime\":\"2023-02-08T10:55:00.000Z\",\"toTime\":\"2023-02-08T11:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 12:00:32.317171+00", - "updatedAt": "2023-02-08 12:00:32.317171+00", - "countryCode": "IND" - }, - { - "id": 267, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 12:00:00+00", - "certificate_issuance_enddate": "2023-02-08 12:40:00+00", - "readvalue_watthour": 2000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"2000\",\"fromTime\":\"2023-02-08T12:00:00.000Z\",\"toTime\":\"2023-02-08T12:40:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-08 13:00:32.908458+00", - "updatedAt": "2023-02-08 13:00:32.908458+00", - "countryCode": "IND" - }, - { - "id": 268, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-08 23:55:00+00", - "certificate_issuance_enddate": "2023-02-09 00:50:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-08T23:55:00.000Z\",\"toTime\":\"2023-02-09T00:50:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 01:00:35.316708+00", - "updatedAt": "2023-02-09 01:00:35.316708+00", - "countryCode": "IND" - }, - { - "id": 269, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 00:45:00+00", - "certificate_issuance_enddate": "2023-02-09 01:55:00+00", - "readvalue_watthour": 5000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"5000\",\"fromTime\":\"2023-02-09T00:45:00.000Z\",\"toTime\":\"2023-02-09T01:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 02:00:35.507684+00", - "updatedAt": "2023-02-09 02:00:35.507684+00", - "countryCode": "IND" - }, - { - "id": 270, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 02:00:00+00", - "certificate_issuance_enddate": "2023-02-09 02:55:00+00", - "readvalue_watthour": 34000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"34000\",\"fromTime\":\"2023-02-09T02:00:00.000Z\",\"toTime\":\"2023-02-09T02:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 03:00:32.6375+00", - "updatedAt": "2023-02-09 03:00:32.6375+00", - "countryCode": "IND" - }, - { - "id": 271, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 03:00:00+00", - "certificate_issuance_enddate": "2023-02-09 03:55:00+00", - "readvalue_watthour": 74000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"74000\",\"fromTime\":\"2023-02-09T03:00:00.000Z\",\"toTime\":\"2023-02-09T03:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 04:00:32.928477+00", - "updatedAt": "2023-02-09 04:00:32.928477+00", - "countryCode": "IND" - }, - { - "id": 272, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 04:00:00+00", - "certificate_issuance_enddate": "2023-02-09 04:55:00+00", - "readvalue_watthour": 111000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"111000\",\"fromTime\":\"2023-02-09T04:00:00.000Z\",\"toTime\":\"2023-02-09T04:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 05:00:32.532502+00", - "updatedAt": "2023-02-09 05:00:32.532502+00", - "countryCode": "IND" - }, - { - "id": 273, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 05:00:00+00", - "certificate_issuance_enddate": "2023-02-09 05:55:00+00", - "readvalue_watthour": 137000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"137000\",\"fromTime\":\"2023-02-09T05:00:00.000Z\",\"toTime\":\"2023-02-09T05:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 06:00:33.008597+00", - "updatedAt": "2023-02-09 06:00:33.008597+00", - "countryCode": "IND" - }, - { - "id": 274, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 06:00:00+00", - "certificate_issuance_enddate": "2023-02-09 06:55:00+00", - "readvalue_watthour": 147000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"147000\",\"fromTime\":\"2023-02-09T06:00:00.000Z\",\"toTime\":\"2023-02-09T06:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 07:00:32.811034+00", - "updatedAt": "2023-02-09 07:00:32.811034+00", - "countryCode": "IND" - }, - { - "id": 275, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 08:00:00+00", - "certificate_issuance_enddate": "2023-02-09 08:55:00+00", - "readvalue_watthour": 105000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"105000\",\"fromTime\":\"2023-02-09T08:00:00.000Z\",\"toTime\":\"2023-02-09T08:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 09:00:32.810319+00", - "updatedAt": "2023-02-09 09:00:32.810319+00", - "countryCode": "IND" - }, - { - "id": 276, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 09:00:00+00", - "certificate_issuance_enddate": "2023-02-09 09:55:00+00", - "readvalue_watthour": 105000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"105000\",\"fromTime\":\"2023-02-09T09:00:00.000Z\",\"toTime\":\"2023-02-09T09:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 10:00:32.918848+00", - "updatedAt": "2023-02-09 10:00:32.918848+00", - "countryCode": "IND" - }, - { - "id": 277, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 10:00:00+00", - "certificate_issuance_enddate": "2023-02-09 10:55:00+00", - "readvalue_watthour": 49000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"49000\",\"fromTime\":\"2023-02-09T10:00:00.000Z\",\"toTime\":\"2023-02-09T10:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 11:00:33.30755+00", - "updatedAt": "2023-02-09 11:00:33.30755+00", - "countryCode": "IND" - }, - { - "id": 278, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 11:00:00+00", - "certificate_issuance_enddate": "2023-02-09 11:55:00+00", - "readvalue_watthour": 18000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"18000\",\"fromTime\":\"2023-02-09T11:00:00.000Z\",\"toTime\":\"2023-02-09T11:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 12:00:35.312202+00", - "updatedAt": "2023-02-09 12:00:35.312202+00", - "countryCode": "IND" - }, - { - "id": 279, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 12:00:00+00", - "certificate_issuance_enddate": "2023-02-09 12:50:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-09T12:00:00.000Z\",\"toTime\":\"2023-02-09T12:50:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 13:00:32.910955+00", - "updatedAt": "2023-02-09 13:00:32.910955+00", - "countryCode": "IND" - }, - { - "id": 280, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-09 20:35:00+00", - "certificate_issuance_enddate": "2023-02-09 21:55:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-09T20:35:00.000Z\",\"toTime\":\"2023-02-09T21:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-09 22:00:31.738005+00", - "updatedAt": "2023-02-09 22:00:31.738005+00", - "countryCode": "IND" - }, - { - "id": 281, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 00:55:00+00", - "certificate_issuance_enddate": "2023-02-10 01:55:00+00", - "readvalue_watthour": 6000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"6000\",\"fromTime\":\"2023-02-10T00:55:00.000Z\",\"toTime\":\"2023-02-10T01:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 02:00:32.414981+00", - "updatedAt": "2023-02-10 02:00:32.414981+00", - "countryCode": "IND" - }, - { - "id": 282, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 02:00:00+00", - "certificate_issuance_enddate": "2023-02-10 02:55:00+00", - "readvalue_watthour": 35000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"35000\",\"fromTime\":\"2023-02-10T02:00:00.000Z\",\"toTime\":\"2023-02-10T02:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 03:00:35.430563+00", - "updatedAt": "2023-02-10 03:00:35.430563+00", - "countryCode": "IND" - }, - { - "id": 283, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 03:00:00+00", - "certificate_issuance_enddate": "2023-02-10 03:55:00+00", - "readvalue_watthour": 74000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"74000\",\"fromTime\":\"2023-02-10T03:00:00.000Z\",\"toTime\":\"2023-02-10T03:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 04:00:32.611211+00", - "updatedAt": "2023-02-10 04:00:32.611211+00", - "countryCode": "IND" - }, - { - "id": 284, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 04:00:00+00", - "certificate_issuance_enddate": "2023-02-10 04:55:00+00", - "readvalue_watthour": 120000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"120000\",\"fromTime\":\"2023-02-10T04:00:00.000Z\",\"toTime\":\"2023-02-10T04:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 05:00:32.913791+00", - "updatedAt": "2023-02-10 05:00:32.913791+00", - "countryCode": "IND" - }, - { - "id": 285, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 05:00:00+00", - "certificate_issuance_enddate": "2023-02-10 05:55:00+00", - "readvalue_watthour": 143000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"143000\",\"fromTime\":\"2023-02-10T05:00:00.000Z\",\"toTime\":\"2023-02-10T05:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 06:00:32.01779+00", - "updatedAt": "2023-02-10 06:00:32.01779+00", - "countryCode": "IND" - }, - { - "id": 286, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 06:00:00+00", - "certificate_issuance_enddate": "2023-02-10 06:55:00+00", - "readvalue_watthour": 157000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"157000\",\"fromTime\":\"2023-02-10T06:00:00.000Z\",\"toTime\":\"2023-02-10T06:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 07:00:32.617217+00", - "updatedAt": "2023-02-10 07:00:32.617217+00", - "countryCode": "IND" - }, - { - "id": 287, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 07:00:00+00", - "certificate_issuance_enddate": "2023-02-10 07:55:00+00", - "readvalue_watthour": 127000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"127000\",\"fromTime\":\"2023-02-10T07:00:00.000Z\",\"toTime\":\"2023-02-10T07:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 08:00:34.611015+00", - "updatedAt": "2023-02-10 08:00:34.611015+00", - "countryCode": "IND" - }, - { - "id": 288, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 08:00:00+00", - "certificate_issuance_enddate": "2023-02-10 08:55:00+00", - "readvalue_watthour": 138000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"138000\",\"fromTime\":\"2023-02-10T08:00:00.000Z\",\"toTime\":\"2023-02-10T08:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 09:00:32.310751+00", - "updatedAt": "2023-02-10 09:00:32.310751+00", - "countryCode": "IND" - }, - { - "id": 289, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 09:00:00+00", - "certificate_issuance_enddate": "2023-02-10 09:55:00+00", - "readvalue_watthour": 105000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"105000\",\"fromTime\":\"2023-02-10T09:00:00.000Z\",\"toTime\":\"2023-02-10T09:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 10:00:32.110596+00", - "updatedAt": "2023-02-10 10:00:32.110596+00", - "countryCode": "IND" - }, - { - "id": 290, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 10:00:00+00", - "certificate_issuance_enddate": "2023-02-10 10:55:00+00", - "readvalue_watthour": 74000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"74000\",\"fromTime\":\"2023-02-10T10:00:00.000Z\",\"toTime\":\"2023-02-10T10:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 11:00:32.727205+00", - "updatedAt": "2023-02-10 11:00:32.727205+00", - "countryCode": "IND" - }, - { - "id": 291, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 11:00:00+00", - "certificate_issuance_enddate": "2023-02-10 11:55:00+00", - "readvalue_watthour": 29000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"29000\",\"fromTime\":\"2023-02-10T11:00:00.000Z\",\"toTime\":\"2023-02-10T11:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 12:00:33.40823+00", - "updatedAt": "2023-02-10 12:00:33.40823+00", - "countryCode": "IND" - }, - { - "id": 292, - "groupid": 14, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-10 12:00:00+00", - "certificate_issuance_enddate": "2023-02-10 12:40:00+00", - "readvalue_watthour": 3000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"14\",\"energyValue\":\"3000\",\"fromTime\":\"2023-02-10T12:00:00.000Z\",\"toTime\":\"2023-02-10T12:40:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}}", - "createdAt": "2023-02-10 13:00:32.210311+00", - "updatedAt": "2023-02-10 13:00:32.210311+00", - "countryCode": "IND" - }, - { - "id": 293, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-11 00:45:00+00", - "certificate_issuance_enddate": "2023-02-11 02:00:00+00", - "readvalue_watthour": 6000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"6000\",\"fromTime\":\"2023-02-11T00:45:00.000Z\",\"toTime\":\"2023-02-11T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:42:32.108312+00", - "updatedAt": "2023-02-18 16:42:32.108312+00", - "countryCode": "IND" - }, - { - "id": 294, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-11 02:00:00+00", - "certificate_issuance_enddate": "2023-02-11 03:00:00+00", - "readvalue_watthour": 43000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"43000\",\"fromTime\":\"2023-02-11T02:00:00.000Z\",\"toTime\":\"2023-02-11T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:43:02.212533+00", - "updatedAt": "2023-02-18 16:43:02.212533+00", - "countryCode": "IND" - }, - { - "id": 295, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-11 03:00:00+00", - "certificate_issuance_enddate": "2023-02-11 03:50:00+00", - "readvalue_watthour": 34000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"34000\",\"fromTime\":\"2023-02-11T03:00:00.000Z\",\"toTime\":\"2023-02-11T03:50:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:43:32.811349+00", - "updatedAt": "2023-02-18 16:43:32.811349+00", - "countryCode": "IND" - }, - { - "id": 296, - "groupid": 18, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2022-12-31 18:30:01+00", - "certificate_issuance_enddate": "2023-01-31 18:29:59+00", - "readvalue_watthour": 1681000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"18\",\"energyValue\":\"1681000\",\"fromTime\":\"2022-12-31T18:30:01.000Z\",\"toTime\":\"2023-01-31T18:29:59.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"20ff2e72-d47b-4bd7-aeee-c3b4e6e1ef2b\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"18\"}}", - "createdAt": "2023-02-18 16:44:33.61728+00", - "updatedAt": "2023-02-18 16:44:33.61728+00", - "countryCode": "IND" - }, - { - "id": 297, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-11 03:15:00+00", - "certificate_issuance_enddate": "2023-02-11 10:00:00+00", - "readvalue_watthour": 12000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"12000\",\"fromTime\":\"2023-02-11T03:15:00.000Z\",\"toTime\":\"2023-02-11T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:46:32.009787+00", - "updatedAt": "2023-02-18 16:46:32.009787+00", - "countryCode": "IND" - }, - { - "id": 298, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-11 10:00:00+00", - "certificate_issuance_enddate": "2023-02-11 11:00:00+00", - "readvalue_watthour": 41000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"41000\",\"fromTime\":\"2023-02-11T10:00:00.000Z\",\"toTime\":\"2023-02-11T11:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:47:01.830367+00", - "updatedAt": "2023-02-18 16:47:01.830367+00", - "countryCode": "IND" - }, - { - "id": 299, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-11 11:00:00+00", - "certificate_issuance_enddate": "2023-02-11 12:00:00+00", - "readvalue_watthour": 18000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"18000\",\"fromTime\":\"2023-02-11T11:00:00.000Z\",\"toTime\":\"2023-02-11T12:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:47:32.713227+00", - "updatedAt": "2023-02-18 16:47:32.713227+00", - "countryCode": "IND" - }, - { - "id": 300, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-11 03:50:00+00", - "certificate_issuance_enddate": "2023-02-11 12:45:00+00", - "readvalue_watthour": 3000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"3000\",\"fromTime\":\"2023-02-11T03:50:00.000Z\",\"toTime\":\"2023-02-11T12:45:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:48:02.333953+00", - "updatedAt": "2023-02-18 16:48:02.333953+00", - "countryCode": "IND" - }, - { - "id": 301, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-11 13:50:00+00", - "certificate_issuance_enddate": "2023-02-11 14:55:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-11T13:50:00.000Z\",\"toTime\":\"2023-02-11T14:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:49:02.547883+00", - "updatedAt": "2023-02-18 16:49:02.547883+00", - "countryCode": "IND" - }, - { - "id": 302, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 00:45:00+00", - "certificate_issuance_enddate": "2023-02-12 02:00:00+00", - "readvalue_watthour": 6000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"6000\",\"fromTime\":\"2023-02-12T00:45:00.000Z\",\"toTime\":\"2023-02-12T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:54:31.732017+00", - "updatedAt": "2023-02-18 16:54:31.732017+00", - "countryCode": "IND" - }, - { - "id": 303, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 02:00:00+00", - "certificate_issuance_enddate": "2023-02-12 03:00:00+00", - "readvalue_watthour": 31000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"31000\",\"fromTime\":\"2023-02-12T02:00:00.000Z\",\"toTime\":\"2023-02-12T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:55:02.910588+00", - "updatedAt": "2023-02-18 16:55:02.910588+00", - "countryCode": "IND" - }, - { - "id": 304, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 03:00:00+00", - "certificate_issuance_enddate": "2023-02-12 04:00:00+00", - "readvalue_watthour": 64000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"64000\",\"fromTime\":\"2023-02-12T03:00:00.000Z\",\"toTime\":\"2023-02-12T04:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:55:31.735581+00", - "updatedAt": "2023-02-18 16:55:31.735581+00", - "countryCode": "IND" - }, - { - "id": 305, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 04:00:00+00", - "certificate_issuance_enddate": "2023-02-12 05:00:00+00", - "readvalue_watthour": 90000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"90000\",\"fromTime\":\"2023-02-12T04:00:00.000Z\",\"toTime\":\"2023-02-12T05:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:56:02.029619+00", - "updatedAt": "2023-02-18 16:56:02.029619+00", - "countryCode": "IND" - }, - { - "id": 306, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 05:00:00+00", - "certificate_issuance_enddate": "2023-02-12 06:00:00+00", - "readvalue_watthour": 107000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"107000\",\"fromTime\":\"2023-02-12T05:00:00.000Z\",\"toTime\":\"2023-02-12T06:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:56:32.326168+00", - "updatedAt": "2023-02-18 16:56:32.326168+00", - "countryCode": "IND" - }, - { - "id": 307, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 06:00:00+00", - "certificate_issuance_enddate": "2023-02-12 07:00:00+00", - "readvalue_watthour": 107000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"107000\",\"fromTime\":\"2023-02-12T06:00:00.000Z\",\"toTime\":\"2023-02-12T07:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:57:02.715344+00", - "updatedAt": "2023-02-18 16:57:02.715344+00", - "countryCode": "IND" - }, - { - "id": 308, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 07:00:00+00", - "certificate_issuance_enddate": "2023-02-12 08:00:00+00", - "readvalue_watthour": 96000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"96000\",\"fromTime\":\"2023-02-12T07:00:00.000Z\",\"toTime\":\"2023-02-12T08:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:57:32.509932+00", - "updatedAt": "2023-02-18 16:57:32.509932+00", - "countryCode": "IND" - }, - { - "id": 309, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 08:00:00+00", - "certificate_issuance_enddate": "2023-02-12 09:00:00+00", - "readvalue_watthour": 93000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"93000\",\"fromTime\":\"2023-02-12T08:00:00.000Z\",\"toTime\":\"2023-02-12T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:58:02.31382+00", - "updatedAt": "2023-02-18 16:58:02.31382+00", - "countryCode": "IND" - }, - { - "id": 310, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 09:00:00+00", - "certificate_issuance_enddate": "2023-02-12 10:00:00+00", - "readvalue_watthour": 78000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"78000\",\"fromTime\":\"2023-02-12T09:00:00.000Z\",\"toTime\":\"2023-02-12T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:58:31.709044+00", - "updatedAt": "2023-02-18 16:58:31.709044+00", - "countryCode": "IND" - }, - { - "id": 311, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 10:00:00+00", - "certificate_issuance_enddate": "2023-02-12 11:00:00+00", - "readvalue_watthour": 50000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"50000\",\"fromTime\":\"2023-02-12T10:00:00.000Z\",\"toTime\":\"2023-02-12T11:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:59:02.211138+00", - "updatedAt": "2023-02-18 16:59:02.211138+00", - "countryCode": "IND" - }, - { - "id": 312, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 11:00:00+00", - "certificate_issuance_enddate": "2023-02-12 12:00:00+00", - "readvalue_watthour": 20000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"20000\",\"fromTime\":\"2023-02-12T11:00:00.000Z\",\"toTime\":\"2023-02-12T12:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 16:59:32.710128+00", - "updatedAt": "2023-02-18 16:59:32.710128+00", - "countryCode": "IND" - }, - { - "id": 313, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 12:00:00+00", - "certificate_issuance_enddate": "2023-02-12 12:50:00+00", - "readvalue_watthour": 2000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"2000\",\"fromTime\":\"2023-02-12T12:00:00.000Z\",\"toTime\":\"2023-02-12T12:50:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:00:02.909316+00", - "updatedAt": "2023-02-18 17:00:02.909316+00", - "countryCode": "IND" - }, - { - "id": 314, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-12 20:45:00+00", - "certificate_issuance_enddate": "2023-02-12 22:00:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-12T20:45:00.000Z\",\"toTime\":\"2023-02-12T22:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:04:31.813319+00", - "updatedAt": "2023-02-18 17:04:31.813319+00", - "countryCode": "IND" - }, - { - "id": 315, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 00:45:00+00", - "certificate_issuance_enddate": "2023-02-13 02:00:00+00", - "readvalue_watthour": 5000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"5000\",\"fromTime\":\"2023-02-13T00:45:00.000Z\",\"toTime\":\"2023-02-13T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:06:32.41899+00", - "updatedAt": "2023-02-18 17:06:32.41899+00", - "countryCode": "IND" - }, - { - "id": 316, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 02:00:00+00", - "certificate_issuance_enddate": "2023-02-13 03:00:00+00", - "readvalue_watthour": 33000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"33000\",\"fromTime\":\"2023-02-13T02:00:00.000Z\",\"toTime\":\"2023-02-13T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:07:02.215389+00", - "updatedAt": "2023-02-18 17:07:02.215389+00", - "countryCode": "IND" - }, - { - "id": 317, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-11 16:00:00+00", - "certificate_issuance_enddate": "2023-02-13 04:00:00+00", - "readvalue_watthour": 480000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"480000\",\"fromTime\":\"2023-02-11T16:00:00.000Z\",\"toTime\":\"2023-02-13T04:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:07:32.211854+00", - "updatedAt": "2023-02-18 17:07:32.211854+00", - "countryCode": "IND" - }, - { - "id": 318, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 04:00:00+00", - "certificate_issuance_enddate": "2023-02-13 05:00:00+00", - "readvalue_watthour": 143000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"143000\",\"fromTime\":\"2023-02-13T04:00:00.000Z\",\"toTime\":\"2023-02-13T05:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:08:02.137561+00", - "updatedAt": "2023-02-18 17:08:02.137561+00", - "countryCode": "IND" - }, - { - "id": 319, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 05:00:00+00", - "certificate_issuance_enddate": "2023-02-13 06:00:00+00", - "readvalue_watthour": 167000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"167000\",\"fromTime\":\"2023-02-13T05:00:00.000Z\",\"toTime\":\"2023-02-13T06:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:08:31.617434+00", - "updatedAt": "2023-02-18 17:08:31.617434+00", - "countryCode": "IND" - }, - { - "id": 320, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 06:00:00+00", - "certificate_issuance_enddate": "2023-02-13 07:00:00+00", - "readvalue_watthour": 180000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"180000\",\"fromTime\":\"2023-02-13T06:00:00.000Z\",\"toTime\":\"2023-02-13T07:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:09:02.917334+00", - "updatedAt": "2023-02-18 17:09:02.917334+00", - "countryCode": "IND" - }, - { - "id": 321, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 07:00:00+00", - "certificate_issuance_enddate": "2023-02-13 08:00:00+00", - "readvalue_watthour": 176000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"176000\",\"fromTime\":\"2023-02-13T07:00:00.000Z\",\"toTime\":\"2023-02-13T08:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:09:32.214067+00", - "updatedAt": "2023-02-18 17:09:32.214067+00", - "countryCode": "IND" - }, - { - "id": 322, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 08:00:00+00", - "certificate_issuance_enddate": "2023-02-13 09:00:00+00", - "readvalue_watthour": 155000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"155000\",\"fromTime\":\"2023-02-13T08:00:00.000Z\",\"toTime\":\"2023-02-13T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:10:02.614069+00", - "updatedAt": "2023-02-18 17:10:02.614069+00", - "countryCode": "IND" - }, - { - "id": 323, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 09:00:00+00", - "certificate_issuance_enddate": "2023-02-13 10:00:00+00", - "readvalue_watthour": 123000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"123000\",\"fromTime\":\"2023-02-13T09:00:00.000Z\",\"toTime\":\"2023-02-13T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:10:31.812788+00", - "updatedAt": "2023-02-18 17:10:31.812788+00", - "countryCode": "IND" - }, - { - "id": 324, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 10:00:00+00", - "certificate_issuance_enddate": "2023-02-13 11:00:00+00", - "readvalue_watthour": 82000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"82000\",\"fromTime\":\"2023-02-13T10:00:00.000Z\",\"toTime\":\"2023-02-13T11:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:11:02.61827+00", - "updatedAt": "2023-02-18 17:11:02.61827+00", - "countryCode": "IND" - }, - { - "id": 325, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 11:00:00+00", - "certificate_issuance_enddate": "2023-02-13 12:00:00+00", - "readvalue_watthour": 32000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"32000\",\"fromTime\":\"2023-02-13T11:00:00.000Z\",\"toTime\":\"2023-02-13T12:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:11:31.815697+00", - "updatedAt": "2023-02-18 17:11:31.815697+00", - "countryCode": "IND" - }, - { - "id": 326, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 12:00:00+00", - "certificate_issuance_enddate": "2023-02-13 13:00:00+00", - "readvalue_watthour": 3000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"3000\",\"fromTime\":\"2023-02-13T12:00:00.000Z\",\"toTime\":\"2023-02-13T13:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:12:02.31245+00", - "updatedAt": "2023-02-18 17:12:02.31245+00", - "countryCode": "IND" - }, - { - "id": 327, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-13 19:40:00+00", - "certificate_issuance_enddate": "2023-02-13 21:00:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-13T19:40:00.000Z\",\"toTime\":\"2023-02-13T21:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:16:02.313154+00", - "updatedAt": "2023-02-18 17:16:02.313154+00", - "countryCode": "IND" - }, - { - "id": 328, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 00:45:00+00", - "certificate_issuance_enddate": "2023-02-14 02:00:00+00", - "readvalue_watthour": 6000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"6000\",\"fromTime\":\"2023-02-14T00:45:00.000Z\",\"toTime\":\"2023-02-14T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:18:32.313869+00", - "updatedAt": "2023-02-18 17:18:32.313869+00", - "countryCode": "IND" - }, - { - "id": 329, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 02:00:00+00", - "certificate_issuance_enddate": "2023-02-14 03:00:00+00", - "readvalue_watthour": 41000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"41000\",\"fromTime\":\"2023-02-14T02:00:00.000Z\",\"toTime\":\"2023-02-14T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:19:02.312426+00", - "updatedAt": "2023-02-18 17:19:02.312426+00", - "countryCode": "IND" - }, - { - "id": 330, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 03:00:00+00", - "certificate_issuance_enddate": "2023-02-14 04:00:00+00", - "readvalue_watthour": 90000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"90000\",\"fromTime\":\"2023-02-14T03:00:00.000Z\",\"toTime\":\"2023-02-14T04:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:19:32.11579+00", - "updatedAt": "2023-02-18 17:19:32.11579+00", - "countryCode": "IND" - }, - { - "id": 331, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 04:00:00+00", - "certificate_issuance_enddate": "2023-02-14 05:00:00+00", - "readvalue_watthour": 127000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"127000\",\"fromTime\":\"2023-02-14T04:00:00.000Z\",\"toTime\":\"2023-02-14T05:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:20:02.32195+00", - "updatedAt": "2023-02-18 17:20:02.32195+00", - "countryCode": "IND" - }, - { - "id": 332, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 05:00:00+00", - "certificate_issuance_enddate": "2023-02-14 06:00:00+00", - "readvalue_watthour": 148000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"148000\",\"fromTime\":\"2023-02-14T05:00:00.000Z\",\"toTime\":\"2023-02-14T06:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:20:33.40854+00", - "updatedAt": "2023-02-18 17:20:33.40854+00", - "countryCode": "IND" - }, - { - "id": 333, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 06:00:00+00", - "certificate_issuance_enddate": "2023-02-14 07:00:00+00", - "readvalue_watthour": 162000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"162000\",\"fromTime\":\"2023-02-14T06:00:00.000Z\",\"toTime\":\"2023-02-14T07:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:21:02.709378+00", - "updatedAt": "2023-02-18 17:21:02.709378+00", - "countryCode": "IND" - }, - { - "id": 334, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 06:55:00+00", - "certificate_issuance_enddate": "2023-02-14 08:00:00+00", - "readvalue_watthour": 136000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"136000\",\"fromTime\":\"2023-02-14T06:55:00.000Z\",\"toTime\":\"2023-02-14T08:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:21:31.913707+00", - "updatedAt": "2023-02-18 17:21:31.913707+00", - "countryCode": "IND" - }, - { - "id": 335, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 08:00:00+00", - "certificate_issuance_enddate": "2023-02-14 09:00:00+00", - "readvalue_watthour": 155000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"155000\",\"fromTime\":\"2023-02-14T08:00:00.000Z\",\"toTime\":\"2023-02-14T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:22:01.933577+00", - "updatedAt": "2023-02-18 17:22:01.933577+00", - "countryCode": "IND" - }, - { - "id": 336, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 09:00:00+00", - "certificate_issuance_enddate": "2023-02-14 10:00:00+00", - "readvalue_watthour": 115000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"115000\",\"fromTime\":\"2023-02-14T09:00:00.000Z\",\"toTime\":\"2023-02-14T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:22:32.11516+00", - "updatedAt": "2023-02-18 17:22:32.11516+00", - "countryCode": "IND" - }, - { - "id": 337, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 09:40:00+00", - "certificate_issuance_enddate": "2023-02-14 11:00:00+00", - "readvalue_watthour": 76000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"76000\",\"fromTime\":\"2023-02-14T09:40:00.000Z\",\"toTime\":\"2023-02-14T11:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:23:02.107921+00", - "updatedAt": "2023-02-18 17:23:02.107921+00", - "countryCode": "IND" - }, - { - "id": 338, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 11:00:00+00", - "certificate_issuance_enddate": "2023-02-14 12:00:00+00", - "readvalue_watthour": 39000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"39000\",\"fromTime\":\"2023-02-14T11:00:00.000Z\",\"toTime\":\"2023-02-14T12:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:23:32.51439+00", - "updatedAt": "2023-02-18 17:23:32.51439+00", - "countryCode": "IND" - }, - { - "id": 339, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 12:00:00+00", - "certificate_issuance_enddate": "2023-02-14 12:45:00+00", - "readvalue_watthour": 3000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"3000\",\"fromTime\":\"2023-02-14T12:00:00.000Z\",\"toTime\":\"2023-02-14T12:45:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:24:02.419212+00", - "updatedAt": "2023-02-18 17:24:02.419212+00", - "countryCode": "IND" - }, - { - "id": 340, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-14 19:40:00+00", - "certificate_issuance_enddate": "2023-02-14 21:00:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-14T19:40:00.000Z\",\"toTime\":\"2023-02-14T21:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:28:02.713901+00", - "updatedAt": "2023-02-18 17:28:02.713901+00", - "countryCode": "IND" - }, - { - "id": 341, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 00:45:00+00", - "certificate_issuance_enddate": "2023-02-15 02:00:00+00", - "readvalue_watthour": 9000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"9000\",\"fromTime\":\"2023-02-15T00:45:00.000Z\",\"toTime\":\"2023-02-15T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:30:32.017616+00", - "updatedAt": "2023-02-18 17:30:32.017616+00", - "countryCode": "IND" - }, - { - "id": 342, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 02:00:00+00", - "certificate_issuance_enddate": "2023-02-15 03:00:00+00", - "readvalue_watthour": 51000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"51000\",\"fromTime\":\"2023-02-15T02:00:00.000Z\",\"toTime\":\"2023-02-15T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:31:03.110255+00", - "updatedAt": "2023-02-18 17:31:03.110255+00", - "countryCode": "IND" - }, - { - "id": 343, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 03:00:00+00", - "certificate_issuance_enddate": "2023-02-15 04:00:00+00", - "readvalue_watthour": 105000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"105000\",\"fromTime\":\"2023-02-15T03:00:00.000Z\",\"toTime\":\"2023-02-15T04:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:31:32.019389+00", - "updatedAt": "2023-02-18 17:31:32.019389+00", - "countryCode": "IND" - }, - { - "id": 344, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 04:00:00+00", - "certificate_issuance_enddate": "2023-02-15 05:00:00+00", - "readvalue_watthour": 149000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"149000\",\"fromTime\":\"2023-02-15T04:00:00.000Z\",\"toTime\":\"2023-02-15T05:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:32:02.715352+00", - "updatedAt": "2023-02-18 17:32:02.715352+00", - "countryCode": "IND" - }, - { - "id": 345, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 05:00:00+00", - "certificate_issuance_enddate": "2023-02-15 06:00:00+00", - "readvalue_watthour": 173000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"173000\",\"fromTime\":\"2023-02-15T05:00:00.000Z\",\"toTime\":\"2023-02-15T06:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:32:35.211929+00", - "updatedAt": "2023-02-18 17:32:35.211929+00", - "countryCode": "IND" - }, - { - "id": 346, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 06:00:00+00", - "certificate_issuance_enddate": "2023-02-15 07:00:00+00", - "readvalue_watthour": 185000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"185000\",\"fromTime\":\"2023-02-15T06:00:00.000Z\",\"toTime\":\"2023-02-15T07:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:33:02.317457+00", - "updatedAt": "2023-02-18 17:33:02.317457+00", - "countryCode": "IND" - }, - { - "id": 347, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 07:00:00+00", - "certificate_issuance_enddate": "2023-02-15 08:00:00+00", - "readvalue_watthour": 179000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"179000\",\"fromTime\":\"2023-02-15T07:00:00.000Z\",\"toTime\":\"2023-02-15T08:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:33:32.21376+00", - "updatedAt": "2023-02-18 17:33:32.21376+00", - "countryCode": "IND" - }, - { - "id": 348, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 08:00:00+00", - "certificate_issuance_enddate": "2023-02-15 09:00:00+00", - "readvalue_watthour": 164000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"164000\",\"fromTime\":\"2023-02-15T08:00:00.000Z\",\"toTime\":\"2023-02-15T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:34:02.240242+00", - "updatedAt": "2023-02-18 17:34:02.240242+00", - "countryCode": "IND" - }, - { - "id": 349, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 09:00:00+00", - "certificate_issuance_enddate": "2023-02-15 10:00:00+00", - "readvalue_watthour": 132000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"132000\",\"fromTime\":\"2023-02-15T09:00:00.000Z\",\"toTime\":\"2023-02-15T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:34:32.109304+00", - "updatedAt": "2023-02-18 17:34:32.109304+00", - "countryCode": "IND" - }, - { - "id": 350, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 10:00:00+00", - "certificate_issuance_enddate": "2023-02-15 11:00:00+00", - "readvalue_watthour": 84000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"84000\",\"fromTime\":\"2023-02-15T10:00:00.000Z\",\"toTime\":\"2023-02-15T11:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:35:02.732312+00", - "updatedAt": "2023-02-18 17:35:02.732312+00", - "countryCode": "IND" - }, - { - "id": 351, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 11:00:00+00", - "certificate_issuance_enddate": "2023-02-15 12:00:00+00", - "readvalue_watthour": 34000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"34000\",\"fromTime\":\"2023-02-15T11:00:00.000Z\",\"toTime\":\"2023-02-15T12:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:35:32.018237+00", - "updatedAt": "2023-02-18 17:35:32.018237+00", - "countryCode": "IND" - }, - { - "id": 352, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 12:00:00+00", - "certificate_issuance_enddate": "2023-02-15 13:00:00+00", - "readvalue_watthour": 3000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"3000\",\"fromTime\":\"2023-02-15T12:00:00.000Z\",\"toTime\":\"2023-02-15T13:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:36:02.108851+00", - "updatedAt": "2023-02-18 17:36:02.108851+00", - "countryCode": "IND" - }, - { - "id": 353, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-15 19:00:00+00", - "certificate_issuance_enddate": "2023-02-15 19:55:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-15T19:00:00.000Z\",\"toTime\":\"2023-02-15T19:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:39:32.613501+00", - "updatedAt": "2023-02-18 17:39:32.613501+00", - "countryCode": "IND" - }, - { - "id": 354, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 00:55:00+00", - "certificate_issuance_enddate": "2023-02-16 02:00:00+00", - "readvalue_watthour": 4000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"4000\",\"fromTime\":\"2023-02-16T00:55:00.000Z\",\"toTime\":\"2023-02-16T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:42:32.71894+00", - "updatedAt": "2023-02-18 17:42:32.71894+00", - "countryCode": "IND" - }, - { - "id": 355, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 02:00:00+00", - "certificate_issuance_enddate": "2023-02-16 03:00:00+00", - "readvalue_watthour": 36000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"36000\",\"fromTime\":\"2023-02-16T02:00:00.000Z\",\"toTime\":\"2023-02-16T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:43:02.408471+00", - "updatedAt": "2023-02-18 17:43:02.408471+00", - "countryCode": "IND" - }, - { - "id": 356, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 03:00:00+00", - "certificate_issuance_enddate": "2023-02-16 04:00:00+00", - "readvalue_watthour": 82000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"82000\",\"fromTime\":\"2023-02-16T03:00:00.000Z\",\"toTime\":\"2023-02-16T04:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:43:32.3124+00", - "updatedAt": "2023-02-18 17:43:32.3124+00", - "countryCode": "IND" - }, - { - "id": 357, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 04:00:00+00", - "certificate_issuance_enddate": "2023-02-16 05:00:00+00", - "readvalue_watthour": 138000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"138000\",\"fromTime\":\"2023-02-16T04:00:00.000Z\",\"toTime\":\"2023-02-16T05:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:44:03.012038+00", - "updatedAt": "2023-02-18 17:44:03.012038+00", - "countryCode": "IND" - }, - { - "id": 358, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 05:00:00+00", - "certificate_issuance_enddate": "2023-02-16 06:00:00+00", - "readvalue_watthour": 164000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"164000\",\"fromTime\":\"2023-02-16T05:00:00.000Z\",\"toTime\":\"2023-02-16T06:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:44:32.411275+00", - "updatedAt": "2023-02-18 17:44:32.411275+00", - "countryCode": "IND" - }, - { - "id": 359, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 06:00:00+00", - "certificate_issuance_enddate": "2023-02-16 07:00:00+00", - "readvalue_watthour": 176000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"176000\",\"fromTime\":\"2023-02-16T06:00:00.000Z\",\"toTime\":\"2023-02-16T07:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:45:02.034386+00", - "updatedAt": "2023-02-18 17:45:02.034386+00", - "countryCode": "IND" - }, - { - "id": 360, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 07:00:00+00", - "certificate_issuance_enddate": "2023-02-16 08:00:00+00", - "readvalue_watthour": 176000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"176000\",\"fromTime\":\"2023-02-16T07:00:00.000Z\",\"toTime\":\"2023-02-16T08:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:45:32.318161+00", - "updatedAt": "2023-02-18 17:45:32.318161+00", - "countryCode": "IND" - }, - { - "id": 361, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 08:00:00+00", - "certificate_issuance_enddate": "2023-02-16 09:00:00+00", - "readvalue_watthour": 159000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"159000\",\"fromTime\":\"2023-02-16T08:00:00.000Z\",\"toTime\":\"2023-02-16T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:46:02.216121+00", - "updatedAt": "2023-02-18 17:46:02.216121+00", - "countryCode": "IND" - }, - { - "id": 362, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 09:00:00+00", - "certificate_issuance_enddate": "2023-02-16 10:00:00+00", - "readvalue_watthour": 124000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"124000\",\"fromTime\":\"2023-02-16T09:00:00.000Z\",\"toTime\":\"2023-02-16T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:46:32.01459+00", - "updatedAt": "2023-02-18 17:46:32.01459+00", - "countryCode": "IND" - }, - { - "id": 363, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 10:00:00+00", - "certificate_issuance_enddate": "2023-02-16 11:00:00+00", - "readvalue_watthour": 80000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"80000\",\"fromTime\":\"2023-02-16T10:00:00.000Z\",\"toTime\":\"2023-02-16T11:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:47:03.219849+00", - "updatedAt": "2023-02-18 17:47:03.219849+00", - "countryCode": "IND" - }, - { - "id": 364, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 11:00:00+00", - "certificate_issuance_enddate": "2023-02-16 12:00:00+00", - "readvalue_watthour": 28000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"28000\",\"fromTime\":\"2023-02-16T11:00:00.000Z\",\"toTime\":\"2023-02-16T12:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:47:31.915293+00", - "updatedAt": "2023-02-18 17:47:31.915293+00", - "countryCode": "IND" - }, - { - "id": 365, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 12:00:00+00", - "certificate_issuance_enddate": "2023-02-16 13:00:00+00", - "readvalue_watthour": 3000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"3000\",\"fromTime\":\"2023-02-16T12:00:00.000Z\",\"toTime\":\"2023-02-16T13:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:48:02.233904+00", - "updatedAt": "2023-02-18 17:48:02.233904+00", - "countryCode": "IND" - }, - { - "id": 366, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-16 17:50:00+00", - "certificate_issuance_enddate": "2023-02-16 19:00:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-16T17:50:00.000Z\",\"toTime\":\"2023-02-16T19:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:51:02.032712+00", - "updatedAt": "2023-02-18 17:51:02.032712+00", - "countryCode": "IND" - }, - { - "id": 367, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 00:50:00+00", - "certificate_issuance_enddate": "2023-02-17 02:00:00+00", - "readvalue_watthour": 4000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"4000\",\"fromTime\":\"2023-02-17T00:50:00.000Z\",\"toTime\":\"2023-02-17T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:54:31.812918+00", - "updatedAt": "2023-02-18 17:54:31.812918+00", - "countryCode": "IND" - }, - { - "id": 368, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 02:00:00+00", - "certificate_issuance_enddate": "2023-02-17 03:00:00+00", - "readvalue_watthour": 36000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"36000\",\"fromTime\":\"2023-02-17T02:00:00.000Z\",\"toTime\":\"2023-02-17T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:55:01.72626+00", - "updatedAt": "2023-02-18 17:55:01.72626+00", - "countryCode": "IND" - }, - { - "id": 369, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 03:00:00+00", - "certificate_issuance_enddate": "2023-02-17 04:00:00+00", - "readvalue_watthour": 93000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"93000\",\"fromTime\":\"2023-02-17T03:00:00.000Z\",\"toTime\":\"2023-02-17T04:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:55:32.114336+00", - "updatedAt": "2023-02-18 17:55:32.114336+00", - "countryCode": "IND" - }, - { - "id": 370, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 04:00:00+00", - "certificate_issuance_enddate": "2023-02-17 05:00:00+00", - "readvalue_watthour": 136000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"136000\",\"fromTime\":\"2023-02-17T04:00:00.000Z\",\"toTime\":\"2023-02-17T05:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:56:03.111331+00", - "updatedAt": "2023-02-18 17:56:03.111331+00", - "countryCode": "IND" - }, - { - "id": 371, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 05:00:00+00", - "certificate_issuance_enddate": "2023-02-17 06:00:00+00", - "readvalue_watthour": 164000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"164000\",\"fromTime\":\"2023-02-17T05:00:00.000Z\",\"toTime\":\"2023-02-17T06:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:56:32.232804+00", - "updatedAt": "2023-02-18 17:56:32.232804+00", - "countryCode": "IND" - }, - { - "id": 372, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 06:00:00+00", - "certificate_issuance_enddate": "2023-02-17 07:00:00+00", - "readvalue_watthour": 174000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"174000\",\"fromTime\":\"2023-02-17T06:00:00.000Z\",\"toTime\":\"2023-02-17T07:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:57:02.317697+00", - "updatedAt": "2023-02-18 17:57:02.317697+00", - "countryCode": "IND" - }, - { - "id": 373, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 07:00:00+00", - "certificate_issuance_enddate": "2023-02-17 08:00:00+00", - "readvalue_watthour": 168000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"168000\",\"fromTime\":\"2023-02-17T07:00:00.000Z\",\"toTime\":\"2023-02-17T08:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:57:32.709264+00", - "updatedAt": "2023-02-18 17:57:32.709264+00", - "countryCode": "IND" - }, - { - "id": 374, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 08:00:00+00", - "certificate_issuance_enddate": "2023-02-17 09:00:00+00", - "readvalue_watthour": 155000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"155000\",\"fromTime\":\"2023-02-17T08:00:00.000Z\",\"toTime\":\"2023-02-17T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:58:01.90935+00", - "updatedAt": "2023-02-18 17:58:01.90935+00", - "countryCode": "IND" - }, - { - "id": 375, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 09:00:00+00", - "certificate_issuance_enddate": "2023-02-17 10:00:00+00", - "readvalue_watthour": 122000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"122000\",\"fromTime\":\"2023-02-17T09:00:00.000Z\",\"toTime\":\"2023-02-17T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:58:32.211015+00", - "updatedAt": "2023-02-18 17:58:32.211015+00", - "countryCode": "IND" - }, - { - "id": 376, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 10:00:00+00", - "certificate_issuance_enddate": "2023-02-17 11:00:00+00", - "readvalue_watthour": 80000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"80000\",\"fromTime\":\"2023-02-17T10:00:00.000Z\",\"toTime\":\"2023-02-17T11:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:59:02.507846+00", - "updatedAt": "2023-02-18 17:59:02.507846+00", - "countryCode": "IND" - }, - { - "id": 377, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 11:00:00+00", - "certificate_issuance_enddate": "2023-02-17 12:00:00+00", - "readvalue_watthour": 30000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"30000\",\"fromTime\":\"2023-02-17T11:00:00.000Z\",\"toTime\":\"2023-02-17T12:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 17:59:31.713719+00", - "updatedAt": "2023-02-18 17:59:31.713719+00", - "countryCode": "IND" - }, - { - "id": 378, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 12:00:00+00", - "certificate_issuance_enddate": "2023-02-17 12:45:00+00", - "readvalue_watthour": 3000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"3000\",\"fromTime\":\"2023-02-17T12:00:00.000Z\",\"toTime\":\"2023-02-17T12:45:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:00:02.983582+00", - "updatedAt": "2023-02-18 18:00:02.983582+00", - "countryCode": "IND" - }, - { - "id": 379, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-17 16:45:00+00", - "certificate_issuance_enddate": "2023-02-17 17:55:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-17T16:45:00.000Z\",\"toTime\":\"2023-02-17T17:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:02:32.013274+00", - "updatedAt": "2023-02-18 18:02:32.013274+00", - "countryCode": "IND" - }, - { - "id": 380, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 00:45:00+00", - "certificate_issuance_enddate": "2023-02-18 02:00:00+00", - "readvalue_watthour": 8000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"8000\",\"fromTime\":\"2023-02-18T00:45:00.000Z\",\"toTime\":\"2023-02-18T02:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:06:32.51998+00", - "updatedAt": "2023-02-18 18:06:32.51998+00", - "countryCode": "IND" - }, - { - "id": 381, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 02:00:00+00", - "certificate_issuance_enddate": "2023-02-18 03:00:00+00", - "readvalue_watthour": 41000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"41000\",\"fromTime\":\"2023-02-18T02:00:00.000Z\",\"toTime\":\"2023-02-18T03:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:07:02.20947+00", - "updatedAt": "2023-02-18 18:07:02.20947+00", - "countryCode": "IND" - }, - { - "id": 382, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 03:00:00+00", - "certificate_issuance_enddate": "2023-02-18 04:00:00+00", - "readvalue_watthour": 68000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"68000\",\"fromTime\":\"2023-02-18T03:00:00.000Z\",\"toTime\":\"2023-02-18T04:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:07:32.331064+00", - "updatedAt": "2023-02-18 18:07:32.331064+00", - "countryCode": "IND" - }, - { - "id": 383, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 04:00:00+00", - "certificate_issuance_enddate": "2023-02-18 05:00:00+00", - "readvalue_watthour": 90000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"90000\",\"fromTime\":\"2023-02-18T04:00:00.000Z\",\"toTime\":\"2023-02-18T05:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:08:02.02336+00", - "updatedAt": "2023-02-18 18:08:02.02336+00", - "countryCode": "IND" - }, - { - "id": 384, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 04:55:00+00", - "certificate_issuance_enddate": "2023-02-18 06:00:00+00", - "readvalue_watthour": 112000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"112000\",\"fromTime\":\"2023-02-18T04:55:00.000Z\",\"toTime\":\"2023-02-18T06:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:08:32.311143+00", - "updatedAt": "2023-02-18 18:08:32.311143+00", - "countryCode": "IND" - }, - { - "id": 385, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 06:00:00+00", - "certificate_issuance_enddate": "2023-02-18 07:00:00+00", - "readvalue_watthour": 129000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"129000\",\"fromTime\":\"2023-02-18T06:00:00.000Z\",\"toTime\":\"2023-02-18T07:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:09:03.01904+00", - "updatedAt": "2023-02-18 18:09:03.01904+00", - "countryCode": "IND" - }, - { - "id": 386, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 07:00:00+00", - "certificate_issuance_enddate": "2023-02-18 08:00:00+00", - "readvalue_watthour": 123000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"123000\",\"fromTime\":\"2023-02-18T07:00:00.000Z\",\"toTime\":\"2023-02-18T08:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:09:32.014182+00", - "updatedAt": "2023-02-18 18:09:32.014182+00", - "countryCode": "IND" - }, - { - "id": 387, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 07:55:00+00", - "certificate_issuance_enddate": "2023-02-18 09:00:00+00", - "readvalue_watthour": 119000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"119000\",\"fromTime\":\"2023-02-18T07:55:00.000Z\",\"toTime\":\"2023-02-18T09:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:10:02.728663+00", - "updatedAt": "2023-02-18 18:10:02.728663+00", - "countryCode": "IND" - }, - { - "id": 388, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 09:00:00+00", - "certificate_issuance_enddate": "2023-02-18 10:00:00+00", - "readvalue_watthour": 93000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"93000\",\"fromTime\":\"2023-02-18T09:00:00.000Z\",\"toTime\":\"2023-02-18T10:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:10:32.515142+00", - "updatedAt": "2023-02-18 18:10:32.515142+00", - "countryCode": "IND" - }, - { - "id": 389, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 10:00:00+00", - "certificate_issuance_enddate": "2023-02-18 11:00:00+00", - "readvalue_watthour": 78000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"78000\",\"fromTime\":\"2023-02-18T10:00:00.000Z\",\"toTime\":\"2023-02-18T11:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:11:02.408689+00", - "updatedAt": "2023-02-18 18:11:02.408689+00", - "countryCode": "IND" - }, - { - "id": 390, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 11:00:00+00", - "certificate_issuance_enddate": "2023-02-18 12:00:00+00", - "readvalue_watthour": 31000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"31000\",\"fromTime\":\"2023-02-18T11:00:00.000Z\",\"toTime\":\"2023-02-18T12:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:11:31.711424+00", - "updatedAt": "2023-02-18 18:11:31.711424+00", - "countryCode": "IND" - }, - { - "id": 391, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 12:00:00+00", - "certificate_issuance_enddate": "2023-02-18 13:00:00+00", - "readvalue_watthour": 3000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"3000\",\"fromTime\":\"2023-02-18T12:00:00.000Z\",\"toTime\":\"2023-02-18T13:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:12:02.316056+00", - "updatedAt": "2023-02-18 18:12:02.316056+00", - "countryCode": "IND" - }, - { - "id": 392, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 16:55:00+00", - "certificate_issuance_enddate": "2023-02-18 18:00:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-18T16:55:00.000Z\",\"toTime\":\"2023-02-18T18:00:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-18 18:14:32.63354+00", - "updatedAt": "2023-02-18 18:14:32.63354+00", - "countryCode": "IND" - }, - { - "id": 393, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 00:40:00+00", - "certificate_issuance_enddate": "2023-02-19 01:55:00+00", - "readvalue_watthour": 5000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"5000\",\"fromTime\":\"2023-02-19T00:40:00.000Z\",\"toTime\":\"2023-02-19T01:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 02:00:03.129423+00", - "updatedAt": "2023-02-19 02:00:03.129423+00", - "countryCode": "IND" - }, - { - "id": 394, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-18 14:55:00+00", - "certificate_issuance_enddate": "2023-02-19 02:55:00+00", - "readvalue_watthour": 42000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"42000\",\"fromTime\":\"2023-02-18T14:55:00.000Z\",\"toTime\":\"2023-02-19T02:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 03:00:03.411386+00", - "updatedAt": "2023-02-19 03:00:03.411386+00", - "countryCode": "IND" - }, - { - "id": 395, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 03:00:00+00", - "certificate_issuance_enddate": "2023-02-19 03:55:00+00", - "readvalue_watthour": 80000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"80000\",\"fromTime\":\"2023-02-19T03:00:00.000Z\",\"toTime\":\"2023-02-19T03:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 04:00:03.229408+00", - "updatedAt": "2023-02-19 04:00:03.229408+00", - "countryCode": "IND" - }, - { - "id": 396, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 04:00:00+00", - "certificate_issuance_enddate": "2023-02-19 04:55:00+00", - "readvalue_watthour": 102000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"102000\",\"fromTime\":\"2023-02-19T04:00:00.000Z\",\"toTime\":\"2023-02-19T04:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 05:00:03.20865+00", - "updatedAt": "2023-02-19 05:00:03.20865+00", - "countryCode": "IND" - }, - { - "id": 397, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 05:00:00+00", - "certificate_issuance_enddate": "2023-02-19 05:55:00+00", - "readvalue_watthour": 129000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"129000\",\"fromTime\":\"2023-02-19T05:00:00.000Z\",\"toTime\":\"2023-02-19T05:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 06:00:04.816649+00", - "updatedAt": "2023-02-19 06:00:04.816649+00", - "countryCode": "IND" - }, - { - "id": 398, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 06:00:00+00", - "certificate_issuance_enddate": "2023-02-19 06:55:00+00", - "readvalue_watthour": 137000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"137000\",\"fromTime\":\"2023-02-19T06:00:00.000Z\",\"toTime\":\"2023-02-19T06:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 07:00:03.923792+00", - "updatedAt": "2023-02-19 07:00:03.923792+00", - "countryCode": "IND" - }, - { - "id": 399, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 07:00:00+00", - "certificate_issuance_enddate": "2023-02-19 07:55:00+00", - "readvalue_watthour": 152000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"152000\",\"fromTime\":\"2023-02-19T07:00:00.000Z\",\"toTime\":\"2023-02-19T07:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 08:00:03.611876+00", - "updatedAt": "2023-02-19 08:00:03.611876+00", - "countryCode": "IND" - }, - { - "id": 400, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 08:00:00+00", - "certificate_issuance_enddate": "2023-02-19 08:35:00+00", - "readvalue_watthour": 86000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"86000\",\"fromTime\":\"2023-02-19T08:00:00.000Z\",\"toTime\":\"2023-02-19T08:35:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 09:00:03.714549+00", - "updatedAt": "2023-02-19 09:00:03.714549+00", - "countryCode": "IND" - }, - { - "id": 401, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 08:30:00+00", - "certificate_issuance_enddate": "2023-02-19 10:55:00+00", - "readvalue_watthour": 28000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"28000\",\"fromTime\":\"2023-02-19T08:30:00.000Z\",\"toTime\":\"2023-02-19T10:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 11:00:02.159543+00", - "updatedAt": "2023-02-19 11:00:02.159543+00", - "countryCode": "IND" - }, - { - "id": 402, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 08:35:00+00", - "certificate_issuance_enddate": "2023-02-19 11:55:00+00", - "readvalue_watthour": 26000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"26000\",\"fromTime\":\"2023-02-19T08:35:00.000Z\",\"toTime\":\"2023-02-19T11:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 12:00:03.207809+00", - "updatedAt": "2023-02-19 12:00:03.207809+00", - "countryCode": "IND" - }, - { - "id": 403, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 12:00:00+00", - "certificate_issuance_enddate": "2023-02-19 12:40:00+00", - "readvalue_watthour": 3000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"3000\",\"fromTime\":\"2023-02-19T12:00:00.000Z\",\"toTime\":\"2023-02-19T12:40:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 13:00:04.013998+00", - "updatedAt": "2023-02-19 13:00:04.013998+00", - "countryCode": "IND" - }, - { - "id": 404, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-19 16:50:00+00", - "certificate_issuance_enddate": "2023-02-19 17:55:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-19T16:50:00.000Z\",\"toTime\":\"2023-02-19T17:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-19 18:00:02.80489+00", - "updatedAt": "2023-02-19 18:00:02.80489+00", - "countryCode": "IND" - }, - { - "id": 405, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 00:55:00+00", - "certificate_issuance_enddate": "2023-02-20 01:55:00+00", - "readvalue_watthour": 7000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"7000\",\"fromTime\":\"2023-02-20T00:55:00.000Z\",\"toTime\":\"2023-02-20T01:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 02:00:03.915432+00", - "updatedAt": "2023-02-20 02:00:03.915432+00", - "countryCode": "IND" - }, - { - "id": 406, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 02:00:00+00", - "certificate_issuance_enddate": "2023-02-20 02:55:00+00", - "readvalue_watthour": 37000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"37000\",\"fromTime\":\"2023-02-20T02:00:00.000Z\",\"toTime\":\"2023-02-20T02:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 03:00:04.112469+00", - "updatedAt": "2023-02-20 03:00:04.112469+00", - "countryCode": "IND" - }, - { - "id": 407, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 03:00:00+00", - "certificate_issuance_enddate": "2023-02-20 03:55:00+00", - "readvalue_watthour": 82000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"82000\",\"fromTime\":\"2023-02-20T03:00:00.000Z\",\"toTime\":\"2023-02-20T03:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 04:00:07.847578+00", - "updatedAt": "2023-02-20 04:00:07.847578+00", - "countryCode": "IND" - }, - { - "id": 408, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 04:00:00+00", - "certificate_issuance_enddate": "2023-02-20 04:55:00+00", - "readvalue_watthour": 120000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"120000\",\"fromTime\":\"2023-02-20T04:00:00.000Z\",\"toTime\":\"2023-02-20T04:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 05:00:03.609555+00", - "updatedAt": "2023-02-20 05:00:03.609555+00", - "countryCode": "IND" - }, - { - "id": 409, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 05:00:00+00", - "certificate_issuance_enddate": "2023-02-20 05:55:00+00", - "readvalue_watthour": 137000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"137000\",\"fromTime\":\"2023-02-20T05:00:00.000Z\",\"toTime\":\"2023-02-20T05:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 06:00:03.408998+00", - "updatedAt": "2023-02-20 06:00:03.408998+00", - "countryCode": "IND" - }, - { - "id": 410, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 06:00:00+00", - "certificate_issuance_enddate": "2023-02-20 06:55:00+00", - "readvalue_watthour": 156000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"156000\",\"fromTime\":\"2023-02-20T06:00:00.000Z\",\"toTime\":\"2023-02-20T06:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 07:00:03.307548+00", - "updatedAt": "2023-02-20 07:00:03.307548+00", - "countryCode": "IND" - }, - { - "id": 411, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 07:00:00+00", - "certificate_issuance_enddate": "2023-02-20 07:55:00+00", - "readvalue_watthour": 153000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"153000\",\"fromTime\":\"2023-02-20T07:00:00.000Z\",\"toTime\":\"2023-02-20T07:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 08:00:03.135818+00", - "updatedAt": "2023-02-20 08:00:03.135818+00", - "countryCode": "IND" - }, - { - "id": 412, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 08:00:00+00", - "certificate_issuance_enddate": "2023-02-20 08:55:00+00", - "readvalue_watthour": 126000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"126000\",\"fromTime\":\"2023-02-20T08:00:00.000Z\",\"toTime\":\"2023-02-20T08:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 09:00:03.33591+00", - "updatedAt": "2023-02-20 09:00:03.33591+00", - "countryCode": "IND" - }, - { - "id": 413, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 09:00:00+00", - "certificate_issuance_enddate": "2023-02-20 09:55:00+00", - "readvalue_watthour": 79000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"79000\",\"fromTime\":\"2023-02-20T09:00:00.000Z\",\"toTime\":\"2023-02-20T09:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 10:00:03.725411+00", - "updatedAt": "2023-02-20 10:00:03.725411+00", - "countryCode": "IND" - }, - { - "id": 414, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 10:00:00+00", - "certificate_issuance_enddate": "2023-02-20 10:55:00+00", - "readvalue_watthour": 54000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"54000\",\"fromTime\":\"2023-02-20T10:00:00.000Z\",\"toTime\":\"2023-02-20T10:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 11:00:05.084176+00", - "updatedAt": "2023-02-20 11:00:05.084176+00", - "countryCode": "IND" - }, - { - "id": 415, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 11:00:00+00", - "certificate_issuance_enddate": "2023-02-20 11:55:00+00", - "readvalue_watthour": 29000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"29000\",\"fromTime\":\"2023-02-20T11:00:00.000Z\",\"toTime\":\"2023-02-20T11:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 12:00:04.012345+00", - "updatedAt": "2023-02-20 12:00:04.012345+00", - "countryCode": "IND" - }, - { - "id": 416, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 11:45:00+00", - "certificate_issuance_enddate": "2023-02-20 13:50:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-20T11:45:00.000Z\",\"toTime\":\"2023-02-20T13:50:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 14:00:03.821708+00", - "updatedAt": "2023-02-20 14:00:03.821708+00", - "countryCode": "IND" - }, - { - "id": 417, - "groupid": 17, - "issuer_certificate_id": null, - "certificate_issuance_startdate": "2023-02-20 20:40:00+00", - "certificate_issuance_enddate": "2023-02-20 21:55:00+00", - "readvalue_watthour": 1000, - "status": "Requested", - "certificate_payload": "{\"deviceId\":\"17\",\"energyValue\":\"1000\",\"fromTime\":\"2023-02-20T20:40:00.000Z\",\"toTime\":\"2023-02-20T21:55:00.000Z\",\"toAddress\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"userId\":\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\",\"metadata\":{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}}", - "createdAt": "2023-02-20 22:00:03.513357+00", - "updatedAt": "2023-02-20 22:00:03.513357+00", - "countryCode": "IND" - } - ] \ No newline at end of file +export const grouplog = [ + { + id: 1, + groupid: 1, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-21 03:45:36+00', + certificate_issuance_enddate: '2022-10-19 05:45:36+00', + readvalue_watthour: 34568, + status: 'Requested', + certificate_payload: + '{"deviceId":"1","energyValue":"34568","fromTime":"2022-08-21T03:45:36.000Z","toTime":"2022-10-19T05:45:36.000Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"66b1de11-53d2-4725-b1ab-31be05de4e69","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[4],"groupId":"1"}}', + createdAt: '2022-12-23 10:06:31.618025+00', + updatedAt: '2022-12-23 10:06:31.618025+00', + countryCode: 'IND', + }, + { + id: 2, + groupid: 2, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-23 05:05:36+00', + certificate_issuance_enddate: '2022-12-23 04:55:36+00', + readvalue_watthour: 632487004, + status: 'Requested', + certificate_payload: + '{"deviceId":"2","energyValue":"632487004","fromTime":"2022-04-23T05:05:36.000Z","toTime":"2022-12-23T04:55:36.000Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"bd9764b7-ecd9-4c75-b775-a0026c8fb15c","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[3],"groupId":"2"}}', + createdAt: '2022-12-23 10:27:31.916857+00', + updatedAt: '2022-12-23 10:27:31.916857+00', + countryCode: 'IND', + }, + { + id: 3, + groupid: 3, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-21 03:45:36+00', + certificate_issuance_enddate: '2022-09-19 05:45:36+00', + readvalue_watthour: 45678, + status: 'Requested', + certificate_payload: + '{"deviceId":"3","energyValue":"45678","fromTime":"2022-03-21T03:45:36.000Z","toTime":"2022-09-19T05:45:36.000Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"c68956ad-be63-410b-bc23-9dde483bdbd6","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[1],"groupId":"3"}}', + createdAt: '2022-12-23 10:28:02.40802+00', + updatedAt: '2022-12-23 10:28:02.40802+00', + countryCode: 'IND', + }, + { + id: 4, + groupid: 2, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 05:05:36.859+00', + certificate_issuance_enddate: '2022-12-23 06:00:36.859+00', + readvalue_watthour: 178000, + status: 'Requested', + certificate_payload: + '{"deviceId":"2","energyValue":"178000","fromTime":"2022-12-23T05:05:36.859Z","toTime":"2022-12-23T06:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"bd9764b7-ecd9-4c75-b775-a0026c8fb15c","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[3],"groupId":"2"}}', + createdAt: '2022-12-23 10:28:03.025039+00', + updatedAt: '2022-12-23 10:28:03.025039+00', + countryCode: 'IND', + }, + { + id: 5, + groupid: 3, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 09:30:36.888+00', + certificate_issuance_enddate: '2022-12-23 09:40:36.888+00', + readvalue_watthour: 56000, + status: 'Requested', + certificate_payload: + '{"deviceId":"3","energyValue":"56000","fromTime":"2022-12-23T09:30:36.888Z","toTime":"2022-12-23T09:40:36.888Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"c68956ad-be63-410b-bc23-9dde483bdbd6","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[1],"groupId":"3"}}', + createdAt: '2022-12-23 10:28:03.310862+00', + updatedAt: '2022-12-23 10:28:03.310862+00', + countryCode: 'IND', + }, + { + id: 6, + groupid: 2, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 05:20:36.859+00', + certificate_issuance_enddate: '2022-12-23 06:00:36.859+00', + readvalue_watthour: 7000, + status: 'Requested', + certificate_payload: + '{"deviceId":"2","energyValue":"7000","fromTime":"2022-12-23T05:20:36.859Z","toTime":"2022-12-23T06:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"bd9764b7-ecd9-4c75-b775-a0026c8fb15c","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[5],"groupId":"2"}}', + createdAt: '2022-12-23 10:28:03.607641+00', + updatedAt: '2022-12-23 10:28:03.607641+00', + countryCode: 'ARG', + }, + { + id: 7, + groupid: 2, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-23 05:15:36+00', + certificate_issuance_enddate: '2022-12-23 05:15:36+00', + readvalue_watthour: 8676454, + status: 'Requested', + certificate_payload: + '{"deviceId":"2","energyValue":"8676454","fromTime":"2022-05-23T05:15:36.000Z","toTime":"2022-12-23T05:15:36.000Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"bd9764b7-ecd9-4c75-b775-a0026c8fb15c","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[5],"groupId":"2"}}', + createdAt: '2022-12-23 10:37:01.72182+00', + updatedAt: '2022-12-23 10:37:01.72182+00', + countryCode: 'ARG', + }, + { + id: 8, + groupid: 4, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-20 09:30:36+00', + certificate_issuance_enddate: '2022-10-20 09:30:36+00', + readvalue_watthour: 6554554, + status: 'Requested', + certificate_payload: + '{"deviceId":"4","energyValue":"6554554","fromTime":"2022-04-20T09:30:36.000Z","toTime":"2022-10-20T09:30:36.000Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"784afc65-333d-45f2-a042-99f8ee3c7fe9","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[2],"groupId":"4"}}', + createdAt: '2022-12-23 10:38:32.007145+00', + updatedAt: '2022-12-23 10:38:32.007145+00', + countryCode: 'IND', + }, + { + id: 9, + groupid: 4, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-10-20 09:31:36+00', + certificate_issuance_enddate: '2022-12-23 04:29:36+00', + readvalue_watthour: 6550900, + status: 'Requested', + certificate_payload: + '{"deviceId":"4","energyValue":"6550900","fromTime":"2022-10-20T09:31:36.000Z","toTime":"2022-12-23T04:29:36.000Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"784afc65-333d-45f2-a042-99f8ee3c7fe9","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[2],"groupId":"4"}}', + createdAt: '2022-12-23 10:38:32.41259+00', + updatedAt: '2022-12-23 10:38:32.41259+00', + countryCode: 'IND', + }, + { + id: 10, + groupid: 4, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 04:31:36.859+00', + certificate_issuance_enddate: '2022-12-23 05:00:36.859+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"4","energyValue":"1000","fromTime":"2022-12-23T04:31:36.859Z","toTime":"2022-12-23T05:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"784afc65-333d-45f2-a042-99f8ee3c7fe9","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[2],"groupId":"4"}}', + createdAt: '2022-12-23 10:39:02.335982+00', + updatedAt: '2022-12-23 10:39:02.335982+00', + countryCode: 'IND', + }, + { + id: 11, + groupid: 4, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 05:00:36.859+00', + certificate_issuance_enddate: '2022-12-23 06:00:36.859+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"4","energyValue":"1000","fromTime":"2022-12-23T05:00:36.859Z","toTime":"2022-12-23T06:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"784afc65-333d-45f2-a042-99f8ee3c7fe9","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[2],"groupId":"4"}}', + createdAt: '2022-12-23 10:39:32.607685+00', + updatedAt: '2022-12-23 10:39:32.607685+00', + countryCode: 'IND', + }, + { + id: 12, + groupid: 4, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 06:00:36.859+00', + certificate_issuance_enddate: '2022-12-23 07:00:36.859+00', + readvalue_watthour: 188000, + status: 'Requested', + certificate_payload: + '{"deviceId":"4","energyValue":"188000","fromTime":"2022-12-23T06:00:36.859Z","toTime":"2022-12-23T07:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"784afc65-333d-45f2-a042-99f8ee3c7fe9","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[3,2],"groupId":"4"}}', + createdAt: '2022-12-23 10:40:02.62098+00', + updatedAt: '2022-12-23 10:40:02.62098+00', + countryCode: 'IND', + }, + { + id: 13, + groupid: 4, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 06:00:36.859+00', + certificate_issuance_enddate: '2022-12-23 07:00:36.859+00', + readvalue_watthour: 11000, + status: 'Requested', + certificate_payload: + '{"deviceId":"4","energyValue":"11000","fromTime":"2022-12-23T06:00:36.859Z","toTime":"2022-12-23T07:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"784afc65-333d-45f2-a042-99f8ee3c7fe9","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[5],"groupId":"4"}}', + createdAt: '2022-12-23 10:40:02.714584+00', + updatedAt: '2022-12-23 10:40:02.714584+00', + countryCode: 'ARG', + }, + { + id: 14, + groupid: 5, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 06:30:36.859+00', + certificate_issuance_enddate: '2022-12-23 08:00:36.859+00', + readvalue_watthour: 12000, + status: 'Requested', + certificate_payload: + '{"deviceId":"5","energyValue":"12000","fromTime":"2022-12-23T06:30:36.859Z","toTime":"2022-12-23T08:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"130a8a50-b037-414e-a32e-ca4413b650f6","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[3,2],"groupId":"5"}}', + createdAt: '2022-12-23 11:34:02.111893+00', + updatedAt: '2022-12-23 11:34:02.111893+00', + countryCode: 'IND', + }, + { + id: 15, + groupid: 5, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 07:00:36.859+00', + certificate_issuance_enddate: '2022-12-23 08:00:36.859+00', + readvalue_watthour: 10000, + status: 'Requested', + certificate_payload: + '{"deviceId":"5","energyValue":"10000","fromTime":"2022-12-23T07:00:36.859Z","toTime":"2022-12-23T08:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"130a8a50-b037-414e-a32e-ca4413b650f6","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[5],"groupId":"5"}}', + createdAt: '2022-12-23 11:34:02.509537+00', + updatedAt: '2022-12-23 11:34:02.509537+00', + countryCode: 'ARG', + }, + { + id: 16, + groupid: 6, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-12 03:45:36+00', + certificate_issuance_enddate: '2022-10-03 05:45:36+00', + readvalue_watthour: 67898, + status: 'Requested', + certificate_payload: + '{"deviceId":"6","energyValue":"67898","fromTime":"2022-06-12T03:45:36.000Z","toTime":"2022-10-03T05:45:36.000Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"4692b40a-ca9a-4fe5-88ca-cab3d076a71a","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[6],"groupId":"6"}}', + createdAt: '2022-12-23 11:53:32.111234+00', + updatedAt: '2022-12-23 11:53:32.111234+00', + countryCode: 'AFG', + }, + { + id: 17, + groupid: 6, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-12 03:45:36+00', + certificate_issuance_enddate: '2022-12-22 05:45:36+00', + readvalue_watthour: 98766, + status: 'Requested', + certificate_payload: + '{"deviceId":"6","energyValue":"98766","fromTime":"2022-04-12T03:45:36.000Z","toTime":"2022-12-22T05:45:36.000Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"4692b40a-ca9a-4fe5-88ca-cab3d076a71a","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[8],"groupId":"6"}}', + createdAt: '2022-12-23 11:53:32.206726+00', + updatedAt: '2022-12-23 11:53:32.206726+00', + countryCode: 'BOL', + }, + { + id: 18, + groupid: 6, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-12 07:45:36+00', + certificate_issuance_enddate: '2022-11-23 09:45:36+00', + readvalue_watthour: 39876, + status: 'Requested', + certificate_payload: + '{"deviceId":"6","energyValue":"39876","fromTime":"2022-05-12T07:45:36.000Z","toTime":"2022-11-23T09:45:36.000Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"4692b40a-ca9a-4fe5-88ca-cab3d076a71a","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[7],"groupId":"6"}}', + createdAt: '2022-12-23 11:53:36.117584+00', + updatedAt: '2022-12-23 11:53:36.117584+00', + countryCode: 'ALB', + }, + { + id: 19, + groupid: 6, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 11:14:36+00', + certificate_issuance_enddate: '2022-12-23 11:16:36.985+00', + readvalue_watthour: 56000, + status: 'Requested', + certificate_payload: + '{"deviceId":"6","energyValue":"56000","fromTime":"2022-12-23T11:14:36.000Z","toTime":"2022-12-23T11:16:36.985Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"4692b40a-ca9a-4fe5-88ca-cab3d076a71a","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[7],"groupId":"6"}}', + createdAt: '2022-12-23 11:54:02.346565+00', + updatedAt: '2022-12-23 11:54:02.346565+00', + countryCode: 'ALB', + }, + { + id: 20, + groupid: 6, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 11:12:36.888+00', + certificate_issuance_enddate: '2022-12-23 11:14:36.888+00', + readvalue_watthour: 2000, + status: 'Requested', + certificate_payload: + '{"deviceId":"6","energyValue":"2000","fromTime":"2022-12-23T11:12:36.888Z","toTime":"2022-12-23T11:14:36.888Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"4692b40a-ca9a-4fe5-88ca-cab3d076a71a","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[6],"groupId":"6"}}', + createdAt: '2022-12-23 11:54:02.529822+00', + updatedAt: '2022-12-23 11:54:02.529822+00', + countryCode: 'AFG', + }, + { + id: 31, + groupid: 8, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 08:00:36.859+00', + certificate_issuance_enddate: '2022-12-23 08:30:36.859+00', + readvalue_watthour: 15000, + status: 'Requested', + certificate_payload: + '{"deviceId":"8","energyValue":"15000","fromTime":"2022-12-23T08:00:36.859Z","toTime":"2022-12-23T08:30:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"ab3a7235-7076-448b-84b1-499579f9c646","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[5],"groupId":"8"}}', + createdAt: '2022-12-26 11:01:02.21186+00', + updatedAt: '2022-12-26 11:01:02.21186+00', + countryCode: 'ARG', + }, + { + id: 32, + groupid: 8, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 08:30:36.859+00', + certificate_issuance_enddate: '2022-12-23 09:30:36.859+00', + readvalue_watthour: 20000, + status: 'Requested', + certificate_payload: + '{"deviceId":"8","energyValue":"20000","fromTime":"2022-12-23T08:30:36.859Z","toTime":"2022-12-23T09:30:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"ab3a7235-7076-448b-84b1-499579f9c646","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[5],"groupId":"8"}}', + createdAt: '2022-12-26 11:01:36.312025+00', + updatedAt: '2022-12-26 11:01:36.312025+00', + countryCode: 'ARG', + }, + { + id: 33, + groupid: 8, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 08:00:36.859+00', + certificate_issuance_enddate: '2022-12-23 09:30:36.859+00', + readvalue_watthour: 40000, + status: 'Requested', + certificate_payload: + '{"deviceId":"8","energyValue":"40000","fromTime":"2022-12-23T08:00:36.859Z","toTime":"2022-12-23T09:30:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"ab3a7235-7076-448b-84b1-499579f9c646","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[3],"groupId":"8"}}', + createdAt: '2022-12-26 11:01:37.210788+00', + updatedAt: '2022-12-26 11:01:37.210788+00', + countryCode: 'IND', + }, + { + id: 34, + groupid: 8, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 09:30:36.859+00', + certificate_issuance_enddate: '2022-12-23 10:00:36.859+00', + readvalue_watthour: 29000, + status: 'Requested', + certificate_payload: + '{"deviceId":"8","energyValue":"29000","fromTime":"2022-12-23T09:30:36.859Z","toTime":"2022-12-23T10:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"ab3a7235-7076-448b-84b1-499579f9c646","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[5],"groupId":"8"}}', + createdAt: '2022-12-26 11:02:02.124335+00', + updatedAt: '2022-12-26 11:02:02.124335+00', + countryCode: 'ARG', + }, + { + id: 35, + groupid: 8, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 09:30:36.859+00', + certificate_issuance_enddate: '2022-12-23 10:30:36.859+00', + readvalue_watthour: 178000, + status: 'Requested', + certificate_payload: + '{"deviceId":"8","energyValue":"178000","fromTime":"2022-12-23T09:30:36.859Z","toTime":"2022-12-23T10:30:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"ab3a7235-7076-448b-84b1-499579f9c646","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[3],"groupId":"8"}}', + createdAt: '2022-12-26 11:02:02.219591+00', + updatedAt: '2022-12-26 11:02:02.219591+00', + countryCode: 'IND', + }, + { + id: 36, + groupid: 8, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 10:00:36.859+00', + certificate_issuance_enddate: '2022-12-23 11:00:36.859+00', + readvalue_watthour: 565000, + status: 'Requested', + certificate_payload: + '{"deviceId":"8","energyValue":"565000","fromTime":"2022-12-23T10:00:36.859Z","toTime":"2022-12-23T11:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"ab3a7235-7076-448b-84b1-499579f9c646","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[5],"groupId":"8"}}', + createdAt: '2022-12-26 11:02:32.715359+00', + updatedAt: '2022-12-26 11:02:32.715359+00', + countryCode: 'ARG', + }, + { + id: 37, + groupid: 8, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 10:30:36.859+00', + certificate_issuance_enddate: '2022-12-23 11:30:36.859+00', + readvalue_watthour: 178000, + status: 'Requested', + certificate_payload: + '{"deviceId":"8","energyValue":"178000","fromTime":"2022-12-23T10:30:36.859Z","toTime":"2022-12-23T11:30:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"ab3a7235-7076-448b-84b1-499579f9c646","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[3],"groupId":"8"}}', + createdAt: '2022-12-26 11:02:33.407951+00', + updatedAt: '2022-12-26 11:02:33.407951+00', + countryCode: 'IND', + }, + { + id: 38, + groupid: 8, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 11:00:36.859+00', + certificate_issuance_enddate: '2022-12-23 12:00:36.859+00', + readvalue_watthour: 565000, + status: 'Requested', + certificate_payload: + '{"deviceId":"8","energyValue":"565000","fromTime":"2022-12-23T11:00:36.859Z","toTime":"2022-12-23T12:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"ab3a7235-7076-448b-84b1-499579f9c646","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[5],"groupId":"8"}}', + createdAt: '2022-12-26 11:03:02.518571+00', + updatedAt: '2022-12-26 11:03:02.518571+00', + countryCode: 'ARG', + }, + { + id: 39, + groupid: 8, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 11:30:36.859+00', + certificate_issuance_enddate: '2022-12-23 12:00:36.859+00', + readvalue_watthour: 57000, + status: 'Requested', + certificate_payload: + '{"deviceId":"8","energyValue":"57000","fromTime":"2022-12-23T11:30:36.859Z","toTime":"2022-12-23T12:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"ab3a7235-7076-448b-84b1-499579f9c646","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[3],"groupId":"8"}}', + createdAt: '2022-12-26 11:03:02.608656+00', + updatedAt: '2022-12-26 11:03:02.608656+00', + countryCode: 'IND', + }, + { + id: 40, + groupid: 8, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-23 12:00:36.859+00', + certificate_issuance_enddate: '2022-12-23 13:00:36.859+00', + readvalue_watthour: 967000, + status: 'Requested', + certificate_payload: + '{"deviceId":"8","energyValue":"967000","fromTime":"2022-12-23T12:00:36.859Z","toTime":"2022-12-23T13:00:36.859Z","toAddress":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","userId":"0xa28A339f853a14235E2Be0dABc7BaF040c4D4e5a","metadata":{"version":"v1.0","buyerReservationId":"ab3a7235-7076-448b-84b1-499579f9c646","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[5],"groupId":"8"}}', + createdAt: '2022-12-26 11:03:31.738768+00', + updatedAt: '2022-12-26 11:03:31.738768+00', + countryCode: 'ARG', + }, + { + id: 41, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 7159100, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"7159100","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.213299+00', + updatedAt: '2023-01-21 18:58:35.213299+00', + countryCode: 'IND', + }, + { + id: 42, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 5066000, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"5066000","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.218668+00', + updatedAt: '2023-01-21 18:58:35.218668+00', + countryCode: 'IND', + }, + { + id: 43, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-31 18:30:01+00', + certificate_issuance_enddate: '2022-04-30 18:29:59+00', + readvalue_watthour: 2003700, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2003700","fromTime":"2022-03-31T18:30:01.000Z","toTime":"2022-04-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.309387+00', + updatedAt: '2023-01-21 18:58:35.309387+00', + countryCode: 'IND', + }, + { + id: 44, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-30 18:30:01+00', + certificate_issuance_enddate: '2022-05-31 18:29:59+00', + readvalue_watthour: 5611700, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"5611700","fromTime":"2022-04-30T18:30:01.000Z","toTime":"2022-05-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.313989+00', + updatedAt: '2023-01-21 18:58:35.313989+00', + countryCode: 'IND', + }, + { + id: 45, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-02-28 18:30:01+00', + certificate_issuance_enddate: '2022-03-31 18:29:59+00', + readvalue_watthour: 5977900, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"5977900","fromTime":"2022-02-28T18:30:01.000Z","toTime":"2022-03-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.316983+00', + updatedAt: '2023-01-21 18:58:35.316983+00', + countryCode: 'IND', + }, + { + id: 46, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-31 18:30:01+00', + certificate_issuance_enddate: '2022-06-30 18:29:59+00', + readvalue_watthour: 6526800, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"6526800","fromTime":"2022-05-31T18:30:01.000Z","toTime":"2022-06-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.408985+00', + updatedAt: '2023-01-21 18:58:35.408985+00', + countryCode: 'IND', + }, + { + id: 47, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-31 18:30:01+00', + certificate_issuance_enddate: '2022-08-31 18:29:59+00', + readvalue_watthour: 5187100, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"5187100","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.414482+00', + updatedAt: '2023-01-21 18:58:35.414482+00', + countryCode: 'IND', + }, + { + id: 48, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-31 18:30:01+00', + certificate_issuance_enddate: '2022-04-30 18:29:59+00', + readvalue_watthour: 2513300, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2513300","fromTime":"2022-03-31T18:30:01.000Z","toTime":"2022-04-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.508949+00', + updatedAt: '2023-01-21 18:58:35.508949+00', + countryCode: 'IND', + }, + { + id: 49, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-02-28 18:30:01+00', + certificate_issuance_enddate: '2022-03-31 18:29:59+00', + readvalue_watthour: 2677400, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2677400","fromTime":"2022-02-28T18:30:01.000Z","toTime":"2022-03-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.514174+00', + updatedAt: '2023-01-21 18:58:35.514174+00', + countryCode: 'IND', + }, + { + id: 50, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-30 18:30:01+00', + certificate_issuance_enddate: '2022-05-31 18:29:59+00', + readvalue_watthour: 2048800, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2048800","fromTime":"2022-04-30T18:30:01.000Z","toTime":"2022-05-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.519281+00', + updatedAt: '2023-01-21 18:58:35.519281+00', + countryCode: 'IND', + }, + { + id: 51, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-31 18:30:01+00', + certificate_issuance_enddate: '2022-06-30 18:29:59+00', + readvalue_watthour: 1752300, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"1752300","fromTime":"2022-05-31T18:30:01.000Z","toTime":"2022-06-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.610697+00', + updatedAt: '2023-01-21 18:58:35.610697+00', + countryCode: 'IND', + }, + { + id: 52, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-30 18:30:01+00', + certificate_issuance_enddate: '2022-07-31 18:29:59+00', + readvalue_watthour: 1877100, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"1877100","fromTime":"2022-06-30T18:30:01.000Z","toTime":"2022-07-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.713298+00', + updatedAt: '2023-01-21 18:58:35.713298+00', + countryCode: 'IND', + }, + { + id: 53, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-31 18:30:01+00', + certificate_issuance_enddate: '2022-08-31 18:29:59+00', + readvalue_watthour: 2109800, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2109800","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.717329+00', + updatedAt: '2023-01-21 18:58:35.717329+00', + countryCode: 'IND', + }, + { + id: 54, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 2479800, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2479800","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.81087+00', + updatedAt: '2023-01-21 18:58:35.81087+00', + countryCode: 'IND', + }, + { + id: 55, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 2062100, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2062100","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.81442+00', + updatedAt: '2023-01-21 18:58:35.81442+00', + countryCode: 'IND', + }, + { + id: 56, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-16 18:30:02+00', + certificate_issuance_enddate: '2022-04-30 18:29:59+00', + readvalue_watthour: 4672000, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"4672000","fromTime":"2022-04-16T18:30:02.000Z","toTime":"2022-04-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.911646+00', + updatedAt: '2023-01-21 18:58:35.911646+00', + countryCode: 'IND', + }, + { + id: 57, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-30 18:30:01+00', + certificate_issuance_enddate: '2022-05-31 18:29:59+00', + readvalue_watthour: 8324000, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"8324000","fromTime":"2022-04-30T18:30:01.000Z","toTime":"2022-05-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.914981+00', + updatedAt: '2023-01-21 18:58:35.914981+00', + countryCode: 'IND', + }, + { + id: 58, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-31 18:30:01+00', + certificate_issuance_enddate: '2022-06-30 18:29:59+00', + readvalue_watthour: 9192000, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"9192000","fromTime":"2022-05-31T18:30:01.000Z","toTime":"2022-06-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:35.917157+00', + updatedAt: '2023-01-21 18:58:35.917157+00', + countryCode: 'IND', + }, + { + id: 59, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-30 18:30:01+00', + certificate_issuance_enddate: '2022-07-31 18:29:59+00', + readvalue_watthour: 5458300, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"5458300","fromTime":"2022-06-30T18:30:01.000Z","toTime":"2022-07-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:36.008051+00', + updatedAt: '2023-01-21 18:58:36.008051+00', + countryCode: 'IND', + }, + { + id: 60, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-30 18:30:01+00', + certificate_issuance_enddate: '2022-07-31 18:29:59+00', + readvalue_watthour: 7879700, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"7879700","fromTime":"2022-06-30T18:30:01.000Z","toTime":"2022-07-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:36.412057+00', + updatedAt: '2023-01-21 18:58:36.412057+00', + countryCode: 'IND', + }, + { + id: 61, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-31 18:30:01+00', + certificate_issuance_enddate: '2022-08-31 18:29:59+00', + readvalue_watthour: 8845500, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"8845500","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:36.414975+00', + updatedAt: '2023-01-21 18:58:36.414975+00', + countryCode: 'IND', + }, + { + id: 62, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 10755300, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"10755300","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:36.41832+00', + updatedAt: '2023-01-21 18:58:36.41832+00', + countryCode: 'IND', + }, + { + id: 63, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 11089500, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"11089500","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:36.525155+00', + updatedAt: '2023-01-21 18:58:36.525155+00', + countryCode: 'IND', + }, + { + id: 64, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-10-31 18:30:01+00', + certificate_issuance_enddate: '2022-11-30 18:29:59+00', + readvalue_watthour: 9646300, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"9646300","fromTime":"2022-10-31T18:30:01.000Z","toTime":"2022-11-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:36.61797+00', + updatedAt: '2023-01-21 18:58:36.61797+00', + countryCode: 'IND', + }, + { + id: 65, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-11-30 18:30:01+00', + certificate_issuance_enddate: '2022-12-14 18:29:59+00', + readvalue_watthour: 3937500, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"3937500","fromTime":"2022-11-30T18:30:01.000Z","toTime":"2022-12-14T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:36.808163+00', + updatedAt: '2023-01-21 18:58:36.808163+00', + countryCode: 'IND', + }, + { + id: 66, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-30 18:30:01+00', + certificate_issuance_enddate: '2022-05-31 18:29:59+00', + readvalue_watthour: 15322600, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"15322600","fromTime":"2022-04-30T18:30:01.000Z","toTime":"2022-05-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:41.209754+00', + updatedAt: '2023-01-21 18:58:41.209754+00', + countryCode: 'IND', + }, + { + id: 67, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-31 18:30:01+00', + certificate_issuance_enddate: '2022-06-30 18:29:59+00', + readvalue_watthour: 11984500, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"11984500","fromTime":"2022-05-31T18:30:01.000Z","toTime":"2022-06-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:41.214329+00', + updatedAt: '2023-01-21 18:58:41.214329+00', + countryCode: 'IND', + }, + { + id: 68, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-30 18:30:01+00', + certificate_issuance_enddate: '2022-07-31 18:29:59+00', + readvalue_watthour: 8300600, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"8300600","fromTime":"2022-06-30T18:30:01.000Z","toTime":"2022-07-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:41.308242+00', + updatedAt: '2023-01-21 18:58:41.308242+00', + countryCode: 'IND', + }, + { + id: 69, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-31 18:30:01+00', + certificate_issuance_enddate: '2022-04-30 18:29:59+00', + readvalue_watthour: 14820700, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"14820700","fromTime":"2022-03-31T18:30:01.000Z","toTime":"2022-04-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:41.3112+00', + updatedAt: '2023-01-21 18:58:41.3112+00', + countryCode: 'IND', + }, + { + id: 70, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-31 18:30:01+00', + certificate_issuance_enddate: '2022-08-31 18:29:59+00', + readvalue_watthour: 9716000, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"9716000","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:41.41318+00', + updatedAt: '2023-01-21 18:58:41.41318+00', + countryCode: 'IND', + }, + { + id: 71, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 9542000, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"9542000","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:41.418586+00', + updatedAt: '2023-01-21 18:58:41.418586+00', + countryCode: 'IND', + }, + { + id: 72, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 11456000, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"11456000","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:41.50889+00', + updatedAt: '2023-01-21 18:58:41.50889+00', + countryCode: 'IND', + }, + { + id: 73, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-02-28 18:30:01+00', + certificate_issuance_enddate: '2022-03-31 18:29:59+00', + readvalue_watthour: 14272300, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"14272300","fromTime":"2022-02-28T18:30:01.000Z","toTime":"2022-03-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:41.520627+00', + updatedAt: '2023-01-21 18:58:41.520627+00', + countryCode: 'IND', + }, + { + id: 74, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-31 18:30:01+00', + certificate_issuance_enddate: '2022-06-30 18:29:59+00', + readvalue_watthour: 2675900, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2675900","fromTime":"2022-05-31T18:30:01.000Z","toTime":"2022-06-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:43.01055+00', + updatedAt: '2023-01-21 18:58:43.01055+00', + countryCode: 'IND', + }, + { + id: 75, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-30 18:30:01+00', + certificate_issuance_enddate: '2022-07-31 18:29:59+00', + readvalue_watthour: 2710100, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2710100","fromTime":"2022-06-30T18:30:01.000Z","toTime":"2022-07-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:43.015235+00', + updatedAt: '2023-01-21 18:58:43.015235+00', + countryCode: 'IND', + }, + { + id: 76, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-02-28 18:30:01+00', + certificate_issuance_enddate: '2022-03-31 18:29:59+00', + readvalue_watthour: 2577200, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2577200","fromTime":"2022-02-28T18:30:01.000Z","toTime":"2022-03-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:43.017396+00', + updatedAt: '2023-01-21 18:58:43.017396+00', + countryCode: 'IND', + }, + { + id: 77, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-31 18:30:01+00', + certificate_issuance_enddate: '2022-04-30 18:29:59+00', + readvalue_watthour: 1801700, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"1801700","fromTime":"2022-03-31T18:30:01.000Z","toTime":"2022-04-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:43.018398+00', + updatedAt: '2023-01-21 18:58:43.018398+00', + countryCode: 'IND', + }, + { + id: 78, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-31 18:30:01+00', + certificate_issuance_enddate: '2022-08-31 18:29:59+00', + readvalue_watthour: 3078900, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"3078900","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:43.111457+00', + updatedAt: '2023-01-21 18:58:43.111457+00', + countryCode: 'IND', + }, + { + id: 79, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-30 18:30:01+00', + certificate_issuance_enddate: '2022-05-31 18:29:59+00', + readvalue_watthour: 2777900, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"2777900","fromTime":"2022-04-30T18:30:01.000Z","toTime":"2022-05-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:43.112978+00', + updatedAt: '2023-01-21 18:58:43.112978+00', + countryCode: 'IND', + }, + { + id: 80, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 3547000, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"3547000","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:43.110017+00', + updatedAt: '2023-01-21 18:58:43.110017+00', + countryCode: 'IND', + }, + { + id: 81, + groupid: 9, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 3521300, + status: 'Requested', + certificate_payload: + '{"deviceId":"9","energyValue":"3521300","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}}', + createdAt: '2023-01-21 18:58:43.214033+00', + updatedAt: '2023-01-21 18:58:43.214033+00', + countryCode: 'IND', + }, + { + id: 82, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 1098000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1098000","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.109068+00', + updatedAt: '2023-01-21 19:01:33.109068+00', + countryCode: 'IND', + }, + { + id: 83, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 1178000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1178000","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.117903+00', + updatedAt: '2023-01-21 19:01:33.117903+00', + countryCode: 'IND', + }, + { + id: 84, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-02-28 18:30:02+00', + certificate_issuance_enddate: '2022-03-31 18:29:59+00', + readvalue_watthour: 991000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"991000","fromTime":"2022-02-28T18:30:02.000Z","toTime":"2022-03-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.208198+00', + updatedAt: '2023-01-21 19:01:33.208198+00', + countryCode: 'IND', + }, + { + id: 85, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-31 18:30:01+00', + certificate_issuance_enddate: '2022-04-30 18:29:59+00', + readvalue_watthour: 1080000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1080000","fromTime":"2022-03-31T18:30:01.000Z","toTime":"2022-04-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.212906+00', + updatedAt: '2023-01-21 19:01:33.212906+00', + countryCode: 'IND', + }, + { + id: 86, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-10-31 18:30:01+00', + certificate_issuance_enddate: '2022-11-30 18:29:59+00', + readvalue_watthour: 1107000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1107000","fromTime":"2022-10-31T18:30:01.000Z","toTime":"2022-11-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.3088+00', + updatedAt: '2023-01-21 19:01:33.3088+00', + countryCode: 'IND', + }, + { + id: 87, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-11-30 18:30:01+00', + certificate_issuance_enddate: '2022-12-31 18:29:59+00', + readvalue_watthour: 1317000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1317000","fromTime":"2022-11-30T18:30:01.000Z","toTime":"2022-12-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.313606+00', + updatedAt: '2023-01-21 19:01:33.313606+00', + countryCode: 'IND', + }, + { + id: 88, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-30 18:30:01+00', + certificate_issuance_enddate: '2022-05-31 18:29:59+00', + readvalue_watthour: 1161000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1161000","fromTime":"2022-04-30T18:30:01.000Z","toTime":"2022-05-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.316625+00', + updatedAt: '2023-01-21 19:01:33.316625+00', + countryCode: 'IND', + }, + { + id: 89, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-30 18:30:01+00', + certificate_issuance_enddate: '2022-05-31 18:29:59+00', + readvalue_watthour: 1075000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1075000","fromTime":"2022-04-30T18:30:01.000Z","toTime":"2022-05-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.412876+00', + updatedAt: '2023-01-21 19:01:33.412876+00', + countryCode: 'IND', + }, + { + id: 90, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-31 18:30:01+00', + certificate_issuance_enddate: '2022-06-30 18:29:59+00', + readvalue_watthour: 1017000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1017000","fromTime":"2022-05-31T18:30:01.000Z","toTime":"2022-06-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.51187+00', + updatedAt: '2023-01-21 19:01:33.51187+00', + countryCode: 'IND', + }, + { + id: 91, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-02-28 18:30:02+00', + certificate_issuance_enddate: '2022-03-31 18:29:59+00', + readvalue_watthour: 968000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"968000","fromTime":"2022-02-28T18:30:02.000Z","toTime":"2022-03-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.514339+00', + updatedAt: '2023-01-21 19:01:33.514339+00', + countryCode: 'IND', + }, + { + id: 92, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-31 18:30:01+00', + certificate_issuance_enddate: '2022-04-30 18:29:59+00', + readvalue_watthour: 1062000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1062000","fromTime":"2022-03-31T18:30:01.000Z","toTime":"2022-04-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.517592+00', + updatedAt: '2023-01-21 19:01:33.517592+00', + countryCode: 'IND', + }, + { + id: 93, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-31 18:30:01+00', + certificate_issuance_enddate: '2022-08-31 18:29:59+00', + readvalue_watthour: 1077000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1077000","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.612675+00', + updatedAt: '2023-01-21 19:01:33.612675+00', + countryCode: 'IND', + }, + { + id: 94, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-30 18:30:01+00', + certificate_issuance_enddate: '2022-07-31 18:29:59+00', + readvalue_watthour: 1175000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1175000","fromTime":"2022-06-30T18:30:01.000Z","toTime":"2022-07-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.709102+00', + updatedAt: '2023-01-21 19:01:33.709102+00', + countryCode: 'IND', + }, + { + id: 95, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-31 18:30:01+00', + certificate_issuance_enddate: '2022-08-31 18:29:59+00', + readvalue_watthour: 1078000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1078000","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.814371+00', + updatedAt: '2023-01-21 19:01:33.814371+00', + countryCode: 'IND', + }, + { + id: 96, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-31 18:30:01+00', + certificate_issuance_enddate: '2022-06-30 18:29:59+00', + readvalue_watthour: 1028000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1028000","fromTime":"2022-05-31T18:30:01.000Z","toTime":"2022-06-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.912382+00', + updatedAt: '2023-01-21 19:01:33.912382+00', + countryCode: 'IND', + }, + { + id: 97, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-30 18:30:01+00', + certificate_issuance_enddate: '2022-07-31 18:29:59+00', + readvalue_watthour: 1033000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1033000","fromTime":"2022-06-30T18:30:01.000Z","toTime":"2022-07-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:33.919121+00', + updatedAt: '2023-01-21 19:01:33.919121+00', + countryCode: 'IND', + }, + { + id: 98, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 1321000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1321000","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.01005+00', + updatedAt: '2023-01-21 19:01:34.01005+00', + countryCode: 'IND', + }, + { + id: 99, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 1284000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1284000","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.020352+00', + updatedAt: '2023-01-21 19:01:34.020352+00', + countryCode: 'IND', + }, + { + id: 100, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-10-31 18:30:01+00', + certificate_issuance_enddate: '2022-11-30 18:29:59+00', + readvalue_watthour: 1151000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1151000","fromTime":"2022-10-31T18:30:01.000Z","toTime":"2022-11-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.112324+00', + updatedAt: '2023-01-21 19:01:34.112324+00', + countryCode: 'IND', + }, + { + id: 101, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-11-30 18:30:01+00', + certificate_issuance_enddate: '2022-12-31 18:29:59+00', + readvalue_watthour: 1320000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1320000","fromTime":"2022-11-30T18:30:01.000Z","toTime":"2022-12-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.115154+00', + updatedAt: '2023-01-21 19:01:34.115154+00', + countryCode: 'IND', + }, + { + id: 102, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-02 18:30:02+00', + certificate_issuance_enddate: '2022-03-31 18:29:59+00', + readvalue_watthour: 1472000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1472000","fromTime":"2022-03-02T18:30:02.000Z","toTime":"2022-03-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.211818+00', + updatedAt: '2023-01-21 19:01:34.211818+00', + countryCode: 'IND', + }, + { + id: 103, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-31 18:30:01+00', + certificate_issuance_enddate: '2022-04-30 18:29:59+00', + readvalue_watthour: 1529000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1529000","fromTime":"2022-03-31T18:30:01.000Z","toTime":"2022-04-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.212546+00', + updatedAt: '2023-01-21 19:01:34.212546+00', + countryCode: 'IND', + }, + { + id: 104, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 2211000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"2211000","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.312497+00', + updatedAt: '2023-01-21 19:01:34.312497+00', + countryCode: 'IND', + }, + { + id: 105, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 2183000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"2183000","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.511741+00', + updatedAt: '2023-01-21 19:01:34.511741+00', + countryCode: 'IND', + }, + { + id: 106, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-10-31 18:30:01+00', + certificate_issuance_enddate: '2022-11-30 18:29:59+00', + readvalue_watthour: 2439000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"2439000","fromTime":"2022-10-31T18:30:01.000Z","toTime":"2022-11-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.609364+00', + updatedAt: '2023-01-21 19:01:34.609364+00', + countryCode: 'IND', + }, + { + id: 107, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-11-30 18:30:01+00', + certificate_issuance_enddate: '2022-12-31 18:29:59+00', + readvalue_watthour: 2304000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"2304000","fromTime":"2022-11-30T18:30:01.000Z","toTime":"2022-12-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.618824+00', + updatedAt: '2023-01-21 19:01:34.618824+00', + countryCode: 'IND', + }, + { + id: 108, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-31 18:30:01+00', + certificate_issuance_enddate: '2022-06-30 18:29:59+00', + readvalue_watthour: 1628000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1628000","fromTime":"2022-05-31T18:30:01.000Z","toTime":"2022-06-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.710688+00', + updatedAt: '2023-01-21 19:01:34.710688+00', + countryCode: 'IND', + }, + { + id: 109, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-04-30 18:30:01+00', + certificate_issuance_enddate: '2022-05-31 18:29:59+00', + readvalue_watthour: 1760000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"1760000","fromTime":"2022-04-30T18:30:01.000Z","toTime":"2022-05-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.810092+00', + updatedAt: '2023-01-21 19:01:34.810092+00', + countryCode: 'IND', + }, + { + id: 110, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-30 18:30:01+00', + certificate_issuance_enddate: '2022-07-31 18:29:59+00', + readvalue_watthour: 2237000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"2237000","fromTime":"2022-06-30T18:30:01.000Z","toTime":"2022-07-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.815828+00', + updatedAt: '2023-01-21 19:01:34.815828+00', + countryCode: 'IND', + }, + { + id: 111, + groupid: 10, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-31 18:30:01+00', + certificate_issuance_enddate: '2022-08-31 18:29:59+00', + readvalue_watthour: 2463000, + status: 'Requested', + certificate_payload: + '{"deviceId":"10","energyValue":"2463000","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}}', + createdAt: '2023-01-21 19:01:34.915391+00', + updatedAt: '2023-01-21 19:01:34.915391+00', + countryCode: 'IND', + }, + { + id: 112, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-14 00:00:00+00', + certificate_issuance_enddate: '2023-01-16 09:00:00+00', + readvalue_watthour: 74545344, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"74545344","fromTime":"2022-03-14T00:00:00.000Z","toTime":"2023-01-16T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[202],"groupId":"11"}}', + createdAt: '2023-01-27 04:58:03.607617+00', + updatedAt: '2023-01-27 04:58:03.607617+00', + countryCode: 'IND', + }, + { + id: 113, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-14 00:00:00+00', + certificate_issuance_enddate: '2023-01-16 09:00:00+00', + readvalue_watthour: 78922632, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"78922632","fromTime":"2022-03-14T00:00:00.000Z","toTime":"2023-01-16T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203],"groupId":"11"}}', + createdAt: '2023-01-27 04:58:04.716641+00', + updatedAt: '2023-01-27 04:58:04.716641+00', + countryCode: 'IND', + }, + { + id: 114, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-14 00:00:00+00', + certificate_issuance_enddate: '2023-01-15 23:59:59+00', + readvalue_watthour: 79136096, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"79136096","fromTime":"2022-03-14T00:00:00.000Z","toTime":"2023-01-15T23:59:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204],"groupId":"11"}}', + createdAt: '2023-01-27 04:58:05.706885+00', + updatedAt: '2023-01-27 04:58:05.706885+00', + countryCode: 'IND', + }, + { + id: 115, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-18 10:25:00+00', + certificate_issuance_enddate: '2023-01-19 10:00:00+00', + readvalue_watthour: 862000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"862000","fromTime":"2023-01-18T10:25:00.000Z","toTime":"2023-01-19T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-27 05:00:06.108474+00', + updatedAt: '2023-01-27 05:00:06.108474+00', + countryCode: 'IND', + }, + { + id: 116, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-19 10:00:00+00', + certificate_issuance_enddate: '2023-01-20 10:00:00+00', + readvalue_watthour: 823000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"823000","fromTime":"2023-01-19T10:00:00.000Z","toTime":"2023-01-20T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-27 05:00:32.509333+00', + updatedAt: '2023-01-27 05:00:32.509333+00', + countryCode: 'IND', + }, + { + id: 117, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-20 10:00:00+00', + certificate_issuance_enddate: '2023-01-21 10:00:00+00', + readvalue_watthour: 877000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"877000","fromTime":"2023-01-20T10:00:00.000Z","toTime":"2023-01-21T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-27 05:01:03.613682+00', + updatedAt: '2023-01-27 05:01:03.613682+00', + countryCode: 'IND', + }, + { + id: 118, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-21 10:00:00+00', + certificate_issuance_enddate: '2023-01-22 10:00:00+00', + readvalue_watthour: 723000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"723000","fromTime":"2023-01-21T10:00:00.000Z","toTime":"2023-01-22T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-27 05:01:31.811882+00', + updatedAt: '2023-01-27 05:01:31.811882+00', + countryCode: 'IND', + }, + { + id: 119, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-22 10:00:00+00', + certificate_issuance_enddate: '2023-01-23 10:00:00+00', + readvalue_watthour: 910000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"910000","fromTime":"2023-01-22T10:00:00.000Z","toTime":"2023-01-23T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-27 05:02:02.114774+00', + updatedAt: '2023-01-27 05:02:02.114774+00', + countryCode: 'IND', + }, + { + id: 120, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-23 10:00:00+00', + certificate_issuance_enddate: '2023-01-24 10:00:00+00', + readvalue_watthour: 1047000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"1047000","fromTime":"2023-01-23T10:00:00.000Z","toTime":"2023-01-24T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-27 05:02:33.216004+00', + updatedAt: '2023-01-27 05:02:33.216004+00', + countryCode: 'IND', + }, + { + id: 121, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-24 10:00:00+00', + certificate_issuance_enddate: '2023-01-25 10:00:00+00', + readvalue_watthour: 1066000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"1066000","fromTime":"2023-01-24T10:00:00.000Z","toTime":"2023-01-25T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-27 05:03:04.810135+00', + updatedAt: '2023-01-27 05:03:04.810135+00', + countryCode: 'IND', + }, + { + id: 122, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-25 10:00:00+00', + certificate_issuance_enddate: '2023-01-26 10:00:00+00', + readvalue_watthour: 1077000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"1077000","fromTime":"2023-01-25T10:00:00.000Z","toTime":"2023-01-26T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-27 05:03:32.107635+00', + updatedAt: '2023-01-27 05:03:32.107635+00', + countryCode: 'IND', + }, + { + id: 123, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-26 10:00:00+00', + certificate_issuance_enddate: '2023-01-27 10:00:00+00', + readvalue_watthour: 1154000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"1154000","fromTime":"2023-01-26T10:00:00.000Z","toTime":"2023-01-27T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-27 10:03:32.326541+00', + updatedAt: '2023-01-27 10:03:32.326541+00', + countryCode: 'IND', + }, + { + id: 124, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-27 10:00:00+00', + certificate_issuance_enddate: '2023-01-28 10:00:00+00', + readvalue_watthour: 1093000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"1093000","fromTime":"2023-01-27T10:00:00.000Z","toTime":"2023-01-28T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-28 10:03:32.811607+00', + updatedAt: '2023-01-28 10:03:32.811607+00', + countryCode: 'IND', + }, + { + id: 125, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-28 10:00:00+00', + certificate_issuance_enddate: '2023-01-29 10:00:00+00', + readvalue_watthour: 752000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"752000","fromTime":"2023-01-28T10:00:00.000Z","toTime":"2023-01-29T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-01-29 10:03:35.026095+00', + updatedAt: '2023-01-29 10:03:35.026095+00', + countryCode: 'IND', + }, + { + id: 126, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-29 10:00:00+00', + certificate_issuance_enddate: '2023-01-30 10:00:00+00', + readvalue_watthour: 529000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"529000","fromTime":"2023-01-29T10:00:00.000Z","toTime":"2023-01-30T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"11"}}', + createdAt: '2023-01-30 10:03:32.016655+00', + updatedAt: '2023-01-30 10:03:32.016655+00', + countryCode: 'IND', + }, + { + id: 127, + groupid: 11, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-01-31 10:00:00+00', + certificate_issuance_enddate: '2023-01-31 23:55:00+00', + readvalue_watthour: 72000, + status: 'Requested', + certificate_payload: + '{"deviceId":"11","energyValue":"72000","fromTime":"2023-01-31T10:00:00.000Z","toTime":"2023-01-31T23:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}}', + createdAt: '2023-02-01 00:00:32.709674+00', + updatedAt: '2023-02-01 00:00:32.709674+00', + countryCode: 'IND', + }, + { + id: 128, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 16336400, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"16336400","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:34.710806+00', + updatedAt: '2023-02-01 18:29:34.710806+00', + countryCode: 'IND', + }, + { + id: 129, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-10-31 18:30:01+00', + certificate_issuance_enddate: '2022-11-30 18:29:59+00', + readvalue_watthour: 5656000, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"5656000","fromTime":"2022-10-31T18:30:01.000Z","toTime":"2022-11-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[207],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.006969+00', + updatedAt: '2023-02-01 18:29:35.006969+00', + countryCode: 'IND', + }, + { + id: 130, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-10-31 18:30:01+00', + certificate_issuance_enddate: '2022-11-30 18:29:59+00', + readvalue_watthour: 11563100, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"11563100","fromTime":"2022-10-31T18:30:01.000Z","toTime":"2022-11-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:34.914183+00', + updatedAt: '2023-02-01 18:29:34.914183+00', + countryCode: 'IND', + }, + { + id: 131, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-11-30 18:30:01+00', + certificate_issuance_enddate: '2022-12-31 18:29:59+00', + readvalue_watthour: 9056700, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"9056700","fromTime":"2022-11-30T18:30:01.000Z","toTime":"2022-12-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.019804+00', + updatedAt: '2023-02-01 18:29:35.019804+00', + countryCode: 'IND', + }, + { + id: 132, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 14118500, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"14118500","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.01986+00', + updatedAt: '2023-02-01 18:29:35.01986+00', + countryCode: 'IND', + }, + { + id: 133, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-11-30 18:30:01+00', + certificate_issuance_enddate: '2022-12-31 18:29:59+00', + readvalue_watthour: 5812000, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"5812000","fromTime":"2022-11-30T18:30:01.000Z","toTime":"2022-12-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[207],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.109288+00', + updatedAt: '2023-02-01 18:29:35.109288+00', + countryCode: 'IND', + }, + { + id: 134, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 3947000, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"3947000","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[206],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.211286+00', + updatedAt: '2023-02-01 18:29:35.211286+00', + countryCode: 'IND', + }, + { + id: 135, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 4111000, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"4111000","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[206],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.224275+00', + updatedAt: '2023-02-01 18:29:35.224275+00', + countryCode: 'IND', + }, + { + id: 136, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-10-31 18:30:01+00', + certificate_issuance_enddate: '2022-11-30 18:29:59+00', + readvalue_watthour: 3920000, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"3920000","fromTime":"2022-10-31T18:30:01.000Z","toTime":"2022-11-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[206],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.311178+00', + updatedAt: '2023-02-01 18:29:35.311178+00', + countryCode: 'IND', + }, + { + id: 137, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-11-30 18:30:01+00', + certificate_issuance_enddate: '2022-12-31 18:29:59+00', + readvalue_watthour: 3923000, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"3923000","fromTime":"2022-11-30T18:30:01.000Z","toTime":"2022-12-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[206],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.31503+00', + updatedAt: '2023-02-01 18:29:35.31503+00', + countryCode: 'IND', + }, + { + id: 138, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-19 18:30:02+00', + certificate_issuance_enddate: '2022-06-30 18:29:59+00', + readvalue_watthour: 3147100, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"3147100","fromTime":"2022-06-19T18:30:02.000Z","toTime":"2022-06-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.509332+00', + updatedAt: '2023-02-01 18:29:35.509332+00', + countryCode: 'IND', + }, + { + id: 139, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-31 18:30:01+00', + certificate_issuance_enddate: '2022-08-31 18:29:59+00', + readvalue_watthour: 16125200, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"16125200","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.513581+00', + updatedAt: '2023-02-01 18:29:35.513581+00', + countryCode: 'IND', + }, + { + id: 140, + groupid: 12, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-30 18:30:01+00', + certificate_issuance_enddate: '2022-07-31 18:29:59+00', + readvalue_watthour: 12173900, + status: 'Requested', + certificate_payload: + '{"deviceId":"12","energyValue":"12173900","fromTime":"2022-06-30T18:30:01.000Z","toTime":"2022-07-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}}', + createdAt: '2023-02-01 18:29:35.908009+00', + updatedAt: '2023-02-01 18:29:35.908009+00', + countryCode: 'IND', + }, + { + id: 141, + groupid: 13, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-31 18:30:01+00', + certificate_issuance_enddate: '2022-08-31 18:29:59+00', + readvalue_watthour: 3205000, + status: 'Requested', + certificate_payload: + '{"deviceId":"13","energyValue":"3205000","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"0a5ce04e-bb3f-4306-9665-2a165ebe45e1","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"13"}}', + createdAt: '2023-02-03 10:17:33.314144+00', + updatedAt: '2023-02-03 10:17:33.314144+00', + countryCode: 'IND', + }, + { + id: 142, + groupid: 13, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-08-31 18:30:01+00', + certificate_issuance_enddate: '2022-09-30 18:29:59+00', + readvalue_watthour: 3247000, + status: 'Requested', + certificate_payload: + '{"deviceId":"13","energyValue":"3247000","fromTime":"2022-08-31T18:30:01.000Z","toTime":"2022-09-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"0a5ce04e-bb3f-4306-9665-2a165ebe45e1","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"13"}}', + createdAt: '2023-02-03 10:17:33.314226+00', + updatedAt: '2023-02-03 10:17:33.314226+00', + countryCode: 'IND', + }, + { + id: 143, + groupid: 13, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-11-30 18:30:01+00', + certificate_issuance_enddate: '2022-12-31 18:29:59+00', + readvalue_watthour: 1617000, + status: 'Requested', + certificate_payload: + '{"deviceId":"13","energyValue":"1617000","fromTime":"2022-11-30T18:30:01.000Z","toTime":"2022-12-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"0a5ce04e-bb3f-4306-9665-2a165ebe45e1","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"13"}}', + createdAt: '2023-02-03 10:17:33.31668+00', + updatedAt: '2023-02-03 10:17:33.31668+00', + countryCode: 'IND', + }, + { + id: 144, + groupid: 13, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-10-31 18:30:01+00', + certificate_issuance_enddate: '2022-11-30 18:29:59+00', + readvalue_watthour: 2312000, + status: 'Requested', + certificate_payload: + '{"deviceId":"13","energyValue":"2312000","fromTime":"2022-10-31T18:30:01.000Z","toTime":"2022-11-30T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"0a5ce04e-bb3f-4306-9665-2a165ebe45e1","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"13"}}', + createdAt: '2023-02-03 10:17:33.319522+00', + updatedAt: '2023-02-03 10:17:33.319522+00', + countryCode: 'IND', + }, + { + id: 145, + groupid: 13, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-30 18:30:01+00', + certificate_issuance_enddate: '2022-10-31 18:29:59+00', + readvalue_watthour: 2803000, + status: 'Requested', + certificate_payload: + '{"deviceId":"13","energyValue":"2803000","fromTime":"2022-09-30T18:30:01.000Z","toTime":"2022-10-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"0a5ce04e-bb3f-4306-9665-2a165ebe45e1","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"13"}}', + createdAt: '2023-02-03 10:17:33.318088+00', + updatedAt: '2023-02-03 10:17:33.318088+00', + countryCode: 'IND', + }, + { + id: 146, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 00:40:00+00', + certificate_issuance_enddate: '2023-02-01 02:00:00+00', + readvalue_watthour: 2000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"2000","fromTime":"2023-02-01T00:40:00.000Z","toTime":"2023-02-01T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:31:32.42693+00', + updatedAt: '2023-02-03 10:31:32.42693+00', + countryCode: 'IND', + }, + { + id: 147, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 02:00:00+00', + certificate_issuance_enddate: '2023-02-01 03:00:00+00', + readvalue_watthour: 12000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"12000","fromTime":"2023-02-01T02:00:00.000Z","toTime":"2023-02-01T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:32:02.914406+00', + updatedAt: '2023-02-03 10:32:02.914406+00', + countryCode: 'IND', + }, + { + id: 148, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 03:00:00+00', + certificate_issuance_enddate: '2023-02-01 04:00:00+00', + readvalue_watthour: 56000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"56000","fromTime":"2023-02-01T03:00:00.000Z","toTime":"2023-02-01T04:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:32:32.938132+00', + updatedAt: '2023-02-03 10:32:32.938132+00', + countryCode: 'IND', + }, + { + id: 149, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 04:00:00+00', + certificate_issuance_enddate: '2023-02-01 05:00:00+00', + readvalue_watthour: 114000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"114000","fromTime":"2023-02-01T04:00:00.000Z","toTime":"2023-02-01T05:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:33:02.623574+00', + updatedAt: '2023-02-03 10:33:02.623574+00', + countryCode: 'IND', + }, + { + id: 150, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 05:00:00+00', + certificate_issuance_enddate: '2023-02-01 06:00:00+00', + readvalue_watthour: 139000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"139000","fromTime":"2023-02-01T05:00:00.000Z","toTime":"2023-02-01T06:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:33:32.519959+00', + updatedAt: '2023-02-03 10:33:32.519959+00', + countryCode: 'IND', + }, + { + id: 151, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 06:00:00+00', + certificate_issuance_enddate: '2023-02-01 07:00:00+00', + readvalue_watthour: 157000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"157000","fromTime":"2023-02-01T06:00:00.000Z","toTime":"2023-02-01T07:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:34:02.713251+00', + updatedAt: '2023-02-03 10:34:02.713251+00', + countryCode: 'IND', + }, + { + id: 152, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 07:00:00+00', + certificate_issuance_enddate: '2023-02-01 08:00:00+00', + readvalue_watthour: 157000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"157000","fromTime":"2023-02-01T07:00:00.000Z","toTime":"2023-02-01T08:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:34:32.620028+00', + updatedAt: '2023-02-03 10:34:32.620028+00', + countryCode: 'IND', + }, + { + id: 153, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 08:00:00+00', + certificate_issuance_enddate: '2023-02-01 09:00:00+00', + readvalue_watthour: 134000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"134000","fromTime":"2023-02-01T08:00:00.000Z","toTime":"2023-02-01T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:35:02.82912+00', + updatedAt: '2023-02-03 10:35:02.82912+00', + countryCode: 'IND', + }, + { + id: 154, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 09:00:00+00', + certificate_issuance_enddate: '2023-02-01 10:00:00+00', + readvalue_watthour: 97000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"97000","fromTime":"2023-02-01T09:00:00.000Z","toTime":"2023-02-01T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:35:32.316738+00', + updatedAt: '2023-02-03 10:35:32.316738+00', + countryCode: 'IND', + }, + { + id: 155, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 10:00:00+00', + certificate_issuance_enddate: '2023-02-01 11:00:00+00', + readvalue_watthour: 57000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"57000","fromTime":"2023-02-01T10:00:00.000Z","toTime":"2023-02-01T11:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:36:02.336257+00', + updatedAt: '2023-02-03 10:36:02.336257+00', + countryCode: 'IND', + }, + { + id: 156, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 11:00:00+00', + certificate_issuance_enddate: '2023-02-01 12:00:00+00', + readvalue_watthour: 20000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"20000","fromTime":"2023-02-01T11:00:00.000Z","toTime":"2023-02-01T12:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:36:32.21486+00', + updatedAt: '2023-02-03 10:36:32.21486+00', + countryCode: 'IND', + }, + { + id: 157, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 12:00:00+00', + certificate_issuance_enddate: '2023-02-01 13:00:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"1000","fromTime":"2023-02-01T12:00:00.000Z","toTime":"2023-02-01T13:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:37:02.644221+00', + updatedAt: '2023-02-03 10:37:02.644221+00', + countryCode: 'IND', + }, + { + id: 158, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-01 22:45:00+00', + certificate_issuance_enddate: '2023-02-02 00:00:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"1000","fromTime":"2023-02-01T22:45:00.000Z","toTime":"2023-02-02T00:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:42:31.610621+00', + updatedAt: '2023-02-03 10:42:31.610621+00', + countryCode: 'IND', + }, + { + id: 159, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 00:45:00+00', + certificate_issuance_enddate: '2023-02-02 02:00:00+00', + readvalue_watthour: 6000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"6000","fromTime":"2023-02-02T00:45:00.000Z","toTime":"2023-02-02T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:43:31.916064+00', + updatedAt: '2023-02-03 10:43:31.916064+00', + countryCode: 'IND', + }, + { + id: 160, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 02:00:00+00', + certificate_issuance_enddate: '2023-02-02 03:00:00+00', + readvalue_watthour: 32000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"32000","fromTime":"2023-02-02T02:00:00.000Z","toTime":"2023-02-02T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:44:01.923366+00', + updatedAt: '2023-02-03 10:44:01.923366+00', + countryCode: 'IND', + }, + { + id: 161, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 03:00:00+00', + certificate_issuance_enddate: '2023-02-02 04:00:00+00', + readvalue_watthour: 60000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"60000","fromTime":"2023-02-02T03:00:00.000Z","toTime":"2023-02-02T04:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:44:31.610514+00', + updatedAt: '2023-02-03 10:44:31.610514+00', + countryCode: 'IND', + }, + { + id: 162, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 04:00:00+00', + certificate_issuance_enddate: '2023-02-02 05:00:00+00', + readvalue_watthour: 114000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"114000","fromTime":"2023-02-02T04:00:00.000Z","toTime":"2023-02-02T05:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:45:01.981585+00', + updatedAt: '2023-02-03 10:45:01.981585+00', + countryCode: 'IND', + }, + { + id: 163, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 05:00:00+00', + certificate_issuance_enddate: '2023-02-02 06:00:00+00', + readvalue_watthour: 138000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"138000","fromTime":"2023-02-02T05:00:00.000Z","toTime":"2023-02-02T06:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:45:32.314129+00', + updatedAt: '2023-02-03 10:45:32.314129+00', + countryCode: 'IND', + }, + { + id: 164, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 06:00:00+00', + certificate_issuance_enddate: '2023-02-02 07:00:00+00', + readvalue_watthour: 150000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"150000","fromTime":"2023-02-02T06:00:00.000Z","toTime":"2023-02-02T07:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:46:02.714385+00', + updatedAt: '2023-02-03 10:46:02.714385+00', + countryCode: 'IND', + }, + { + id: 165, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 06:55:00+00', + certificate_issuance_enddate: '2023-02-02 08:00:00+00', + readvalue_watthour: 154000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"154000","fromTime":"2023-02-02T06:55:00.000Z","toTime":"2023-02-02T08:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:46:31.808269+00', + updatedAt: '2023-02-03 10:46:31.808269+00', + countryCode: 'IND', + }, + { + id: 166, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 08:00:00+00', + certificate_issuance_enddate: '2023-02-02 09:00:00+00', + readvalue_watthour: 137000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"137000","fromTime":"2023-02-02T08:00:00.000Z","toTime":"2023-02-02T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:47:01.813651+00', + updatedAt: '2023-02-03 10:47:01.813651+00', + countryCode: 'IND', + }, + { + id: 167, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 09:00:00+00', + certificate_issuance_enddate: '2023-02-02 10:00:00+00', + readvalue_watthour: 102000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"102000","fromTime":"2023-02-02T09:00:00.000Z","toTime":"2023-02-02T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:47:32.009263+00', + updatedAt: '2023-02-03 10:47:32.009263+00', + countryCode: 'IND', + }, + { + id: 168, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 10:00:00+00', + certificate_issuance_enddate: '2023-02-02 11:00:00+00', + readvalue_watthour: 55000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"55000","fromTime":"2023-02-02T10:00:00.000Z","toTime":"2023-02-02T11:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:48:02.719068+00', + updatedAt: '2023-02-03 10:48:02.719068+00', + countryCode: 'IND', + }, + { + id: 169, + groupid: 15, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-30 18:30:01+00', + certificate_issuance_enddate: '2022-07-31 18:29:59+00', + readvalue_watthour: 2431000, + status: 'Requested', + certificate_payload: + '{"deviceId":"15","energyValue":"2431000","fromTime":"2022-06-30T18:30:01.000Z","toTime":"2022-07-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"95c6ed07-4001-478e-a5b8-119aa0101f10","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"15"}}', + createdAt: '2023-02-03 10:48:32.311538+00', + updatedAt: '2023-02-03 10:48:32.311538+00', + countryCode: 'IND', + }, + { + id: 170, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 11:00:00+00', + certificate_issuance_enddate: '2023-02-02 12:00:00+00', + readvalue_watthour: 16000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"16000","fromTime":"2023-02-02T11:00:00.000Z","toTime":"2023-02-02T12:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:48:32.633315+00', + updatedAt: '2023-02-03 10:48:32.633315+00', + countryCode: 'IND', + }, + { + id: 171, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 12:00:00+00', + certificate_issuance_enddate: '2023-02-02 12:40:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"1000","fromTime":"2023-02-02T12:00:00.000Z","toTime":"2023-02-02T12:40:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:49:02.309781+00', + updatedAt: '2023-02-03 10:49:02.309781+00', + countryCode: 'IND', + }, + { + id: 172, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-02 13:55:00+00', + certificate_issuance_enddate: '2023-02-02 15:00:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"1000","fromTime":"2023-02-02T13:55:00.000Z","toTime":"2023-02-02T15:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:50:03.008612+00', + updatedAt: '2023-02-03 10:50:03.008612+00', + countryCode: 'IND', + }, + { + id: 173, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 00:40:00+00', + certificate_issuance_enddate: '2023-02-03 02:00:00+00', + readvalue_watthour: 6000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"6000","fromTime":"2023-02-03T00:40:00.000Z","toTime":"2023-02-03T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:55:32.108756+00', + updatedAt: '2023-02-03 10:55:32.108756+00', + countryCode: 'IND', + }, + { + id: 174, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 02:00:00+00', + certificate_issuance_enddate: '2023-02-03 03:00:00+00', + readvalue_watthour: 31000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"31000","fromTime":"2023-02-03T02:00:00.000Z","toTime":"2023-02-03T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:56:03.320877+00', + updatedAt: '2023-02-03 10:56:03.320877+00', + countryCode: 'IND', + }, + { + id: 175, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 03:00:00+00', + certificate_issuance_enddate: '2023-02-03 04:00:00+00', + readvalue_watthour: 75000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"75000","fromTime":"2023-02-03T03:00:00.000Z","toTime":"2023-02-03T04:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:56:32.311785+00', + updatedAt: '2023-02-03 10:56:32.311785+00', + countryCode: 'IND', + }, + { + id: 176, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 04:00:00+00', + certificate_issuance_enddate: '2023-02-03 05:00:00+00', + readvalue_watthour: 120000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"120000","fromTime":"2023-02-03T04:00:00.000Z","toTime":"2023-02-03T05:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:57:02.241373+00', + updatedAt: '2023-02-03 10:57:02.241373+00', + countryCode: 'IND', + }, + { + id: 177, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 05:00:00+00', + certificate_issuance_enddate: '2023-02-03 06:00:00+00', + readvalue_watthour: 142000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"142000","fromTime":"2023-02-03T05:00:00.000Z","toTime":"2023-02-03T06:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:57:32.609744+00', + updatedAt: '2023-02-03 10:57:32.609744+00', + countryCode: 'IND', + }, + { + id: 178, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 06:00:00+00', + certificate_issuance_enddate: '2023-02-03 07:00:00+00', + readvalue_watthour: 163000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"163000","fromTime":"2023-02-03T06:00:00.000Z","toTime":"2023-02-03T07:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:58:03.056922+00', + updatedAt: '2023-02-03 10:58:03.056922+00', + countryCode: 'IND', + }, + { + id: 179, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 07:00:00+00', + certificate_issuance_enddate: '2023-02-03 08:00:00+00', + readvalue_watthour: 106000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"106000","fromTime":"2023-02-03T07:00:00.000Z","toTime":"2023-02-03T08:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:58:32.713036+00', + updatedAt: '2023-02-03 10:58:32.713036+00', + countryCode: 'IND', + }, + { + id: 180, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 07:50:00+00', + certificate_issuance_enddate: '2023-02-03 09:00:00+00', + readvalue_watthour: 91000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"91000","fromTime":"2023-02-03T07:50:00.000Z","toTime":"2023-02-03T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:59:02.50932+00', + updatedAt: '2023-02-03 10:59:02.50932+00', + countryCode: 'IND', + }, + { + id: 181, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 08:55:00+00', + certificate_issuance_enddate: '2023-02-03 10:00:00+00', + readvalue_watthour: 69000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"69000","fromTime":"2023-02-03T08:55:00.000Z","toTime":"2023-02-03T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 10:59:32.613515+00', + updatedAt: '2023-02-03 10:59:32.613515+00', + countryCode: 'IND', + }, + { + id: 182, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 10:00:00+00', + certificate_issuance_enddate: '2023-02-03 10:55:00+00', + readvalue_watthour: 53000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"53000","fromTime":"2023-02-03T10:00:00.000Z","toTime":"2023-02-03T10:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 11:00:32.308736+00', + updatedAt: '2023-02-03 11:00:32.308736+00', + countryCode: 'IND', + }, + { + id: 183, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 11:00:00+00', + certificate_issuance_enddate: '2023-02-03 11:55:00+00', + readvalue_watthour: 20000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"20000","fromTime":"2023-02-03T11:00:00.000Z","toTime":"2023-02-03T11:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 12:00:32.021111+00', + updatedAt: '2023-02-03 12:00:32.021111+00', + countryCode: 'IND', + }, + { + id: 184, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 12:00:00+00', + certificate_issuance_enddate: '2023-02-03 12:50:00+00', + readvalue_watthour: 2000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"2000","fromTime":"2023-02-03T12:00:00.000Z","toTime":"2023-02-03T12:50:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-03 13:00:32.208085+00', + updatedAt: '2023-02-03 13:00:32.208085+00', + countryCode: 'IND', + }, + { + id: 185, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-03 22:50:00+00', + certificate_issuance_enddate: '2023-02-03 23:55:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"1000","fromTime":"2023-02-03T22:50:00.000Z","toTime":"2023-02-03T23:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 00:00:32.423614+00', + updatedAt: '2023-02-04 00:00:32.423614+00', + countryCode: 'IND', + }, + { + id: 186, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 00:45:00+00', + certificate_issuance_enddate: '2023-02-04 01:55:00+00', + readvalue_watthour: 4000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"4000","fromTime":"2023-02-04T00:45:00.000Z","toTime":"2023-02-04T01:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 02:00:32.509567+00', + updatedAt: '2023-02-04 02:00:32.509567+00', + countryCode: 'IND', + }, + { + id: 187, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 02:00:00+00', + certificate_issuance_enddate: '2023-02-04 02:55:00+00', + readvalue_watthour: 32000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"32000","fromTime":"2023-02-04T02:00:00.000Z","toTime":"2023-02-04T02:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 03:00:32.625015+00', + updatedAt: '2023-02-04 03:00:32.625015+00', + countryCode: 'IND', + }, + { + id: 188, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 03:00:00+00', + certificate_issuance_enddate: '2023-02-04 03:55:00+00', + readvalue_watthour: 74000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"74000","fromTime":"2023-02-04T03:00:00.000Z","toTime":"2023-02-04T03:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 04:00:33.611064+00', + updatedAt: '2023-02-04 04:00:33.611064+00', + countryCode: 'IND', + }, + { + id: 189, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 04:00:00+00', + certificate_issuance_enddate: '2023-02-04 04:55:00+00', + readvalue_watthour: 112000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"112000","fromTime":"2023-02-04T04:00:00.000Z","toTime":"2023-02-04T04:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 05:00:32.709617+00', + updatedAt: '2023-02-04 05:00:32.709617+00', + countryCode: 'IND', + }, + { + id: 190, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 05:00:00+00', + certificate_issuance_enddate: '2023-02-04 05:55:00+00', + readvalue_watthour: 139000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"139000","fromTime":"2023-02-04T05:00:00.000Z","toTime":"2023-02-04T05:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 06:00:32.813502+00', + updatedAt: '2023-02-04 06:00:32.813502+00', + countryCode: 'IND', + }, + { + id: 191, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 06:00:00+00', + certificate_issuance_enddate: '2023-02-04 06:55:00+00', + readvalue_watthour: 154000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"154000","fromTime":"2023-02-04T06:00:00.000Z","toTime":"2023-02-04T06:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 07:00:32.318602+00', + updatedAt: '2023-02-04 07:00:32.318602+00', + countryCode: 'IND', + }, + { + id: 192, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 07:00:00+00', + certificate_issuance_enddate: '2023-02-04 07:55:00+00', + readvalue_watthour: 156000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"156000","fromTime":"2023-02-04T07:00:00.000Z","toTime":"2023-02-04T07:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 08:00:32.112994+00', + updatedAt: '2023-02-04 08:00:32.112994+00', + countryCode: 'IND', + }, + { + id: 193, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-06 00:31:00+00', + certificate_issuance_enddate: '2023-01-21 18:29:59+00', + readvalue_watthour: 715063, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"715063","fromTime":"2022-05-06T00:31:00.000Z","toTime":"2023-01-21T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[218],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:06.80854+00', + updatedAt: '2023-02-04 08:49:06.80854+00', + countryCode: 'IND', + }, + { + id: 194, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-19 00:30:00+00', + certificate_issuance_enddate: '2023-01-16 18:29:59+00', + readvalue_watthour: 667217, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"667217","fromTime":"2022-07-19T00:30:00.000Z","toTime":"2023-01-16T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[212],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:07.613071+00', + updatedAt: '2023-02-04 08:49:07.613071+00', + countryCode: 'IND', + }, + { + id: 195, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-07 00:31:00+00', + certificate_issuance_enddate: '2023-01-21 18:29:59+00', + readvalue_watthour: 1050064, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1050064","fromTime":"2022-06-07T00:31:00.000Z","toTime":"2023-01-21T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[219],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:07.709626+00', + updatedAt: '2023-02-04 08:49:07.709626+00', + countryCode: 'IND', + }, + { + id: 196, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-14 00:31:00+00', + certificate_issuance_enddate: '2023-01-27 18:29:59+00', + readvalue_watthour: 2566955, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"2566955","fromTime":"2022-03-14T00:31:00.000Z","toTime":"2023-01-27T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[220],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:07.712647+00', + updatedAt: '2023-02-04 08:49:07.712647+00', + countryCode: 'IND', + }, + { + id: 197, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-04 00:31:00+00', + certificate_issuance_enddate: '2023-01-31 18:29:59+00', + readvalue_watthour: 1175658, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1175658","fromTime":"2022-03-04T00:31:00.000Z","toTime":"2023-01-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[228],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:07.809244+00', + updatedAt: '2023-02-04 08:49:07.809244+00', + countryCode: 'IND', + }, + { + id: 198, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-02-25 00:31:00+00', + certificate_issuance_enddate: '2023-01-21 18:29:59+00', + readvalue_watthour: 1588159, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1588159","fromTime":"2022-02-25T00:31:00.000Z","toTime":"2023-01-21T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[226],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:07.814287+00', + updatedAt: '2023-02-04 08:49:07.814287+00', + countryCode: 'IND', + }, + { + id: 199, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-25 00:31:00+00', + certificate_issuance_enddate: '2023-01-24 18:29:59+00', + readvalue_watthour: 890473, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"890473","fromTime":"2022-06-25T00:31:00.000Z","toTime":"2023-01-24T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[213],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:08.007744+00', + updatedAt: '2023-02-04 08:49:08.007744+00', + countryCode: 'IND', + }, + { + id: 200, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-10 00:31:00+00', + certificate_issuance_enddate: '2023-01-24 18:29:59+00', + readvalue_watthour: 525381, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"525381","fromTime":"2022-07-10T00:31:00.000Z","toTime":"2023-01-24T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[214],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:08.208586+00', + updatedAt: '2023-02-04 08:49:08.208586+00', + countryCode: 'IND', + }, + { + id: 201, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-07-09 00:31:00+00', + certificate_issuance_enddate: '2023-01-23 18:29:59+00', + readvalue_watthour: 1422460, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1422460","fromTime":"2022-07-09T00:31:00.000Z","toTime":"2023-01-23T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[216],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:08.511822+00', + updatedAt: '2023-02-04 08:49:08.511822+00', + countryCode: 'IND', + }, + { + id: 202, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-10-29 00:31:00+00', + certificate_issuance_enddate: '2023-01-18 18:29:59+00', + readvalue_watthour: 182151, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"182151","fromTime":"2022-10-29T00:31:00.000Z","toTime":"2023-01-18T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[217],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:08.611254+00', + updatedAt: '2023-02-04 08:49:08.611254+00', + countryCode: 'IND', + }, + { + id: 203, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-02-22 00:31:00+00', + certificate_issuance_enddate: '2023-01-20 18:29:59+00', + readvalue_watthour: 1235593, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1235593","fromTime":"2022-02-22T00:31:00.000Z","toTime":"2023-01-20T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[221],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:08.810611+00', + updatedAt: '2023-02-04 08:49:08.810611+00', + countryCode: 'IND', + }, + { + id: 204, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-02-16 00:31:00+00', + certificate_issuance_enddate: '2023-01-20 18:29:59+00', + readvalue_watthour: 1791330, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1791330","fromTime":"2022-02-16T00:31:00.000Z","toTime":"2023-01-20T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[222],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:08.914392+00', + updatedAt: '2023-02-04 08:49:08.914392+00', + countryCode: 'IND', + }, + { + id: 205, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-01 00:31:00+00', + certificate_issuance_enddate: '2023-01-20 18:29:59+00', + readvalue_watthour: 1256659, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1256659","fromTime":"2022-03-01T00:31:00.000Z","toTime":"2023-01-20T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[223],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:09.109319+00', + updatedAt: '2023-02-04 08:49:09.109319+00', + countryCode: 'IND', + }, + { + id: 206, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-02 00:31:00+00', + certificate_issuance_enddate: '2023-01-20 18:29:59+00', + readvalue_watthour: 1550926, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1550926","fromTime":"2022-03-02T00:31:00.000Z","toTime":"2023-01-20T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[224],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:09.207456+00', + updatedAt: '2023-02-04 08:49:09.207456+00', + countryCode: 'IND', + }, + { + id: 207, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-02-25 00:31:00+00', + certificate_issuance_enddate: '2023-01-21 18:29:59+00', + readvalue_watthour: 2067802, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"2067802","fromTime":"2022-02-25T00:31:00.000Z","toTime":"2023-01-21T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[225],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:09.211625+00', + updatedAt: '2023-02-04 08:49:09.211625+00', + countryCode: 'IND', + }, + { + id: 208, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-05-06 00:31:00+00', + certificate_issuance_enddate: '2023-01-21 18:29:59+00', + readvalue_watthour: 1359759, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1359759","fromTime":"2022-05-06T00:31:00.000Z","toTime":"2023-01-21T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[230],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:09.309674+00', + updatedAt: '2023-02-04 08:49:09.309674+00', + countryCode: 'IND', + }, + { + id: 209, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-03-04 00:31:00+00', + certificate_issuance_enddate: '2023-01-27 18:29:59+00', + readvalue_watthour: 756124, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"756124","fromTime":"2022-03-04T00:31:00.000Z","toTime":"2023-01-27T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[227],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:09.313023+00', + updatedAt: '2023-02-04 08:49:09.313023+00', + countryCode: 'IND', + }, + { + id: 210, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-07 00:31:00+00', + certificate_issuance_enddate: '2023-01-20 18:29:59+00', + readvalue_watthour: 1012799, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1012799","fromTime":"2022-06-07T00:31:00.000Z","toTime":"2023-01-20T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[231],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:09.409084+00', + updatedAt: '2023-02-04 08:49:09.409084+00', + countryCode: 'IND', + }, + { + id: 211, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-06-07 00:31:00+00', + certificate_issuance_enddate: '2023-01-20 18:29:59+00', + readvalue_watthour: 1137486, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"1137486","fromTime":"2022-06-07T00:31:00.000Z","toTime":"2023-01-20T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[232],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:09.415343+00', + updatedAt: '2023-02-04 08:49:09.415343+00', + countryCode: 'IND', + }, + { + id: 212, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-20 00:31:00+00', + certificate_issuance_enddate: '2023-01-19 18:29:59+00', + readvalue_watthour: 710356, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"710356","fromTime":"2022-09-20T00:31:00.000Z","toTime":"2023-01-19T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[233],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:09.418874+00', + updatedAt: '2023-02-04 08:49:09.418874+00', + countryCode: 'IND', + }, + { + id: 213, + groupid: 16, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-09-20 00:31:00+00', + certificate_issuance_enddate: '2023-01-23 18:29:59+00', + readvalue_watthour: 503212, + status: 'Requested', + certificate_payload: + '{"deviceId":"16","energyValue":"503212","fromTime":"2022-09-20T00:31:00.000Z","toTime":"2023-01-23T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[234],"groupId":"16"}}', + createdAt: '2023-02-04 08:49:09.510845+00', + updatedAt: '2023-02-04 08:49:09.510845+00', + countryCode: 'IND', + }, + { + id: 214, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 08:00:00+00', + certificate_issuance_enddate: '2023-02-04 08:55:00+00', + readvalue_watthour: 137000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"137000","fromTime":"2023-02-04T08:00:00.000Z","toTime":"2023-02-04T08:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 09:00:33.220692+00', + updatedAt: '2023-02-04 09:00:33.220692+00', + countryCode: 'IND', + }, + { + id: 215, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 09:00:00+00', + certificate_issuance_enddate: '2023-02-04 09:55:00+00', + readvalue_watthour: 105000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"105000","fromTime":"2023-02-04T09:00:00.000Z","toTime":"2023-02-04T09:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 10:00:33.207464+00', + updatedAt: '2023-02-04 10:00:33.207464+00', + countryCode: 'IND', + }, + { + id: 216, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 10:00:00+00', + certificate_issuance_enddate: '2023-02-04 10:55:00+00', + readvalue_watthour: 66000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"66000","fromTime":"2023-02-04T10:00:00.000Z","toTime":"2023-02-04T10:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 11:00:32.711105+00', + updatedAt: '2023-02-04 11:00:32.711105+00', + countryCode: 'IND', + }, + { + id: 217, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 11:00:00+00', + certificate_issuance_enddate: '2023-02-04 11:55:00+00', + readvalue_watthour: 24000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"24000","fromTime":"2023-02-04T11:00:00.000Z","toTime":"2023-02-04T11:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 12:00:32.81314+00', + updatedAt: '2023-02-04 12:00:32.81314+00', + countryCode: 'IND', + }, + { + id: 218, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-04 11:55:00+00', + certificate_issuance_enddate: '2023-02-04 12:55:00+00', + readvalue_watthour: 3000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"3000","fromTime":"2023-02-04T11:55:00.000Z","toTime":"2023-02-04T12:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-04 13:00:33.017559+00', + updatedAt: '2023-02-04 13:00:33.017559+00', + countryCode: 'IND', + }, + { + id: 219, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 00:40:00+00', + certificate_issuance_enddate: '2023-02-05 01:55:00+00', + readvalue_watthour: 5000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"5000","fromTime":"2023-02-05T00:40:00.000Z","toTime":"2023-02-05T01:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 02:00:32.212273+00', + updatedAt: '2023-02-05 02:00:32.212273+00', + countryCode: 'IND', + }, + { + id: 220, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 02:00:00+00', + certificate_issuance_enddate: '2023-02-05 02:55:00+00', + readvalue_watthour: 33000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"33000","fromTime":"2023-02-05T02:00:00.000Z","toTime":"2023-02-05T02:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 03:00:32.506747+00', + updatedAt: '2023-02-05 03:00:32.506747+00', + countryCode: 'IND', + }, + { + id: 221, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 03:00:00+00', + certificate_issuance_enddate: '2023-02-05 03:55:00+00', + readvalue_watthour: 71000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"71000","fromTime":"2023-02-05T03:00:00.000Z","toTime":"2023-02-05T03:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 04:00:32.612582+00', + updatedAt: '2023-02-05 04:00:32.612582+00', + countryCode: 'IND', + }, + { + id: 222, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 04:00:00+00', + certificate_issuance_enddate: '2023-02-05 04:55:00+00', + readvalue_watthour: 105000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"105000","fromTime":"2023-02-05T04:00:00.000Z","toTime":"2023-02-05T04:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 05:00:32.509482+00', + updatedAt: '2023-02-05 05:00:32.509482+00', + countryCode: 'IND', + }, + { + id: 223, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 04:55:00+00', + certificate_issuance_enddate: '2023-02-05 05:55:00+00', + readvalue_watthour: 141000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"141000","fromTime":"2023-02-05T04:55:00.000Z","toTime":"2023-02-05T05:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 06:00:32.615283+00', + updatedAt: '2023-02-05 06:00:32.615283+00', + countryCode: 'IND', + }, + { + id: 224, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 05:55:00+00', + certificate_issuance_enddate: '2023-02-05 06:55:00+00', + readvalue_watthour: 148000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"148000","fromTime":"2023-02-05T05:55:00.000Z","toTime":"2023-02-05T06:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 07:00:32.220717+00', + updatedAt: '2023-02-05 07:00:32.220717+00', + countryCode: 'IND', + }, + { + id: 225, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 07:00:00+00', + certificate_issuance_enddate: '2023-02-05 07:55:00+00', + readvalue_watthour: 151000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"151000","fromTime":"2023-02-05T07:00:00.000Z","toTime":"2023-02-05T07:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 08:00:33.009528+00', + updatedAt: '2023-02-05 08:00:33.009528+00', + countryCode: 'IND', + }, + { + id: 226, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 08:00:00+00', + certificate_issuance_enddate: '2023-02-05 08:55:00+00', + readvalue_watthour: 117000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"117000","fromTime":"2023-02-05T08:00:00.000Z","toTime":"2023-02-05T08:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 09:00:32.613953+00', + updatedAt: '2023-02-05 09:00:32.613953+00', + countryCode: 'IND', + }, + { + id: 227, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 09:00:00+00', + certificate_issuance_enddate: '2023-02-05 09:55:00+00', + readvalue_watthour: 103000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"103000","fromTime":"2023-02-05T09:00:00.000Z","toTime":"2023-02-05T09:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 10:00:32.511769+00', + updatedAt: '2023-02-05 10:00:32.511769+00', + countryCode: 'IND', + }, + { + id: 228, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 10:00:00+00', + certificate_issuance_enddate: '2023-02-05 10:55:00+00', + readvalue_watthour: 55000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"55000","fromTime":"2023-02-05T10:00:00.000Z","toTime":"2023-02-05T10:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 11:00:32.213753+00', + updatedAt: '2023-02-05 11:00:32.213753+00', + countryCode: 'IND', + }, + { + id: 229, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 11:00:00+00', + certificate_issuance_enddate: '2023-02-05 11:55:00+00', + readvalue_watthour: 21000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"21000","fromTime":"2023-02-05T11:00:00.000Z","toTime":"2023-02-05T11:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 12:00:33.013501+00', + updatedAt: '2023-02-05 12:00:33.013501+00', + countryCode: 'IND', + }, + { + id: 230, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 12:00:00+00', + certificate_issuance_enddate: '2023-02-05 12:55:00+00', + readvalue_watthour: 2000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"2000","fromTime":"2023-02-05T12:00:00.000Z","toTime":"2023-02-05T12:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 13:00:32.634831+00', + updatedAt: '2023-02-05 13:00:32.634831+00', + countryCode: 'IND', + }, + { + id: 231, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-05 21:45:00+00', + certificate_issuance_enddate: '2023-02-05 22:55:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"1000","fromTime":"2023-02-05T21:45:00.000Z","toTime":"2023-02-05T22:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-05 23:00:32.610542+00', + updatedAt: '2023-02-05 23:00:32.610542+00', + countryCode: 'IND', + }, + { + id: 232, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 00:40:00+00', + certificate_issuance_enddate: '2023-02-06 01:55:00+00', + readvalue_watthour: 4000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"4000","fromTime":"2023-02-06T00:40:00.000Z","toTime":"2023-02-06T01:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 02:00:31.912175+00', + updatedAt: '2023-02-06 02:00:31.912175+00', + countryCode: 'IND', + }, + { + id: 233, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 02:00:00+00', + certificate_issuance_enddate: '2023-02-06 02:55:00+00', + readvalue_watthour: 33000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"33000","fromTime":"2023-02-06T02:00:00.000Z","toTime":"2023-02-06T02:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 03:00:35.107819+00', + updatedAt: '2023-02-06 03:00:35.107819+00', + countryCode: 'IND', + }, + { + id: 234, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 03:00:00+00', + certificate_issuance_enddate: '2023-02-06 03:55:00+00', + readvalue_watthour: 67000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"67000","fromTime":"2023-02-06T03:00:00.000Z","toTime":"2023-02-06T03:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 04:00:33.407299+00', + updatedAt: '2023-02-06 04:00:33.407299+00', + countryCode: 'IND', + }, + { + id: 235, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 04:00:00+00', + certificate_issuance_enddate: '2023-02-06 04:55:00+00', + readvalue_watthour: 102000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"102000","fromTime":"2023-02-06T04:00:00.000Z","toTime":"2023-02-06T04:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 05:00:33.017248+00', + updatedAt: '2023-02-06 05:00:33.017248+00', + countryCode: 'IND', + }, + { + id: 236, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 05:00:00+00', + certificate_issuance_enddate: '2023-02-06 05:55:00+00', + readvalue_watthour: 141000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"141000","fromTime":"2023-02-06T05:00:00.000Z","toTime":"2023-02-06T05:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 06:00:32.709168+00', + updatedAt: '2023-02-06 06:00:32.709168+00', + countryCode: 'IND', + }, + { + id: 237, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 06:00:00+00', + certificate_issuance_enddate: '2023-02-06 06:55:00+00', + readvalue_watthour: 144000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"144000","fromTime":"2023-02-06T06:00:00.000Z","toTime":"2023-02-06T06:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 07:00:33.108454+00', + updatedAt: '2023-02-06 07:00:33.108454+00', + countryCode: 'IND', + }, + { + id: 238, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 07:00:00+00', + certificate_issuance_enddate: '2023-02-06 07:55:00+00', + readvalue_watthour: 149000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"149000","fromTime":"2023-02-06T07:00:00.000Z","toTime":"2023-02-06T07:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 08:00:32.714917+00', + updatedAt: '2023-02-06 08:00:32.714917+00', + countryCode: 'IND', + }, + { + id: 239, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 08:00:00+00', + certificate_issuance_enddate: '2023-02-06 08:55:00+00', + readvalue_watthour: 140000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"140000","fromTime":"2023-02-06T08:00:00.000Z","toTime":"2023-02-06T08:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 09:00:32.91881+00', + updatedAt: '2023-02-06 09:00:32.91881+00', + countryCode: 'IND', + }, + { + id: 240, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 09:00:00+00', + certificate_issuance_enddate: '2023-02-06 09:55:00+00', + readvalue_watthour: 98000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"98000","fromTime":"2023-02-06T09:00:00.000Z","toTime":"2023-02-06T09:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 10:00:34.717611+00', + updatedAt: '2023-02-06 10:00:34.717611+00', + countryCode: 'IND', + }, + { + id: 241, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 10:00:00+00', + certificate_issuance_enddate: '2023-02-06 10:55:00+00', + readvalue_watthour: 60000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"60000","fromTime":"2023-02-06T10:00:00.000Z","toTime":"2023-02-06T10:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 11:00:33.30878+00', + updatedAt: '2023-02-06 11:00:33.30878+00', + countryCode: 'IND', + }, + { + id: 242, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 11:00:00+00', + certificate_issuance_enddate: '2023-02-06 11:55:00+00', + readvalue_watthour: 22000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"22000","fromTime":"2023-02-06T11:00:00.000Z","toTime":"2023-02-06T11:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 12:00:32.917498+00', + updatedAt: '2023-02-06 12:00:32.917498+00', + countryCode: 'IND', + }, + { + id: 243, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-06 12:00:00+00', + certificate_issuance_enddate: '2023-02-06 12:35:00+00', + readvalue_watthour: 2000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"2000","fromTime":"2023-02-06T12:00:00.000Z","toTime":"2023-02-06T12:35:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-06 13:00:32.511225+00', + updatedAt: '2023-02-06 13:00:32.511225+00', + countryCode: 'IND', + }, + { + id: 244, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 00:45:00+00', + certificate_issuance_enddate: '2023-02-07 01:55:00+00', + readvalue_watthour: 5000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"5000","fromTime":"2023-02-07T00:45:00.000Z","toTime":"2023-02-07T01:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 02:00:32.115526+00', + updatedAt: '2023-02-07 02:00:32.115526+00', + countryCode: 'IND', + }, + { + id: 245, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 02:00:00+00', + certificate_issuance_enddate: '2023-02-07 02:55:00+00', + readvalue_watthour: 34000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"34000","fromTime":"2023-02-07T02:00:00.000Z","toTime":"2023-02-07T02:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 03:00:32.715513+00', + updatedAt: '2023-02-07 03:00:32.715513+00', + countryCode: 'IND', + }, + { + id: 246, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 03:00:00+00', + certificate_issuance_enddate: '2023-02-07 03:55:00+00', + readvalue_watthour: 73000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"73000","fromTime":"2023-02-07T03:00:00.000Z","toTime":"2023-02-07T03:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 04:00:32.91131+00', + updatedAt: '2023-02-07 04:00:32.91131+00', + countryCode: 'IND', + }, + { + id: 247, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 04:00:00+00', + certificate_issuance_enddate: '2023-02-07 04:55:00+00', + readvalue_watthour: 103000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"103000","fromTime":"2023-02-07T04:00:00.000Z","toTime":"2023-02-07T04:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 05:00:32.523234+00', + updatedAt: '2023-02-07 05:00:32.523234+00', + countryCode: 'IND', + }, + { + id: 248, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 05:00:00+00', + certificate_issuance_enddate: '2023-02-07 05:55:00+00', + readvalue_watthour: 141000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"141000","fromTime":"2023-02-07T05:00:00.000Z","toTime":"2023-02-07T05:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 06:00:32.718138+00', + updatedAt: '2023-02-07 06:00:32.718138+00', + countryCode: 'IND', + }, + { + id: 249, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 06:00:00+00', + certificate_issuance_enddate: '2023-02-07 06:55:00+00', + readvalue_watthour: 151000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"151000","fromTime":"2023-02-07T06:00:00.000Z","toTime":"2023-02-07T06:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 07:00:32.520071+00', + updatedAt: '2023-02-07 07:00:32.520071+00', + countryCode: 'IND', + }, + { + id: 250, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 07:00:00+00', + certificate_issuance_enddate: '2023-02-07 07:55:00+00', + readvalue_watthour: 136000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"136000","fromTime":"2023-02-07T07:00:00.000Z","toTime":"2023-02-07T07:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 08:00:32.021667+00', + updatedAt: '2023-02-07 08:00:32.021667+00', + countryCode: 'IND', + }, + { + id: 251, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 08:00:00+00', + certificate_issuance_enddate: '2023-02-07 08:55:00+00', + readvalue_watthour: 124000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"124000","fromTime":"2023-02-07T08:00:00.000Z","toTime":"2023-02-07T08:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 09:00:32.618056+00', + updatedAt: '2023-02-07 09:00:32.618056+00', + countryCode: 'IND', + }, + { + id: 252, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 09:00:00+00', + certificate_issuance_enddate: '2023-02-07 09:55:00+00', + readvalue_watthour: 100000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"100000","fromTime":"2023-02-07T09:00:00.000Z","toTime":"2023-02-07T09:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 10:00:32.707136+00', + updatedAt: '2023-02-07 10:00:32.707136+00', + countryCode: 'IND', + }, + { + id: 253, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 10:00:00+00', + certificate_issuance_enddate: '2023-02-07 10:55:00+00', + readvalue_watthour: 67000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"67000","fromTime":"2023-02-07T10:00:00.000Z","toTime":"2023-02-07T10:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 11:00:32.516584+00', + updatedAt: '2023-02-07 11:00:32.516584+00', + countryCode: 'IND', + }, + { + id: 254, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 11:00:00+00', + certificate_issuance_enddate: '2023-02-07 11:55:00+00', + readvalue_watthour: 27000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"27000","fromTime":"2023-02-07T11:00:00.000Z","toTime":"2023-02-07T11:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 12:00:32.109999+00', + updatedAt: '2023-02-07 12:00:32.109999+00', + countryCode: 'IND', + }, + { + id: 255, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-07 12:00:00+00', + certificate_issuance_enddate: '2023-02-07 12:35:00+00', + readvalue_watthour: 2000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"2000","fromTime":"2023-02-07T12:00:00.000Z","toTime":"2023-02-07T12:35:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-07 13:00:32.616885+00', + updatedAt: '2023-02-07 13:00:32.616885+00', + countryCode: 'IND', + }, + { + id: 256, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 00:50:00+00', + certificate_issuance_enddate: '2023-02-08 01:55:00+00', + readvalue_watthour: 5000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"5000","fromTime":"2023-02-08T00:50:00.000Z","toTime":"2023-02-08T01:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 02:00:32.716963+00', + updatedAt: '2023-02-08 02:00:32.716963+00', + countryCode: 'IND', + }, + { + id: 257, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 02:00:00+00', + certificate_issuance_enddate: '2023-02-08 02:55:00+00', + readvalue_watthour: 31000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"31000","fromTime":"2023-02-08T02:00:00.000Z","toTime":"2023-02-08T02:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 03:00:32.915916+00', + updatedAt: '2023-02-08 03:00:32.915916+00', + countryCode: 'IND', + }, + { + id: 258, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 03:00:00+00', + certificate_issuance_enddate: '2023-02-08 03:55:00+00', + readvalue_watthour: 71000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"71000","fromTime":"2023-02-08T03:00:00.000Z","toTime":"2023-02-08T03:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 04:00:32.113023+00', + updatedAt: '2023-02-08 04:00:32.113023+00', + countryCode: 'IND', + }, + { + id: 259, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 04:00:00+00', + certificate_issuance_enddate: '2023-02-08 04:55:00+00', + readvalue_watthour: 109000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"109000","fromTime":"2023-02-08T04:00:00.000Z","toTime":"2023-02-08T04:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 05:00:32.109458+00', + updatedAt: '2023-02-08 05:00:32.109458+00', + countryCode: 'IND', + }, + { + id: 260, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 05:00:00+00', + certificate_issuance_enddate: '2023-02-08 05:55:00+00', + readvalue_watthour: 140000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"140000","fromTime":"2023-02-08T05:00:00.000Z","toTime":"2023-02-08T05:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 06:00:32.212049+00', + updatedAt: '2023-02-08 06:00:32.212049+00', + countryCode: 'IND', + }, + { + id: 261, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 06:00:00+00', + certificate_issuance_enddate: '2023-02-08 06:55:00+00', + readvalue_watthour: 146000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"146000","fromTime":"2023-02-08T06:00:00.000Z","toTime":"2023-02-08T06:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 07:00:32.321027+00', + updatedAt: '2023-02-08 07:00:32.321027+00', + countryCode: 'IND', + }, + { + id: 262, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 07:00:00+00', + certificate_issuance_enddate: '2023-02-08 07:55:00+00', + readvalue_watthour: 147000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"147000","fromTime":"2023-02-08T07:00:00.000Z","toTime":"2023-02-08T07:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 08:00:32.809136+00', + updatedAt: '2023-02-08 08:00:32.809136+00', + countryCode: 'IND', + }, + { + id: 263, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 08:00:00+00', + certificate_issuance_enddate: '2023-02-08 08:55:00+00', + readvalue_watthour: 130000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"130000","fromTime":"2023-02-08T08:00:00.000Z","toTime":"2023-02-08T08:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 09:00:32.41981+00', + updatedAt: '2023-02-08 09:00:32.41981+00', + countryCode: 'IND', + }, + { + id: 264, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 09:00:00+00', + certificate_issuance_enddate: '2023-02-08 09:55:00+00', + readvalue_watthour: 103000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"103000","fromTime":"2023-02-08T09:00:00.000Z","toTime":"2023-02-08T09:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 10:00:32.313169+00', + updatedAt: '2023-02-08 10:00:32.313169+00', + countryCode: 'IND', + }, + { + id: 265, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 10:00:00+00', + certificate_issuance_enddate: '2023-02-08 10:55:00+00', + readvalue_watthour: 62000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"62000","fromTime":"2023-02-08T10:00:00.000Z","toTime":"2023-02-08T10:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 11:00:32.907894+00', + updatedAt: '2023-02-08 11:00:32.907894+00', + countryCode: 'IND', + }, + { + id: 266, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 10:55:00+00', + certificate_issuance_enddate: '2023-02-08 11:55:00+00', + readvalue_watthour: 20000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"20000","fromTime":"2023-02-08T10:55:00.000Z","toTime":"2023-02-08T11:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 12:00:32.317171+00', + updatedAt: '2023-02-08 12:00:32.317171+00', + countryCode: 'IND', + }, + { + id: 267, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 12:00:00+00', + certificate_issuance_enddate: '2023-02-08 12:40:00+00', + readvalue_watthour: 2000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"2000","fromTime":"2023-02-08T12:00:00.000Z","toTime":"2023-02-08T12:40:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-08 13:00:32.908458+00', + updatedAt: '2023-02-08 13:00:32.908458+00', + countryCode: 'IND', + }, + { + id: 268, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-08 23:55:00+00', + certificate_issuance_enddate: '2023-02-09 00:50:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"1000","fromTime":"2023-02-08T23:55:00.000Z","toTime":"2023-02-09T00:50:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 01:00:35.316708+00', + updatedAt: '2023-02-09 01:00:35.316708+00', + countryCode: 'IND', + }, + { + id: 269, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 00:45:00+00', + certificate_issuance_enddate: '2023-02-09 01:55:00+00', + readvalue_watthour: 5000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"5000","fromTime":"2023-02-09T00:45:00.000Z","toTime":"2023-02-09T01:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 02:00:35.507684+00', + updatedAt: '2023-02-09 02:00:35.507684+00', + countryCode: 'IND', + }, + { + id: 270, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 02:00:00+00', + certificate_issuance_enddate: '2023-02-09 02:55:00+00', + readvalue_watthour: 34000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"34000","fromTime":"2023-02-09T02:00:00.000Z","toTime":"2023-02-09T02:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 03:00:32.6375+00', + updatedAt: '2023-02-09 03:00:32.6375+00', + countryCode: 'IND', + }, + { + id: 271, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 03:00:00+00', + certificate_issuance_enddate: '2023-02-09 03:55:00+00', + readvalue_watthour: 74000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"74000","fromTime":"2023-02-09T03:00:00.000Z","toTime":"2023-02-09T03:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 04:00:32.928477+00', + updatedAt: '2023-02-09 04:00:32.928477+00', + countryCode: 'IND', + }, + { + id: 272, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 04:00:00+00', + certificate_issuance_enddate: '2023-02-09 04:55:00+00', + readvalue_watthour: 111000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"111000","fromTime":"2023-02-09T04:00:00.000Z","toTime":"2023-02-09T04:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 05:00:32.532502+00', + updatedAt: '2023-02-09 05:00:32.532502+00', + countryCode: 'IND', + }, + { + id: 273, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 05:00:00+00', + certificate_issuance_enddate: '2023-02-09 05:55:00+00', + readvalue_watthour: 137000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"137000","fromTime":"2023-02-09T05:00:00.000Z","toTime":"2023-02-09T05:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 06:00:33.008597+00', + updatedAt: '2023-02-09 06:00:33.008597+00', + countryCode: 'IND', + }, + { + id: 274, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 06:00:00+00', + certificate_issuance_enddate: '2023-02-09 06:55:00+00', + readvalue_watthour: 147000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"147000","fromTime":"2023-02-09T06:00:00.000Z","toTime":"2023-02-09T06:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 07:00:32.811034+00', + updatedAt: '2023-02-09 07:00:32.811034+00', + countryCode: 'IND', + }, + { + id: 275, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 08:00:00+00', + certificate_issuance_enddate: '2023-02-09 08:55:00+00', + readvalue_watthour: 105000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"105000","fromTime":"2023-02-09T08:00:00.000Z","toTime":"2023-02-09T08:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 09:00:32.810319+00', + updatedAt: '2023-02-09 09:00:32.810319+00', + countryCode: 'IND', + }, + { + id: 276, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 09:00:00+00', + certificate_issuance_enddate: '2023-02-09 09:55:00+00', + readvalue_watthour: 105000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"105000","fromTime":"2023-02-09T09:00:00.000Z","toTime":"2023-02-09T09:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 10:00:32.918848+00', + updatedAt: '2023-02-09 10:00:32.918848+00', + countryCode: 'IND', + }, + { + id: 277, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 10:00:00+00', + certificate_issuance_enddate: '2023-02-09 10:55:00+00', + readvalue_watthour: 49000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"49000","fromTime":"2023-02-09T10:00:00.000Z","toTime":"2023-02-09T10:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 11:00:33.30755+00', + updatedAt: '2023-02-09 11:00:33.30755+00', + countryCode: 'IND', + }, + { + id: 278, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 11:00:00+00', + certificate_issuance_enddate: '2023-02-09 11:55:00+00', + readvalue_watthour: 18000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"18000","fromTime":"2023-02-09T11:00:00.000Z","toTime":"2023-02-09T11:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 12:00:35.312202+00', + updatedAt: '2023-02-09 12:00:35.312202+00', + countryCode: 'IND', + }, + { + id: 279, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 12:00:00+00', + certificate_issuance_enddate: '2023-02-09 12:50:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"1000","fromTime":"2023-02-09T12:00:00.000Z","toTime":"2023-02-09T12:50:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 13:00:32.910955+00', + updatedAt: '2023-02-09 13:00:32.910955+00', + countryCode: 'IND', + }, + { + id: 280, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-09 20:35:00+00', + certificate_issuance_enddate: '2023-02-09 21:55:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"1000","fromTime":"2023-02-09T20:35:00.000Z","toTime":"2023-02-09T21:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-09 22:00:31.738005+00', + updatedAt: '2023-02-09 22:00:31.738005+00', + countryCode: 'IND', + }, + { + id: 281, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 00:55:00+00', + certificate_issuance_enddate: '2023-02-10 01:55:00+00', + readvalue_watthour: 6000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"6000","fromTime":"2023-02-10T00:55:00.000Z","toTime":"2023-02-10T01:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 02:00:32.414981+00', + updatedAt: '2023-02-10 02:00:32.414981+00', + countryCode: 'IND', + }, + { + id: 282, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 02:00:00+00', + certificate_issuance_enddate: '2023-02-10 02:55:00+00', + readvalue_watthour: 35000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"35000","fromTime":"2023-02-10T02:00:00.000Z","toTime":"2023-02-10T02:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 03:00:35.430563+00', + updatedAt: '2023-02-10 03:00:35.430563+00', + countryCode: 'IND', + }, + { + id: 283, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 03:00:00+00', + certificate_issuance_enddate: '2023-02-10 03:55:00+00', + readvalue_watthour: 74000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"74000","fromTime":"2023-02-10T03:00:00.000Z","toTime":"2023-02-10T03:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 04:00:32.611211+00', + updatedAt: '2023-02-10 04:00:32.611211+00', + countryCode: 'IND', + }, + { + id: 284, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 04:00:00+00', + certificate_issuance_enddate: '2023-02-10 04:55:00+00', + readvalue_watthour: 120000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"120000","fromTime":"2023-02-10T04:00:00.000Z","toTime":"2023-02-10T04:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 05:00:32.913791+00', + updatedAt: '2023-02-10 05:00:32.913791+00', + countryCode: 'IND', + }, + { + id: 285, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 05:00:00+00', + certificate_issuance_enddate: '2023-02-10 05:55:00+00', + readvalue_watthour: 143000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"143000","fromTime":"2023-02-10T05:00:00.000Z","toTime":"2023-02-10T05:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 06:00:32.01779+00', + updatedAt: '2023-02-10 06:00:32.01779+00', + countryCode: 'IND', + }, + { + id: 286, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 06:00:00+00', + certificate_issuance_enddate: '2023-02-10 06:55:00+00', + readvalue_watthour: 157000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"157000","fromTime":"2023-02-10T06:00:00.000Z","toTime":"2023-02-10T06:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 07:00:32.617217+00', + updatedAt: '2023-02-10 07:00:32.617217+00', + countryCode: 'IND', + }, + { + id: 287, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 07:00:00+00', + certificate_issuance_enddate: '2023-02-10 07:55:00+00', + readvalue_watthour: 127000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"127000","fromTime":"2023-02-10T07:00:00.000Z","toTime":"2023-02-10T07:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 08:00:34.611015+00', + updatedAt: '2023-02-10 08:00:34.611015+00', + countryCode: 'IND', + }, + { + id: 288, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 08:00:00+00', + certificate_issuance_enddate: '2023-02-10 08:55:00+00', + readvalue_watthour: 138000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"138000","fromTime":"2023-02-10T08:00:00.000Z","toTime":"2023-02-10T08:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 09:00:32.310751+00', + updatedAt: '2023-02-10 09:00:32.310751+00', + countryCode: 'IND', + }, + { + id: 289, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 09:00:00+00', + certificate_issuance_enddate: '2023-02-10 09:55:00+00', + readvalue_watthour: 105000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"105000","fromTime":"2023-02-10T09:00:00.000Z","toTime":"2023-02-10T09:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 10:00:32.110596+00', + updatedAt: '2023-02-10 10:00:32.110596+00', + countryCode: 'IND', + }, + { + id: 290, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 10:00:00+00', + certificate_issuance_enddate: '2023-02-10 10:55:00+00', + readvalue_watthour: 74000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"74000","fromTime":"2023-02-10T10:00:00.000Z","toTime":"2023-02-10T10:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 11:00:32.727205+00', + updatedAt: '2023-02-10 11:00:32.727205+00', + countryCode: 'IND', + }, + { + id: 291, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 11:00:00+00', + certificate_issuance_enddate: '2023-02-10 11:55:00+00', + readvalue_watthour: 29000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"29000","fromTime":"2023-02-10T11:00:00.000Z","toTime":"2023-02-10T11:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 12:00:33.40823+00', + updatedAt: '2023-02-10 12:00:33.40823+00', + countryCode: 'IND', + }, + { + id: 292, + groupid: 14, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-10 12:00:00+00', + certificate_issuance_enddate: '2023-02-10 12:40:00+00', + readvalue_watthour: 3000, + status: 'Requested', + certificate_payload: + '{"deviceId":"14","energyValue":"3000","fromTime":"2023-02-10T12:00:00.000Z","toTime":"2023-02-10T12:40:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}}', + createdAt: '2023-02-10 13:00:32.210311+00', + updatedAt: '2023-02-10 13:00:32.210311+00', + countryCode: 'IND', + }, + { + id: 293, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-11 00:45:00+00', + certificate_issuance_enddate: '2023-02-11 02:00:00+00', + readvalue_watthour: 6000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"6000","fromTime":"2023-02-11T00:45:00.000Z","toTime":"2023-02-11T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:42:32.108312+00', + updatedAt: '2023-02-18 16:42:32.108312+00', + countryCode: 'IND', + }, + { + id: 294, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-11 02:00:00+00', + certificate_issuance_enddate: '2023-02-11 03:00:00+00', + readvalue_watthour: 43000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"43000","fromTime":"2023-02-11T02:00:00.000Z","toTime":"2023-02-11T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:43:02.212533+00', + updatedAt: '2023-02-18 16:43:02.212533+00', + countryCode: 'IND', + }, + { + id: 295, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-11 03:00:00+00', + certificate_issuance_enddate: '2023-02-11 03:50:00+00', + readvalue_watthour: 34000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"34000","fromTime":"2023-02-11T03:00:00.000Z","toTime":"2023-02-11T03:50:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:43:32.811349+00', + updatedAt: '2023-02-18 16:43:32.811349+00', + countryCode: 'IND', + }, + { + id: 296, + groupid: 18, + issuer_certificate_id: null, + certificate_issuance_startdate: '2022-12-31 18:30:01+00', + certificate_issuance_enddate: '2023-01-31 18:29:59+00', + readvalue_watthour: 1681000, + status: 'Requested', + certificate_payload: + '{"deviceId":"18","energyValue":"1681000","fromTime":"2022-12-31T18:30:01.000Z","toTime":"2023-01-31T18:29:59.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"20ff2e72-d47b-4bd7-aeee-c3b4e6e1ef2b","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"18"}}', + createdAt: '2023-02-18 16:44:33.61728+00', + updatedAt: '2023-02-18 16:44:33.61728+00', + countryCode: 'IND', + }, + { + id: 297, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-11 03:15:00+00', + certificate_issuance_enddate: '2023-02-11 10:00:00+00', + readvalue_watthour: 12000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"12000","fromTime":"2023-02-11T03:15:00.000Z","toTime":"2023-02-11T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:46:32.009787+00', + updatedAt: '2023-02-18 16:46:32.009787+00', + countryCode: 'IND', + }, + { + id: 298, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-11 10:00:00+00', + certificate_issuance_enddate: '2023-02-11 11:00:00+00', + readvalue_watthour: 41000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"41000","fromTime":"2023-02-11T10:00:00.000Z","toTime":"2023-02-11T11:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:47:01.830367+00', + updatedAt: '2023-02-18 16:47:01.830367+00', + countryCode: 'IND', + }, + { + id: 299, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-11 11:00:00+00', + certificate_issuance_enddate: '2023-02-11 12:00:00+00', + readvalue_watthour: 18000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"18000","fromTime":"2023-02-11T11:00:00.000Z","toTime":"2023-02-11T12:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:47:32.713227+00', + updatedAt: '2023-02-18 16:47:32.713227+00', + countryCode: 'IND', + }, + { + id: 300, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-11 03:50:00+00', + certificate_issuance_enddate: '2023-02-11 12:45:00+00', + readvalue_watthour: 3000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"3000","fromTime":"2023-02-11T03:50:00.000Z","toTime":"2023-02-11T12:45:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:48:02.333953+00', + updatedAt: '2023-02-18 16:48:02.333953+00', + countryCode: 'IND', + }, + { + id: 301, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-11 13:50:00+00', + certificate_issuance_enddate: '2023-02-11 14:55:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-11T13:50:00.000Z","toTime":"2023-02-11T14:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:49:02.547883+00', + updatedAt: '2023-02-18 16:49:02.547883+00', + countryCode: 'IND', + }, + { + id: 302, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 00:45:00+00', + certificate_issuance_enddate: '2023-02-12 02:00:00+00', + readvalue_watthour: 6000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"6000","fromTime":"2023-02-12T00:45:00.000Z","toTime":"2023-02-12T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:54:31.732017+00', + updatedAt: '2023-02-18 16:54:31.732017+00', + countryCode: 'IND', + }, + { + id: 303, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 02:00:00+00', + certificate_issuance_enddate: '2023-02-12 03:00:00+00', + readvalue_watthour: 31000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"31000","fromTime":"2023-02-12T02:00:00.000Z","toTime":"2023-02-12T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:55:02.910588+00', + updatedAt: '2023-02-18 16:55:02.910588+00', + countryCode: 'IND', + }, + { + id: 304, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 03:00:00+00', + certificate_issuance_enddate: '2023-02-12 04:00:00+00', + readvalue_watthour: 64000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"64000","fromTime":"2023-02-12T03:00:00.000Z","toTime":"2023-02-12T04:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:55:31.735581+00', + updatedAt: '2023-02-18 16:55:31.735581+00', + countryCode: 'IND', + }, + { + id: 305, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 04:00:00+00', + certificate_issuance_enddate: '2023-02-12 05:00:00+00', + readvalue_watthour: 90000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"90000","fromTime":"2023-02-12T04:00:00.000Z","toTime":"2023-02-12T05:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:56:02.029619+00', + updatedAt: '2023-02-18 16:56:02.029619+00', + countryCode: 'IND', + }, + { + id: 306, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 05:00:00+00', + certificate_issuance_enddate: '2023-02-12 06:00:00+00', + readvalue_watthour: 107000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"107000","fromTime":"2023-02-12T05:00:00.000Z","toTime":"2023-02-12T06:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:56:32.326168+00', + updatedAt: '2023-02-18 16:56:32.326168+00', + countryCode: 'IND', + }, + { + id: 307, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 06:00:00+00', + certificate_issuance_enddate: '2023-02-12 07:00:00+00', + readvalue_watthour: 107000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"107000","fromTime":"2023-02-12T06:00:00.000Z","toTime":"2023-02-12T07:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:57:02.715344+00', + updatedAt: '2023-02-18 16:57:02.715344+00', + countryCode: 'IND', + }, + { + id: 308, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 07:00:00+00', + certificate_issuance_enddate: '2023-02-12 08:00:00+00', + readvalue_watthour: 96000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"96000","fromTime":"2023-02-12T07:00:00.000Z","toTime":"2023-02-12T08:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:57:32.509932+00', + updatedAt: '2023-02-18 16:57:32.509932+00', + countryCode: 'IND', + }, + { + id: 309, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 08:00:00+00', + certificate_issuance_enddate: '2023-02-12 09:00:00+00', + readvalue_watthour: 93000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"93000","fromTime":"2023-02-12T08:00:00.000Z","toTime":"2023-02-12T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:58:02.31382+00', + updatedAt: '2023-02-18 16:58:02.31382+00', + countryCode: 'IND', + }, + { + id: 310, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 09:00:00+00', + certificate_issuance_enddate: '2023-02-12 10:00:00+00', + readvalue_watthour: 78000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"78000","fromTime":"2023-02-12T09:00:00.000Z","toTime":"2023-02-12T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:58:31.709044+00', + updatedAt: '2023-02-18 16:58:31.709044+00', + countryCode: 'IND', + }, + { + id: 311, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 10:00:00+00', + certificate_issuance_enddate: '2023-02-12 11:00:00+00', + readvalue_watthour: 50000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"50000","fromTime":"2023-02-12T10:00:00.000Z","toTime":"2023-02-12T11:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:59:02.211138+00', + updatedAt: '2023-02-18 16:59:02.211138+00', + countryCode: 'IND', + }, + { + id: 312, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 11:00:00+00', + certificate_issuance_enddate: '2023-02-12 12:00:00+00', + readvalue_watthour: 20000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"20000","fromTime":"2023-02-12T11:00:00.000Z","toTime":"2023-02-12T12:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 16:59:32.710128+00', + updatedAt: '2023-02-18 16:59:32.710128+00', + countryCode: 'IND', + }, + { + id: 313, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 12:00:00+00', + certificate_issuance_enddate: '2023-02-12 12:50:00+00', + readvalue_watthour: 2000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"2000","fromTime":"2023-02-12T12:00:00.000Z","toTime":"2023-02-12T12:50:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:00:02.909316+00', + updatedAt: '2023-02-18 17:00:02.909316+00', + countryCode: 'IND', + }, + { + id: 314, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-12 20:45:00+00', + certificate_issuance_enddate: '2023-02-12 22:00:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-12T20:45:00.000Z","toTime":"2023-02-12T22:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:04:31.813319+00', + updatedAt: '2023-02-18 17:04:31.813319+00', + countryCode: 'IND', + }, + { + id: 315, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 00:45:00+00', + certificate_issuance_enddate: '2023-02-13 02:00:00+00', + readvalue_watthour: 5000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"5000","fromTime":"2023-02-13T00:45:00.000Z","toTime":"2023-02-13T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:06:32.41899+00', + updatedAt: '2023-02-18 17:06:32.41899+00', + countryCode: 'IND', + }, + { + id: 316, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 02:00:00+00', + certificate_issuance_enddate: '2023-02-13 03:00:00+00', + readvalue_watthour: 33000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"33000","fromTime":"2023-02-13T02:00:00.000Z","toTime":"2023-02-13T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:07:02.215389+00', + updatedAt: '2023-02-18 17:07:02.215389+00', + countryCode: 'IND', + }, + { + id: 317, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-11 16:00:00+00', + certificate_issuance_enddate: '2023-02-13 04:00:00+00', + readvalue_watthour: 480000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"480000","fromTime":"2023-02-11T16:00:00.000Z","toTime":"2023-02-13T04:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:07:32.211854+00', + updatedAt: '2023-02-18 17:07:32.211854+00', + countryCode: 'IND', + }, + { + id: 318, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 04:00:00+00', + certificate_issuance_enddate: '2023-02-13 05:00:00+00', + readvalue_watthour: 143000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"143000","fromTime":"2023-02-13T04:00:00.000Z","toTime":"2023-02-13T05:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:08:02.137561+00', + updatedAt: '2023-02-18 17:08:02.137561+00', + countryCode: 'IND', + }, + { + id: 319, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 05:00:00+00', + certificate_issuance_enddate: '2023-02-13 06:00:00+00', + readvalue_watthour: 167000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"167000","fromTime":"2023-02-13T05:00:00.000Z","toTime":"2023-02-13T06:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:08:31.617434+00', + updatedAt: '2023-02-18 17:08:31.617434+00', + countryCode: 'IND', + }, + { + id: 320, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 06:00:00+00', + certificate_issuance_enddate: '2023-02-13 07:00:00+00', + readvalue_watthour: 180000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"180000","fromTime":"2023-02-13T06:00:00.000Z","toTime":"2023-02-13T07:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:09:02.917334+00', + updatedAt: '2023-02-18 17:09:02.917334+00', + countryCode: 'IND', + }, + { + id: 321, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 07:00:00+00', + certificate_issuance_enddate: '2023-02-13 08:00:00+00', + readvalue_watthour: 176000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"176000","fromTime":"2023-02-13T07:00:00.000Z","toTime":"2023-02-13T08:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:09:32.214067+00', + updatedAt: '2023-02-18 17:09:32.214067+00', + countryCode: 'IND', + }, + { + id: 322, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 08:00:00+00', + certificate_issuance_enddate: '2023-02-13 09:00:00+00', + readvalue_watthour: 155000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"155000","fromTime":"2023-02-13T08:00:00.000Z","toTime":"2023-02-13T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:10:02.614069+00', + updatedAt: '2023-02-18 17:10:02.614069+00', + countryCode: 'IND', + }, + { + id: 323, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 09:00:00+00', + certificate_issuance_enddate: '2023-02-13 10:00:00+00', + readvalue_watthour: 123000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"123000","fromTime":"2023-02-13T09:00:00.000Z","toTime":"2023-02-13T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:10:31.812788+00', + updatedAt: '2023-02-18 17:10:31.812788+00', + countryCode: 'IND', + }, + { + id: 324, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 10:00:00+00', + certificate_issuance_enddate: '2023-02-13 11:00:00+00', + readvalue_watthour: 82000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"82000","fromTime":"2023-02-13T10:00:00.000Z","toTime":"2023-02-13T11:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:11:02.61827+00', + updatedAt: '2023-02-18 17:11:02.61827+00', + countryCode: 'IND', + }, + { + id: 325, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 11:00:00+00', + certificate_issuance_enddate: '2023-02-13 12:00:00+00', + readvalue_watthour: 32000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"32000","fromTime":"2023-02-13T11:00:00.000Z","toTime":"2023-02-13T12:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:11:31.815697+00', + updatedAt: '2023-02-18 17:11:31.815697+00', + countryCode: 'IND', + }, + { + id: 326, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 12:00:00+00', + certificate_issuance_enddate: '2023-02-13 13:00:00+00', + readvalue_watthour: 3000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"3000","fromTime":"2023-02-13T12:00:00.000Z","toTime":"2023-02-13T13:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:12:02.31245+00', + updatedAt: '2023-02-18 17:12:02.31245+00', + countryCode: 'IND', + }, + { + id: 327, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-13 19:40:00+00', + certificate_issuance_enddate: '2023-02-13 21:00:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-13T19:40:00.000Z","toTime":"2023-02-13T21:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:16:02.313154+00', + updatedAt: '2023-02-18 17:16:02.313154+00', + countryCode: 'IND', + }, + { + id: 328, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 00:45:00+00', + certificate_issuance_enddate: '2023-02-14 02:00:00+00', + readvalue_watthour: 6000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"6000","fromTime":"2023-02-14T00:45:00.000Z","toTime":"2023-02-14T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:18:32.313869+00', + updatedAt: '2023-02-18 17:18:32.313869+00', + countryCode: 'IND', + }, + { + id: 329, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 02:00:00+00', + certificate_issuance_enddate: '2023-02-14 03:00:00+00', + readvalue_watthour: 41000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"41000","fromTime":"2023-02-14T02:00:00.000Z","toTime":"2023-02-14T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:19:02.312426+00', + updatedAt: '2023-02-18 17:19:02.312426+00', + countryCode: 'IND', + }, + { + id: 330, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 03:00:00+00', + certificate_issuance_enddate: '2023-02-14 04:00:00+00', + readvalue_watthour: 90000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"90000","fromTime":"2023-02-14T03:00:00.000Z","toTime":"2023-02-14T04:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:19:32.11579+00', + updatedAt: '2023-02-18 17:19:32.11579+00', + countryCode: 'IND', + }, + { + id: 331, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 04:00:00+00', + certificate_issuance_enddate: '2023-02-14 05:00:00+00', + readvalue_watthour: 127000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"127000","fromTime":"2023-02-14T04:00:00.000Z","toTime":"2023-02-14T05:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:20:02.32195+00', + updatedAt: '2023-02-18 17:20:02.32195+00', + countryCode: 'IND', + }, + { + id: 332, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 05:00:00+00', + certificate_issuance_enddate: '2023-02-14 06:00:00+00', + readvalue_watthour: 148000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"148000","fromTime":"2023-02-14T05:00:00.000Z","toTime":"2023-02-14T06:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:20:33.40854+00', + updatedAt: '2023-02-18 17:20:33.40854+00', + countryCode: 'IND', + }, + { + id: 333, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 06:00:00+00', + certificate_issuance_enddate: '2023-02-14 07:00:00+00', + readvalue_watthour: 162000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"162000","fromTime":"2023-02-14T06:00:00.000Z","toTime":"2023-02-14T07:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:21:02.709378+00', + updatedAt: '2023-02-18 17:21:02.709378+00', + countryCode: 'IND', + }, + { + id: 334, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 06:55:00+00', + certificate_issuance_enddate: '2023-02-14 08:00:00+00', + readvalue_watthour: 136000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"136000","fromTime":"2023-02-14T06:55:00.000Z","toTime":"2023-02-14T08:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:21:31.913707+00', + updatedAt: '2023-02-18 17:21:31.913707+00', + countryCode: 'IND', + }, + { + id: 335, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 08:00:00+00', + certificate_issuance_enddate: '2023-02-14 09:00:00+00', + readvalue_watthour: 155000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"155000","fromTime":"2023-02-14T08:00:00.000Z","toTime":"2023-02-14T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:22:01.933577+00', + updatedAt: '2023-02-18 17:22:01.933577+00', + countryCode: 'IND', + }, + { + id: 336, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 09:00:00+00', + certificate_issuance_enddate: '2023-02-14 10:00:00+00', + readvalue_watthour: 115000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"115000","fromTime":"2023-02-14T09:00:00.000Z","toTime":"2023-02-14T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:22:32.11516+00', + updatedAt: '2023-02-18 17:22:32.11516+00', + countryCode: 'IND', + }, + { + id: 337, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 09:40:00+00', + certificate_issuance_enddate: '2023-02-14 11:00:00+00', + readvalue_watthour: 76000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"76000","fromTime":"2023-02-14T09:40:00.000Z","toTime":"2023-02-14T11:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:23:02.107921+00', + updatedAt: '2023-02-18 17:23:02.107921+00', + countryCode: 'IND', + }, + { + id: 338, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 11:00:00+00', + certificate_issuance_enddate: '2023-02-14 12:00:00+00', + readvalue_watthour: 39000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"39000","fromTime":"2023-02-14T11:00:00.000Z","toTime":"2023-02-14T12:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:23:32.51439+00', + updatedAt: '2023-02-18 17:23:32.51439+00', + countryCode: 'IND', + }, + { + id: 339, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 12:00:00+00', + certificate_issuance_enddate: '2023-02-14 12:45:00+00', + readvalue_watthour: 3000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"3000","fromTime":"2023-02-14T12:00:00.000Z","toTime":"2023-02-14T12:45:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:24:02.419212+00', + updatedAt: '2023-02-18 17:24:02.419212+00', + countryCode: 'IND', + }, + { + id: 340, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-14 19:40:00+00', + certificate_issuance_enddate: '2023-02-14 21:00:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-14T19:40:00.000Z","toTime":"2023-02-14T21:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:28:02.713901+00', + updatedAt: '2023-02-18 17:28:02.713901+00', + countryCode: 'IND', + }, + { + id: 341, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 00:45:00+00', + certificate_issuance_enddate: '2023-02-15 02:00:00+00', + readvalue_watthour: 9000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"9000","fromTime":"2023-02-15T00:45:00.000Z","toTime":"2023-02-15T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:30:32.017616+00', + updatedAt: '2023-02-18 17:30:32.017616+00', + countryCode: 'IND', + }, + { + id: 342, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 02:00:00+00', + certificate_issuance_enddate: '2023-02-15 03:00:00+00', + readvalue_watthour: 51000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"51000","fromTime":"2023-02-15T02:00:00.000Z","toTime":"2023-02-15T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:31:03.110255+00', + updatedAt: '2023-02-18 17:31:03.110255+00', + countryCode: 'IND', + }, + { + id: 343, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 03:00:00+00', + certificate_issuance_enddate: '2023-02-15 04:00:00+00', + readvalue_watthour: 105000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"105000","fromTime":"2023-02-15T03:00:00.000Z","toTime":"2023-02-15T04:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:31:32.019389+00', + updatedAt: '2023-02-18 17:31:32.019389+00', + countryCode: 'IND', + }, + { + id: 344, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 04:00:00+00', + certificate_issuance_enddate: '2023-02-15 05:00:00+00', + readvalue_watthour: 149000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"149000","fromTime":"2023-02-15T04:00:00.000Z","toTime":"2023-02-15T05:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:32:02.715352+00', + updatedAt: '2023-02-18 17:32:02.715352+00', + countryCode: 'IND', + }, + { + id: 345, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 05:00:00+00', + certificate_issuance_enddate: '2023-02-15 06:00:00+00', + readvalue_watthour: 173000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"173000","fromTime":"2023-02-15T05:00:00.000Z","toTime":"2023-02-15T06:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:32:35.211929+00', + updatedAt: '2023-02-18 17:32:35.211929+00', + countryCode: 'IND', + }, + { + id: 346, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 06:00:00+00', + certificate_issuance_enddate: '2023-02-15 07:00:00+00', + readvalue_watthour: 185000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"185000","fromTime":"2023-02-15T06:00:00.000Z","toTime":"2023-02-15T07:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:33:02.317457+00', + updatedAt: '2023-02-18 17:33:02.317457+00', + countryCode: 'IND', + }, + { + id: 347, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 07:00:00+00', + certificate_issuance_enddate: '2023-02-15 08:00:00+00', + readvalue_watthour: 179000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"179000","fromTime":"2023-02-15T07:00:00.000Z","toTime":"2023-02-15T08:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:33:32.21376+00', + updatedAt: '2023-02-18 17:33:32.21376+00', + countryCode: 'IND', + }, + { + id: 348, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 08:00:00+00', + certificate_issuance_enddate: '2023-02-15 09:00:00+00', + readvalue_watthour: 164000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"164000","fromTime":"2023-02-15T08:00:00.000Z","toTime":"2023-02-15T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:34:02.240242+00', + updatedAt: '2023-02-18 17:34:02.240242+00', + countryCode: 'IND', + }, + { + id: 349, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 09:00:00+00', + certificate_issuance_enddate: '2023-02-15 10:00:00+00', + readvalue_watthour: 132000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"132000","fromTime":"2023-02-15T09:00:00.000Z","toTime":"2023-02-15T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:34:32.109304+00', + updatedAt: '2023-02-18 17:34:32.109304+00', + countryCode: 'IND', + }, + { + id: 350, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 10:00:00+00', + certificate_issuance_enddate: '2023-02-15 11:00:00+00', + readvalue_watthour: 84000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"84000","fromTime":"2023-02-15T10:00:00.000Z","toTime":"2023-02-15T11:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:35:02.732312+00', + updatedAt: '2023-02-18 17:35:02.732312+00', + countryCode: 'IND', + }, + { + id: 351, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 11:00:00+00', + certificate_issuance_enddate: '2023-02-15 12:00:00+00', + readvalue_watthour: 34000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"34000","fromTime":"2023-02-15T11:00:00.000Z","toTime":"2023-02-15T12:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:35:32.018237+00', + updatedAt: '2023-02-18 17:35:32.018237+00', + countryCode: 'IND', + }, + { + id: 352, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 12:00:00+00', + certificate_issuance_enddate: '2023-02-15 13:00:00+00', + readvalue_watthour: 3000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"3000","fromTime":"2023-02-15T12:00:00.000Z","toTime":"2023-02-15T13:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:36:02.108851+00', + updatedAt: '2023-02-18 17:36:02.108851+00', + countryCode: 'IND', + }, + { + id: 353, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-15 19:00:00+00', + certificate_issuance_enddate: '2023-02-15 19:55:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-15T19:00:00.000Z","toTime":"2023-02-15T19:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:39:32.613501+00', + updatedAt: '2023-02-18 17:39:32.613501+00', + countryCode: 'IND', + }, + { + id: 354, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 00:55:00+00', + certificate_issuance_enddate: '2023-02-16 02:00:00+00', + readvalue_watthour: 4000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"4000","fromTime":"2023-02-16T00:55:00.000Z","toTime":"2023-02-16T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:42:32.71894+00', + updatedAt: '2023-02-18 17:42:32.71894+00', + countryCode: 'IND', + }, + { + id: 355, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 02:00:00+00', + certificate_issuance_enddate: '2023-02-16 03:00:00+00', + readvalue_watthour: 36000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"36000","fromTime":"2023-02-16T02:00:00.000Z","toTime":"2023-02-16T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:43:02.408471+00', + updatedAt: '2023-02-18 17:43:02.408471+00', + countryCode: 'IND', + }, + { + id: 356, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 03:00:00+00', + certificate_issuance_enddate: '2023-02-16 04:00:00+00', + readvalue_watthour: 82000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"82000","fromTime":"2023-02-16T03:00:00.000Z","toTime":"2023-02-16T04:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:43:32.3124+00', + updatedAt: '2023-02-18 17:43:32.3124+00', + countryCode: 'IND', + }, + { + id: 357, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 04:00:00+00', + certificate_issuance_enddate: '2023-02-16 05:00:00+00', + readvalue_watthour: 138000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"138000","fromTime":"2023-02-16T04:00:00.000Z","toTime":"2023-02-16T05:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:44:03.012038+00', + updatedAt: '2023-02-18 17:44:03.012038+00', + countryCode: 'IND', + }, + { + id: 358, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 05:00:00+00', + certificate_issuance_enddate: '2023-02-16 06:00:00+00', + readvalue_watthour: 164000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"164000","fromTime":"2023-02-16T05:00:00.000Z","toTime":"2023-02-16T06:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:44:32.411275+00', + updatedAt: '2023-02-18 17:44:32.411275+00', + countryCode: 'IND', + }, + { + id: 359, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 06:00:00+00', + certificate_issuance_enddate: '2023-02-16 07:00:00+00', + readvalue_watthour: 176000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"176000","fromTime":"2023-02-16T06:00:00.000Z","toTime":"2023-02-16T07:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:45:02.034386+00', + updatedAt: '2023-02-18 17:45:02.034386+00', + countryCode: 'IND', + }, + { + id: 360, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 07:00:00+00', + certificate_issuance_enddate: '2023-02-16 08:00:00+00', + readvalue_watthour: 176000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"176000","fromTime":"2023-02-16T07:00:00.000Z","toTime":"2023-02-16T08:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:45:32.318161+00', + updatedAt: '2023-02-18 17:45:32.318161+00', + countryCode: 'IND', + }, + { + id: 361, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 08:00:00+00', + certificate_issuance_enddate: '2023-02-16 09:00:00+00', + readvalue_watthour: 159000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"159000","fromTime":"2023-02-16T08:00:00.000Z","toTime":"2023-02-16T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:46:02.216121+00', + updatedAt: '2023-02-18 17:46:02.216121+00', + countryCode: 'IND', + }, + { + id: 362, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 09:00:00+00', + certificate_issuance_enddate: '2023-02-16 10:00:00+00', + readvalue_watthour: 124000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"124000","fromTime":"2023-02-16T09:00:00.000Z","toTime":"2023-02-16T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:46:32.01459+00', + updatedAt: '2023-02-18 17:46:32.01459+00', + countryCode: 'IND', + }, + { + id: 363, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 10:00:00+00', + certificate_issuance_enddate: '2023-02-16 11:00:00+00', + readvalue_watthour: 80000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"80000","fromTime":"2023-02-16T10:00:00.000Z","toTime":"2023-02-16T11:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:47:03.219849+00', + updatedAt: '2023-02-18 17:47:03.219849+00', + countryCode: 'IND', + }, + { + id: 364, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 11:00:00+00', + certificate_issuance_enddate: '2023-02-16 12:00:00+00', + readvalue_watthour: 28000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"28000","fromTime":"2023-02-16T11:00:00.000Z","toTime":"2023-02-16T12:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:47:31.915293+00', + updatedAt: '2023-02-18 17:47:31.915293+00', + countryCode: 'IND', + }, + { + id: 365, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 12:00:00+00', + certificate_issuance_enddate: '2023-02-16 13:00:00+00', + readvalue_watthour: 3000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"3000","fromTime":"2023-02-16T12:00:00.000Z","toTime":"2023-02-16T13:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:48:02.233904+00', + updatedAt: '2023-02-18 17:48:02.233904+00', + countryCode: 'IND', + }, + { + id: 366, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-16 17:50:00+00', + certificate_issuance_enddate: '2023-02-16 19:00:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-16T17:50:00.000Z","toTime":"2023-02-16T19:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:51:02.032712+00', + updatedAt: '2023-02-18 17:51:02.032712+00', + countryCode: 'IND', + }, + { + id: 367, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 00:50:00+00', + certificate_issuance_enddate: '2023-02-17 02:00:00+00', + readvalue_watthour: 4000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"4000","fromTime":"2023-02-17T00:50:00.000Z","toTime":"2023-02-17T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:54:31.812918+00', + updatedAt: '2023-02-18 17:54:31.812918+00', + countryCode: 'IND', + }, + { + id: 368, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 02:00:00+00', + certificate_issuance_enddate: '2023-02-17 03:00:00+00', + readvalue_watthour: 36000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"36000","fromTime":"2023-02-17T02:00:00.000Z","toTime":"2023-02-17T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:55:01.72626+00', + updatedAt: '2023-02-18 17:55:01.72626+00', + countryCode: 'IND', + }, + { + id: 369, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 03:00:00+00', + certificate_issuance_enddate: '2023-02-17 04:00:00+00', + readvalue_watthour: 93000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"93000","fromTime":"2023-02-17T03:00:00.000Z","toTime":"2023-02-17T04:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:55:32.114336+00', + updatedAt: '2023-02-18 17:55:32.114336+00', + countryCode: 'IND', + }, + { + id: 370, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 04:00:00+00', + certificate_issuance_enddate: '2023-02-17 05:00:00+00', + readvalue_watthour: 136000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"136000","fromTime":"2023-02-17T04:00:00.000Z","toTime":"2023-02-17T05:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:56:03.111331+00', + updatedAt: '2023-02-18 17:56:03.111331+00', + countryCode: 'IND', + }, + { + id: 371, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 05:00:00+00', + certificate_issuance_enddate: '2023-02-17 06:00:00+00', + readvalue_watthour: 164000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"164000","fromTime":"2023-02-17T05:00:00.000Z","toTime":"2023-02-17T06:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:56:32.232804+00', + updatedAt: '2023-02-18 17:56:32.232804+00', + countryCode: 'IND', + }, + { + id: 372, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 06:00:00+00', + certificate_issuance_enddate: '2023-02-17 07:00:00+00', + readvalue_watthour: 174000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"174000","fromTime":"2023-02-17T06:00:00.000Z","toTime":"2023-02-17T07:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:57:02.317697+00', + updatedAt: '2023-02-18 17:57:02.317697+00', + countryCode: 'IND', + }, + { + id: 373, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 07:00:00+00', + certificate_issuance_enddate: '2023-02-17 08:00:00+00', + readvalue_watthour: 168000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"168000","fromTime":"2023-02-17T07:00:00.000Z","toTime":"2023-02-17T08:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:57:32.709264+00', + updatedAt: '2023-02-18 17:57:32.709264+00', + countryCode: 'IND', + }, + { + id: 374, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 08:00:00+00', + certificate_issuance_enddate: '2023-02-17 09:00:00+00', + readvalue_watthour: 155000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"155000","fromTime":"2023-02-17T08:00:00.000Z","toTime":"2023-02-17T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:58:01.90935+00', + updatedAt: '2023-02-18 17:58:01.90935+00', + countryCode: 'IND', + }, + { + id: 375, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 09:00:00+00', + certificate_issuance_enddate: '2023-02-17 10:00:00+00', + readvalue_watthour: 122000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"122000","fromTime":"2023-02-17T09:00:00.000Z","toTime":"2023-02-17T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:58:32.211015+00', + updatedAt: '2023-02-18 17:58:32.211015+00', + countryCode: 'IND', + }, + { + id: 376, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 10:00:00+00', + certificate_issuance_enddate: '2023-02-17 11:00:00+00', + readvalue_watthour: 80000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"80000","fromTime":"2023-02-17T10:00:00.000Z","toTime":"2023-02-17T11:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:59:02.507846+00', + updatedAt: '2023-02-18 17:59:02.507846+00', + countryCode: 'IND', + }, + { + id: 377, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 11:00:00+00', + certificate_issuance_enddate: '2023-02-17 12:00:00+00', + readvalue_watthour: 30000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"30000","fromTime":"2023-02-17T11:00:00.000Z","toTime":"2023-02-17T12:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 17:59:31.713719+00', + updatedAt: '2023-02-18 17:59:31.713719+00', + countryCode: 'IND', + }, + { + id: 378, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 12:00:00+00', + certificate_issuance_enddate: '2023-02-17 12:45:00+00', + readvalue_watthour: 3000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"3000","fromTime":"2023-02-17T12:00:00.000Z","toTime":"2023-02-17T12:45:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:00:02.983582+00', + updatedAt: '2023-02-18 18:00:02.983582+00', + countryCode: 'IND', + }, + { + id: 379, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-17 16:45:00+00', + certificate_issuance_enddate: '2023-02-17 17:55:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-17T16:45:00.000Z","toTime":"2023-02-17T17:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:02:32.013274+00', + updatedAt: '2023-02-18 18:02:32.013274+00', + countryCode: 'IND', + }, + { + id: 380, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 00:45:00+00', + certificate_issuance_enddate: '2023-02-18 02:00:00+00', + readvalue_watthour: 8000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"8000","fromTime":"2023-02-18T00:45:00.000Z","toTime":"2023-02-18T02:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:06:32.51998+00', + updatedAt: '2023-02-18 18:06:32.51998+00', + countryCode: 'IND', + }, + { + id: 381, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 02:00:00+00', + certificate_issuance_enddate: '2023-02-18 03:00:00+00', + readvalue_watthour: 41000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"41000","fromTime":"2023-02-18T02:00:00.000Z","toTime":"2023-02-18T03:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:07:02.20947+00', + updatedAt: '2023-02-18 18:07:02.20947+00', + countryCode: 'IND', + }, + { + id: 382, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 03:00:00+00', + certificate_issuance_enddate: '2023-02-18 04:00:00+00', + readvalue_watthour: 68000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"68000","fromTime":"2023-02-18T03:00:00.000Z","toTime":"2023-02-18T04:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:07:32.331064+00', + updatedAt: '2023-02-18 18:07:32.331064+00', + countryCode: 'IND', + }, + { + id: 383, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 04:00:00+00', + certificate_issuance_enddate: '2023-02-18 05:00:00+00', + readvalue_watthour: 90000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"90000","fromTime":"2023-02-18T04:00:00.000Z","toTime":"2023-02-18T05:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:08:02.02336+00', + updatedAt: '2023-02-18 18:08:02.02336+00', + countryCode: 'IND', + }, + { + id: 384, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 04:55:00+00', + certificate_issuance_enddate: '2023-02-18 06:00:00+00', + readvalue_watthour: 112000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"112000","fromTime":"2023-02-18T04:55:00.000Z","toTime":"2023-02-18T06:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:08:32.311143+00', + updatedAt: '2023-02-18 18:08:32.311143+00', + countryCode: 'IND', + }, + { + id: 385, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 06:00:00+00', + certificate_issuance_enddate: '2023-02-18 07:00:00+00', + readvalue_watthour: 129000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"129000","fromTime":"2023-02-18T06:00:00.000Z","toTime":"2023-02-18T07:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:09:03.01904+00', + updatedAt: '2023-02-18 18:09:03.01904+00', + countryCode: 'IND', + }, + { + id: 386, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 07:00:00+00', + certificate_issuance_enddate: '2023-02-18 08:00:00+00', + readvalue_watthour: 123000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"123000","fromTime":"2023-02-18T07:00:00.000Z","toTime":"2023-02-18T08:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:09:32.014182+00', + updatedAt: '2023-02-18 18:09:32.014182+00', + countryCode: 'IND', + }, + { + id: 387, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 07:55:00+00', + certificate_issuance_enddate: '2023-02-18 09:00:00+00', + readvalue_watthour: 119000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"119000","fromTime":"2023-02-18T07:55:00.000Z","toTime":"2023-02-18T09:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:10:02.728663+00', + updatedAt: '2023-02-18 18:10:02.728663+00', + countryCode: 'IND', + }, + { + id: 388, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 09:00:00+00', + certificate_issuance_enddate: '2023-02-18 10:00:00+00', + readvalue_watthour: 93000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"93000","fromTime":"2023-02-18T09:00:00.000Z","toTime":"2023-02-18T10:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:10:32.515142+00', + updatedAt: '2023-02-18 18:10:32.515142+00', + countryCode: 'IND', + }, + { + id: 389, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 10:00:00+00', + certificate_issuance_enddate: '2023-02-18 11:00:00+00', + readvalue_watthour: 78000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"78000","fromTime":"2023-02-18T10:00:00.000Z","toTime":"2023-02-18T11:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:11:02.408689+00', + updatedAt: '2023-02-18 18:11:02.408689+00', + countryCode: 'IND', + }, + { + id: 390, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 11:00:00+00', + certificate_issuance_enddate: '2023-02-18 12:00:00+00', + readvalue_watthour: 31000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"31000","fromTime":"2023-02-18T11:00:00.000Z","toTime":"2023-02-18T12:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:11:31.711424+00', + updatedAt: '2023-02-18 18:11:31.711424+00', + countryCode: 'IND', + }, + { + id: 391, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 12:00:00+00', + certificate_issuance_enddate: '2023-02-18 13:00:00+00', + readvalue_watthour: 3000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"3000","fromTime":"2023-02-18T12:00:00.000Z","toTime":"2023-02-18T13:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:12:02.316056+00', + updatedAt: '2023-02-18 18:12:02.316056+00', + countryCode: 'IND', + }, + { + id: 392, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 16:55:00+00', + certificate_issuance_enddate: '2023-02-18 18:00:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-18T16:55:00.000Z","toTime":"2023-02-18T18:00:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-18 18:14:32.63354+00', + updatedAt: '2023-02-18 18:14:32.63354+00', + countryCode: 'IND', + }, + { + id: 393, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 00:40:00+00', + certificate_issuance_enddate: '2023-02-19 01:55:00+00', + readvalue_watthour: 5000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"5000","fromTime":"2023-02-19T00:40:00.000Z","toTime":"2023-02-19T01:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}}', + createdAt: '2023-02-19 02:00:03.129423+00', + updatedAt: '2023-02-19 02:00:03.129423+00', + countryCode: 'IND', + }, + { + id: 394, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-18 14:55:00+00', + certificate_issuance_enddate: '2023-02-19 02:55:00+00', + readvalue_watthour: 42000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"42000","fromTime":"2023-02-18T14:55:00.000Z","toTime":"2023-02-19T02:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-19 03:00:03.411386+00', + updatedAt: '2023-02-19 03:00:03.411386+00', + countryCode: 'IND', + }, + { + id: 395, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 03:00:00+00', + certificate_issuance_enddate: '2023-02-19 03:55:00+00', + readvalue_watthour: 80000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"80000","fromTime":"2023-02-19T03:00:00.000Z","toTime":"2023-02-19T03:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-19 04:00:03.229408+00', + updatedAt: '2023-02-19 04:00:03.229408+00', + countryCode: 'IND', + }, + { + id: 396, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 04:00:00+00', + certificate_issuance_enddate: '2023-02-19 04:55:00+00', + readvalue_watthour: 102000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"102000","fromTime":"2023-02-19T04:00:00.000Z","toTime":"2023-02-19T04:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-19 05:00:03.20865+00', + updatedAt: '2023-02-19 05:00:03.20865+00', + countryCode: 'IND', + }, + { + id: 397, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 05:00:00+00', + certificate_issuance_enddate: '2023-02-19 05:55:00+00', + readvalue_watthour: 129000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"129000","fromTime":"2023-02-19T05:00:00.000Z","toTime":"2023-02-19T05:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-19 06:00:04.816649+00', + updatedAt: '2023-02-19 06:00:04.816649+00', + countryCode: 'IND', + }, + { + id: 398, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 06:00:00+00', + certificate_issuance_enddate: '2023-02-19 06:55:00+00', + readvalue_watthour: 137000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"137000","fromTime":"2023-02-19T06:00:00.000Z","toTime":"2023-02-19T06:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-19 07:00:03.923792+00', + updatedAt: '2023-02-19 07:00:03.923792+00', + countryCode: 'IND', + }, + { + id: 399, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 07:00:00+00', + certificate_issuance_enddate: '2023-02-19 07:55:00+00', + readvalue_watthour: 152000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"152000","fromTime":"2023-02-19T07:00:00.000Z","toTime":"2023-02-19T07:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-19 08:00:03.611876+00', + updatedAt: '2023-02-19 08:00:03.611876+00', + countryCode: 'IND', + }, + { + id: 400, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 08:00:00+00', + certificate_issuance_enddate: '2023-02-19 08:35:00+00', + readvalue_watthour: 86000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"86000","fromTime":"2023-02-19T08:00:00.000Z","toTime":"2023-02-19T08:35:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-19 09:00:03.714549+00', + updatedAt: '2023-02-19 09:00:03.714549+00', + countryCode: 'IND', + }, + { + id: 401, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 08:30:00+00', + certificate_issuance_enddate: '2023-02-19 10:55:00+00', + readvalue_watthour: 28000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"28000","fromTime":"2023-02-19T08:30:00.000Z","toTime":"2023-02-19T10:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203],"groupId":"17"}}', + createdAt: '2023-02-19 11:00:02.159543+00', + updatedAt: '2023-02-19 11:00:02.159543+00', + countryCode: 'IND', + }, + { + id: 402, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 08:35:00+00', + certificate_issuance_enddate: '2023-02-19 11:55:00+00', + readvalue_watthour: 26000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"26000","fromTime":"2023-02-19T08:35:00.000Z","toTime":"2023-02-19T11:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-19 12:00:03.207809+00', + updatedAt: '2023-02-19 12:00:03.207809+00', + countryCode: 'IND', + }, + { + id: 403, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 12:00:00+00', + certificate_issuance_enddate: '2023-02-19 12:40:00+00', + readvalue_watthour: 3000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"3000","fromTime":"2023-02-19T12:00:00.000Z","toTime":"2023-02-19T12:40:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-19 13:00:04.013998+00', + updatedAt: '2023-02-19 13:00:04.013998+00', + countryCode: 'IND', + }, + { + id: 404, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-19 16:50:00+00', + certificate_issuance_enddate: '2023-02-19 17:55:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-19T16:50:00.000Z","toTime":"2023-02-19T17:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-19 18:00:02.80489+00', + updatedAt: '2023-02-19 18:00:02.80489+00', + countryCode: 'IND', + }, + { + id: 405, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 00:55:00+00', + certificate_issuance_enddate: '2023-02-20 01:55:00+00', + readvalue_watthour: 7000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"7000","fromTime":"2023-02-20T00:55:00.000Z","toTime":"2023-02-20T01:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 02:00:03.915432+00', + updatedAt: '2023-02-20 02:00:03.915432+00', + countryCode: 'IND', + }, + { + id: 406, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 02:00:00+00', + certificate_issuance_enddate: '2023-02-20 02:55:00+00', + readvalue_watthour: 37000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"37000","fromTime":"2023-02-20T02:00:00.000Z","toTime":"2023-02-20T02:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 03:00:04.112469+00', + updatedAt: '2023-02-20 03:00:04.112469+00', + countryCode: 'IND', + }, + { + id: 407, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 03:00:00+00', + certificate_issuance_enddate: '2023-02-20 03:55:00+00', + readvalue_watthour: 82000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"82000","fromTime":"2023-02-20T03:00:00.000Z","toTime":"2023-02-20T03:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 04:00:07.847578+00', + updatedAt: '2023-02-20 04:00:07.847578+00', + countryCode: 'IND', + }, + { + id: 408, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 04:00:00+00', + certificate_issuance_enddate: '2023-02-20 04:55:00+00', + readvalue_watthour: 120000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"120000","fromTime":"2023-02-20T04:00:00.000Z","toTime":"2023-02-20T04:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 05:00:03.609555+00', + updatedAt: '2023-02-20 05:00:03.609555+00', + countryCode: 'IND', + }, + { + id: 409, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 05:00:00+00', + certificate_issuance_enddate: '2023-02-20 05:55:00+00', + readvalue_watthour: 137000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"137000","fromTime":"2023-02-20T05:00:00.000Z","toTime":"2023-02-20T05:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 06:00:03.408998+00', + updatedAt: '2023-02-20 06:00:03.408998+00', + countryCode: 'IND', + }, + { + id: 410, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 06:00:00+00', + certificate_issuance_enddate: '2023-02-20 06:55:00+00', + readvalue_watthour: 156000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"156000","fromTime":"2023-02-20T06:00:00.000Z","toTime":"2023-02-20T06:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 07:00:03.307548+00', + updatedAt: '2023-02-20 07:00:03.307548+00', + countryCode: 'IND', + }, + { + id: 411, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 07:00:00+00', + certificate_issuance_enddate: '2023-02-20 07:55:00+00', + readvalue_watthour: 153000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"153000","fromTime":"2023-02-20T07:00:00.000Z","toTime":"2023-02-20T07:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 08:00:03.135818+00', + updatedAt: '2023-02-20 08:00:03.135818+00', + countryCode: 'IND', + }, + { + id: 412, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 08:00:00+00', + certificate_issuance_enddate: '2023-02-20 08:55:00+00', + readvalue_watthour: 126000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"126000","fromTime":"2023-02-20T08:00:00.000Z","toTime":"2023-02-20T08:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 09:00:03.33591+00', + updatedAt: '2023-02-20 09:00:03.33591+00', + countryCode: 'IND', + }, + { + id: 413, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 09:00:00+00', + certificate_issuance_enddate: '2023-02-20 09:55:00+00', + readvalue_watthour: 79000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"79000","fromTime":"2023-02-20T09:00:00.000Z","toTime":"2023-02-20T09:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 10:00:03.725411+00', + updatedAt: '2023-02-20 10:00:03.725411+00', + countryCode: 'IND', + }, + { + id: 414, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 10:00:00+00', + certificate_issuance_enddate: '2023-02-20 10:55:00+00', + readvalue_watthour: 54000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"54000","fromTime":"2023-02-20T10:00:00.000Z","toTime":"2023-02-20T10:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 11:00:05.084176+00', + updatedAt: '2023-02-20 11:00:05.084176+00', + countryCode: 'IND', + }, + { + id: 415, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 11:00:00+00', + certificate_issuance_enddate: '2023-02-20 11:55:00+00', + readvalue_watthour: 29000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"29000","fromTime":"2023-02-20T11:00:00.000Z","toTime":"2023-02-20T11:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 12:00:04.012345+00', + updatedAt: '2023-02-20 12:00:04.012345+00', + countryCode: 'IND', + }, + { + id: 416, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 11:45:00+00', + certificate_issuance_enddate: '2023-02-20 13:50:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-20T11:45:00.000Z","toTime":"2023-02-20T13:50:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 14:00:03.821708+00', + updatedAt: '2023-02-20 14:00:03.821708+00', + countryCode: 'IND', + }, + { + id: 417, + groupid: 17, + issuer_certificate_id: null, + certificate_issuance_startdate: '2023-02-20 20:40:00+00', + certificate_issuance_enddate: '2023-02-20 21:55:00+00', + readvalue_watthour: 1000, + status: 'Requested', + certificate_payload: + '{"deviceId":"17","energyValue":"1000","fromTime":"2023-02-20T20:40:00.000Z","toTime":"2023-02-20T21:55:00.000Z","toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","userId":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437","metadata":{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}}', + createdAt: '2023-02-20 22:00:03.513357+00', + updatedAt: '2023-02-20 22:00:03.513357+00', + countryCode: 'IND', + }, +]; diff --git a/apps/drec-api/src/pods/certificate-log/issuercertificate.ts b/apps/drec-api/src/pods/certificate-log/issuercertificate.ts index 71002243b..7f5495287 100755 --- a/apps/drec-api/src/pods/certificate-log/issuercertificate.ts +++ b/apps/drec-api/src/pods/certificate-log/issuercertificate.ts @@ -1,4167 +1,4657 @@ -export const issuercertificatelog = [ - { - "createdAt": "2023-01-21 18:59:02.444933+00", - "updatedAt": "2023-01-21 18:59:12.707698+00", - "id": 26, - "deviceId": 9, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1674327530, - "creationBlockHash": "0x608737bec1d4ba906efd9c0fd081ebaf9cf3da48f2f05e4b1c5f99991ae43fb5", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"5066000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-21 19:00:39.324224+00", - "updatedAt": "2023-01-21 19:00:39.324224+00", - "id": 27, - "deviceId": 9, - "generationStartTime": 1648751401, - "generationEndTime": 1651343399, - "creationTime": 1674327615, - "creationBlockHash": "0x9e8b930bc674ce0622232ddb00dea09ae15e952bc8f5e49afb4c5c9ea6119456", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2003700\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-21 19:02:17.127285+00", - "updatedAt": "2023-01-21 19:02:17.127285+00", - "id": 29, - "deviceId": 9, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1674327720, - "creationBlockHash": "0xfb9f884b1ab1f7248d711b56f0ca7248baf25d41223577082d851773b9509ac0", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"7159100\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-21 19:03:49.212606+00", - "updatedAt": "2023-01-21 19:03:49.212606+00", - "id": 30, - "deviceId": 9, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1674327810, - "creationBlockHash": "0xc9d6d5155b15d33895c1cc75d27b4358d9cda5a05928d8564b5a3c8eb27daa4f", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"5187100\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 10:59:04.121746+00", - "updatedAt": "2023-01-23 10:59:04.121746+00", - "id": 31, - "deviceId": 10, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1674471515, - "creationBlockHash": "0x3b9d761c8949af57d9414c3803b06206a448f4a7a180ca61ac574f4d28bcaf2e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2463000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 10:59:12.687065+00", - "updatedAt": "2023-01-23 10:59:12.687065+00", - "id": 32, - "deviceId": 9, - "generationStartTime": 1648751401, - "generationEndTime": 1651343399, - "creationTime": 1674471540, - "creationBlockHash": "0x14dca3535390a853df6e2a45ec173c95baff1fb8629f3e3712155ba30e060e13", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2513300\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:00:34.49206+00", - "updatedAt": "2023-01-23 11:00:40.821891+00", - "id": 33, - "deviceId": 9, - "generationStartTime": 1646073001, - "generationEndTime": 1648751399, - "creationTime": 1674471620, - "creationBlockHash": "0xa42a0dfacb4d4beb879e53b56f85b69751c5eda6bc1aa37d155dd43cae4655e3", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2677400\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:01:53.507644+00", - "updatedAt": "2023-01-23 11:01:53.507644+00", - "id": 34, - "deviceId": 9, - "generationStartTime": 1651343401, - "generationEndTime": 1654021799, - "creationTime": 1674471700, - "creationBlockHash": "0x3595822cb7ef9052fcd72bb184388d7942376f4ae171997fb25383a0f294aba3", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2048800\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:03:12.292232+00", - "updatedAt": "2023-01-23 11:03:12.292232+00", - "id": 35, - "deviceId": 9, - "generationStartTime": 1654021801, - "generationEndTime": 1656613799, - "creationTime": 1674471780, - "creationBlockHash": "0x305cde14d4b8bb7217d594007816f01d2532d37ff763fcec77a3da9fdfe70dfe", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1752300\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:04:44.60855+00", - "updatedAt": "2023-01-23 11:04:44.60855+00", - "id": 36, - "deviceId": 9, - "generationStartTime": 1656613801, - "generationEndTime": 1659292199, - "creationTime": 1674471865, - "creationBlockHash": "0x4a05c427bee27c7ea38bf4e24b12fbf9007063d7deba1af7d6dd8b6ee3af6a8a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1877100\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:06:16.520458+00", - "updatedAt": "2023-01-23 11:06:18.130206+00", - "id": 37, - "deviceId": 9, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1674471955, - "creationBlockHash": "0x3c79400dfdb26cbe1cc5ef2d76509a87bd9cda3d8d1f7900fa4a3b2ef3f95bba", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2109800\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:07:38.243091+00", - "updatedAt": "2023-01-23 11:07:38.243091+00", - "id": 38, - "deviceId": 9, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1674472045, - "creationBlockHash": "0x4507fc1761e0ae477f08c1bb5120c65cbc78d01114ad1f6a58e2ab8084149c4c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2062100\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:08:59.315803+00", - "updatedAt": "2023-01-23 11:08:59.315803+00", - "id": 39, - "deviceId": 9, - "generationStartTime": 1651343401, - "generationEndTime": 1654021799, - "creationTime": 1674472125, - "creationBlockHash": "0x0d58a1e2c6fafbb3804b1c873266c986661fdf540f4942c30eb2ab8de5a2367a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"8324000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:10:17.211595+00", - "updatedAt": "2023-01-23 11:10:17.211595+00", - "id": 40, - "deviceId": 9, - "generationStartTime": 1654021801, - "generationEndTime": 1656613799, - "creationTime": 1674472205, - "creationBlockHash": "0x403da7f710a00cccc40ab462e18a057d51bc5f5ea0c448bcc502209e2f2560fe", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"9192000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:11:42.218607+00", - "updatedAt": "2023-01-23 11:11:42.218607+00", - "id": 41, - "deviceId": 9, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1674472285, - "creationBlockHash": "0xf8da62708760d173a246672e40ceca0826b7d8e5ae93086676101884ae5e33a0", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2479800\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[11],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:13:11.518201+00", - "updatedAt": "2023-01-23 11:13:11.518201+00", - "id": 42, - "deviceId": 9, - "generationStartTime": 1656613801, - "generationEndTime": 1659292199, - "creationTime": 1674472375, - "creationBlockHash": "0x58e08a9129da85292afd0364ce53c4e1453f6aa166ce0aa712fd3b2a5f77d269", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"5458300\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:14:36.908494+00", - "updatedAt": "2023-01-23 11:14:36.908494+00", - "id": 43, - "deviceId": 9, - "generationStartTime": 1650133802, - "generationEndTime": 1651343399, - "creationTime": 1674472460, - "creationBlockHash": "0x08cca3556d708b7459e1c8879a328f88636a8f12f1367d8958e6b4cf23b7fff6", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"4672000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:15:57.930925+00", - "updatedAt": "2023-01-23 11:15:57.930925+00", - "id": 44, - "deviceId": 9, - "generationStartTime": 1656613801, - "generationEndTime": 1659292199, - "creationTime": 1674472545, - "creationBlockHash": "0x2ac25d796c5a2bac7c7e9f080c08d2429daa8633877b9be670076311f85c8a6c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"7879700\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:17:18.748778+00", - "updatedAt": "2023-01-23 11:17:18.748778+00", - "id": 45, - "deviceId": 9, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1674472625, - "creationBlockHash": "0x9a8430225d9301aee6592fc2c87687a646d9ddce367b830ed524c2676970ca0b", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"8845500\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:18:38.463565+00", - "updatedAt": "2023-01-23 11:18:44.064084+00", - "id": 46, - "deviceId": 9, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1674472705, - "creationBlockHash": "0x0f7aecfcace9ee869aeeedd65c4efbe4c93777f50e9226d3df330d4f43414c91", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"10755300\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:20:15.329845+00", - "updatedAt": "2023-01-23 11:20:15.329845+00", - "id": 47, - "deviceId": 9, - "generationStartTime": 1667241001, - "generationEndTime": 1669832999, - "creationTime": 1674472790, - "creationBlockHash": "0x01ea6cbdbc98186e759c11a1a337528f938001fa3b72fdfa8b68e7b5014ec08e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"9646300\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:20:49.594445+00", - "updatedAt": "2023-01-23 11:20:54.428691+00", - "id": 50, - "deviceId": 9, - "generationStartTime": 1654021801, - "generationEndTime": 1656613799, - "creationTime": 1674472835, - "creationBlockHash": "0x3a33eac0ece764c7c2999e7b1990c436dec25a21ece88aac6c58ca06b8e33e00", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"11984500\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:22:08.847269+00", - "updatedAt": "2023-01-23 11:22:08.847269+00", - "id": 51, - "deviceId": 9, - "generationStartTime": 1648751401, - "generationEndTime": 1651343399, - "creationTime": 1674472915, - "creationBlockHash": "0x124d3712a01d7cebac7246c753082f11fc24e5e5b8e0acac51a528340dc58fc5", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"14820700\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 11:23:32.807386+00", - "updatedAt": "2023-01-23 11:23:32.807386+00", - "id": 52, - "deviceId": 9, - "generationStartTime": 1656613801, - "generationEndTime": 1659292199, - "creationTime": 1674472995, - "creationBlockHash": "0x977cbab7a400bead1d4ce9b70a5077ac3e62a27dd833599bf7d9e8315ec846c9", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"8300600\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 12:19:39.420056+00", - "updatedAt": "2023-01-23 12:19:39.420056+00", - "id": 53, - "deviceId": 10, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1674476360, - "creationBlockHash": "0x5bde7031866f54ac78da916b69ae927b49950864a6eed3ac2c4c1e1f0f6444dc", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1098000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:19:57.653316+00", - "updatedAt": "2023-01-23 12:20:35.673645+00", - "id": 54, - "deviceId": 9, - "generationStartTime": 1646073001, - "generationEndTime": 1648751399, - "creationTime": 1674476385, - "creationBlockHash": "0xe136c50cd037d4df4a0ea998b4f2c97e3137517980566d3e1be55cea6d24c27d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"14272300\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 12:21:19.839847+00", - "updatedAt": "2023-01-23 12:21:40.266689+00", - "id": 55, - "deviceId": 9, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1674476465, - "creationBlockHash": "0x6f8c42c753da5d57e4141fb03c94385725dcfa11224e90bfca410e0a4420d841", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"11456000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 12:22:50.229245+00", - "updatedAt": "2023-01-23 12:22:50.229245+00", - "id": 56, - "deviceId": 9, - "generationStartTime": 1654021801, - "generationEndTime": 1656613799, - "creationTime": 1674476555, - "creationBlockHash": "0x8dbe78790fb73138596ba46b25be86e50985d2a620e9d3f1aad6cd71e6538ef6", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2675900\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 12:24:22.522089+00", - "updatedAt": "2023-01-23 12:24:23.02064+00", - "id": 57, - "deviceId": 9, - "generationStartTime": 1656613801, - "generationEndTime": 1659292199, - "creationTime": 1674476645, - "creationBlockHash": "0xbd0a2d4dee4cf6eaedea1021a6c9c95c91d956d21eebc84a11323275811fd472", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2710100\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 12:32:23.439903+00", - "updatedAt": "2023-01-23 12:32:42.009075+00", - "id": 58, - "deviceId": 10, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1674477120, - "creationBlockHash": "0xecc612507c3333b47c5010ac4a70e111bd850741cc889cf878d2ebfc23bb247e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1178000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:32:47.2108+00", - "updatedAt": "2023-01-23 12:32:47.2108+00", - "id": 59, - "deviceId": 9, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1674477150, - "creationBlockHash": "0x2e0dca801a40e02d38f7fcadefcb13b8dd036ddd3b53f10608d81b899c801447", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3078900\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 12:34:10.208001+00", - "updatedAt": "2023-01-23 12:34:37.776098+00", - "id": 60, - "deviceId": 9, - "generationStartTime": 1651343401, - "generationEndTime": 1654021799, - "creationTime": 1674477235, - "creationBlockHash": "0xf985d34a9804c4737d86db63ed728d673e0c2a4a8da6690336d088961719df8c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2777900\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-23 12:35:41.598756+00", - "updatedAt": "2023-01-23 12:35:41.598756+00", - "id": 61, - "deviceId": 10, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1674477325, - "creationBlockHash": "0xbe4489f47d4fc7240ebe7a42d0587540839cb3702695e7b06ef3c849d8062afe", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1098000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:37:00.507577+00", - "updatedAt": "2023-01-23 12:37:20.698493+00", - "id": 62, - "deviceId": 10, - "generationStartTime": 1646073002, - "generationEndTime": 1648751399, - "creationTime": 1674477410, - "creationBlockHash": "0x650a60aede8f66084e0aaba7688920409f809a73c5f357d1a65f2359492d048e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"991000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:38:24.769928+00", - "updatedAt": "2023-01-23 12:38:24.769928+00", - "id": 63, - "deviceId": 10, - "generationStartTime": 1648751401, - "generationEndTime": 1651343399, - "creationTime": 1674477490, - "creationBlockHash": "0x14806d7158989e64736054ab10c7ff67a460c437c71718fd80a906157539212e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1080000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:39:49.513919+00", - "updatedAt": "2023-01-23 12:39:49.513919+00", - "id": 64, - "deviceId": 10, - "generationStartTime": 1669833001, - "generationEndTime": 1672511399, - "creationTime": 1674477570, - "creationBlockHash": "0x615e8344a6e736e8ecdbf7d7abbb32b015c4fd547fe04ec04a0dc9062595cf98", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1317000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:40:12.013138+00", - "updatedAt": "2023-01-23 12:40:12.013138+00", - "id": 65, - "deviceId": 10, - "generationStartTime": 1651343401, - "generationEndTime": 1654021799, - "creationTime": 1674477585, - "creationBlockHash": "0xa84435904e48cc34e988c9c78178b7cb66cd69ae5f5f50da8ddaf0eb006569ed", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1161000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:40:17.073752+00", - "updatedAt": "2023-01-23 12:40:17.073752+00", - "id": 66, - "deviceId": 10, - "generationStartTime": 1667241001, - "generationEndTime": 1669832999, - "creationTime": 1674477605, - "creationBlockHash": "0x02ef8fbe51c9631c6d1308c8d3005079ef0b5039fef76786d6b8c0f8312116c4", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1107000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:41:44.028058+00", - "updatedAt": "2023-01-23 12:41:51.523802+00", - "id": 67, - "deviceId": 10, - "generationStartTime": 1651343401, - "generationEndTime": 1654021799, - "creationTime": 1674477685, - "creationBlockHash": "0x51cd8878dc0c3c401783ee23f064018a81da470ff25ff44b67de25a5bf968345", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1075000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:43:02.46999+00", - "updatedAt": "2023-01-23 12:43:02.46999+00", - "id": 68, - "deviceId": 10, - "generationStartTime": 1654021801, - "generationEndTime": 1656613799, - "creationTime": 1674477770, - "creationBlockHash": "0xbb1679e16cddb96fac1348e552b1a36731b316ff4bdb9cd657337cf746964021", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1017000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:44:25.038045+00", - "updatedAt": "2023-01-23 12:44:25.038045+00", - "id": 69, - "deviceId": 10, - "generationStartTime": 1646073002, - "generationEndTime": 1648751399, - "creationTime": 1674477850, - "creationBlockHash": "0xa211debb3a2d3d353215dd96cb57a2c0b5e0e7ce480004ceb83f6dc8ebe37008", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"968000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:45:46.80714+00", - "updatedAt": "2023-01-23 12:45:46.80714+00", - "id": 70, - "deviceId": 10, - "generationStartTime": 1648751401, - "generationEndTime": 1651343399, - "creationTime": 1674477930, - "creationBlockHash": "0xee3e0bea1904ebb3da8c22abd2cee261c20e824bf4b67df3eaae97b4e444aa32", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1062000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:47:24.241055+00", - "updatedAt": "2023-01-23 12:47:24.241055+00", - "id": 72, - "deviceId": 10, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1674478030, - "creationBlockHash": "0xe7110ee55dcf2c76b956487e8fc26bf8dcd41680549c25fde3b36037e1cfb764", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1078000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:48:47.419358+00", - "updatedAt": "2023-01-23 12:48:47.419358+00", - "id": 73, - "deviceId": 10, - "generationStartTime": 1654021801, - "generationEndTime": 1656613799, - "creationTime": 1674478115, - "creationBlockHash": "0x14748f14ea1d0c977483aed06ab0255cf1ef559107cc21e29df807d56b7bf22d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1028000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 12:50:13.309833+00", - "updatedAt": "2023-01-23 12:50:13.309833+00", - "id": 74, - "deviceId": 10, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1674478195, - "creationBlockHash": "0x4364b28ffdf4fb906e21f85758de767b6e7d75c4d36a1cc926ccd2bdb26f39bc", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1321000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 13:23:12.061788+00", - "updatedAt": "2023-01-23 13:23:12.061788+00", - "id": 75, - "deviceId": 10, - "generationStartTime": 1656613801, - "generationEndTime": 1659292199, - "creationTime": 1674480160, - "creationBlockHash": "0xaafe0fbcc47f1e722f57cdaf0c1dded2c9bfcf73df8277c05b9f5d0d6717e872", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2237000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 13:23:19.11004+00", - "updatedAt": "2023-01-23 13:24:27.896862+00", - "id": 76, - "deviceId": 10, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1674480185, - "creationBlockHash": "0x666da4cbf46ff0f8a05b3e2ea3edae820c550d31de488dd48c0888f954902d48", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1284000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 13:24:38.909757+00", - "updatedAt": "2023-01-23 13:24:38.909757+00", - "id": 77, - "deviceId": 10, - "generationStartTime": 1656613801, - "generationEndTime": 1659292199, - "creationTime": 1674480265, - "creationBlockHash": "0x055b6a6db8bfefd3155ff3c011aed0251dc0b9910ab02020ddc09176737e5e2d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1033000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[16],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 13:26:01.212217+00", - "updatedAt": "2023-01-23 13:26:01.212217+00", - "id": 78, - "deviceId": 10, - "generationStartTime": 1646245802, - "generationEndTime": 1648751399, - "creationTime": 1674480345, - "creationBlockHash": "0x39357bec41313d93a908e1e7e61caf0bab09f78fb69251e6dad7237f1fa27d33", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1472000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 13:27:34.352893+00", - "updatedAt": "2023-01-23 13:27:34.352893+00", - "id": 79, - "deviceId": 10, - "generationStartTime": 1648751401, - "generationEndTime": 1651343399, - "creationTime": 1674480430, - "creationBlockHash": "0x98a890ef8d3e7f408530f12b149fd3861572ac1033355c863d3335d68c68fe87", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1529000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 13:28:51.426555+00", - "updatedAt": "2023-01-23 13:28:51.426555+00", - "id": 80, - "deviceId": 10, - "generationStartTime": 1669833001, - "generationEndTime": 1672511399, - "creationTime": 1674480520, - "creationBlockHash": "0x0b3d2bdf1ad929f4bd314bcf9aa1ce49996db2b6f68a926f33619af7633982ed", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1320000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 13:30:17.962236+00", - "updatedAt": "2023-01-23 13:30:17.962236+00", - "id": 81, - "deviceId": 10, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1674480605, - "creationBlockHash": "0x51d106a50cd2a585dba6ffbea537189e9c1bc86920acea4f55a07fb74351d46c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2183000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 13:50:29.019755+00", - "updatedAt": "2023-01-23 13:50:52.802898+00", - "id": 82, - "deviceId": 10, - "generationStartTime": 1651343401, - "generationEndTime": 1654021799, - "creationTime": 1674481805, - "creationBlockHash": "0x3050e62c8d9e85c688d38687b6c3adf539cc5743b86b5985b8286ccdfc4fbacf", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1760000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 13:51:13.598053+00", - "updatedAt": "2023-01-23 13:51:13.598053+00", - "id": 83, - "deviceId": 10, - "generationStartTime": 1654021801, - "generationEndTime": 1656613799, - "creationTime": 1674481855, - "creationBlockHash": "0x5ad5c60be9d5d8f2ec9be86ad54fd09e47f56f622388a6d74826ba3eeef0f623", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1628000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-23 13:53:14.091888+00", - "updatedAt": "2023-01-23 13:53:29.613845+00", - "id": 85, - "deviceId": 10, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1674481965, - "creationBlockHash": "0x784c9a5ff695eb710db893ae60ac7c001c3f5eecc42a9d0a487fde8a5acce411", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2463000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-01-25 12:51:31.709132+00", - "updatedAt": "2023-01-25 12:51:31.709132+00", - "id": 86, - "deviceId": 9, - "generationStartTime": 1651343401, - "generationEndTime": 1654021799, - "creationTime": 1674651065, - "creationBlockHash": "0xbaad4160b147f83d940d55a8bff8f1e93eb3c6a993f5c5837a9666a7550d1a79", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"5611700\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-25 12:58:54.019531+00", - "updatedAt": "2023-01-25 12:58:54.019531+00", - "id": 87, - "deviceId": 9, - "generationStartTime": 1654021801, - "generationEndTime": 1656613799, - "creationTime": 1674651505, - "creationBlockHash": "0xbf169938fca581e031e286dfbe564ded03b0848a6d5837a5a2c2c62ba07259ad", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"6526800\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-01-27 04:58:29.433628+00", - "updatedAt": "2023-01-27 04:58:29.433628+00", - "id": 88, - "deviceId": 11, - "generationStartTime": 1647216000, - "generationEndTime": 1673859600, - "creationTime": 1674795495, - "creationBlockHash": "0x795cd6faf2ee2acdf93771e946499c3aa025e037870210c6d326c39ef0727c49", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"74545344\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-01-27 04:59:46.864137+00", - "updatedAt": "2023-01-27 04:59:46.864137+00", - "id": 89, - "deviceId": 11, - "generationStartTime": 1647216000, - "generationEndTime": 1673859600, - "creationTime": 1674795575, - "creationBlockHash": "0xfe8596c3d96c74be26d47647feb937846bcc872bc043fccac3f2f9ade4fb59ee", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"78922632\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-01-27 05:01:12.880564+00", - "updatedAt": "2023-01-27 05:01:12.880564+00", - "id": 90, - "deviceId": 11, - "generationStartTime": 1647216000, - "generationEndTime": 1673827199, - "creationTime": 1674795655, - "creationBlockHash": "0xdcd5288df7b8783a90013d22fefcaa6f7973d0a5853fdbd8c3598eee2d91a5c5", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"79136096\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-01-27 05:03:11.162919+00", - "updatedAt": "2023-01-27 05:03:11.162919+00", - "id": 92, - "deviceId": 11, - "generationStartTime": 1674208800, - "generationEndTime": 1674295200, - "creationTime": 1674795775, - "creationBlockHash": "0xb664c4a9746576441702d9e71cedb1d62708aebcb0b915c911d7ed9c65ba849c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"877000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-01-27 05:04:37.819675+00", - "updatedAt": "2023-01-27 05:04:37.819675+00", - "id": 93, - "deviceId": 11, - "generationStartTime": 1674295200, - "generationEndTime": 1674381600, - "creationTime": 1674795860, - "creationBlockHash": "0x624d98ca548cbe3197eee5349852554b98920c8d57d44da163c421547d825414", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"723000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-01-27 05:06:13.216261+00", - "updatedAt": "2023-01-27 05:06:13.216261+00", - "id": 94, - "deviceId": 11, - "generationStartTime": 1674381600, - "generationEndTime": 1674468000, - "creationTime": 1674795945, - "creationBlockHash": "0x71451dd0a8cb3a3ac5e6b2033c7e4bc0e861a9ac328f0ef3358be2f2c86b75fc", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"910000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-01-27 05:07:37.016925+00", - "updatedAt": "2023-01-27 05:07:37.016925+00", - "id": 95, - "deviceId": 11, - "generationStartTime": 1674468000, - "generationEndTime": 1674554400, - "creationTime": 1674796040, - "creationBlockHash": "0x5519eeac0a67988aeb5e373baf8351c537a3ca0d20cc696925b16923b537774a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1047000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-01-27 05:09:07.414096+00", - "updatedAt": "2023-01-27 05:09:07.414096+00", - "id": 96, - "deviceId": 11, - "generationStartTime": 1674640800, - "generationEndTime": 1674727200, - "creationTime": 1674796130, - "creationBlockHash": "0x5328b3d8690d6c4cd1bbcb46f1fc732a3dcd4ecf6465682849758188c615e370", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1077000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-01-28 10:03:54.109853+00", - "updatedAt": "2023-01-28 10:03:54.109853+00", - "id": 97, - "deviceId": 11, - "generationStartTime": 1674813600, - "generationEndTime": 1674900000, - "creationTime": 1674900220, - "creationBlockHash": "0x0f60dbd0388d88f693179e0bc3034be9ac4e32ccc64aaa9d0159c1e038a353e6", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1093000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-01-29 10:03:58.378342+00", - "updatedAt": "2023-01-29 10:03:58.378342+00", - "id": 98, - "deviceId": 11, - "generationStartTime": 1674900000, - "generationEndTime": 1674986400, - "creationTime": 1674986620, - "creationBlockHash": "0xa6017eee8415bf0068c85a6643b530f9d976dfe39523f9e2ebe595e1efd16559", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"752000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-01-31 07:16:23.53761+00", - "updatedAt": "2023-01-31 07:16:23.53761+00", - "id": 99, - "deviceId": 9, - "generationStartTime": 1654021801, - "generationEndTime": 1656613799, - "creationTime": 1675149340, - "creationBlockHash": "0x8c1f8d86fe721be68d54aa461c71ef08f1ee4aee00d89ab64fedabfc001dd071", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"6526800\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-09 07:38:15.957428+00", - "updatedAt": "2023-02-09 07:38:15.957428+00", - "id": 102, - "deviceId": 12, - "generationStartTime": 1667241001, - "generationEndTime": 1669832999, - "creationTime": 1675928275, - "creationBlockHash": "0x01c5166a9dad4ab1c5927d979689a40942e2d1b2ba3e32b99f4937e14f34b797", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"5656000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[207],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-09 07:38:35.116796+00", - "updatedAt": "2023-02-09 07:38:35.116796+00", - "id": 103, - "deviceId": 12, - "generationStartTime": 1669833001, - "generationEndTime": 1672511399, - "creationTime": 1675928290, - "creationBlockHash": "0x94cc00abf7c1c8d64f87ee4c05db9e716a73f08296ea86f082cf4899928dbca2", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"5812000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[207],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-09 07:40:05.317533+00", - "updatedAt": "2023-02-09 07:40:05.317533+00", - "id": 104, - "deviceId": 12, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1675928390, - "creationBlockHash": "0x6e14952ca91d9e4dabea19c911bbe1f9506b56471b5a116a3f392bf5a75775b4", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3947000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[206],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-09 07:41:35.136466+00", - "updatedAt": "2023-02-09 07:41:35.136466+00", - "id": 105, - "deviceId": 12, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1675928470, - "creationBlockHash": "0x52860dd9072bdd2423137ef21b4d3984f1628abb7de47070a6c527cc4e0c1a53", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"4111000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[206],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-09 07:43:30.11491+00", - "updatedAt": "2023-02-09 07:43:30.11491+00", - "id": 107, - "deviceId": 12, - "generationStartTime": 1669833001, - "generationEndTime": 1672511399, - "creationTime": 1675928590, - "creationBlockHash": "0xcc67e75aef90b30088369a1b2b0e9efececc8f6d7ad0f3ea623a7116b45dd808", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3923000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[206],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-09 07:44:57.233304+00", - "updatedAt": "2023-02-09 07:44:57.233304+00", - "id": 108, - "deviceId": 12, - "generationStartTime": 1655663402, - "generationEndTime": 1656613799, - "creationTime": 1675928680, - "creationBlockHash": "0x1eb26c3fc940710da3444b0548491ee2a8ede96935a71c01aee93aa7226bff59", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3147100\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-09 07:46:40.041752+00", - "updatedAt": "2023-02-09 07:46:40.041752+00", - "id": 109, - "deviceId": 12, - "generationStartTime": 1656613801, - "generationEndTime": 1659292199, - "creationTime": 1675928775, - "creationBlockHash": "0x61c270ce5eb2f1be005477462b8c1159f0f85d85670f3712bae95823c8548bb4", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"12173900\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-09 07:46:57.807186+00", - "updatedAt": "2023-02-09 07:46:57.807186+00", - "id": 110, - "deviceId": 13, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1675928795, - "creationBlockHash": "0xdbfa1b71d5c57d6b3bf7924cea9e7e8edfdb9d996155d0aa1a4012bac90dd4fb", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3205000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"0a5ce04e-bb3f-4306-9665-2a165ebe45e1\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"13\"}" - }, - { - "createdAt": "2023-02-09 07:48:25.622072+00", - "updatedAt": "2023-02-09 07:48:25.622072+00", - "id": 111, - "deviceId": 13, - "generationStartTime": 1667241001, - "generationEndTime": 1669832999, - "creationTime": 1675928890, - "creationBlockHash": "0xed0adfce480849b3f52369afd1f43958385da606dddb794727e92f471ade64e5", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2312000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"0a5ce04e-bb3f-4306-9665-2a165ebe45e1\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"13\"}" - }, - { - "createdAt": "2023-02-09 07:50:12.061461+00", - "updatedAt": "2023-02-09 07:50:12.061461+00", - "id": 112, - "deviceId": 13, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1675928980, - "creationBlockHash": "0xb287b9eea161bac0ab8aef20e179e53c4a88151c9380f1427f2376e7d6deee67", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3247000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"0a5ce04e-bb3f-4306-9665-2a165ebe45e1\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"13\"}" - }, - { - "createdAt": "2023-02-09 07:50:18.479291+00", - "updatedAt": "2023-02-09 07:50:18.479291+00", - "id": 113, - "deviceId": 13, - "generationStartTime": 1669833001, - "generationEndTime": 1672511399, - "creationTime": 1675928995, - "creationBlockHash": "0xda573fc24f37c0fce59e201fb8c6acab8df9e03842aa69ab851f4c214ebf3e68", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1617000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"0a5ce04e-bb3f-4306-9665-2a165ebe45e1\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"13\"}" - }, - { - "createdAt": "2023-02-09 07:50:34.058044+00", - "updatedAt": "2023-02-09 07:50:34.058044+00", - "id": 114, - "deviceId": 14, - "generationStartTime": 1675212000, - "generationEndTime": 1675216800, - "creationTime": 1675929015, - "creationBlockHash": "0xfe74b98bd80a248e0da5f5d375389c6f91ee32bdaa237af8690a7c4a2f3f495f", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 07:51:54.41039+00", - "updatedAt": "2023-02-09 07:51:54.41039+00", - "id": 115, - "deviceId": 14, - "generationStartTime": 1675216800, - "generationEndTime": 1675220400, - "creationTime": 1675929100, - "creationBlockHash": "0x21b1f2782f604718581cd403b0e6703b35e807678704a1c6fb5dfa1ad2c5fbeb", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"12000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 07:53:18.769567+00", - "updatedAt": "2023-02-09 07:53:30.210157+00", - "id": 116, - "deviceId": 14, - "generationStartTime": 1675224000, - "generationEndTime": 1675227600, - "creationTime": 1675929185, - "creationBlockHash": "0x5a65b7c54e0f9d9de72e950ef6a4dc3c780e00791190f9815e37d731c474cc01", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"114000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 07:54:44.120055+00", - "updatedAt": "2023-02-09 07:54:44.120055+00", - "id": 117, - "deviceId": 14, - "generationStartTime": 1675227600, - "generationEndTime": 1675231200, - "creationTime": 1675929265, - "creationBlockHash": "0xb8592d9805c2bb127b344fc3b5ea02c332c08d71ccac2ab4bcdda049a042ab6a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"139000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 07:56:07.384558+00", - "updatedAt": "2023-02-09 07:56:07.384558+00", - "id": 118, - "deviceId": 14, - "generationStartTime": 1675231200, - "generationEndTime": 1675234800, - "creationTime": 1675929350, - "creationBlockHash": "0xe8ec6174375a2d4d27ecb84cf115ea174c379479603b7ba08e9c57d5b11031b1", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"157000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 07:57:27.853056+00", - "updatedAt": "2023-02-09 07:57:27.853056+00", - "id": 119, - "deviceId": 14, - "generationStartTime": 1675234800, - "generationEndTime": 1675238400, - "creationTime": 1675929435, - "creationBlockHash": "0x1269ee6f5397bcb41cd6ebc95cd1e6ad4208e8a7be7a0925e1e94b6166fcd9fc", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"157000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 07:58:52.751723+00", - "updatedAt": "2023-02-09 07:59:02.20733+00", - "id": 120, - "deviceId": 14, - "generationStartTime": 1675238400, - "generationEndTime": 1675242000, - "creationTime": 1675929515, - "creationBlockHash": "0x574f1aca42ae7d16da698ae879a5fc3a2d74caa7ded6b568e7442311d15c0076", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"134000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 08:00:15.487653+00", - "updatedAt": "2023-02-09 08:00:15.487653+00", - "id": 121, - "deviceId": 14, - "generationStartTime": 1675242000, - "generationEndTime": 1675245600, - "creationTime": 1675929600, - "creationBlockHash": "0x45dc150063872f64af40ea0db916d709d9e51cd3b4615b1e5ef45ce5c5daa541", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"97000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 08:02:05.94366+00", - "updatedAt": "2023-02-09 08:02:05.94366+00", - "id": 122, - "deviceId": 14, - "generationStartTime": 1675245600, - "generationEndTime": 1675249200, - "creationTime": 1675929685, - "creationBlockHash": "0x1b5f86142f2f63e4cc1c8a0fbee76fbd80474f65eb490dffcc9a44df360e8016", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"57000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 08:01:57.221263+00", - "updatedAt": "2023-02-09 08:01:57.221263+00", - "id": 123, - "deviceId": 14, - "generationStartTime": 1675249200, - "generationEndTime": 1675252800, - "creationTime": 1675929700, - "creationBlockHash": "0x975d6bcd035108882d0be92e974acabc4483859c5f21c483a03ab2bae1b2f0e9", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"20000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 08:03:20.711784+00", - "updatedAt": "2023-02-09 08:03:20.711784+00", - "id": 124, - "deviceId": 14, - "generationStartTime": 1675252800, - "generationEndTime": 1675256400, - "creationTime": 1675929785, - "creationBlockHash": "0x874fe48621299c9981860d1348eab17d951b7c4303cdadee76518a9d4fb28855", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 08:04:59.424589+00", - "updatedAt": "2023-02-09 08:04:59.424589+00", - "id": 125, - "deviceId": 14, - "generationStartTime": 1675291500, - "generationEndTime": 1675296000, - "creationTime": 1675929875, - "creationBlockHash": "0x5b283a3edca27fe82bd344640ae57aa615222ff61af113b48dd1e82c7bd3aa1f", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 08:06:31.527473+00", - "updatedAt": "2023-02-09 08:06:36.959815+00", - "id": 126, - "deviceId": 14, - "generationStartTime": 1675303200, - "generationEndTime": 1675306800, - "creationTime": 1675929970, - "creationBlockHash": "0x1fd6409caf51e3e684ac6edea76cd6e41a243349e838f1eb8fd837504e7dbe61", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"32000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 08:08:21.310134+00", - "updatedAt": "2023-02-09 08:08:21.310134+00", - "id": 128, - "deviceId": 14, - "generationStartTime": 1675314000, - "generationEndTime": 1675317600, - "creationTime": 1675930080, - "creationBlockHash": "0x98c6c6546be20b6413bfa0e25a9bc4699281a3b1ecced021f5cffb64f4b2cf31", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"138000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 12:49:45.033389+00", - "updatedAt": "2023-02-09 12:49:45.033389+00", - "id": 129, - "deviceId": 12, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1675946965, - "creationBlockHash": "0x5e4d68a05ccd13fb0bd0e5e9914ba3e83bb3ea5d25e4889e2ae0d8bcc5d47564", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"16336400\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-09 12:50:08.413105+00", - "updatedAt": "2023-02-09 12:50:08.413105+00", - "id": 130, - "deviceId": 14, - "generationStartTime": 1675320900, - "generationEndTime": 1675324800, - "creationTime": 1675946995, - "creationBlockHash": "0xd14d1a7533a4169e634a074eab1139fb586073ca8c0af4fd757ef0db2187d89b", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"154000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 12:51:54.01125+00", - "updatedAt": "2023-02-09 12:52:01.732099+00", - "id": 132, - "deviceId": 14, - "generationStartTime": 1675332000, - "generationEndTime": 1675335600, - "creationTime": 1675947095, - "creationBlockHash": "0x46c93b4ae4b4c854a9d24a8804a8602ee2026ca13d8f4623d1076ddbeaa86b90", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"55000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 12:53:21.248664+00", - "updatedAt": "2023-02-09 12:53:32.9871+00", - "id": 133, - "deviceId": 15, - "generationStartTime": 1656613801, - "generationEndTime": 1659292199, - "creationTime": 1675947185, - "creationBlockHash": "0x82aed950a7e2cf6b312eab6a0ff841fc4ca368bac7c4aa9d411c753988dd6004", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2431000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95c6ed07-4001-478e-a5b8-119aa0101f10\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"15\"}" - }, - { - "createdAt": "2023-02-09 13:25:09.897056+00", - "updatedAt": "2023-02-09 13:25:09.897056+00", - "id": 134, - "deviceId": 14, - "generationStartTime": 1675339200, - "generationEndTime": 1675341600, - "creationTime": 1675949090, - "creationBlockHash": "0xf68bd40654980fb1d8caa102aa3288e4984a70575857f763fae44aa09a2f658d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 13:25:37.233495+00", - "updatedAt": "2023-02-09 13:25:37.233495+00", - "id": 135, - "deviceId": 14, - "generationStartTime": 1675339200, - "generationEndTime": 1675341600, - "creationTime": 1675949115, - "creationBlockHash": "0x4818042baf19289447d804c240d2950e2877f3e259b9ee1924a445c912874345", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-09 13:25:47.175637+00", - "updatedAt": "2023-02-09 13:25:47.175637+00", - "id": 136, - "deviceId": 14, - "generationStartTime": 1675346100, - "generationEndTime": 1675350000, - "creationTime": 1675949125, - "creationBlockHash": "0x919466141e762272cf8cf998f6bc265df9a2b1018d027d0bc9514fd07845f1fc", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-10 12:11:13.161997+00", - "updatedAt": "2023-02-10 12:11:18.890086+00", - "id": 138, - "deviceId": 14, - "generationStartTime": 1675857600, - "generationEndTime": 1675860000, - "creationTime": 1676031045, - "creationBlockHash": "0xb375fa740d74b9daf0a3c08c547d1fe5502430270d4c134802328fc67640480c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-10 12:11:36.070475+00", - "updatedAt": "2023-02-10 12:11:36.070475+00", - "id": 139, - "deviceId": 14, - "generationStartTime": 1675393200, - "generationEndTime": 1675396800, - "creationTime": 1676031075, - "creationBlockHash": "0xbb4d1576a50f176e1fa87124f0ebe5f3432d6f0e875b7ed741c8736ef374f21f", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"75000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-10 12:47:11.627092+00", - "updatedAt": "2023-02-10 12:47:11.627092+00", - "id": 142, - "deviceId": 14, - "generationStartTime": 1675404000, - "generationEndTime": 1675407600, - "creationTime": 1676033215, - "creationBlockHash": "0x0f2373bff80eeccad08378af489c93ea7d1e7a2919256eddb4ebd696a6a3523c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"163000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:34:08.034808+00", - "updatedAt": "2023-02-12 04:34:08.034808+00", - "id": 143, - "deviceId": 14, - "generationStartTime": 1675911600, - "generationEndTime": 1675914900, - "creationTime": 1676176430, - "creationBlockHash": "0x89bcfb5fbf7ddd10b0745c41333a9e67a6faa0ac3faf0b5f02b95e99999a3a85", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"74000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:35:58.262192+00", - "updatedAt": "2023-02-12 04:36:10.0627+00", - "id": 144, - "deviceId": 14, - "generationStartTime": 1675908000, - "generationEndTime": 1675911300, - "creationTime": 1676176535, - "creationBlockHash": "0xfe6c94e173cdddfb75a566fe6886c412a6059d4139d5cf799e79b03529338b52", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"34000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:37:27.564367+00", - "updatedAt": "2023-02-12 04:37:27.564367+00", - "id": 145, - "deviceId": 14, - "generationStartTime": 1675903500, - "generationEndTime": 1675907700, - "creationTime": 1676176630, - "creationBlockHash": "0xc4983057fb355c6e5f41b4b047cddb46193797f6d7fa86e1b6004052dd9f5d82", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"5000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:38:58.897122+00", - "updatedAt": "2023-02-12 04:38:58.897122+00", - "id": 146, - "deviceId": 14, - "generationStartTime": 1675900500, - "generationEndTime": 1675903800, - "creationTime": 1676176715, - "creationBlockHash": "0x1275d5092bb75d2ca2cd201426f12f8d43f8a7c174a70de17dc4c19110fe3b91", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:39:14.308692+00", - "updatedAt": "2023-02-12 04:39:22.234634+00", - "id": 147, - "deviceId": 14, - "generationStartTime": 1675422000, - "generationEndTime": 1675425300, - "creationTime": 1676176740, - "creationBlockHash": "0x12f4d534f0b3076ed7656b2fa71c95018d896beae0bf7c2406d36c45b80f97ac", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"20000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:51:12.211966+00", - "updatedAt": "2023-02-12 04:51:12.211966+00", - "id": 148, - "deviceId": 14, - "generationStartTime": 1675857600, - "generationEndTime": 1675860000, - "creationTime": 1676177440, - "creationBlockHash": "0x3cfbd40fec680ad3fee5bb3105f0d441f06e68d1dbd6f4e6e752f7bbda09d493", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:51:21.107295+00", - "updatedAt": "2023-02-12 04:51:21.107295+00", - "id": 149, - "deviceId": 14, - "generationStartTime": 1675464600, - "generationEndTime": 1675468500, - "creationTime": 1676177465, - "creationBlockHash": "0x002bcc51d17e2c615ff873db2b2016051da29355f9581f4b35994399c03d9be6", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:52:51.010187+00", - "updatedAt": "2023-02-12 04:52:51.010187+00", - "id": 150, - "deviceId": 14, - "generationStartTime": 1675471500, - "generationEndTime": 1675475700, - "creationTime": 1676177550, - "creationBlockHash": "0x729265355323ba72d58b3f6fb3666bf35ffa13b266dca06597e753b716897789", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"4000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:54:19.532645+00", - "updatedAt": "2023-02-12 04:54:19.532645+00", - "id": 151, - "deviceId": 14, - "generationStartTime": 1675479600, - "generationEndTime": 1675482900, - "creationTime": 1676177645, - "creationBlockHash": "0xdeb449b4dbd69a354d837290092318f5295845dfd4b736297ee261d89732da9e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"74000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:55:40.905075+00", - "updatedAt": "2023-02-12 04:55:54.313328+00", - "id": 152, - "deviceId": 14, - "generationStartTime": 1675483200, - "generationEndTime": 1675486500, - "creationTime": 1676177725, - "creationBlockHash": "0x5b27a2c5eb2821aa753c49e0f66f30744a5fc192a980422f1dc747fcbdfefd05", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"112000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:57:24.85269+00", - "updatedAt": "2023-02-12 04:57:24.85269+00", - "id": 153, - "deviceId": 14, - "generationStartTime": 1675486800, - "generationEndTime": 1675490100, - "creationTime": 1676177815, - "creationBlockHash": "0xbb57bfdb85598bec4f1c4f6c61db4ea29bc827141444a96e7646eed7cd78e26b", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"139000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:57:32.228158+00", - "updatedAt": "2023-02-12 04:57:32.228158+00", - "id": 154, - "deviceId": 14, - "generationStartTime": 1675490400, - "generationEndTime": 1675493700, - "creationTime": 1676177840, - "creationBlockHash": "0xde62e4ebcd7233f5c180af1ac10769fb5db8c21d9c5ded4ead2a900309eee444", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"154000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 04:58:55.703429+00", - "updatedAt": "2023-02-12 04:59:07.928141+00", - "id": 155, - "deviceId": 14, - "generationStartTime": 1675494000, - "generationEndTime": 1675497300, - "creationTime": 1676177920, - "creationBlockHash": "0x9e71acdb83d4625a7a257e6a2e04b6654cbd9f6e887ec9815dca851e26756e00", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"156000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 05:00:20.715913+00", - "updatedAt": "2023-02-12 05:00:20.715913+00", - "id": 156, - "deviceId": 16, - "generationStartTime": 1651797060, - "generationEndTime": 1674325799, - "creationTime": 1676178005, - "creationBlockHash": "0xcde30bb62a0488d40234d6ce11fc17fe5283cba05acd5161e73750745d731aaa", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"715063\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[218],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 05:01:49.798427+00", - "updatedAt": "2023-02-12 05:01:54.967656+00", - "id": 157, - "deviceId": 16, - "generationStartTime": 1658190600, - "generationEndTime": 1673893799, - "creationTime": 1676178090, - "creationBlockHash": "0x01f8cce1836ea797300ed941971f57c395077135d428d009fc5966c356e76795", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"667217\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[212],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 05:03:44.218338+00", - "updatedAt": "2023-02-12 05:03:44.218338+00", - "id": 159, - "deviceId": 16, - "generationStartTime": 1647217860, - "generationEndTime": 1674844199, - "creationTime": 1676178200, - "creationBlockHash": "0xe31f86c853205a90f7c1b109078478b1f5dbe969dede9a3bd0e2523d6b852cd8", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2566955\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[220],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 05:05:24.723323+00", - "updatedAt": "2023-02-12 05:05:24.723323+00", - "id": 160, - "deviceId": 16, - "generationStartTime": 1645749060, - "generationEndTime": 1674325799, - "creationTime": 1676178290, - "creationBlockHash": "0x94eacca5754fb5be7bc1dc59e24b5e2ee1d96304cd8ffd90c6414fe09c3ecca2", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1588159\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[226],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 05:05:28.112433+00", - "updatedAt": "2023-02-12 05:05:28.112433+00", - "id": 161, - "deviceId": 16, - "generationStartTime": 1656117060, - "generationEndTime": 1674584999, - "creationTime": 1676178300, - "creationBlockHash": "0x2c96ec725be72ed44ae2420b1e5a7bdc47090e21029fc826985e7dcd98bddf1d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"890473\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[213],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 05:05:33.122006+00", - "updatedAt": "2023-02-12 05:05:33.122006+00", - "id": 162, - "deviceId": 16, - "generationStartTime": 1646353860, - "generationEndTime": 1675189799, - "creationTime": 1676178320, - "creationBlockHash": "0xdb7378698c1927cc995e0ca2f99808f6058fb0f5478729d0e2bc6571f9a83eb3", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1175658\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[228],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 05:07:01.617354+00", - "updatedAt": "2023-02-12 05:07:01.617354+00", - "id": 163, - "deviceId": 16, - "generationStartTime": 1657413060, - "generationEndTime": 1674584999, - "creationTime": 1676178405, - "creationBlockHash": "0xd8ffe7e940df0a4d8d84d0bde857e02c81bb074671df23f0c7d5e4314799e916", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"525381\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[214],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 05:08:31.859954+00", - "updatedAt": "2023-02-12 05:08:31.859954+00", - "id": 164, - "deviceId": 16, - "generationStartTime": 1657326660, - "generationEndTime": 1674498599, - "creationTime": 1676178495, - "creationBlockHash": "0x3d9b05fdf301f74e8d8b6a56df1a461a4242d913705c1d069d876f4435a54fa3", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1422460\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[216],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 05:10:10.582909+00", - "updatedAt": "2023-02-12 05:10:10.582909+00", - "id": 165, - "deviceId": 16, - "generationStartTime": 1667003460, - "generationEndTime": 1674066599, - "creationTime": 1676178580, - "creationBlockHash": "0xb613eba94860e8de14eed6926e2c8bb36777415c153b49ece8bf6fb84b4440cd", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"182151\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[217],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 05:11:43.827113+00", - "updatedAt": "2023-02-12 05:11:43.827113+00", - "id": 166, - "deviceId": 16, - "generationStartTime": 1645489860, - "generationEndTime": 1674239399, - "creationTime": 1676178680, - "creationBlockHash": "0x328112d8a757c8cb671e821c5225cc07edb4af7e91aed365503e63034333c836", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1235593\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[221],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 05:12:46.474104+00", - "updatedAt": "2023-02-12 05:12:46.474104+00", - "id": 167, - "deviceId": 9, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1676178740, - "creationBlockHash": "0x0c62f415f90c054410de4563ae7982223530c53804cf747e620b4934db85a209", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"11089500\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-12 05:13:31.06109+00", - "updatedAt": "2023-02-12 05:13:31.06109+00", - "id": 168, - "deviceId": 16, - "generationStartTime": 1644971460, - "generationEndTime": 1674239399, - "creationTime": 1676178770, - "creationBlockHash": "0x2867a68a898c14b7f765a329f64b4f76a1984baf560e0aed80c02c447deeb3be", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1791330\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[222],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 07:08:21.727622+00", - "updatedAt": "2023-02-12 07:08:21.727622+00", - "id": 169, - "deviceId": 9, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1676185680, - "creationBlockHash": "0xbeb17df585c02c79e087b551533a97c463686d23321ca3d50ca28293c496591b", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"9716000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-12 07:08:46.518617+00", - "updatedAt": "2023-02-12 07:08:46.518617+00", - "id": 170, - "deviceId": 16, - "generationStartTime": 1646181060, - "generationEndTime": 1674239399, - "creationTime": 1676185710, - "creationBlockHash": "0x8896b9ffc2a79460e12e904da1a08aae61d7f1d37a181a23809a31567d3c959a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1550926\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[224],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 07:10:24.116183+00", - "updatedAt": "2023-02-12 07:10:27.400426+00", - "id": 171, - "deviceId": 16, - "generationStartTime": 1646353860, - "generationEndTime": 1674844199, - "creationTime": 1676185800, - "creationBlockHash": "0x0b3fee0747b10ed65a09aea8fccbc350ef76089006471a7175ab583cc69b12b6", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"756124\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[227],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 07:12:07.0333+00", - "updatedAt": "2023-02-12 07:12:07.0333+00", - "id": 172, - "deviceId": 16, - "generationStartTime": 1654561860, - "generationEndTime": 1674239399, - "creationTime": 1676185900, - "creationBlockHash": "0x0b81f85aa3472cc181a367dc9ad74081b826c85e48aa4c57a90477398583adbf", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1137486\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[232],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 07:13:33.53664+00", - "updatedAt": "2023-02-12 07:13:33.53664+00", - "id": 173, - "deviceId": 16, - "generationStartTime": 1663633860, - "generationEndTime": 1674152999, - "creationTime": 1676185995, - "creationBlockHash": "0x3b0c9b10de8b507245aa2ed6b952ce71ac4ddec1875c2a01f55c1c8022a4d5db", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"710356\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[233],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 07:15:07.109549+00", - "updatedAt": "2023-02-12 07:15:07.109549+00", - "id": 174, - "deviceId": 16, - "generationStartTime": 1654561860, - "generationEndTime": 1674239399, - "creationTime": 1676186080, - "creationBlockHash": "0x4663e25a79cf7e35ca2dd86c51219b727b6a6af587e50903d92c404e1c6ee865", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1012799\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[231],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 07:15:53.517035+00", - "updatedAt": "2023-02-12 07:15:53.517035+00", - "id": 175, - "deviceId": 9, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1676186130, - "creationBlockHash": "0x67eda41b7ed37e340826104e3357e642d0ff346d78502a231742b13dfa12f6a0", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"9716000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-12 07:16:44.209786+00", - "updatedAt": "2023-02-12 07:16:44.308588+00", - "id": 176, - "deviceId": 16, - "generationStartTime": 1663633860, - "generationEndTime": 1674498599, - "creationTime": 1676186175, - "creationBlockHash": "0xbab81b0648a8c4047e4d39569d36ff70b1adee96b39542689e581b7bceb5535a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"503212\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[234],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-12 07:18:17.459128+00", - "updatedAt": "2023-02-12 07:18:17.459128+00", - "id": 178, - "deviceId": 14, - "generationStartTime": 1675501200, - "generationEndTime": 1675504500, - "creationTime": 1676186280, - "creationBlockHash": "0xf49f9b04dba220d38395608b518fc0f17e134b17c8164cb9c41076aad80e1cbe", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"105000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:19:40.642001+00", - "updatedAt": "2023-02-12 07:19:40.642001+00", - "id": 179, - "deviceId": 14, - "generationStartTime": 1675504800, - "generationEndTime": 1675508100, - "creationTime": 1676186365, - "creationBlockHash": "0x05181557817f2edae191336fb4ae74e9e5fae264d239842a1c3457d41770305f", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"66000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:21:05.076735+00", - "updatedAt": "2023-02-12 07:21:05.076735+00", - "id": 180, - "deviceId": 14, - "generationStartTime": 1675508400, - "generationEndTime": 1675511700, - "creationTime": 1676186445, - "creationBlockHash": "0x358a36a2563c2db6b6004c18682b598e50355fef70226beb39ff389693afd637", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"24000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:22:25.394095+00", - "updatedAt": "2023-02-12 07:22:25.394095+00", - "id": 182, - "deviceId": 14, - "generationStartTime": 1675511700, - "generationEndTime": 1675515300, - "creationTime": 1676186530, - "creationBlockHash": "0xf802475df5ebc57e0eeb902a01735e1009f2ce639e73c89b9c6d277d1f56ad3b", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:24:03.678922+00", - "updatedAt": "2023-02-12 07:24:03.678922+00", - "id": 183, - "deviceId": 14, - "generationStartTime": 1675557600, - "generationEndTime": 1675562100, - "creationTime": 1676186615, - "creationBlockHash": "0x08ce114344d9e54ae79b562cc43efa72b771208b3fc2aab77eee605577a9bc93", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"5000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:27:53.307346+00", - "updatedAt": "2023-02-12 07:27:53.307346+00", - "id": 185, - "deviceId": 14, - "generationStartTime": 1675566000, - "generationEndTime": 1675569300, - "creationTime": 1676186860, - "creationBlockHash": "0xe962a429d1ed5302e8434abdb1a8a3afe656318822ac30a1ad543d99f014eb9c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"71000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:29:18.90852+00", - "updatedAt": "2023-02-12 07:29:18.90852+00", - "id": 186, - "deviceId": 14, - "generationStartTime": 1675572900, - "generationEndTime": 1675576500, - "creationTime": 1676186945, - "creationBlockHash": "0x43d40dc376ca4d43746d6f2d23bafb54b9bc2c2e7dab7936b291eeb09e309a98", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"141000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:30:44.68691+00", - "updatedAt": "2023-02-12 07:30:44.68691+00", - "id": 187, - "deviceId": 14, - "generationStartTime": 1675576500, - "generationEndTime": 1675580100, - "creationTime": 1676187025, - "creationBlockHash": "0x9aec3642805bed07b12efbf8eeb64a8b655e3555b16bbeeb5ccfd38d3122983b", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"148000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:32:08.611193+00", - "updatedAt": "2023-02-12 07:32:08.611193+00", - "id": 188, - "deviceId": 14, - "generationStartTime": 1675580400, - "generationEndTime": 1675583700, - "creationTime": 1676187110, - "creationBlockHash": "0xa74e17427b39030dc65f784a5d072c53a63fbf66aaf5edb953589f489e0c8c88", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"151000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:33:29.603691+00", - "updatedAt": "2023-02-12 07:33:29.603691+00", - "id": 189, - "deviceId": 14, - "generationStartTime": 1675584000, - "generationEndTime": 1675587300, - "creationTime": 1676187195, - "creationBlockHash": "0xbb04fbe041cf74ef4898610aee4815a0f58f133f8a161fe1b2bac2c760e1011c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"117000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:35:15.20688+00", - "updatedAt": "2023-02-12 07:35:15.20688+00", - "id": 190, - "deviceId": 14, - "generationStartTime": 1675587600, - "generationEndTime": 1675590900, - "creationTime": 1676187280, - "creationBlockHash": "0x10342a874a153952386edb07ea6441fe9746f9494e743881ff8734e51cb5cf8b", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"103000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:35:15.844845+00", - "updatedAt": "2023-02-12 07:35:15.844845+00", - "id": 191, - "deviceId": 14, - "generationStartTime": 1675591200, - "generationEndTime": 1675594500, - "creationTime": 1676187295, - "creationBlockHash": "0x9a408fb45de87ac41e795bf1c5f5044ac861fa1756609c286825d5fad33d545a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"55000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:36:45.999452+00", - "updatedAt": "2023-02-12 07:36:45.999452+00", - "id": 192, - "deviceId": 14, - "generationStartTime": 1675594800, - "generationEndTime": 1675598100, - "creationTime": 1676187385, - "creationBlockHash": "0xb5b5f6666120d686f3551e2ce60ddbf4881f30e26f12e6dfcc3c855b8074d674", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"21000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:38:24.613389+00", - "updatedAt": "2023-02-12 07:38:24.613389+00", - "id": 193, - "deviceId": 14, - "generationStartTime": 1675598400, - "generationEndTime": 1675601700, - "creationTime": 1676187480, - "creationBlockHash": "0x527939fd036fbdb90cbea7870e25f73f51d3e5226e9d8d2f4cedc3f00daf1b36", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:39:42.48503+00", - "updatedAt": "2023-02-12 07:39:42.48503+00", - "id": 194, - "deviceId": 14, - "generationStartTime": 1675633500, - "generationEndTime": 1675637700, - "creationTime": 1676187570, - "creationBlockHash": "0xfe88349fa571e991aea43d8b7dfc03f16f9e3c20de9d80f950fe23646de41a9d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 07:46:01.520224+00", - "updatedAt": "2023-02-12 07:46:01.520224+00", - "id": 195, - "deviceId": 10, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1676187935, - "creationBlockHash": "0x9538d953f99dfaa0c6522221899d69b55a81ab0db2e1b65f02889b685421d5f7", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1077000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-02-12 07:46:26.013986+00", - "updatedAt": "2023-02-12 07:46:26.013986+00", - "id": 196, - "deviceId": 14, - "generationStartTime": 1675648800, - "generationEndTime": 1675652100, - "creationTime": 1676187970, - "creationBlockHash": "0x35892cab5a4c646e85e40a1e0f1fcf8452b6809974c10a9295eb26e2ebe0f4ec", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"33000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 09:06:18.039506+00", - "updatedAt": "2023-02-12 09:06:27.628648+00", - "id": 197, - "deviceId": 12, - "generationStartTime": 1655663402, - "generationEndTime": 1656613799, - "creationTime": 1676192760, - "creationBlockHash": "0xceb96746a9e15ae675b86bb975e5cf6497f0f275dbae4e0b4f345a86654ad7eb", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3147100\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-12 09:06:47.914143+00", - "updatedAt": "2023-02-12 09:06:47.914143+00", - "id": 198, - "deviceId": 14, - "generationStartTime": 1675656000, - "generationEndTime": 1675659300, - "creationTime": 1676192795, - "creationBlockHash": "0x22d6263b673dd02348a5236a5b20161850daf946318692a1e0d94386af21ab7d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"102000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 09:08:11.374785+00", - "updatedAt": "2023-02-12 09:08:24.212885+00", - "id": 199, - "deviceId": 14, - "generationStartTime": 1675659600, - "generationEndTime": 1675662900, - "creationTime": 1676192875, - "creationBlockHash": "0xa24f551b909c154357214871c0590351ca0a1f4a83f60bb5761531a254ff2466", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"141000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 09:09:44.999688+00", - "updatedAt": "2023-02-12 09:09:59.599783+00", - "id": 200, - "deviceId": 14, - "generationStartTime": 1675663200, - "generationEndTime": 1675666500, - "creationTime": 1676192965, - "creationBlockHash": "0x955bffd4d827e1e99a93580f6713be691b4a2a04699034f5106ccf82cfa2b36e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"144000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 10:44:37.481243+00", - "updatedAt": "2023-02-12 10:44:57.787711+00", - "id": 201, - "deviceId": 12, - "generationStartTime": 1655663402, - "generationEndTime": 1656613799, - "creationTime": 1676198660, - "creationBlockHash": "0x793893b567c5f6427408d87a5c18dde417055a8b22a6c8abfc6e14459d85b91f", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3147100\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-12 10:45:14.507234+00", - "updatedAt": "2023-02-12 10:45:14.507234+00", - "id": 202, - "deviceId": 14, - "generationStartTime": 1675670400, - "generationEndTime": 1675673700, - "creationTime": 1676198690, - "creationBlockHash": "0x5ba6937bfe1c40a5373e2463dfd8a1ce6f3b1ff903cf93d8a6b815d0ae506828", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"140000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 10:46:36.61143+00", - "updatedAt": "2023-02-12 10:46:52.542371+00", - "id": 203, - "deviceId": 14, - "generationStartTime": 1675674000, - "generationEndTime": 1675677300, - "creationTime": 1676198780, - "creationBlockHash": "0xbc42bd0db044a2e3ff06cd9a3567cc52d873616365fde1a80d8e1739873c69ae", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"98000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 10:48:15.122994+00", - "updatedAt": "2023-02-12 10:48:15.122994+00", - "id": 204, - "deviceId": 14, - "generationStartTime": 1675677600, - "generationEndTime": 1675680900, - "creationTime": 1676198865, - "creationBlockHash": "0xa1fe665da4e14a358c0123ae458ee24b41eb9f6faeedb4ea1b31a2bd733d6119", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"60000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 10:49:36.261735+00", - "updatedAt": "2023-02-12 10:49:36.261735+00", - "id": 205, - "deviceId": 14, - "generationStartTime": 1675681200, - "generationEndTime": 1675684500, - "creationTime": 1676198960, - "creationBlockHash": "0xfcd19377fe5662f1c57a2715bc57d41ba7930e501b51d894e3b79a72ba46db83", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"22000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 10:51:00.904437+00", - "updatedAt": "2023-02-12 10:51:00.904437+00", - "id": 206, - "deviceId": 14, - "generationStartTime": 1675684800, - "generationEndTime": 1675686900, - "creationTime": 1676199040, - "creationBlockHash": "0xb4b2a81449b7eca4c1a20dedfde9daa1c1bddaf25c874d59e070f74216ac0c8e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 10:52:33.901482+00", - "updatedAt": "2023-02-12 10:52:33.901482+00", - "id": 207, - "deviceId": 14, - "generationStartTime": 1675735200, - "generationEndTime": 1675738500, - "creationTime": 1676199130, - "creationBlockHash": "0xda389c807ffeba6ba296181c5f359dce417a4c3388b95816df063e09d9951c75", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"34000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 10:54:03.359584+00", - "updatedAt": "2023-02-12 10:54:17.165897+00", - "id": 208, - "deviceId": 14, - "generationStartTime": 1675738800, - "generationEndTime": 1675742100, - "creationTime": 1676199220, - "creationBlockHash": "0xc4e99b90b61f308af21e76de260e62123945cdf96eab376b2fe10729a53af09e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"73000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 10:55:44.530663+00", - "updatedAt": "2023-02-12 10:55:44.530663+00", - "id": 209, - "deviceId": 14, - "generationStartTime": 1675742400, - "generationEndTime": 1675745700, - "creationTime": 1676199310, - "creationBlockHash": "0xb495ed0b611e0f27d391844a52c4bbe5bc5ab487562d5efb2e8b191c8f58f205", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"103000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 10:55:45.63257+00", - "updatedAt": "2023-02-12 10:55:45.63257+00", - "id": 210, - "deviceId": 14, - "generationStartTime": 1675746000, - "generationEndTime": 1675749300, - "creationTime": 1676199320, - "creationBlockHash": "0x25bfdac3de15ce31da453e9b855a4a6e9e477fc6602bc90b5b1734c21fdab01d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"141000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 11:00:40.8803+00", - "updatedAt": "2023-02-12 11:00:40.8803+00", - "id": 212, - "deviceId": 14, - "generationStartTime": 1675764000, - "generationEndTime": 1675767300, - "creationTime": 1676199625, - "creationBlockHash": "0x79e32383c42ac156644e26335da3bf5d18dbf80bd98113027b964302dde3976d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"67000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 11:02:10.47835+00", - "updatedAt": "2023-02-12 11:02:10.47835+00", - "id": 213, - "deviceId": 14, - "generationStartTime": 1675767600, - "generationEndTime": 1675770900, - "creationTime": 1676199710, - "creationBlockHash": "0x2ec3841a601700ffde116d4196ef02dece95af29e899d9cb07b5ad56a97d7a63", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"27000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 11:03:44.493917+00", - "updatedAt": "2023-02-12 11:03:44.493917+00", - "id": 214, - "deviceId": 14, - "generationStartTime": 1675771200, - "generationEndTime": 1675773300, - "creationTime": 1676199800, - "creationBlockHash": "0x6eefc39b1f35929423c8582fc4ae694ba7201864ef88f0cfa3a1514346e880c0", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 11:05:08.695815+00", - "updatedAt": "2023-02-12 11:05:08.695815+00", - "id": 215, - "deviceId": 14, - "generationStartTime": 1675817400, - "generationEndTime": 1675821300, - "creationTime": 1676199890, - "creationBlockHash": "0x42c30f8fc2b023689c923862afc44de0c72b45c987006be8dd8b0b1bc11c79b6", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"5000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 11:06:37.412306+00", - "updatedAt": "2023-02-12 11:06:44.046421+00", - "id": 216, - "deviceId": 14, - "generationStartTime": 1675821600, - "generationEndTime": 1675824900, - "creationTime": 1676199975, - "creationBlockHash": "0x9bdb4964344018c5d43f02204e3d748940f98548fed30e3dea121de8b86295fb", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"31000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 11:08:26.214933+00", - "updatedAt": "2023-02-12 11:08:26.214933+00", - "id": 217, - "deviceId": 14, - "generationStartTime": 1675825200, - "generationEndTime": 1675828500, - "creationTime": 1676200065, - "creationBlockHash": "0xeda376df2c734818787b79781e305ad1276cf402bf43136568dc282665ab94e4", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"71000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 11:08:26.511506+00", - "updatedAt": "2023-02-12 11:08:26.511506+00", - "id": 218, - "deviceId": 14, - "generationStartTime": 1675828800, - "generationEndTime": 1675832100, - "creationTime": 1676200080, - "creationBlockHash": "0x555f8ffdbdb1a1222c3f38283dba6adf7f0669cf40d0c0f12381f8da1f060caf", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"109000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 11:10:11.842651+00", - "updatedAt": "2023-02-12 11:10:11.842651+00", - "id": 220, - "deviceId": 14, - "generationStartTime": 1675836000, - "generationEndTime": 1675839300, - "creationTime": 1676200195, - "creationBlockHash": "0xb5a687c84a41d62eb7ef9cfbbcbbf85f3bb45036f83bb4021d7c3ca645e8357d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"146000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 11:11:41.220003+00", - "updatedAt": "2023-02-12 11:11:41.220003+00", - "id": 221, - "deviceId": 14, - "generationStartTime": 1675839600, - "generationEndTime": 1675842900, - "creationTime": 1676200280, - "creationBlockHash": "0x4fe4d79fa27ab074938490142c7b23a61de0127be1f23e075ef9c14c99264813", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"147000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 11:13:10.717787+00", - "updatedAt": "2023-02-12 11:13:19.241438+00", - "id": 222, - "deviceId": 14, - "generationStartTime": 1675843200, - "generationEndTime": 1675846500, - "creationTime": 1676200370, - "creationBlockHash": "0x4cd820cfaa67ddb401b18253454b36817e14ab0ed300af5df5639819d4b7be5d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"130000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:42:26.922068+00", - "updatedAt": "2023-02-12 12:42:34.414505+00", - "id": 224, - "deviceId": 14, - "generationStartTime": 1675850400, - "generationEndTime": 1675853700, - "creationTime": 1676205725, - "creationBlockHash": "0x49a8b3ea248f6bf0735b85aa7ccdfebca2c3407f2912f2371f391d0ce94b4ae9", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"62000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:44:00.136624+00", - "updatedAt": "2023-02-12 12:44:04.102524+00", - "id": 225, - "deviceId": 14, - "generationStartTime": 1675853700, - "generationEndTime": 1675857300, - "creationTime": 1676205815, - "creationBlockHash": "0x5404debcbc5982aff032565b34bfc27f42def8cfe2beaa496723aa0e78200d74", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"20000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:45:36.202456+00", - "updatedAt": "2023-02-12 12:45:36.202456+00", - "id": 226, - "deviceId": 14, - "generationStartTime": 1675900500, - "generationEndTime": 1675903800, - "creationTime": 1676205915, - "creationBlockHash": "0xff0786895f96b46d1841c78bcde04e48ea2a269b474a996edbdcae212b9ac035", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:47:11.945192+00", - "updatedAt": "2023-02-12 12:47:24.909615+00", - "id": 227, - "deviceId": 9, - "generationStartTime": 1646073001, - "generationEndTime": 1648751399, - "creationTime": 1676206010, - "creationBlockHash": "0xa93a71ba585bfad69a4503cd06968cbe8e8e495e0c9d923605013beb51be90c5", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2577200\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-12 12:47:18.182718+00", - "updatedAt": "2023-02-12 12:47:18.182718+00", - "id": 228, - "deviceId": 14, - "generationStartTime": 1675915200, - "generationEndTime": 1675918500, - "creationTime": 1676206015, - "creationBlockHash": "0x32e006663aba58cf8de2dbc5f5ee24f9c39794a7f04c14b5f14a3eabe013ca7b", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"111000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:48:52.214767+00", - "updatedAt": "2023-02-12 12:48:59.233866+00", - "id": 229, - "deviceId": 14, - "generationStartTime": 1675918800, - "generationEndTime": 1675922100, - "creationTime": 1676206110, - "creationBlockHash": "0xe866be7ebfcfc767dd7bec2c9c94a2372ad35f728b5f9748b28e318cb756c4d5", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"137000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:50:19.893376+00", - "updatedAt": "2023-02-12 12:50:19.893376+00", - "id": 230, - "deviceId": 14, - "generationStartTime": 1675922400, - "generationEndTime": 1675925700, - "creationTime": 1676206200, - "creationBlockHash": "0x976c1c44058e439d6217158583db517b4710d010e8c013259c177667614d327d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"147000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:51:46.51415+00", - "updatedAt": "2023-02-12 12:51:46.51415+00", - "id": 231, - "deviceId": 14, - "generationStartTime": 1675929600, - "generationEndTime": 1675932900, - "creationTime": 1676206285, - "creationBlockHash": "0x2ed1b848ad220a8a5b90d7ba0bd80797a3fb6c0a904da618431750e4a8f35623", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"105000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:53:19.1139+00", - "updatedAt": "2023-02-12 12:53:25.141903+00", - "id": 232, - "deviceId": 14, - "generationStartTime": 1675933200, - "generationEndTime": 1675936500, - "creationTime": 1676206375, - "creationBlockHash": "0x03436c99e685c8665296dcef723760b39511ee896a09e4e1441c2c59d0d7f3a9", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"105000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:54:42.647218+00", - "updatedAt": "2023-02-12 12:54:42.647218+00", - "id": 233, - "deviceId": 14, - "generationStartTime": 1675936800, - "generationEndTime": 1675940100, - "creationTime": 1676206465, - "creationBlockHash": "0xec391de0a4b9640ed579f3232542eb25a171af2a3925d5eb49a3518d8bf1ca0c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"49000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:56:18.819037+00", - "updatedAt": "2023-02-12 12:56:18.819037+00", - "id": 234, - "deviceId": 14, - "generationStartTime": 1675940400, - "generationEndTime": 1675943700, - "creationTime": 1676206550, - "creationBlockHash": "0xb1eb6902549a4ce6e00016245b2dde479a6db7d392a0b0ce53dd3fce9ac6bd8a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"18000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:57:55.958214+00", - "updatedAt": "2023-02-12 12:57:55.958214+00", - "id": 235, - "deviceId": 14, - "generationStartTime": 1675944000, - "generationEndTime": 1675947000, - "creationTime": 1676206655, - "creationBlockHash": "0x7fad6a829178c1675d0ddc85a83ba653a176568c59e4f6049ef7a42fbd532512", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 12:59:23.739019+00", - "updatedAt": "2023-02-12 12:59:23.739019+00", - "id": 236, - "deviceId": 14, - "generationStartTime": 1675974900, - "generationEndTime": 1675979700, - "creationTime": 1676206745, - "creationBlockHash": "0x0acef863ecd1602917656c09337dff9739f4cc4f81e8dc74c1af40824ca54b24", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 13:14:48.116158+00", - "updatedAt": "2023-02-12 13:14:48.116158+00", - "id": 238, - "deviceId": 9, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1676207665, - "creationBlockHash": "0xbb2251f8d6782dc331250d6393270fc2638804db7340178df1c94f6625fdc288", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3547000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-12 13:15:10.814652+00", - "updatedAt": "2023-02-12 13:15:10.814652+00", - "id": 239, - "deviceId": 14, - "generationStartTime": 1675998000, - "generationEndTime": 1676001300, - "creationTime": 1676207690, - "creationBlockHash": "0xa28cfcd14f565561cd81b2b5a3356d7e5da9995d06e86e67fd5f1bcdb4d8c991", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"74000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 13:16:49.737245+00", - "updatedAt": "2023-02-12 13:16:55.874476+00", - "id": 240, - "deviceId": 14, - "generationStartTime": 1676001600, - "generationEndTime": 1676004900, - "creationTime": 1676207780, - "creationBlockHash": "0x42aaaa05e6a9d17afb45b7c3b09b533f178214a440f21614a120ff7765986a69", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"120000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 13:16:49.216247+00", - "updatedAt": "2023-02-12 13:16:49.216247+00", - "id": 241, - "deviceId": 14, - "generationStartTime": 1676005200, - "generationEndTime": 1676008500, - "creationTime": 1676207790, - "creationBlockHash": "0x1da82e784bba5464b345a8c86e3e787d7a327fd2b25aa95838be9e1b7a4a486c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"143000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 13:18:24.013367+00", - "updatedAt": "2023-02-12 13:18:24.013367+00", - "id": 242, - "deviceId": 14, - "generationStartTime": 1676008800, - "generationEndTime": 1676012100, - "creationTime": 1676207875, - "creationBlockHash": "0x2b600fce41c1ae7cb499ed2de16b6237eed5c9cc1366cb5193393d01aadfff42", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"157000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 13:18:29.476453+00", - "updatedAt": "2023-02-12 13:18:29.476453+00", - "id": 243, - "deviceId": 14, - "generationStartTime": 1676012400, - "generationEndTime": 1676015700, - "creationTime": 1676207890, - "creationBlockHash": "0xddf1e6d7605933b50173feaa21e09590f94b39ee28f75c6674b9ef3577e6292e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"127000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 13:20:10.551054+00", - "updatedAt": "2023-02-12 13:20:10.551054+00", - "id": 244, - "deviceId": 14, - "generationStartTime": 1676016000, - "generationEndTime": 1676019300, - "creationTime": 1676207980, - "creationBlockHash": "0xb88a61fc473a97bf352813f8219bb4d7b80194c9e1cc9ab26a3673f5c8185646", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"138000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 13:21:42.039503+00", - "updatedAt": "2023-02-12 13:21:42.039503+00", - "id": 245, - "deviceId": 14, - "generationStartTime": 1676019600, - "generationEndTime": 1676022900, - "creationTime": 1676208080, - "creationBlockHash": "0x646009cb1aaf2cf06c69bc04cb591045f29464806061e2b6947595ec08fafc2c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"105000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 13:23:13.176588+00", - "updatedAt": "2023-02-12 13:23:13.176588+00", - "id": 246, - "deviceId": 14, - "generationStartTime": 1676023200, - "generationEndTime": 1676026500, - "creationTime": 1676208175, - "creationBlockHash": "0x837e82ccb9e324ff221640885c373a207ae4f886efd2a9419ed48003a3985a14", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"74000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 13:24:38.80499+00", - "updatedAt": "2023-02-12 13:24:38.80499+00", - "id": 247, - "deviceId": 14, - "generationStartTime": 1676026800, - "generationEndTime": 1676030100, - "creationTime": 1676208260, - "creationBlockHash": "0x8e3a66a405a0b49f440c33ccee4e96674f4b4a6b3dedfa457d522cdd657e1451", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"29000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 13:26:02.31376+00", - "updatedAt": "2023-02-12 13:26:02.31376+00", - "id": 248, - "deviceId": 14, - "generationStartTime": 1676030400, - "generationEndTime": 1676032800, - "creationTime": 1676208345, - "creationBlockHash": "0xcfeee39678b791426d3b65b3a1844b4fadd57bff03314e718c57ed7836b2d26c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-12 14:06:18.317861+00", - "updatedAt": "2023-02-12 14:06:18.317861+00", - "id": 249, - "deviceId": 9, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1676210745, - "creationBlockHash": "0xebb4a9a9c643207b74ce45b992901bfcf2ec0cbcc017de8ab432acf45f14a324", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3521300\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-12 14:18:14.878364+00", - "updatedAt": "2023-02-12 14:18:14.878364+00", - "id": 250, - "deviceId": 9, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1676211475, - "creationBlockHash": "0x45df265e2d372d4ff9267df5e9fb74e5bf37857fbcea1c4c4192aa67368778a6", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3521300\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-12 15:26:31.18853+00", - "updatedAt": "2023-02-12 15:26:31.18853+00", - "id": 252, - "deviceId": 10, - "generationStartTime": 1667241001, - "generationEndTime": 1669832999, - "creationTime": 1676215570, - "creationBlockHash": "0xaedaa10b86664d5fe04975ecfcc5bbcf0a8fedcd7f083381360c35e376edcaaa", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1151000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[15],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-02-12 15:34:32.009316+00", - "updatedAt": "2023-02-12 15:34:42.255495+00", - "id": 253, - "deviceId": 10, - "generationStartTime": 1661970601, - "generationEndTime": 1664562599, - "creationTime": 1676216050, - "creationBlockHash": "0xffc2ab8c5f8750c7f1600e06c47b2f6ee270a6a2bdcdef952954b390c3c00bec", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2211000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-02-12 15:38:35.144093+00", - "updatedAt": "2023-02-12 15:38:52.09274+00", - "id": 254, - "deviceId": 10, - "generationStartTime": 1667241001, - "generationEndTime": 1669832999, - "creationTime": 1676216285, - "creationBlockHash": "0xfa74c8216276b135a6a6d04273cb36883235af7cd75e3d1de6cc26a52af7ad72", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2439000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-02-12 15:46:40.575301+00", - "updatedAt": "2023-02-12 15:46:40.575301+00", - "id": 255, - "deviceId": 10, - "generationStartTime": 1667241001, - "generationEndTime": 1669832999, - "creationTime": 1676216755, - "creationBlockHash": "0x1331bebd584edb67a6ad957b27df5a1be2503c33e02cc7478b8d896fd55dc69c", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2439000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-02-12 15:48:28.509877+00", - "updatedAt": "2023-02-12 15:48:28.509877+00", - "id": 256, - "deviceId": 10, - "generationStartTime": 1669833001, - "generationEndTime": 1672511399, - "creationTime": 1676216880, - "creationBlockHash": "0xf98f9ef4ec5b1c5836f6618d115eccba4cdc78f72360c267be602862c3178791", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2304000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-02-12 16:22:02.024281+00", - "updatedAt": "2023-02-12 16:22:12.060323+00", - "id": 257, - "deviceId": 10, - "generationStartTime": 1669833001, - "generationEndTime": 1672511399, - "creationTime": 1676218900, - "creationBlockHash": "0x7233601c7fa93ccebce66f00015a7ddae42ae43015c0bebc5a63cc075d641b7a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2304000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[14],\"groupId\":\"10\"}" - }, - { - "createdAt": "2023-02-12 16:23:38.078267+00", - "updatedAt": "2023-02-12 16:23:49.818674+00", - "id": 258, - "deviceId": 11, - "generationStartTime": 1674122400, - "generationEndTime": 1674208800, - "creationTime": 1676218995, - "creationBlockHash": "0xdca992e7423696be30599c47f7f809a6f3201796f8a398849b49c171a7e84fc1", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"823000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-02-12 17:11:50.230806+00", - "updatedAt": "2023-02-12 17:11:50.230806+00", - "id": 259, - "deviceId": 11, - "generationStartTime": 1674727200, - "generationEndTime": 1674813600, - "creationTime": 1676221880, - "creationBlockHash": "0x719005dd6857cefc1681b93a6fd682fd7a2e01c66c9e91a0ea42c57565a44e10", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1154000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-02-12 17:17:52.724175+00", - "updatedAt": "2023-02-12 17:18:14.661072+00", - "id": 260, - "deviceId": 11, - "generationStartTime": 1674727200, - "generationEndTime": 1674813600, - "creationTime": 1676222225, - "creationBlockHash": "0xf430789c9527ba7f1ce2fa0e57f5a9f6d5e1010bf80720d1e273f38dd8a24a0a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1154000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-02-12 17:19:43.432869+00", - "updatedAt": "2023-02-12 17:20:47.797502+00", - "id": 261, - "deviceId": 12, - "generationStartTime": 1667241001, - "generationEndTime": 1669832999, - "creationTime": 1676222360, - "creationBlockHash": "0x3405075e8a953a2fbeddc58504e5abaf8355fb21ef5d0e6d7c8938f3b688d10d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"11563100\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-12 17:43:33.668431+00", - "updatedAt": "2023-02-12 17:44:02.915616+00", - "id": 262, - "deviceId": 12, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1676223780, - "creationBlockHash": "0x3df466b9e36f3397a55b05fc3cd977ee046b44389e0c886575511cc82fdd8a90", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"14118500\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-12 17:45:25.214298+00", - "updatedAt": "2023-02-12 17:46:26.490245+00", - "id": 263, - "deviceId": 12, - "generationStartTime": 1659292201, - "generationEndTime": 1661970599, - "creationTime": 1676223900, - "creationBlockHash": "0x2ce248212bdfea90ef95080237e4b0d3b02da332c9cfdaaf0f61086fcb5f60f3", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"16125200\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[205],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-13 14:52:29.710799+00", - "updatedAt": "2023-02-13 14:52:29.710799+00", - "id": 265, - "deviceId": 13, - "generationStartTime": 1664562601, - "generationEndTime": 1667240999, - "creationTime": 1676299915, - "creationBlockHash": "0x28da517250495da0ae068c0af821f6900853d8b48011ebffda9e8ad67941140d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2803000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"0a5ce04e-bb3f-4306-9665-2a165ebe45e1\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"13\"}" - }, - { - "createdAt": "2023-02-14 06:59:44.707387+00", - "updatedAt": "2023-02-14 06:59:49.241588+00", - "id": 266, - "deviceId": 16, - "generationStartTime": 1645749060, - "generationEndTime": 1674325799, - "creationTime": 1676357950, - "creationBlockHash": "0x427e2ae36e12b0cdecb074e7777e128ad1c4b08cd1c7d968ebcb5c0739a01a0a", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2067802\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[225],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-14 07:02:01.02934+00", - "updatedAt": "2023-02-14 07:02:01.02934+00", - "id": 267, - "deviceId": 16, - "generationStartTime": 1651797060, - "generationEndTime": 1674325799, - "creationTime": 1676358080, - "creationBlockHash": "0xbd48139454a134ccb7bd2149133a5c886f70a987967e57b1460935349960f642", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1359759\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[230],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-14 07:03:51.719366+00", - "updatedAt": "2023-02-14 07:04:33.601592+00", - "id": 268, - "deviceId": 16, - "generationStartTime": 1646094660, - "generationEndTime": 1674239399, - "creationTime": 1676358200, - "creationBlockHash": "0x93437d55f1e950c98a9f4b71de19c8a6254eb1d4978781eeb49a9c5cb50f831b", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1256659\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[223],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-14 07:06:40.276189+00", - "updatedAt": "2023-02-14 07:06:40.276189+00", - "id": 269, - "deviceId": 16, - "generationStartTime": 1651797060, - "generationEndTime": 1674325799, - "creationTime": 1676358355, - "creationBlockHash": "0x8bc85176d2e197b8aee9e7c635691b556dce5fc4c4cf6ae799c8026c36fe0993", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"715063\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"9dc7388e-a40a-4d10-aa5b-001168e9f8d0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[218],\"groupId\":\"16\"}" - }, - { - "createdAt": "2023-02-14 07:08:33.505602+00", - "updatedAt": "2023-02-14 07:08:33.505602+00", - "id": 270, - "deviceId": 11, - "generationStartTime": 1674986400, - "generationEndTime": 1675072800, - "creationTime": 1676358480, - "creationBlockHash": "0x26e236a4bc7febee525e3e7a2ac632d66e4609b88796fcb210641d3427d850d7", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"529000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-02-15 07:29:35.815382+00", - "updatedAt": "2023-02-18 16:43:11.849743+00", - "id": 271, - "deviceId": 9, - "generationStartTime": 1646073001, - "generationEndTime": 1648751399, - "creationTime": 1676358480, - "creationBlockHash": "0xa3318a13466122d57d69f2daa049493c3684d5fea2cafa8e88d84a6acbc44f50", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"5977900\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[12],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-15 07:47:49.27722+00", - "updatedAt": "2023-02-15 07:47:49.27722+00", - "id": 272, - "deviceId": 9, - "generationStartTime": 1669833001, - "generationEndTime": 1671042599, - "creationTime": 1676358480, - "creationBlockHash": "0xe02e6139a23bcb22f73b7ca13f65125f973c217fcdecb32ce3c8399751db368d", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3937500\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[10],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-15 07:47:49.27722+00", - "updatedAt": "2023-02-22 10:44:54.635718+00", - "id": 273, - "deviceId": 18, - "generationStartTime": 1672511401, - "generationEndTime": 1675189799, - "creationTime": 1677062640, - "creationBlockHash": "0x46e339f5e7e389553c7f7a6fb130961094c1722f6a717db77770c160ba5a8f40", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1681000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"20ff2e72-d47b-4bd7-aeee-c3b4e6e1ef2b\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"18\"}" - }, - { - "createdAt": "2023-02-15 07:47:49.27722+00", - "updatedAt": "2023-02-22 10:45:15.830042+00", - "id": 274, - "deviceId": 18, - "generationStartTime": 1672511401, - "generationEndTime": 1675189799, - "creationTime": 1677062675, - "creationBlockHash": "0x432c8fa81dd6f246bde739d0b8d72ab813a81d3a65be7c07370f55fb72bb7e21", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1681000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"20ff2e72-d47b-4bd7-aeee-c3b4e6e1ef2b\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[208],\"groupId\":\"18\"}" - }, - { - "createdAt": "2023-02-15 07:47:49.27722+00", - "updatedAt": "2023-02-22 10:46:21.73023+00", - "id": 275, - "deviceId": 17, - "generationStartTime": 1676131200, - "generationEndTime": 1676260800, - "creationTime": 1677062740, - "creationBlockHash": "0xbbf9635993f95e4ac071fe8fa6c19a5453fd1ef775c9c09a8d7318d20f7b6c63", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"480000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-15 08:07:49.061319+00", - "updatedAt": "2023-02-22 10:47:07.520711+00", - "id": 276, - "deviceId": 17, - "generationStartTime": 1676085300, - "generationEndTime": 1676109600, - "creationTime": 1677062770, - "creationBlockHash": "0x7bd78a5ca16e063976aafeaf998fc578f59011eff3ba048b7fc242eb414fca8f", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"12000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-15 08:07:49.061319+00", - "updatedAt": "2023-02-22 10:47:51.252161+00", - "id": 277, - "deviceId": 17, - "generationStartTime": 1676440800, - "generationEndTime": 1676444400, - "creationTime": 1677062835, - "creationBlockHash": "0x9286e3fdf100043d78874fe1386157333544bba06ffa2a1ba65139e658271a88", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"185000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-15 08:07:49.061319+00", - "updatedAt": "2023-02-22 10:48:35.316589+00", - "id": 278, - "deviceId": 11, - "generationStartTime": 1674554400, - "generationEndTime": 1674640800, - "creationTime": 1676358480, - "creationBlockHash": "0xd16b261c19778edf9bf4e8f0cfade67e1564d29da83b564a7c2276c6414b9685", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"41000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c56aeb0a-ed02-4ba1-964f-52469986f8ff\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"11\"}" - }, - { - "createdAt": "2023-02-15 08:07:49.061319+00", - "updatedAt": "2023-02-22 10:48:56.992204+00", - "id": 279, - "deviceId": 17, - "generationStartTime": 1676113200, - "generationEndTime": 1676116800, - "creationTime": 1677062895, - "creationBlockHash": "0xce654cc55b4176c4703b521ef7f88630021f29833ba667ab7f332adb6d24f1eb", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"18000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-15 08:07:49.061319+00", - "updatedAt": "2023-02-22 10:49:29.608227+00", - "id": 280, - "deviceId": 12, - "generationStartTime": 1667241001, - "generationEndTime": 1669832999, - "creationTime": 1676358480, - "creationBlockHash": "0xa443dd238a4a19f56466df1d7011e75ca8bbf4484ee2bef6b012ae84355bdc10", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"3920000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"1205deab-2255-46d7-950d-117bba7d88cf\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[206],\"groupId\":\"12\"}" - }, - { - "createdAt": "2023-02-15 08:07:49.061319+00", - "updatedAt": "2023-02-15 08:07:49.061319+00", - "id": 281, - "deviceId": 14, - "generationStartTime": 1675310400, - "generationEndTime": 1675314000, - "creationTime": 1676358480, - "creationBlockHash": "0xdf628303b6ea5806f60f2f02594005b726cfcf7927778ccd92025050229c1cc8", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"114000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-15 08:07:49.061319+00", - "updatedAt": "2023-02-22 10:50:31.218841+00", - "id": 282, - "deviceId": 14, - "generationStartTime": 1675298700, - "generationEndTime": 1675303200, - "creationTime": 1676358480, - "creationBlockHash": "0x7c041c9e2c7f307cf826d638ed0035e4e8651720b536a3f01f91d929bb667720", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"b03f2ed1-0998-43ea-a995-5f407e8fcfae\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[204,203,202],\"groupId\":\"14\"}" - }, - { - "createdAt": "2023-02-15 08:07:49.061319+00", - "updatedAt": "2023-02-22 10:50:54.371429+00", - "id": 283, - "deviceId": 17, - "generationStartTime": 1676167200, - "generationEndTime": 1676170800, - "creationTime": 1677063025, - "creationBlockHash": "0x047a037663156fe4c028a735bf5f238b39be7f38d3551447e26f3ef6cbd1c2b0", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"31000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-15 08:07:49.061319+00", - "updatedAt": "2023-02-22 10:52:13.821523+00", - "id": 284, - "deviceId": 17, - "generationStartTime": 1676170800, - "generationEndTime": 1676174400, - "creationTime": 1677063115, - "creationBlockHash": "0x9b8aba9a16982c46e4b69e6a566d0c8928db4f1e94d4710f9ad5ba8bc98d9577", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"64000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-22 10:53:47.710023+00", - "updatedAt": "2023-02-22 10:53:47.710023+00", - "id": 285, - "deviceId": 17, - "generationStartTime": 1676174400, - "generationEndTime": 1676178000, - "creationTime": 1677063200, - "creationBlockHash": "0x40b67de0aff7bfadf08e924eafacc94617c6cd1c209ad6c8a86e909989ad50ec", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"90000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-22 10:55:15.710137+00", - "updatedAt": "2023-02-22 10:55:27.309692+00", - "id": 286, - "deviceId": 17, - "generationStartTime": 1676178000, - "generationEndTime": 1676181600, - "creationTime": 1677063300, - "creationBlockHash": "0x5f700b2747fcb73d51b4529d6d13d404704ec6b913d01a3da5230366b9afe35f", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"107000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-22 10:56:49.907521+00", - "updatedAt": "2023-02-22 10:56:55.030504+00", - "id": 287, - "deviceId": 17, - "generationStartTime": 1676185200, - "generationEndTime": 1676188800, - "creationTime": 1677063385, - "creationBlockHash": "0x4971e4b77262971bf91cc16e14eccf81bcaf90e6a56f0dfbde96fd87aa2fbe29", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"96000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-22 10:58:18.718832+00", - "updatedAt": "2023-02-22 10:58:18.718832+00", - "id": 288, - "deviceId": 17, - "generationStartTime": 1676188800, - "generationEndTime": 1676192400, - "creationTime": 1677063480, - "creationBlockHash": "0x00506614ab3f25b80d2fc3e6989d1b2ee775bfba3e9c4142c3dea3ccd10d351e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"93000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-22 10:59:51.913789+00", - "updatedAt": "2023-02-22 10:59:51.913789+00", - "id": 289, - "deviceId": 17, - "generationStartTime": 1676192400, - "generationEndTime": 1676196000, - "creationTime": 1677063565, - "creationBlockHash": "0x70e09a6217d42aeca785e044fe7614c6e9cb2bd805ddb22ad6a8601e8c6ec0a8", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"78000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-22 11:01:32.910073+00", - "updatedAt": "2023-02-22 11:01:33.68855+00", - "id": 290, - "deviceId": 17, - "generationStartTime": 1676199600, - "generationEndTime": 1676203200, - "creationTime": 1677063665, - "creationBlockHash": "0xb7d9e1250c6097f088370585ce0425a9012e52c29b1191935bcb04e2b5cbb98e", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"20000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-22 11:03:05.92423+00", - "updatedAt": "2023-02-22 11:03:05.92423+00", - "id": 291, - "deviceId": 17, - "generationStartTime": 1676203200, - "generationEndTime": 1676206200, - "creationTime": 1677063760, - "creationBlockHash": "0x350aa785c6d7912183f017c2460573f92dd61f4c64f9e8541f5ed9cd489ef9b5", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"2000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"c87208a2-119b-43ee-9cf7-95f41b206ffa\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[203,202],\"groupId\":\"17\"}" - }, - { - "createdAt": "2023-02-23 07:29:45.634561+00", - "updatedAt": "2023-02-23 07:29:45.634561+00", - "id": 292, - "deviceId": 9, - "generationStartTime": 1, - "generationEndTime": 1, - "creationTime": 1677063760, - "creationBlockHash": "0x3ece329d69310a2b0326062a0a051071baef11ab9e1f23a6790b93efa554b14b", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"15322600\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-23 07:29:45.634561+00", - "updatedAt": "2023-02-23 07:29:45.634561+00", - "id": 293, - "deviceId": 9, - "generationStartTime": 1, - "generationEndTime": 1, - "creationTime": 1677063760, - "creationBlockHash": "0x00bcfecf2b7ef0d1e96bdd345f10105998d6badb29a4e0d7b516879519ff2cc0", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"9542000\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": "{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[9],\"groupId\":\"9\"}" - }, - { - "createdAt": "2023-02-23 07:29:45.634561+00", - "updatedAt": "2023-02-23 07:29:45.634561+00", - "id": 294, - "deviceId": 9, - "generationStartTime": 1, - "generationEndTime": 1, - "creationTime": 1677063760, - "creationBlockHash": "0x23ee3782de16d444d13a55973b43ab70bcf12c1c7e6199f850f6a0bc3f2decbb", - "owners": "{\"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437\":\"1801700\"}", - "claimers": null, - "claims": null, - "latestCommitment": null, - "issuedPrivately": false, - "blockchainNetId": 246, - "metadata": ":{\"version\":\"v1.0\",\"buyerReservationId\":\"95e06592-f52d-4acf-94d8-c5e655ff85c0\",\"isStandardIssuanceRequested\":\"I-REC\",\"type\":\"REC\",\"deviceIds\":[13],\"groupId\":\"9\"}" - } - ] \ No newline at end of file +export const issuercertificatelog = [ + { + createdAt: '2023-01-21 18:59:02.444933+00', + updatedAt: '2023-01-21 18:59:12.707698+00', + id: 26, + deviceId: 9, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1674327530, + creationBlockHash: + '0x608737bec1d4ba906efd9c0fd081ebaf9cf3da48f2f05e4b1c5f99991ae43fb5', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"5066000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}', + }, + { + createdAt: '2023-01-21 19:00:39.324224+00', + updatedAt: '2023-01-21 19:00:39.324224+00', + id: 27, + deviceId: 9, + generationStartTime: 1648751401, + generationEndTime: 1651343399, + creationTime: 1674327615, + creationBlockHash: + '0x9e8b930bc674ce0622232ddb00dea09ae15e952bc8f5e49afb4c5c9ea6119456', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2003700"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}', + }, + { + createdAt: '2023-01-21 19:02:17.127285+00', + updatedAt: '2023-01-21 19:02:17.127285+00', + id: 29, + deviceId: 9, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1674327720, + creationBlockHash: + '0xfb9f884b1ab1f7248d711b56f0ca7248baf25d41223577082d851773b9509ac0', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"7159100"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}', + }, + { + createdAt: '2023-01-21 19:03:49.212606+00', + updatedAt: '2023-01-21 19:03:49.212606+00', + id: 30, + deviceId: 9, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1674327810, + creationBlockHash: + '0xc9d6d5155b15d33895c1cc75d27b4358d9cda5a05928d8564b5a3c8eb27daa4f', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"5187100"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 10:59:04.121746+00', + updatedAt: '2023-01-23 10:59:04.121746+00', + id: 31, + deviceId: 10, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1674471515, + creationBlockHash: + '0x3b9d761c8949af57d9414c3803b06206a448f4a7a180ca61ac574f4d28bcaf2e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2463000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 10:59:12.687065+00', + updatedAt: '2023-01-23 10:59:12.687065+00', + id: 32, + deviceId: 9, + generationStartTime: 1648751401, + generationEndTime: 1651343399, + creationTime: 1674471540, + creationBlockHash: + '0x14dca3535390a853df6e2a45ec173c95baff1fb8629f3e3712155ba30e060e13', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2513300"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:00:34.49206+00', + updatedAt: '2023-01-23 11:00:40.821891+00', + id: 33, + deviceId: 9, + generationStartTime: 1646073001, + generationEndTime: 1648751399, + creationTime: 1674471620, + creationBlockHash: + '0xa42a0dfacb4d4beb879e53b56f85b69751c5eda6bc1aa37d155dd43cae4655e3', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2677400"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:01:53.507644+00', + updatedAt: '2023-01-23 11:01:53.507644+00', + id: 34, + deviceId: 9, + generationStartTime: 1651343401, + generationEndTime: 1654021799, + creationTime: 1674471700, + creationBlockHash: + '0x3595822cb7ef9052fcd72bb184388d7942376f4ae171997fb25383a0f294aba3', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2048800"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:03:12.292232+00', + updatedAt: '2023-01-23 11:03:12.292232+00', + id: 35, + deviceId: 9, + generationStartTime: 1654021801, + generationEndTime: 1656613799, + creationTime: 1674471780, + creationBlockHash: + '0x305cde14d4b8bb7217d594007816f01d2532d37ff763fcec77a3da9fdfe70dfe', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1752300"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:04:44.60855+00', + updatedAt: '2023-01-23 11:04:44.60855+00', + id: 36, + deviceId: 9, + generationStartTime: 1656613801, + generationEndTime: 1659292199, + creationTime: 1674471865, + creationBlockHash: + '0x4a05c427bee27c7ea38bf4e24b12fbf9007063d7deba1af7d6dd8b6ee3af6a8a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1877100"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:06:16.520458+00', + updatedAt: '2023-01-23 11:06:18.130206+00', + id: 37, + deviceId: 9, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1674471955, + creationBlockHash: + '0x3c79400dfdb26cbe1cc5ef2d76509a87bd9cda3d8d1f7900fa4a3b2ef3f95bba', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2109800"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:07:38.243091+00', + updatedAt: '2023-01-23 11:07:38.243091+00', + id: 38, + deviceId: 9, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1674472045, + creationBlockHash: + '0x4507fc1761e0ae477f08c1bb5120c65cbc78d01114ad1f6a58e2ab8084149c4c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2062100"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:08:59.315803+00', + updatedAt: '2023-01-23 11:08:59.315803+00', + id: 39, + deviceId: 9, + generationStartTime: 1651343401, + generationEndTime: 1654021799, + creationTime: 1674472125, + creationBlockHash: + '0x0d58a1e2c6fafbb3804b1c873266c986661fdf540f4942c30eb2ab8de5a2367a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"8324000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:10:17.211595+00', + updatedAt: '2023-01-23 11:10:17.211595+00', + id: 40, + deviceId: 9, + generationStartTime: 1654021801, + generationEndTime: 1656613799, + creationTime: 1674472205, + creationBlockHash: + '0x403da7f710a00cccc40ab462e18a057d51bc5f5ea0c448bcc502209e2f2560fe', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"9192000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:11:42.218607+00', + updatedAt: '2023-01-23 11:11:42.218607+00', + id: 41, + deviceId: 9, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1674472285, + creationBlockHash: + '0xf8da62708760d173a246672e40ceca0826b7d8e5ae93086676101884ae5e33a0', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2479800"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[11],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:13:11.518201+00', + updatedAt: '2023-01-23 11:13:11.518201+00', + id: 42, + deviceId: 9, + generationStartTime: 1656613801, + generationEndTime: 1659292199, + creationTime: 1674472375, + creationBlockHash: + '0x58e08a9129da85292afd0364ce53c4e1453f6aa166ce0aa712fd3b2a5f77d269', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"5458300"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:14:36.908494+00', + updatedAt: '2023-01-23 11:14:36.908494+00', + id: 43, + deviceId: 9, + generationStartTime: 1650133802, + generationEndTime: 1651343399, + creationTime: 1674472460, + creationBlockHash: + '0x08cca3556d708b7459e1c8879a328f88636a8f12f1367d8958e6b4cf23b7fff6', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"4672000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:15:57.930925+00', + updatedAt: '2023-01-23 11:15:57.930925+00', + id: 44, + deviceId: 9, + generationStartTime: 1656613801, + generationEndTime: 1659292199, + creationTime: 1674472545, + creationBlockHash: + '0x2ac25d796c5a2bac7c7e9f080c08d2429daa8633877b9be670076311f85c8a6c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"7879700"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:17:18.748778+00', + updatedAt: '2023-01-23 11:17:18.748778+00', + id: 45, + deviceId: 9, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1674472625, + creationBlockHash: + '0x9a8430225d9301aee6592fc2c87687a646d9ddce367b830ed524c2676970ca0b', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"8845500"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:18:38.463565+00', + updatedAt: '2023-01-23 11:18:44.064084+00', + id: 46, + deviceId: 9, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1674472705, + creationBlockHash: + '0x0f7aecfcace9ee869aeeedd65c4efbe4c93777f50e9226d3df330d4f43414c91', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"10755300"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:20:15.329845+00', + updatedAt: '2023-01-23 11:20:15.329845+00', + id: 47, + deviceId: 9, + generationStartTime: 1667241001, + generationEndTime: 1669832999, + creationTime: 1674472790, + creationBlockHash: + '0x01ea6cbdbc98186e759c11a1a337528f938001fa3b72fdfa8b68e7b5014ec08e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"9646300"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:20:49.594445+00', + updatedAt: '2023-01-23 11:20:54.428691+00', + id: 50, + deviceId: 9, + generationStartTime: 1654021801, + generationEndTime: 1656613799, + creationTime: 1674472835, + creationBlockHash: + '0x3a33eac0ece764c7c2999e7b1990c436dec25a21ece88aac6c58ca06b8e33e00', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"11984500"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:22:08.847269+00', + updatedAt: '2023-01-23 11:22:08.847269+00', + id: 51, + deviceId: 9, + generationStartTime: 1648751401, + generationEndTime: 1651343399, + creationTime: 1674472915, + creationBlockHash: + '0x124d3712a01d7cebac7246c753082f11fc24e5e5b8e0acac51a528340dc58fc5', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"14820700"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 11:23:32.807386+00', + updatedAt: '2023-01-23 11:23:32.807386+00', + id: 52, + deviceId: 9, + generationStartTime: 1656613801, + generationEndTime: 1659292199, + creationTime: 1674472995, + creationBlockHash: + '0x977cbab7a400bead1d4ce9b70a5077ac3e62a27dd833599bf7d9e8315ec846c9', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"8300600"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 12:19:39.420056+00', + updatedAt: '2023-01-23 12:19:39.420056+00', + id: 53, + deviceId: 10, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1674476360, + creationBlockHash: + '0x5bde7031866f54ac78da916b69ae927b49950864a6eed3ac2c4c1e1f0f6444dc', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1098000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:19:57.653316+00', + updatedAt: '2023-01-23 12:20:35.673645+00', + id: 54, + deviceId: 9, + generationStartTime: 1646073001, + generationEndTime: 1648751399, + creationTime: 1674476385, + creationBlockHash: + '0xe136c50cd037d4df4a0ea998b4f2c97e3137517980566d3e1be55cea6d24c27d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"14272300"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 12:21:19.839847+00', + updatedAt: '2023-01-23 12:21:40.266689+00', + id: 55, + deviceId: 9, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1674476465, + creationBlockHash: + '0x6f8c42c753da5d57e4141fb03c94385725dcfa11224e90bfca410e0a4420d841', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"11456000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 12:22:50.229245+00', + updatedAt: '2023-01-23 12:22:50.229245+00', + id: 56, + deviceId: 9, + generationStartTime: 1654021801, + generationEndTime: 1656613799, + creationTime: 1674476555, + creationBlockHash: + '0x8dbe78790fb73138596ba46b25be86e50985d2a620e9d3f1aad6cd71e6538ef6', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2675900"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 12:24:22.522089+00', + updatedAt: '2023-01-23 12:24:23.02064+00', + id: 57, + deviceId: 9, + generationStartTime: 1656613801, + generationEndTime: 1659292199, + creationTime: 1674476645, + creationBlockHash: + '0xbd0a2d4dee4cf6eaedea1021a6c9c95c91d956d21eebc84a11323275811fd472', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2710100"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 12:32:23.439903+00', + updatedAt: '2023-01-23 12:32:42.009075+00', + id: 58, + deviceId: 10, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1674477120, + creationBlockHash: + '0xecc612507c3333b47c5010ac4a70e111bd850741cc889cf878d2ebfc23bb247e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1178000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:32:47.2108+00', + updatedAt: '2023-01-23 12:32:47.2108+00', + id: 59, + deviceId: 9, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1674477150, + creationBlockHash: + '0x2e0dca801a40e02d38f7fcadefcb13b8dd036ddd3b53f10608d81b899c801447', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3078900"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 12:34:10.208001+00', + updatedAt: '2023-01-23 12:34:37.776098+00', + id: 60, + deviceId: 9, + generationStartTime: 1651343401, + generationEndTime: 1654021799, + creationTime: 1674477235, + creationBlockHash: + '0xf985d34a9804c4737d86db63ed728d673e0c2a4a8da6690336d088961719df8c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2777900"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}', + }, + { + createdAt: '2023-01-23 12:35:41.598756+00', + updatedAt: '2023-01-23 12:35:41.598756+00', + id: 61, + deviceId: 10, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1674477325, + creationBlockHash: + '0xbe4489f47d4fc7240ebe7a42d0587540839cb3702695e7b06ef3c849d8062afe', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1098000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:37:00.507577+00', + updatedAt: '2023-01-23 12:37:20.698493+00', + id: 62, + deviceId: 10, + generationStartTime: 1646073002, + generationEndTime: 1648751399, + creationTime: 1674477410, + creationBlockHash: + '0x650a60aede8f66084e0aaba7688920409f809a73c5f357d1a65f2359492d048e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"991000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:38:24.769928+00', + updatedAt: '2023-01-23 12:38:24.769928+00', + id: 63, + deviceId: 10, + generationStartTime: 1648751401, + generationEndTime: 1651343399, + creationTime: 1674477490, + creationBlockHash: + '0x14806d7158989e64736054ab10c7ff67a460c437c71718fd80a906157539212e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1080000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:39:49.513919+00', + updatedAt: '2023-01-23 12:39:49.513919+00', + id: 64, + deviceId: 10, + generationStartTime: 1669833001, + generationEndTime: 1672511399, + creationTime: 1674477570, + creationBlockHash: + '0x615e8344a6e736e8ecdbf7d7abbb32b015c4fd547fe04ec04a0dc9062595cf98', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1317000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:40:12.013138+00', + updatedAt: '2023-01-23 12:40:12.013138+00', + id: 65, + deviceId: 10, + generationStartTime: 1651343401, + generationEndTime: 1654021799, + creationTime: 1674477585, + creationBlockHash: + '0xa84435904e48cc34e988c9c78178b7cb66cd69ae5f5f50da8ddaf0eb006569ed', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1161000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:40:17.073752+00', + updatedAt: '2023-01-23 12:40:17.073752+00', + id: 66, + deviceId: 10, + generationStartTime: 1667241001, + generationEndTime: 1669832999, + creationTime: 1674477605, + creationBlockHash: + '0x02ef8fbe51c9631c6d1308c8d3005079ef0b5039fef76786d6b8c0f8312116c4', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1107000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:41:44.028058+00', + updatedAt: '2023-01-23 12:41:51.523802+00', + id: 67, + deviceId: 10, + generationStartTime: 1651343401, + generationEndTime: 1654021799, + creationTime: 1674477685, + creationBlockHash: + '0x51cd8878dc0c3c401783ee23f064018a81da470ff25ff44b67de25a5bf968345', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1075000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:43:02.46999+00', + updatedAt: '2023-01-23 12:43:02.46999+00', + id: 68, + deviceId: 10, + generationStartTime: 1654021801, + generationEndTime: 1656613799, + creationTime: 1674477770, + creationBlockHash: + '0xbb1679e16cddb96fac1348e552b1a36731b316ff4bdb9cd657337cf746964021', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1017000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:44:25.038045+00', + updatedAt: '2023-01-23 12:44:25.038045+00', + id: 69, + deviceId: 10, + generationStartTime: 1646073002, + generationEndTime: 1648751399, + creationTime: 1674477850, + creationBlockHash: + '0xa211debb3a2d3d353215dd96cb57a2c0b5e0e7ce480004ceb83f6dc8ebe37008', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"968000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:45:46.80714+00', + updatedAt: '2023-01-23 12:45:46.80714+00', + id: 70, + deviceId: 10, + generationStartTime: 1648751401, + generationEndTime: 1651343399, + creationTime: 1674477930, + creationBlockHash: + '0xee3e0bea1904ebb3da8c22abd2cee261c20e824bf4b67df3eaae97b4e444aa32', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1062000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:47:24.241055+00', + updatedAt: '2023-01-23 12:47:24.241055+00', + id: 72, + deviceId: 10, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1674478030, + creationBlockHash: + '0xe7110ee55dcf2c76b956487e8fc26bf8dcd41680549c25fde3b36037e1cfb764', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1078000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:48:47.419358+00', + updatedAt: '2023-01-23 12:48:47.419358+00', + id: 73, + deviceId: 10, + generationStartTime: 1654021801, + generationEndTime: 1656613799, + creationTime: 1674478115, + creationBlockHash: + '0x14748f14ea1d0c977483aed06ab0255cf1ef559107cc21e29df807d56b7bf22d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1028000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 12:50:13.309833+00', + updatedAt: '2023-01-23 12:50:13.309833+00', + id: 74, + deviceId: 10, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1674478195, + creationBlockHash: + '0x4364b28ffdf4fb906e21f85758de767b6e7d75c4d36a1cc926ccd2bdb26f39bc', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1321000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 13:23:12.061788+00', + updatedAt: '2023-01-23 13:23:12.061788+00', + id: 75, + deviceId: 10, + generationStartTime: 1656613801, + generationEndTime: 1659292199, + creationTime: 1674480160, + creationBlockHash: + '0xaafe0fbcc47f1e722f57cdaf0c1dded2c9bfcf73df8277c05b9f5d0d6717e872', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2237000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 13:23:19.11004+00', + updatedAt: '2023-01-23 13:24:27.896862+00', + id: 76, + deviceId: 10, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1674480185, + creationBlockHash: + '0x666da4cbf46ff0f8a05b3e2ea3edae820c550d31de488dd48c0888f954902d48', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1284000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 13:24:38.909757+00', + updatedAt: '2023-01-23 13:24:38.909757+00', + id: 77, + deviceId: 10, + generationStartTime: 1656613801, + generationEndTime: 1659292199, + creationTime: 1674480265, + creationBlockHash: + '0x055b6a6db8bfefd3155ff3c011aed0251dc0b9910ab02020ddc09176737e5e2d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1033000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[16],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 13:26:01.212217+00', + updatedAt: '2023-01-23 13:26:01.212217+00', + id: 78, + deviceId: 10, + generationStartTime: 1646245802, + generationEndTime: 1648751399, + creationTime: 1674480345, + creationBlockHash: + '0x39357bec41313d93a908e1e7e61caf0bab09f78fb69251e6dad7237f1fa27d33', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1472000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 13:27:34.352893+00', + updatedAt: '2023-01-23 13:27:34.352893+00', + id: 79, + deviceId: 10, + generationStartTime: 1648751401, + generationEndTime: 1651343399, + creationTime: 1674480430, + creationBlockHash: + '0x98a890ef8d3e7f408530f12b149fd3861572ac1033355c863d3335d68c68fe87', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1529000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 13:28:51.426555+00', + updatedAt: '2023-01-23 13:28:51.426555+00', + id: 80, + deviceId: 10, + generationStartTime: 1669833001, + generationEndTime: 1672511399, + creationTime: 1674480520, + creationBlockHash: + '0x0b3d2bdf1ad929f4bd314bcf9aa1ce49996db2b6f68a926f33619af7633982ed', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1320000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 13:30:17.962236+00', + updatedAt: '2023-01-23 13:30:17.962236+00', + id: 81, + deviceId: 10, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1674480605, + creationBlockHash: + '0x51d106a50cd2a585dba6ffbea537189e9c1bc86920acea4f55a07fb74351d46c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2183000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 13:50:29.019755+00', + updatedAt: '2023-01-23 13:50:52.802898+00', + id: 82, + deviceId: 10, + generationStartTime: 1651343401, + generationEndTime: 1654021799, + creationTime: 1674481805, + creationBlockHash: + '0x3050e62c8d9e85c688d38687b6c3adf539cc5743b86b5985b8286ccdfc4fbacf', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1760000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 13:51:13.598053+00', + updatedAt: '2023-01-23 13:51:13.598053+00', + id: 83, + deviceId: 10, + generationStartTime: 1654021801, + generationEndTime: 1656613799, + creationTime: 1674481855, + creationBlockHash: + '0x5ad5c60be9d5d8f2ec9be86ad54fd09e47f56f622388a6d74826ba3eeef0f623', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1628000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-01-23 13:53:14.091888+00', + updatedAt: '2023-01-23 13:53:29.613845+00', + id: 85, + deviceId: 10, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1674481965, + creationBlockHash: + '0x784c9a5ff695eb710db893ae60ac7c001c3f5eecc42a9d0a487fde8a5acce411', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2463000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-01-25 12:51:31.709132+00', + updatedAt: '2023-01-25 12:51:31.709132+00', + id: 86, + deviceId: 9, + generationStartTime: 1651343401, + generationEndTime: 1654021799, + creationTime: 1674651065, + creationBlockHash: + '0xbaad4160b147f83d940d55a8bff8f1e93eb3c6a993f5c5837a9666a7550d1a79', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"5611700"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}', + }, + { + createdAt: '2023-01-25 12:58:54.019531+00', + updatedAt: '2023-01-25 12:58:54.019531+00', + id: 87, + deviceId: 9, + generationStartTime: 1654021801, + generationEndTime: 1656613799, + creationTime: 1674651505, + creationBlockHash: + '0xbf169938fca581e031e286dfbe564ded03b0848a6d5837a5a2c2c62ba07259ad', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"6526800"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}', + }, + { + createdAt: '2023-01-27 04:58:29.433628+00', + updatedAt: '2023-01-27 04:58:29.433628+00', + id: 88, + deviceId: 11, + generationStartTime: 1647216000, + generationEndTime: 1673859600, + creationTime: 1674795495, + creationBlockHash: + '0x795cd6faf2ee2acdf93771e946499c3aa025e037870210c6d326c39ef0727c49', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"74545344"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[202],"groupId":"11"}', + }, + { + createdAt: '2023-01-27 04:59:46.864137+00', + updatedAt: '2023-01-27 04:59:46.864137+00', + id: 89, + deviceId: 11, + generationStartTime: 1647216000, + generationEndTime: 1673859600, + creationTime: 1674795575, + creationBlockHash: + '0xfe8596c3d96c74be26d47647feb937846bcc872bc043fccac3f2f9ade4fb59ee', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"78922632"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203],"groupId":"11"}', + }, + { + createdAt: '2023-01-27 05:01:12.880564+00', + updatedAt: '2023-01-27 05:01:12.880564+00', + id: 90, + deviceId: 11, + generationStartTime: 1647216000, + generationEndTime: 1673827199, + creationTime: 1674795655, + creationBlockHash: + '0xdcd5288df7b8783a90013d22fefcaa6f7973d0a5853fdbd8c3598eee2d91a5c5', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"79136096"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204],"groupId":"11"}', + }, + { + createdAt: '2023-01-27 05:03:11.162919+00', + updatedAt: '2023-01-27 05:03:11.162919+00', + id: 92, + deviceId: 11, + generationStartTime: 1674208800, + generationEndTime: 1674295200, + creationTime: 1674795775, + creationBlockHash: + '0xb664c4a9746576441702d9e71cedb1d62708aebcb0b915c911d7ed9c65ba849c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"877000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-01-27 05:04:37.819675+00', + updatedAt: '2023-01-27 05:04:37.819675+00', + id: 93, + deviceId: 11, + generationStartTime: 1674295200, + generationEndTime: 1674381600, + creationTime: 1674795860, + creationBlockHash: + '0x624d98ca548cbe3197eee5349852554b98920c8d57d44da163c421547d825414', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"723000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-01-27 05:06:13.216261+00', + updatedAt: '2023-01-27 05:06:13.216261+00', + id: 94, + deviceId: 11, + generationStartTime: 1674381600, + generationEndTime: 1674468000, + creationTime: 1674795945, + creationBlockHash: + '0x71451dd0a8cb3a3ac5e6b2033c7e4bc0e861a9ac328f0ef3358be2f2c86b75fc', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"910000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-01-27 05:07:37.016925+00', + updatedAt: '2023-01-27 05:07:37.016925+00', + id: 95, + deviceId: 11, + generationStartTime: 1674468000, + generationEndTime: 1674554400, + creationTime: 1674796040, + creationBlockHash: + '0x5519eeac0a67988aeb5e373baf8351c537a3ca0d20cc696925b16923b537774a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1047000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-01-27 05:09:07.414096+00', + updatedAt: '2023-01-27 05:09:07.414096+00', + id: 96, + deviceId: 11, + generationStartTime: 1674640800, + generationEndTime: 1674727200, + creationTime: 1674796130, + creationBlockHash: + '0x5328b3d8690d6c4cd1bbcb46f1fc732a3dcd4ecf6465682849758188c615e370', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1077000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-01-28 10:03:54.109853+00', + updatedAt: '2023-01-28 10:03:54.109853+00', + id: 97, + deviceId: 11, + generationStartTime: 1674813600, + generationEndTime: 1674900000, + creationTime: 1674900220, + creationBlockHash: + '0x0f60dbd0388d88f693179e0bc3034be9ac4e32ccc64aaa9d0159c1e038a353e6', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1093000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-01-29 10:03:58.378342+00', + updatedAt: '2023-01-29 10:03:58.378342+00', + id: 98, + deviceId: 11, + generationStartTime: 1674900000, + generationEndTime: 1674986400, + creationTime: 1674986620, + creationBlockHash: + '0xa6017eee8415bf0068c85a6643b530f9d976dfe39523f9e2ebe595e1efd16559', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"752000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-01-31 07:16:23.53761+00', + updatedAt: '2023-01-31 07:16:23.53761+00', + id: 99, + deviceId: 9, + generationStartTime: 1654021801, + generationEndTime: 1656613799, + creationTime: 1675149340, + creationBlockHash: + '0x8c1f8d86fe721be68d54aa461c71ef08f1ee4aee00d89ab64fedabfc001dd071', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"6526800"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}', + }, + { + createdAt: '2023-02-09 07:38:15.957428+00', + updatedAt: '2023-02-09 07:38:15.957428+00', + id: 102, + deviceId: 12, + generationStartTime: 1667241001, + generationEndTime: 1669832999, + creationTime: 1675928275, + creationBlockHash: + '0x01c5166a9dad4ab1c5927d979689a40942e2d1b2ba3e32b99f4937e14f34b797', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"5656000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[207],"groupId":"12"}', + }, + { + createdAt: '2023-02-09 07:38:35.116796+00', + updatedAt: '2023-02-09 07:38:35.116796+00', + id: 103, + deviceId: 12, + generationStartTime: 1669833001, + generationEndTime: 1672511399, + creationTime: 1675928290, + creationBlockHash: + '0x94cc00abf7c1c8d64f87ee4c05db9e716a73f08296ea86f082cf4899928dbca2', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"5812000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[207],"groupId":"12"}', + }, + { + createdAt: '2023-02-09 07:40:05.317533+00', + updatedAt: '2023-02-09 07:40:05.317533+00', + id: 104, + deviceId: 12, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1675928390, + creationBlockHash: + '0x6e14952ca91d9e4dabea19c911bbe1f9506b56471b5a116a3f392bf5a75775b4', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3947000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[206],"groupId":"12"}', + }, + { + createdAt: '2023-02-09 07:41:35.136466+00', + updatedAt: '2023-02-09 07:41:35.136466+00', + id: 105, + deviceId: 12, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1675928470, + creationBlockHash: + '0x52860dd9072bdd2423137ef21b4d3984f1628abb7de47070a6c527cc4e0c1a53', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"4111000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[206],"groupId":"12"}', + }, + { + createdAt: '2023-02-09 07:43:30.11491+00', + updatedAt: '2023-02-09 07:43:30.11491+00', + id: 107, + deviceId: 12, + generationStartTime: 1669833001, + generationEndTime: 1672511399, + creationTime: 1675928590, + creationBlockHash: + '0xcc67e75aef90b30088369a1b2b0e9efececc8f6d7ad0f3ea623a7116b45dd808', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3923000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[206],"groupId":"12"}', + }, + { + createdAt: '2023-02-09 07:44:57.233304+00', + updatedAt: '2023-02-09 07:44:57.233304+00', + id: 108, + deviceId: 12, + generationStartTime: 1655663402, + generationEndTime: 1656613799, + creationTime: 1675928680, + creationBlockHash: + '0x1eb26c3fc940710da3444b0548491ee2a8ede96935a71c01aee93aa7226bff59', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3147100"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}', + }, + { + createdAt: '2023-02-09 07:46:40.041752+00', + updatedAt: '2023-02-09 07:46:40.041752+00', + id: 109, + deviceId: 12, + generationStartTime: 1656613801, + generationEndTime: 1659292199, + creationTime: 1675928775, + creationBlockHash: + '0x61c270ce5eb2f1be005477462b8c1159f0f85d85670f3712bae95823c8548bb4', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"12173900"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}', + }, + { + createdAt: '2023-02-09 07:46:57.807186+00', + updatedAt: '2023-02-09 07:46:57.807186+00', + id: 110, + deviceId: 13, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1675928795, + creationBlockHash: + '0xdbfa1b71d5c57d6b3bf7924cea9e7e8edfdb9d996155d0aa1a4012bac90dd4fb', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3205000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"0a5ce04e-bb3f-4306-9665-2a165ebe45e1","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"13"}', + }, + { + createdAt: '2023-02-09 07:48:25.622072+00', + updatedAt: '2023-02-09 07:48:25.622072+00', + id: 111, + deviceId: 13, + generationStartTime: 1667241001, + generationEndTime: 1669832999, + creationTime: 1675928890, + creationBlockHash: + '0xed0adfce480849b3f52369afd1f43958385da606dddb794727e92f471ade64e5', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2312000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"0a5ce04e-bb3f-4306-9665-2a165ebe45e1","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"13"}', + }, + { + createdAt: '2023-02-09 07:50:12.061461+00', + updatedAt: '2023-02-09 07:50:12.061461+00', + id: 112, + deviceId: 13, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1675928980, + creationBlockHash: + '0xb287b9eea161bac0ab8aef20e179e53c4a88151c9380f1427f2376e7d6deee67', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3247000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"0a5ce04e-bb3f-4306-9665-2a165ebe45e1","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"13"}', + }, + { + createdAt: '2023-02-09 07:50:18.479291+00', + updatedAt: '2023-02-09 07:50:18.479291+00', + id: 113, + deviceId: 13, + generationStartTime: 1669833001, + generationEndTime: 1672511399, + creationTime: 1675928995, + creationBlockHash: + '0xda573fc24f37c0fce59e201fb8c6acab8df9e03842aa69ab851f4c214ebf3e68', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1617000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"0a5ce04e-bb3f-4306-9665-2a165ebe45e1","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"13"}', + }, + { + createdAt: '2023-02-09 07:50:34.058044+00', + updatedAt: '2023-02-09 07:50:34.058044+00', + id: 114, + deviceId: 14, + generationStartTime: 1675212000, + generationEndTime: 1675216800, + creationTime: 1675929015, + creationBlockHash: + '0xfe74b98bd80a248e0da5f5d375389c6f91ee32bdaa237af8690a7c4a2f3f495f', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 07:51:54.41039+00', + updatedAt: '2023-02-09 07:51:54.41039+00', + id: 115, + deviceId: 14, + generationStartTime: 1675216800, + generationEndTime: 1675220400, + creationTime: 1675929100, + creationBlockHash: + '0x21b1f2782f604718581cd403b0e6703b35e807678704a1c6fb5dfa1ad2c5fbeb', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"12000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 07:53:18.769567+00', + updatedAt: '2023-02-09 07:53:30.210157+00', + id: 116, + deviceId: 14, + generationStartTime: 1675224000, + generationEndTime: 1675227600, + creationTime: 1675929185, + creationBlockHash: + '0x5a65b7c54e0f9d9de72e950ef6a4dc3c780e00791190f9815e37d731c474cc01', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"114000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 07:54:44.120055+00', + updatedAt: '2023-02-09 07:54:44.120055+00', + id: 117, + deviceId: 14, + generationStartTime: 1675227600, + generationEndTime: 1675231200, + creationTime: 1675929265, + creationBlockHash: + '0xb8592d9805c2bb127b344fc3b5ea02c332c08d71ccac2ab4bcdda049a042ab6a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"139000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 07:56:07.384558+00', + updatedAt: '2023-02-09 07:56:07.384558+00', + id: 118, + deviceId: 14, + generationStartTime: 1675231200, + generationEndTime: 1675234800, + creationTime: 1675929350, + creationBlockHash: + '0xe8ec6174375a2d4d27ecb84cf115ea174c379479603b7ba08e9c57d5b11031b1', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"157000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 07:57:27.853056+00', + updatedAt: '2023-02-09 07:57:27.853056+00', + id: 119, + deviceId: 14, + generationStartTime: 1675234800, + generationEndTime: 1675238400, + creationTime: 1675929435, + creationBlockHash: + '0x1269ee6f5397bcb41cd6ebc95cd1e6ad4208e8a7be7a0925e1e94b6166fcd9fc', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"157000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 07:58:52.751723+00', + updatedAt: '2023-02-09 07:59:02.20733+00', + id: 120, + deviceId: 14, + generationStartTime: 1675238400, + generationEndTime: 1675242000, + creationTime: 1675929515, + creationBlockHash: + '0x574f1aca42ae7d16da698ae879a5fc3a2d74caa7ded6b568e7442311d15c0076', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"134000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 08:00:15.487653+00', + updatedAt: '2023-02-09 08:00:15.487653+00', + id: 121, + deviceId: 14, + generationStartTime: 1675242000, + generationEndTime: 1675245600, + creationTime: 1675929600, + creationBlockHash: + '0x45dc150063872f64af40ea0db916d709d9e51cd3b4615b1e5ef45ce5c5daa541', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"97000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 08:02:05.94366+00', + updatedAt: '2023-02-09 08:02:05.94366+00', + id: 122, + deviceId: 14, + generationStartTime: 1675245600, + generationEndTime: 1675249200, + creationTime: 1675929685, + creationBlockHash: + '0x1b5f86142f2f63e4cc1c8a0fbee76fbd80474f65eb490dffcc9a44df360e8016', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"57000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 08:01:57.221263+00', + updatedAt: '2023-02-09 08:01:57.221263+00', + id: 123, + deviceId: 14, + generationStartTime: 1675249200, + generationEndTime: 1675252800, + creationTime: 1675929700, + creationBlockHash: + '0x975d6bcd035108882d0be92e974acabc4483859c5f21c483a03ab2bae1b2f0e9', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"20000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 08:03:20.711784+00', + updatedAt: '2023-02-09 08:03:20.711784+00', + id: 124, + deviceId: 14, + generationStartTime: 1675252800, + generationEndTime: 1675256400, + creationTime: 1675929785, + creationBlockHash: + '0x874fe48621299c9981860d1348eab17d951b7c4303cdadee76518a9d4fb28855', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 08:04:59.424589+00', + updatedAt: '2023-02-09 08:04:59.424589+00', + id: 125, + deviceId: 14, + generationStartTime: 1675291500, + generationEndTime: 1675296000, + creationTime: 1675929875, + creationBlockHash: + '0x5b283a3edca27fe82bd344640ae57aa615222ff61af113b48dd1e82c7bd3aa1f', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 08:06:31.527473+00', + updatedAt: '2023-02-09 08:06:36.959815+00', + id: 126, + deviceId: 14, + generationStartTime: 1675303200, + generationEndTime: 1675306800, + creationTime: 1675929970, + creationBlockHash: + '0x1fd6409caf51e3e684ac6edea76cd6e41a243349e838f1eb8fd837504e7dbe61', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"32000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 08:08:21.310134+00', + updatedAt: '2023-02-09 08:08:21.310134+00', + id: 128, + deviceId: 14, + generationStartTime: 1675314000, + generationEndTime: 1675317600, + creationTime: 1675930080, + creationBlockHash: + '0x98c6c6546be20b6413bfa0e25a9bc4699281a3b1ecced021f5cffb64f4b2cf31', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"138000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 12:49:45.033389+00', + updatedAt: '2023-02-09 12:49:45.033389+00', + id: 129, + deviceId: 12, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1675946965, + creationBlockHash: + '0x5e4d68a05ccd13fb0bd0e5e9914ba3e83bb3ea5d25e4889e2ae0d8bcc5d47564', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"16336400"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}', + }, + { + createdAt: '2023-02-09 12:50:08.413105+00', + updatedAt: '2023-02-09 12:50:08.413105+00', + id: 130, + deviceId: 14, + generationStartTime: 1675320900, + generationEndTime: 1675324800, + creationTime: 1675946995, + creationBlockHash: + '0xd14d1a7533a4169e634a074eab1139fb586073ca8c0af4fd757ef0db2187d89b', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"154000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 12:51:54.01125+00', + updatedAt: '2023-02-09 12:52:01.732099+00', + id: 132, + deviceId: 14, + generationStartTime: 1675332000, + generationEndTime: 1675335600, + creationTime: 1675947095, + creationBlockHash: + '0x46c93b4ae4b4c854a9d24a8804a8602ee2026ca13d8f4623d1076ddbeaa86b90', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"55000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 12:53:21.248664+00', + updatedAt: '2023-02-09 12:53:32.9871+00', + id: 133, + deviceId: 15, + generationStartTime: 1656613801, + generationEndTime: 1659292199, + creationTime: 1675947185, + creationBlockHash: + '0x82aed950a7e2cf6b312eab6a0ff841fc4ca368bac7c4aa9d411c753988dd6004', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2431000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95c6ed07-4001-478e-a5b8-119aa0101f10","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"15"}', + }, + { + createdAt: '2023-02-09 13:25:09.897056+00', + updatedAt: '2023-02-09 13:25:09.897056+00', + id: 134, + deviceId: 14, + generationStartTime: 1675339200, + generationEndTime: 1675341600, + creationTime: 1675949090, + creationBlockHash: + '0xf68bd40654980fb1d8caa102aa3288e4984a70575857f763fae44aa09a2f658d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 13:25:37.233495+00', + updatedAt: '2023-02-09 13:25:37.233495+00', + id: 135, + deviceId: 14, + generationStartTime: 1675339200, + generationEndTime: 1675341600, + creationTime: 1675949115, + creationBlockHash: + '0x4818042baf19289447d804c240d2950e2877f3e259b9ee1924a445c912874345', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-09 13:25:47.175637+00', + updatedAt: '2023-02-09 13:25:47.175637+00', + id: 136, + deviceId: 14, + generationStartTime: 1675346100, + generationEndTime: 1675350000, + creationTime: 1675949125, + creationBlockHash: + '0x919466141e762272cf8cf998f6bc265df9a2b1018d027d0bc9514fd07845f1fc', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-10 12:11:13.161997+00', + updatedAt: '2023-02-10 12:11:18.890086+00', + id: 138, + deviceId: 14, + generationStartTime: 1675857600, + generationEndTime: 1675860000, + creationTime: 1676031045, + creationBlockHash: + '0xb375fa740d74b9daf0a3c08c547d1fe5502430270d4c134802328fc67640480c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-10 12:11:36.070475+00', + updatedAt: '2023-02-10 12:11:36.070475+00', + id: 139, + deviceId: 14, + generationStartTime: 1675393200, + generationEndTime: 1675396800, + creationTime: 1676031075, + creationBlockHash: + '0xbb4d1576a50f176e1fa87124f0ebe5f3432d6f0e875b7ed741c8736ef374f21f', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"75000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-10 12:47:11.627092+00', + updatedAt: '2023-02-10 12:47:11.627092+00', + id: 142, + deviceId: 14, + generationStartTime: 1675404000, + generationEndTime: 1675407600, + creationTime: 1676033215, + creationBlockHash: + '0x0f2373bff80eeccad08378af489c93ea7d1e7a2919256eddb4ebd696a6a3523c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"163000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:34:08.034808+00', + updatedAt: '2023-02-12 04:34:08.034808+00', + id: 143, + deviceId: 14, + generationStartTime: 1675911600, + generationEndTime: 1675914900, + creationTime: 1676176430, + creationBlockHash: + '0x89bcfb5fbf7ddd10b0745c41333a9e67a6faa0ac3faf0b5f02b95e99999a3a85', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"74000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:35:58.262192+00', + updatedAt: '2023-02-12 04:36:10.0627+00', + id: 144, + deviceId: 14, + generationStartTime: 1675908000, + generationEndTime: 1675911300, + creationTime: 1676176535, + creationBlockHash: + '0xfe6c94e173cdddfb75a566fe6886c412a6059d4139d5cf799e79b03529338b52', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"34000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:37:27.564367+00', + updatedAt: '2023-02-12 04:37:27.564367+00', + id: 145, + deviceId: 14, + generationStartTime: 1675903500, + generationEndTime: 1675907700, + creationTime: 1676176630, + creationBlockHash: + '0xc4983057fb355c6e5f41b4b047cddb46193797f6d7fa86e1b6004052dd9f5d82', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"5000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:38:58.897122+00', + updatedAt: '2023-02-12 04:38:58.897122+00', + id: 146, + deviceId: 14, + generationStartTime: 1675900500, + generationEndTime: 1675903800, + creationTime: 1676176715, + creationBlockHash: + '0x1275d5092bb75d2ca2cd201426f12f8d43f8a7c174a70de17dc4c19110fe3b91', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:39:14.308692+00', + updatedAt: '2023-02-12 04:39:22.234634+00', + id: 147, + deviceId: 14, + generationStartTime: 1675422000, + generationEndTime: 1675425300, + creationTime: 1676176740, + creationBlockHash: + '0x12f4d534f0b3076ed7656b2fa71c95018d896beae0bf7c2406d36c45b80f97ac', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"20000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:51:12.211966+00', + updatedAt: '2023-02-12 04:51:12.211966+00', + id: 148, + deviceId: 14, + generationStartTime: 1675857600, + generationEndTime: 1675860000, + creationTime: 1676177440, + creationBlockHash: + '0x3cfbd40fec680ad3fee5bb3105f0d441f06e68d1dbd6f4e6e752f7bbda09d493', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:51:21.107295+00', + updatedAt: '2023-02-12 04:51:21.107295+00', + id: 149, + deviceId: 14, + generationStartTime: 1675464600, + generationEndTime: 1675468500, + creationTime: 1676177465, + creationBlockHash: + '0x002bcc51d17e2c615ff873db2b2016051da29355f9581f4b35994399c03d9be6', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:52:51.010187+00', + updatedAt: '2023-02-12 04:52:51.010187+00', + id: 150, + deviceId: 14, + generationStartTime: 1675471500, + generationEndTime: 1675475700, + creationTime: 1676177550, + creationBlockHash: + '0x729265355323ba72d58b3f6fb3666bf35ffa13b266dca06597e753b716897789', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"4000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:54:19.532645+00', + updatedAt: '2023-02-12 04:54:19.532645+00', + id: 151, + deviceId: 14, + generationStartTime: 1675479600, + generationEndTime: 1675482900, + creationTime: 1676177645, + creationBlockHash: + '0xdeb449b4dbd69a354d837290092318f5295845dfd4b736297ee261d89732da9e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"74000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:55:40.905075+00', + updatedAt: '2023-02-12 04:55:54.313328+00', + id: 152, + deviceId: 14, + generationStartTime: 1675483200, + generationEndTime: 1675486500, + creationTime: 1676177725, + creationBlockHash: + '0x5b27a2c5eb2821aa753c49e0f66f30744a5fc192a980422f1dc747fcbdfefd05', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"112000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:57:24.85269+00', + updatedAt: '2023-02-12 04:57:24.85269+00', + id: 153, + deviceId: 14, + generationStartTime: 1675486800, + generationEndTime: 1675490100, + creationTime: 1676177815, + creationBlockHash: + '0xbb57bfdb85598bec4f1c4f6c61db4ea29bc827141444a96e7646eed7cd78e26b', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"139000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:57:32.228158+00', + updatedAt: '2023-02-12 04:57:32.228158+00', + id: 154, + deviceId: 14, + generationStartTime: 1675490400, + generationEndTime: 1675493700, + creationTime: 1676177840, + creationBlockHash: + '0xde62e4ebcd7233f5c180af1ac10769fb5db8c21d9c5ded4ead2a900309eee444', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"154000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 04:58:55.703429+00', + updatedAt: '2023-02-12 04:59:07.928141+00', + id: 155, + deviceId: 14, + generationStartTime: 1675494000, + generationEndTime: 1675497300, + creationTime: 1676177920, + creationBlockHash: + '0x9e71acdb83d4625a7a257e6a2e04b6654cbd9f6e887ec9815dca851e26756e00', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"156000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 05:00:20.715913+00', + updatedAt: '2023-02-12 05:00:20.715913+00', + id: 156, + deviceId: 16, + generationStartTime: 1651797060, + generationEndTime: 1674325799, + creationTime: 1676178005, + creationBlockHash: + '0xcde30bb62a0488d40234d6ce11fc17fe5283cba05acd5161e73750745d731aaa', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"715063"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[218],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 05:01:49.798427+00', + updatedAt: '2023-02-12 05:01:54.967656+00', + id: 157, + deviceId: 16, + generationStartTime: 1658190600, + generationEndTime: 1673893799, + creationTime: 1676178090, + creationBlockHash: + '0x01f8cce1836ea797300ed941971f57c395077135d428d009fc5966c356e76795', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"667217"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[212],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 05:03:44.218338+00', + updatedAt: '2023-02-12 05:03:44.218338+00', + id: 159, + deviceId: 16, + generationStartTime: 1647217860, + generationEndTime: 1674844199, + creationTime: 1676178200, + creationBlockHash: + '0xe31f86c853205a90f7c1b109078478b1f5dbe969dede9a3bd0e2523d6b852cd8', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2566955"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[220],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 05:05:24.723323+00', + updatedAt: '2023-02-12 05:05:24.723323+00', + id: 160, + deviceId: 16, + generationStartTime: 1645749060, + generationEndTime: 1674325799, + creationTime: 1676178290, + creationBlockHash: + '0x94eacca5754fb5be7bc1dc59e24b5e2ee1d96304cd8ffd90c6414fe09c3ecca2', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1588159"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[226],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 05:05:28.112433+00', + updatedAt: '2023-02-12 05:05:28.112433+00', + id: 161, + deviceId: 16, + generationStartTime: 1656117060, + generationEndTime: 1674584999, + creationTime: 1676178300, + creationBlockHash: + '0x2c96ec725be72ed44ae2420b1e5a7bdc47090e21029fc826985e7dcd98bddf1d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"890473"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[213],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 05:05:33.122006+00', + updatedAt: '2023-02-12 05:05:33.122006+00', + id: 162, + deviceId: 16, + generationStartTime: 1646353860, + generationEndTime: 1675189799, + creationTime: 1676178320, + creationBlockHash: + '0xdb7378698c1927cc995e0ca2f99808f6058fb0f5478729d0e2bc6571f9a83eb3', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1175658"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[228],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 05:07:01.617354+00', + updatedAt: '2023-02-12 05:07:01.617354+00', + id: 163, + deviceId: 16, + generationStartTime: 1657413060, + generationEndTime: 1674584999, + creationTime: 1676178405, + creationBlockHash: + '0xd8ffe7e940df0a4d8d84d0bde857e02c81bb074671df23f0c7d5e4314799e916', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"525381"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[214],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 05:08:31.859954+00', + updatedAt: '2023-02-12 05:08:31.859954+00', + id: 164, + deviceId: 16, + generationStartTime: 1657326660, + generationEndTime: 1674498599, + creationTime: 1676178495, + creationBlockHash: + '0x3d9b05fdf301f74e8d8b6a56df1a461a4242d913705c1d069d876f4435a54fa3', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1422460"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[216],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 05:10:10.582909+00', + updatedAt: '2023-02-12 05:10:10.582909+00', + id: 165, + deviceId: 16, + generationStartTime: 1667003460, + generationEndTime: 1674066599, + creationTime: 1676178580, + creationBlockHash: + '0xb613eba94860e8de14eed6926e2c8bb36777415c153b49ece8bf6fb84b4440cd', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"182151"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[217],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 05:11:43.827113+00', + updatedAt: '2023-02-12 05:11:43.827113+00', + id: 166, + deviceId: 16, + generationStartTime: 1645489860, + generationEndTime: 1674239399, + creationTime: 1676178680, + creationBlockHash: + '0x328112d8a757c8cb671e821c5225cc07edb4af7e91aed365503e63034333c836', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1235593"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[221],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 05:12:46.474104+00', + updatedAt: '2023-02-12 05:12:46.474104+00', + id: 167, + deviceId: 9, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1676178740, + creationBlockHash: + '0x0c62f415f90c054410de4563ae7982223530c53804cf747e620b4934db85a209', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"11089500"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}', + }, + { + createdAt: '2023-02-12 05:13:31.06109+00', + updatedAt: '2023-02-12 05:13:31.06109+00', + id: 168, + deviceId: 16, + generationStartTime: 1644971460, + generationEndTime: 1674239399, + creationTime: 1676178770, + creationBlockHash: + '0x2867a68a898c14b7f765a329f64b4f76a1984baf560e0aed80c02c447deeb3be', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1791330"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[222],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 07:08:21.727622+00', + updatedAt: '2023-02-12 07:08:21.727622+00', + id: 169, + deviceId: 9, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1676185680, + creationBlockHash: + '0xbeb17df585c02c79e087b551533a97c463686d23321ca3d50ca28293c496591b', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"9716000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}', + }, + { + createdAt: '2023-02-12 07:08:46.518617+00', + updatedAt: '2023-02-12 07:08:46.518617+00', + id: 170, + deviceId: 16, + generationStartTime: 1646181060, + generationEndTime: 1674239399, + creationTime: 1676185710, + creationBlockHash: + '0x8896b9ffc2a79460e12e904da1a08aae61d7f1d37a181a23809a31567d3c959a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1550926"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[224],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 07:10:24.116183+00', + updatedAt: '2023-02-12 07:10:27.400426+00', + id: 171, + deviceId: 16, + generationStartTime: 1646353860, + generationEndTime: 1674844199, + creationTime: 1676185800, + creationBlockHash: + '0x0b3fee0747b10ed65a09aea8fccbc350ef76089006471a7175ab583cc69b12b6', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"756124"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[227],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 07:12:07.0333+00', + updatedAt: '2023-02-12 07:12:07.0333+00', + id: 172, + deviceId: 16, + generationStartTime: 1654561860, + generationEndTime: 1674239399, + creationTime: 1676185900, + creationBlockHash: + '0x0b81f85aa3472cc181a367dc9ad74081b826c85e48aa4c57a90477398583adbf', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1137486"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[232],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 07:13:33.53664+00', + updatedAt: '2023-02-12 07:13:33.53664+00', + id: 173, + deviceId: 16, + generationStartTime: 1663633860, + generationEndTime: 1674152999, + creationTime: 1676185995, + creationBlockHash: + '0x3b0c9b10de8b507245aa2ed6b952ce71ac4ddec1875c2a01f55c1c8022a4d5db', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"710356"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[233],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 07:15:07.109549+00', + updatedAt: '2023-02-12 07:15:07.109549+00', + id: 174, + deviceId: 16, + generationStartTime: 1654561860, + generationEndTime: 1674239399, + creationTime: 1676186080, + creationBlockHash: + '0x4663e25a79cf7e35ca2dd86c51219b727b6a6af587e50903d92c404e1c6ee865', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1012799"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[231],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 07:15:53.517035+00', + updatedAt: '2023-02-12 07:15:53.517035+00', + id: 175, + deviceId: 9, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1676186130, + creationBlockHash: + '0x67eda41b7ed37e340826104e3357e642d0ff346d78502a231742b13dfa12f6a0', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"9716000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}', + }, + { + createdAt: '2023-02-12 07:16:44.209786+00', + updatedAt: '2023-02-12 07:16:44.308588+00', + id: 176, + deviceId: 16, + generationStartTime: 1663633860, + generationEndTime: 1674498599, + creationTime: 1676186175, + creationBlockHash: + '0xbab81b0648a8c4047e4d39569d36ff70b1adee96b39542689e581b7bceb5535a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"503212"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[234],"groupId":"16"}', + }, + { + createdAt: '2023-02-12 07:18:17.459128+00', + updatedAt: '2023-02-12 07:18:17.459128+00', + id: 178, + deviceId: 14, + generationStartTime: 1675501200, + generationEndTime: 1675504500, + creationTime: 1676186280, + creationBlockHash: + '0xf49f9b04dba220d38395608b518fc0f17e134b17c8164cb9c41076aad80e1cbe', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"105000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:19:40.642001+00', + updatedAt: '2023-02-12 07:19:40.642001+00', + id: 179, + deviceId: 14, + generationStartTime: 1675504800, + generationEndTime: 1675508100, + creationTime: 1676186365, + creationBlockHash: + '0x05181557817f2edae191336fb4ae74e9e5fae264d239842a1c3457d41770305f', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"66000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:21:05.076735+00', + updatedAt: '2023-02-12 07:21:05.076735+00', + id: 180, + deviceId: 14, + generationStartTime: 1675508400, + generationEndTime: 1675511700, + creationTime: 1676186445, + creationBlockHash: + '0x358a36a2563c2db6b6004c18682b598e50355fef70226beb39ff389693afd637', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"24000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:22:25.394095+00', + updatedAt: '2023-02-12 07:22:25.394095+00', + id: 182, + deviceId: 14, + generationStartTime: 1675511700, + generationEndTime: 1675515300, + creationTime: 1676186530, + creationBlockHash: + '0xf802475df5ebc57e0eeb902a01735e1009f2ce639e73c89b9c6d277d1f56ad3b', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:24:03.678922+00', + updatedAt: '2023-02-12 07:24:03.678922+00', + id: 183, + deviceId: 14, + generationStartTime: 1675557600, + generationEndTime: 1675562100, + creationTime: 1676186615, + creationBlockHash: + '0x08ce114344d9e54ae79b562cc43efa72b771208b3fc2aab77eee605577a9bc93', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"5000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:27:53.307346+00', + updatedAt: '2023-02-12 07:27:53.307346+00', + id: 185, + deviceId: 14, + generationStartTime: 1675566000, + generationEndTime: 1675569300, + creationTime: 1676186860, + creationBlockHash: + '0xe962a429d1ed5302e8434abdb1a8a3afe656318822ac30a1ad543d99f014eb9c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"71000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:29:18.90852+00', + updatedAt: '2023-02-12 07:29:18.90852+00', + id: 186, + deviceId: 14, + generationStartTime: 1675572900, + generationEndTime: 1675576500, + creationTime: 1676186945, + creationBlockHash: + '0x43d40dc376ca4d43746d6f2d23bafb54b9bc2c2e7dab7936b291eeb09e309a98', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"141000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:30:44.68691+00', + updatedAt: '2023-02-12 07:30:44.68691+00', + id: 187, + deviceId: 14, + generationStartTime: 1675576500, + generationEndTime: 1675580100, + creationTime: 1676187025, + creationBlockHash: + '0x9aec3642805bed07b12efbf8eeb64a8b655e3555b16bbeeb5ccfd38d3122983b', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"148000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:32:08.611193+00', + updatedAt: '2023-02-12 07:32:08.611193+00', + id: 188, + deviceId: 14, + generationStartTime: 1675580400, + generationEndTime: 1675583700, + creationTime: 1676187110, + creationBlockHash: + '0xa74e17427b39030dc65f784a5d072c53a63fbf66aaf5edb953589f489e0c8c88', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"151000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:33:29.603691+00', + updatedAt: '2023-02-12 07:33:29.603691+00', + id: 189, + deviceId: 14, + generationStartTime: 1675584000, + generationEndTime: 1675587300, + creationTime: 1676187195, + creationBlockHash: + '0xbb04fbe041cf74ef4898610aee4815a0f58f133f8a161fe1b2bac2c760e1011c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"117000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:35:15.20688+00', + updatedAt: '2023-02-12 07:35:15.20688+00', + id: 190, + deviceId: 14, + generationStartTime: 1675587600, + generationEndTime: 1675590900, + creationTime: 1676187280, + creationBlockHash: + '0x10342a874a153952386edb07ea6441fe9746f9494e743881ff8734e51cb5cf8b', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"103000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:35:15.844845+00', + updatedAt: '2023-02-12 07:35:15.844845+00', + id: 191, + deviceId: 14, + generationStartTime: 1675591200, + generationEndTime: 1675594500, + creationTime: 1676187295, + creationBlockHash: + '0x9a408fb45de87ac41e795bf1c5f5044ac861fa1756609c286825d5fad33d545a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"55000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:36:45.999452+00', + updatedAt: '2023-02-12 07:36:45.999452+00', + id: 192, + deviceId: 14, + generationStartTime: 1675594800, + generationEndTime: 1675598100, + creationTime: 1676187385, + creationBlockHash: + '0xb5b5f6666120d686f3551e2ce60ddbf4881f30e26f12e6dfcc3c855b8074d674', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"21000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:38:24.613389+00', + updatedAt: '2023-02-12 07:38:24.613389+00', + id: 193, + deviceId: 14, + generationStartTime: 1675598400, + generationEndTime: 1675601700, + creationTime: 1676187480, + creationBlockHash: + '0x527939fd036fbdb90cbea7870e25f73f51d3e5226e9d8d2f4cedc3f00daf1b36', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:39:42.48503+00', + updatedAt: '2023-02-12 07:39:42.48503+00', + id: 194, + deviceId: 14, + generationStartTime: 1675633500, + generationEndTime: 1675637700, + creationTime: 1676187570, + creationBlockHash: + '0xfe88349fa571e991aea43d8b7dfc03f16f9e3c20de9d80f950fe23646de41a9d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 07:46:01.520224+00', + updatedAt: '2023-02-12 07:46:01.520224+00', + id: 195, + deviceId: 10, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1676187935, + creationBlockHash: + '0x9538d953f99dfaa0c6522221899d69b55a81ab0db2e1b65f02889b685421d5f7', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1077000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}', + }, + { + createdAt: '2023-02-12 07:46:26.013986+00', + updatedAt: '2023-02-12 07:46:26.013986+00', + id: 196, + deviceId: 14, + generationStartTime: 1675648800, + generationEndTime: 1675652100, + creationTime: 1676187970, + creationBlockHash: + '0x35892cab5a4c646e85e40a1e0f1fcf8452b6809974c10a9295eb26e2ebe0f4ec', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"33000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 09:06:18.039506+00', + updatedAt: '2023-02-12 09:06:27.628648+00', + id: 197, + deviceId: 12, + generationStartTime: 1655663402, + generationEndTime: 1656613799, + creationTime: 1676192760, + creationBlockHash: + '0xceb96746a9e15ae675b86bb975e5cf6497f0f275dbae4e0b4f345a86654ad7eb', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3147100"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}', + }, + { + createdAt: '2023-02-12 09:06:47.914143+00', + updatedAt: '2023-02-12 09:06:47.914143+00', + id: 198, + deviceId: 14, + generationStartTime: 1675656000, + generationEndTime: 1675659300, + creationTime: 1676192795, + creationBlockHash: + '0x22d6263b673dd02348a5236a5b20161850daf946318692a1e0d94386af21ab7d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"102000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 09:08:11.374785+00', + updatedAt: '2023-02-12 09:08:24.212885+00', + id: 199, + deviceId: 14, + generationStartTime: 1675659600, + generationEndTime: 1675662900, + creationTime: 1676192875, + creationBlockHash: + '0xa24f551b909c154357214871c0590351ca0a1f4a83f60bb5761531a254ff2466', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"141000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 09:09:44.999688+00', + updatedAt: '2023-02-12 09:09:59.599783+00', + id: 200, + deviceId: 14, + generationStartTime: 1675663200, + generationEndTime: 1675666500, + creationTime: 1676192965, + creationBlockHash: + '0x955bffd4d827e1e99a93580f6713be691b4a2a04699034f5106ccf82cfa2b36e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"144000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 10:44:37.481243+00', + updatedAt: '2023-02-12 10:44:57.787711+00', + id: 201, + deviceId: 12, + generationStartTime: 1655663402, + generationEndTime: 1656613799, + creationTime: 1676198660, + creationBlockHash: + '0x793893b567c5f6427408d87a5c18dde417055a8b22a6c8abfc6e14459d85b91f', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3147100"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}', + }, + { + createdAt: '2023-02-12 10:45:14.507234+00', + updatedAt: '2023-02-12 10:45:14.507234+00', + id: 202, + deviceId: 14, + generationStartTime: 1675670400, + generationEndTime: 1675673700, + creationTime: 1676198690, + creationBlockHash: + '0x5ba6937bfe1c40a5373e2463dfd8a1ce6f3b1ff903cf93d8a6b815d0ae506828', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"140000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 10:46:36.61143+00', + updatedAt: '2023-02-12 10:46:52.542371+00', + id: 203, + deviceId: 14, + generationStartTime: 1675674000, + generationEndTime: 1675677300, + creationTime: 1676198780, + creationBlockHash: + '0xbc42bd0db044a2e3ff06cd9a3567cc52d873616365fde1a80d8e1739873c69ae', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"98000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 10:48:15.122994+00', + updatedAt: '2023-02-12 10:48:15.122994+00', + id: 204, + deviceId: 14, + generationStartTime: 1675677600, + generationEndTime: 1675680900, + creationTime: 1676198865, + creationBlockHash: + '0xa1fe665da4e14a358c0123ae458ee24b41eb9f6faeedb4ea1b31a2bd733d6119', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"60000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 10:49:36.261735+00', + updatedAt: '2023-02-12 10:49:36.261735+00', + id: 205, + deviceId: 14, + generationStartTime: 1675681200, + generationEndTime: 1675684500, + creationTime: 1676198960, + creationBlockHash: + '0xfcd19377fe5662f1c57a2715bc57d41ba7930e501b51d894e3b79a72ba46db83', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"22000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 10:51:00.904437+00', + updatedAt: '2023-02-12 10:51:00.904437+00', + id: 206, + deviceId: 14, + generationStartTime: 1675684800, + generationEndTime: 1675686900, + creationTime: 1676199040, + creationBlockHash: + '0xb4b2a81449b7eca4c1a20dedfde9daa1c1bddaf25c874d59e070f74216ac0c8e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 10:52:33.901482+00', + updatedAt: '2023-02-12 10:52:33.901482+00', + id: 207, + deviceId: 14, + generationStartTime: 1675735200, + generationEndTime: 1675738500, + creationTime: 1676199130, + creationBlockHash: + '0xda389c807ffeba6ba296181c5f359dce417a4c3388b95816df063e09d9951c75', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"34000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 10:54:03.359584+00', + updatedAt: '2023-02-12 10:54:17.165897+00', + id: 208, + deviceId: 14, + generationStartTime: 1675738800, + generationEndTime: 1675742100, + creationTime: 1676199220, + creationBlockHash: + '0xc4e99b90b61f308af21e76de260e62123945cdf96eab376b2fe10729a53af09e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"73000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 10:55:44.530663+00', + updatedAt: '2023-02-12 10:55:44.530663+00', + id: 209, + deviceId: 14, + generationStartTime: 1675742400, + generationEndTime: 1675745700, + creationTime: 1676199310, + creationBlockHash: + '0xb495ed0b611e0f27d391844a52c4bbe5bc5ab487562d5efb2e8b191c8f58f205', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"103000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 10:55:45.63257+00', + updatedAt: '2023-02-12 10:55:45.63257+00', + id: 210, + deviceId: 14, + generationStartTime: 1675746000, + generationEndTime: 1675749300, + creationTime: 1676199320, + creationBlockHash: + '0x25bfdac3de15ce31da453e9b855a4a6e9e477fc6602bc90b5b1734c21fdab01d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"141000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 11:00:40.8803+00', + updatedAt: '2023-02-12 11:00:40.8803+00', + id: 212, + deviceId: 14, + generationStartTime: 1675764000, + generationEndTime: 1675767300, + creationTime: 1676199625, + creationBlockHash: + '0x79e32383c42ac156644e26335da3bf5d18dbf80bd98113027b964302dde3976d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"67000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 11:02:10.47835+00', + updatedAt: '2023-02-12 11:02:10.47835+00', + id: 213, + deviceId: 14, + generationStartTime: 1675767600, + generationEndTime: 1675770900, + creationTime: 1676199710, + creationBlockHash: + '0x2ec3841a601700ffde116d4196ef02dece95af29e899d9cb07b5ad56a97d7a63', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"27000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 11:03:44.493917+00', + updatedAt: '2023-02-12 11:03:44.493917+00', + id: 214, + deviceId: 14, + generationStartTime: 1675771200, + generationEndTime: 1675773300, + creationTime: 1676199800, + creationBlockHash: + '0x6eefc39b1f35929423c8582fc4ae694ba7201864ef88f0cfa3a1514346e880c0', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 11:05:08.695815+00', + updatedAt: '2023-02-12 11:05:08.695815+00', + id: 215, + deviceId: 14, + generationStartTime: 1675817400, + generationEndTime: 1675821300, + creationTime: 1676199890, + creationBlockHash: + '0x42c30f8fc2b023689c923862afc44de0c72b45c987006be8dd8b0b1bc11c79b6', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"5000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 11:06:37.412306+00', + updatedAt: '2023-02-12 11:06:44.046421+00', + id: 216, + deviceId: 14, + generationStartTime: 1675821600, + generationEndTime: 1675824900, + creationTime: 1676199975, + creationBlockHash: + '0x9bdb4964344018c5d43f02204e3d748940f98548fed30e3dea121de8b86295fb', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"31000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 11:08:26.214933+00', + updatedAt: '2023-02-12 11:08:26.214933+00', + id: 217, + deviceId: 14, + generationStartTime: 1675825200, + generationEndTime: 1675828500, + creationTime: 1676200065, + creationBlockHash: + '0xeda376df2c734818787b79781e305ad1276cf402bf43136568dc282665ab94e4', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"71000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 11:08:26.511506+00', + updatedAt: '2023-02-12 11:08:26.511506+00', + id: 218, + deviceId: 14, + generationStartTime: 1675828800, + generationEndTime: 1675832100, + creationTime: 1676200080, + creationBlockHash: + '0x555f8ffdbdb1a1222c3f38283dba6adf7f0669cf40d0c0f12381f8da1f060caf', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"109000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 11:10:11.842651+00', + updatedAt: '2023-02-12 11:10:11.842651+00', + id: 220, + deviceId: 14, + generationStartTime: 1675836000, + generationEndTime: 1675839300, + creationTime: 1676200195, + creationBlockHash: + '0xb5a687c84a41d62eb7ef9cfbbcbbf85f3bb45036f83bb4021d7c3ca645e8357d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"146000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 11:11:41.220003+00', + updatedAt: '2023-02-12 11:11:41.220003+00', + id: 221, + deviceId: 14, + generationStartTime: 1675839600, + generationEndTime: 1675842900, + creationTime: 1676200280, + creationBlockHash: + '0x4fe4d79fa27ab074938490142c7b23a61de0127be1f23e075ef9c14c99264813', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"147000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 11:13:10.717787+00', + updatedAt: '2023-02-12 11:13:19.241438+00', + id: 222, + deviceId: 14, + generationStartTime: 1675843200, + generationEndTime: 1675846500, + creationTime: 1676200370, + creationBlockHash: + '0x4cd820cfaa67ddb401b18253454b36817e14ab0ed300af5df5639819d4b7be5d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"130000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:42:26.922068+00', + updatedAt: '2023-02-12 12:42:34.414505+00', + id: 224, + deviceId: 14, + generationStartTime: 1675850400, + generationEndTime: 1675853700, + creationTime: 1676205725, + creationBlockHash: + '0x49a8b3ea248f6bf0735b85aa7ccdfebca2c3407f2912f2371f391d0ce94b4ae9', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"62000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:44:00.136624+00', + updatedAt: '2023-02-12 12:44:04.102524+00', + id: 225, + deviceId: 14, + generationStartTime: 1675853700, + generationEndTime: 1675857300, + creationTime: 1676205815, + creationBlockHash: + '0x5404debcbc5982aff032565b34bfc27f42def8cfe2beaa496723aa0e78200d74', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"20000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:45:36.202456+00', + updatedAt: '2023-02-12 12:45:36.202456+00', + id: 226, + deviceId: 14, + generationStartTime: 1675900500, + generationEndTime: 1675903800, + creationTime: 1676205915, + creationBlockHash: + '0xff0786895f96b46d1841c78bcde04e48ea2a269b474a996edbdcae212b9ac035', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:47:11.945192+00', + updatedAt: '2023-02-12 12:47:24.909615+00', + id: 227, + deviceId: 9, + generationStartTime: 1646073001, + generationEndTime: 1648751399, + creationTime: 1676206010, + creationBlockHash: + '0xa93a71ba585bfad69a4503cd06968cbe8e8e495e0c9d923605013beb51be90c5', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2577200"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}', + }, + { + createdAt: '2023-02-12 12:47:18.182718+00', + updatedAt: '2023-02-12 12:47:18.182718+00', + id: 228, + deviceId: 14, + generationStartTime: 1675915200, + generationEndTime: 1675918500, + creationTime: 1676206015, + creationBlockHash: + '0x32e006663aba58cf8de2dbc5f5ee24f9c39794a7f04c14b5f14a3eabe013ca7b', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"111000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:48:52.214767+00', + updatedAt: '2023-02-12 12:48:59.233866+00', + id: 229, + deviceId: 14, + generationStartTime: 1675918800, + generationEndTime: 1675922100, + creationTime: 1676206110, + creationBlockHash: + '0xe866be7ebfcfc767dd7bec2c9c94a2372ad35f728b5f9748b28e318cb756c4d5', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"137000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:50:19.893376+00', + updatedAt: '2023-02-12 12:50:19.893376+00', + id: 230, + deviceId: 14, + generationStartTime: 1675922400, + generationEndTime: 1675925700, + creationTime: 1676206200, + creationBlockHash: + '0x976c1c44058e439d6217158583db517b4710d010e8c013259c177667614d327d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"147000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:51:46.51415+00', + updatedAt: '2023-02-12 12:51:46.51415+00', + id: 231, + deviceId: 14, + generationStartTime: 1675929600, + generationEndTime: 1675932900, + creationTime: 1676206285, + creationBlockHash: + '0x2ed1b848ad220a8a5b90d7ba0bd80797a3fb6c0a904da618431750e4a8f35623', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"105000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:53:19.1139+00', + updatedAt: '2023-02-12 12:53:25.141903+00', + id: 232, + deviceId: 14, + generationStartTime: 1675933200, + generationEndTime: 1675936500, + creationTime: 1676206375, + creationBlockHash: + '0x03436c99e685c8665296dcef723760b39511ee896a09e4e1441c2c59d0d7f3a9', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"105000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:54:42.647218+00', + updatedAt: '2023-02-12 12:54:42.647218+00', + id: 233, + deviceId: 14, + generationStartTime: 1675936800, + generationEndTime: 1675940100, + creationTime: 1676206465, + creationBlockHash: + '0xec391de0a4b9640ed579f3232542eb25a171af2a3925d5eb49a3518d8bf1ca0c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"49000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:56:18.819037+00', + updatedAt: '2023-02-12 12:56:18.819037+00', + id: 234, + deviceId: 14, + generationStartTime: 1675940400, + generationEndTime: 1675943700, + creationTime: 1676206550, + creationBlockHash: + '0xb1eb6902549a4ce6e00016245b2dde479a6db7d392a0b0ce53dd3fce9ac6bd8a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"18000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:57:55.958214+00', + updatedAt: '2023-02-12 12:57:55.958214+00', + id: 235, + deviceId: 14, + generationStartTime: 1675944000, + generationEndTime: 1675947000, + creationTime: 1676206655, + creationBlockHash: + '0x7fad6a829178c1675d0ddc85a83ba653a176568c59e4f6049ef7a42fbd532512', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 12:59:23.739019+00', + updatedAt: '2023-02-12 12:59:23.739019+00', + id: 236, + deviceId: 14, + generationStartTime: 1675974900, + generationEndTime: 1675979700, + creationTime: 1676206745, + creationBlockHash: + '0x0acef863ecd1602917656c09337dff9739f4cc4f81e8dc74c1af40824ca54b24', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 13:14:48.116158+00', + updatedAt: '2023-02-12 13:14:48.116158+00', + id: 238, + deviceId: 9, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1676207665, + creationBlockHash: + '0xbb2251f8d6782dc331250d6393270fc2638804db7340178df1c94f6625fdc288', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3547000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}', + }, + { + createdAt: '2023-02-12 13:15:10.814652+00', + updatedAt: '2023-02-12 13:15:10.814652+00', + id: 239, + deviceId: 14, + generationStartTime: 1675998000, + generationEndTime: 1676001300, + creationTime: 1676207690, + creationBlockHash: + '0xa28cfcd14f565561cd81b2b5a3356d7e5da9995d06e86e67fd5f1bcdb4d8c991', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"74000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 13:16:49.737245+00', + updatedAt: '2023-02-12 13:16:55.874476+00', + id: 240, + deviceId: 14, + generationStartTime: 1676001600, + generationEndTime: 1676004900, + creationTime: 1676207780, + creationBlockHash: + '0x42aaaa05e6a9d17afb45b7c3b09b533f178214a440f21614a120ff7765986a69', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"120000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 13:16:49.216247+00', + updatedAt: '2023-02-12 13:16:49.216247+00', + id: 241, + deviceId: 14, + generationStartTime: 1676005200, + generationEndTime: 1676008500, + creationTime: 1676207790, + creationBlockHash: + '0x1da82e784bba5464b345a8c86e3e787d7a327fd2b25aa95838be9e1b7a4a486c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"143000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 13:18:24.013367+00', + updatedAt: '2023-02-12 13:18:24.013367+00', + id: 242, + deviceId: 14, + generationStartTime: 1676008800, + generationEndTime: 1676012100, + creationTime: 1676207875, + creationBlockHash: + '0x2b600fce41c1ae7cb499ed2de16b6237eed5c9cc1366cb5193393d01aadfff42', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"157000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 13:18:29.476453+00', + updatedAt: '2023-02-12 13:18:29.476453+00', + id: 243, + deviceId: 14, + generationStartTime: 1676012400, + generationEndTime: 1676015700, + creationTime: 1676207890, + creationBlockHash: + '0xddf1e6d7605933b50173feaa21e09590f94b39ee28f75c6674b9ef3577e6292e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"127000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 13:20:10.551054+00', + updatedAt: '2023-02-12 13:20:10.551054+00', + id: 244, + deviceId: 14, + generationStartTime: 1676016000, + generationEndTime: 1676019300, + creationTime: 1676207980, + creationBlockHash: + '0xb88a61fc473a97bf352813f8219bb4d7b80194c9e1cc9ab26a3673f5c8185646', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"138000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 13:21:42.039503+00', + updatedAt: '2023-02-12 13:21:42.039503+00', + id: 245, + deviceId: 14, + generationStartTime: 1676019600, + generationEndTime: 1676022900, + creationTime: 1676208080, + creationBlockHash: + '0x646009cb1aaf2cf06c69bc04cb591045f29464806061e2b6947595ec08fafc2c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"105000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 13:23:13.176588+00', + updatedAt: '2023-02-12 13:23:13.176588+00', + id: 246, + deviceId: 14, + generationStartTime: 1676023200, + generationEndTime: 1676026500, + creationTime: 1676208175, + creationBlockHash: + '0x837e82ccb9e324ff221640885c373a207ae4f886efd2a9419ed48003a3985a14', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"74000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 13:24:38.80499+00', + updatedAt: '2023-02-12 13:24:38.80499+00', + id: 247, + deviceId: 14, + generationStartTime: 1676026800, + generationEndTime: 1676030100, + creationTime: 1676208260, + creationBlockHash: + '0x8e3a66a405a0b49f440c33ccee4e96674f4b4a6b3dedfa457d522cdd657e1451', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"29000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 13:26:02.31376+00', + updatedAt: '2023-02-12 13:26:02.31376+00', + id: 248, + deviceId: 14, + generationStartTime: 1676030400, + generationEndTime: 1676032800, + creationTime: 1676208345, + creationBlockHash: + '0xcfeee39678b791426d3b65b3a1844b4fadd57bff03314e718c57ed7836b2d26c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-12 14:06:18.317861+00', + updatedAt: '2023-02-12 14:06:18.317861+00', + id: 249, + deviceId: 9, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1676210745, + creationBlockHash: + '0xebb4a9a9c643207b74ce45b992901bfcf2ec0cbcc017de8ab432acf45f14a324', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3521300"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}', + }, + { + createdAt: '2023-02-12 14:18:14.878364+00', + updatedAt: '2023-02-12 14:18:14.878364+00', + id: 250, + deviceId: 9, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1676211475, + creationBlockHash: + '0x45df265e2d372d4ff9267df5e9fb74e5bf37857fbcea1c4c4192aa67368778a6', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3521300"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}', + }, + { + createdAt: '2023-02-12 15:26:31.18853+00', + updatedAt: '2023-02-12 15:26:31.18853+00', + id: 252, + deviceId: 10, + generationStartTime: 1667241001, + generationEndTime: 1669832999, + creationTime: 1676215570, + creationBlockHash: + '0xaedaa10b86664d5fe04975ecfcc5bbcf0a8fedcd7f083381360c35e376edcaaa', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1151000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[15],"groupId":"10"}', + }, + { + createdAt: '2023-02-12 15:34:32.009316+00', + updatedAt: '2023-02-12 15:34:42.255495+00', + id: 253, + deviceId: 10, + generationStartTime: 1661970601, + generationEndTime: 1664562599, + creationTime: 1676216050, + creationBlockHash: + '0xffc2ab8c5f8750c7f1600e06c47b2f6ee270a6a2bdcdef952954b390c3c00bec', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2211000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-02-12 15:38:35.144093+00', + updatedAt: '2023-02-12 15:38:52.09274+00', + id: 254, + deviceId: 10, + generationStartTime: 1667241001, + generationEndTime: 1669832999, + creationTime: 1676216285, + creationBlockHash: + '0xfa74c8216276b135a6a6d04273cb36883235af7cd75e3d1de6cc26a52af7ad72', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2439000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-02-12 15:46:40.575301+00', + updatedAt: '2023-02-12 15:46:40.575301+00', + id: 255, + deviceId: 10, + generationStartTime: 1667241001, + generationEndTime: 1669832999, + creationTime: 1676216755, + creationBlockHash: + '0x1331bebd584edb67a6ad957b27df5a1be2503c33e02cc7478b8d896fd55dc69c', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2439000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-02-12 15:48:28.509877+00', + updatedAt: '2023-02-12 15:48:28.509877+00', + id: 256, + deviceId: 10, + generationStartTime: 1669833001, + generationEndTime: 1672511399, + creationTime: 1676216880, + creationBlockHash: + '0xf98f9ef4ec5b1c5836f6618d115eccba4cdc78f72360c267be602862c3178791', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2304000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-02-12 16:22:02.024281+00', + updatedAt: '2023-02-12 16:22:12.060323+00', + id: 257, + deviceId: 10, + generationStartTime: 1669833001, + generationEndTime: 1672511399, + creationTime: 1676218900, + creationBlockHash: + '0x7233601c7fa93ccebce66f00015a7ddae42ae43015c0bebc5a63cc075d641b7a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2304000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"e02f1ffb-bef3-45fd-b6b2-0d5724fa5205","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[14],"groupId":"10"}', + }, + { + createdAt: '2023-02-12 16:23:38.078267+00', + updatedAt: '2023-02-12 16:23:49.818674+00', + id: 258, + deviceId: 11, + generationStartTime: 1674122400, + generationEndTime: 1674208800, + creationTime: 1676218995, + creationBlockHash: + '0xdca992e7423696be30599c47f7f809a6f3201796f8a398849b49c171a7e84fc1', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"823000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-02-12 17:11:50.230806+00', + updatedAt: '2023-02-12 17:11:50.230806+00', + id: 259, + deviceId: 11, + generationStartTime: 1674727200, + generationEndTime: 1674813600, + creationTime: 1676221880, + creationBlockHash: + '0x719005dd6857cefc1681b93a6fd682fd7a2e01c66c9e91a0ea42c57565a44e10', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1154000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-02-12 17:17:52.724175+00', + updatedAt: '2023-02-12 17:18:14.661072+00', + id: 260, + deviceId: 11, + generationStartTime: 1674727200, + generationEndTime: 1674813600, + creationTime: 1676222225, + creationBlockHash: + '0xf430789c9527ba7f1ce2fa0e57f5a9f6d5e1010bf80720d1e273f38dd8a24a0a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1154000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-02-12 17:19:43.432869+00', + updatedAt: '2023-02-12 17:20:47.797502+00', + id: 261, + deviceId: 12, + generationStartTime: 1667241001, + generationEndTime: 1669832999, + creationTime: 1676222360, + creationBlockHash: + '0x3405075e8a953a2fbeddc58504e5abaf8355fb21ef5d0e6d7c8938f3b688d10d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"11563100"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}', + }, + { + createdAt: '2023-02-12 17:43:33.668431+00', + updatedAt: '2023-02-12 17:44:02.915616+00', + id: 262, + deviceId: 12, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1676223780, + creationBlockHash: + '0x3df466b9e36f3397a55b05fc3cd977ee046b44389e0c886575511cc82fdd8a90', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"14118500"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}', + }, + { + createdAt: '2023-02-12 17:45:25.214298+00', + updatedAt: '2023-02-12 17:46:26.490245+00', + id: 263, + deviceId: 12, + generationStartTime: 1659292201, + generationEndTime: 1661970599, + creationTime: 1676223900, + creationBlockHash: + '0x2ce248212bdfea90ef95080237e4b0d3b02da332c9cfdaaf0f61086fcb5f60f3', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"16125200"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[205],"groupId":"12"}', + }, + { + createdAt: '2023-02-13 14:52:29.710799+00', + updatedAt: '2023-02-13 14:52:29.710799+00', + id: 265, + deviceId: 13, + generationStartTime: 1664562601, + generationEndTime: 1667240999, + creationTime: 1676299915, + creationBlockHash: + '0x28da517250495da0ae068c0af821f6900853d8b48011ebffda9e8ad67941140d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2803000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"0a5ce04e-bb3f-4306-9665-2a165ebe45e1","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"13"}', + }, + { + createdAt: '2023-02-14 06:59:44.707387+00', + updatedAt: '2023-02-14 06:59:49.241588+00', + id: 266, + deviceId: 16, + generationStartTime: 1645749060, + generationEndTime: 1674325799, + creationTime: 1676357950, + creationBlockHash: + '0x427e2ae36e12b0cdecb074e7777e128ad1c4b08cd1c7d968ebcb5c0739a01a0a', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2067802"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[225],"groupId":"16"}', + }, + { + createdAt: '2023-02-14 07:02:01.02934+00', + updatedAt: '2023-02-14 07:02:01.02934+00', + id: 267, + deviceId: 16, + generationStartTime: 1651797060, + generationEndTime: 1674325799, + creationTime: 1676358080, + creationBlockHash: + '0xbd48139454a134ccb7bd2149133a5c886f70a987967e57b1460935349960f642', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1359759"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[230],"groupId":"16"}', + }, + { + createdAt: '2023-02-14 07:03:51.719366+00', + updatedAt: '2023-02-14 07:04:33.601592+00', + id: 268, + deviceId: 16, + generationStartTime: 1646094660, + generationEndTime: 1674239399, + creationTime: 1676358200, + creationBlockHash: + '0x93437d55f1e950c98a9f4b71de19c8a6254eb1d4978781eeb49a9c5cb50f831b', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1256659"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[223],"groupId":"16"}', + }, + { + createdAt: '2023-02-14 07:06:40.276189+00', + updatedAt: '2023-02-14 07:06:40.276189+00', + id: 269, + deviceId: 16, + generationStartTime: 1651797060, + generationEndTime: 1674325799, + creationTime: 1676358355, + creationBlockHash: + '0x8bc85176d2e197b8aee9e7c635691b556dce5fc4c4cf6ae799c8026c36fe0993', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"715063"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"9dc7388e-a40a-4d10-aa5b-001168e9f8d0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[218],"groupId":"16"}', + }, + { + createdAt: '2023-02-14 07:08:33.505602+00', + updatedAt: '2023-02-14 07:08:33.505602+00', + id: 270, + deviceId: 11, + generationStartTime: 1674986400, + generationEndTime: 1675072800, + creationTime: 1676358480, + creationBlockHash: + '0x26e236a4bc7febee525e3e7a2ac632d66e4609b88796fcb210641d3427d850d7', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"529000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"11"}', + }, + { + createdAt: '2023-02-15 07:29:35.815382+00', + updatedAt: '2023-02-18 16:43:11.849743+00', + id: 271, + deviceId: 9, + generationStartTime: 1646073001, + generationEndTime: 1648751399, + creationTime: 1676358480, + creationBlockHash: + '0xa3318a13466122d57d69f2daa049493c3684d5fea2cafa8e88d84a6acbc44f50', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"5977900"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[12],"groupId":"9"}', + }, + { + createdAt: '2023-02-15 07:47:49.27722+00', + updatedAt: '2023-02-15 07:47:49.27722+00', + id: 272, + deviceId: 9, + generationStartTime: 1669833001, + generationEndTime: 1671042599, + creationTime: 1676358480, + creationBlockHash: + '0xe02e6139a23bcb22f73b7ca13f65125f973c217fcdecb32ce3c8399751db368d', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3937500"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[10],"groupId":"9"}', + }, + { + createdAt: '2023-02-15 07:47:49.27722+00', + updatedAt: '2023-02-22 10:44:54.635718+00', + id: 273, + deviceId: 18, + generationStartTime: 1672511401, + generationEndTime: 1675189799, + creationTime: 1677062640, + creationBlockHash: + '0x46e339f5e7e389553c7f7a6fb130961094c1722f6a717db77770c160ba5a8f40', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1681000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"20ff2e72-d47b-4bd7-aeee-c3b4e6e1ef2b","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"18"}', + }, + { + createdAt: '2023-02-15 07:47:49.27722+00', + updatedAt: '2023-02-22 10:45:15.830042+00', + id: 274, + deviceId: 18, + generationStartTime: 1672511401, + generationEndTime: 1675189799, + creationTime: 1677062675, + creationBlockHash: + '0x432c8fa81dd6f246bde739d0b8d72ab813a81d3a65be7c07370f55fb72bb7e21', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1681000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"20ff2e72-d47b-4bd7-aeee-c3b4e6e1ef2b","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[208],"groupId":"18"}', + }, + { + createdAt: '2023-02-15 07:47:49.27722+00', + updatedAt: '2023-02-22 10:46:21.73023+00', + id: 275, + deviceId: 17, + generationStartTime: 1676131200, + generationEndTime: 1676260800, + creationTime: 1677062740, + creationBlockHash: + '0xbbf9635993f95e4ac071fe8fa6c19a5453fd1ef775c9c09a8d7318d20f7b6c63', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"480000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-15 08:07:49.061319+00', + updatedAt: '2023-02-22 10:47:07.520711+00', + id: 276, + deviceId: 17, + generationStartTime: 1676085300, + generationEndTime: 1676109600, + creationTime: 1677062770, + creationBlockHash: + '0x7bd78a5ca16e063976aafeaf998fc578f59011eff3ba048b7fc242eb414fca8f', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"12000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-15 08:07:49.061319+00', + updatedAt: '2023-02-22 10:47:51.252161+00', + id: 277, + deviceId: 17, + generationStartTime: 1676440800, + generationEndTime: 1676444400, + creationTime: 1677062835, + creationBlockHash: + '0x9286e3fdf100043d78874fe1386157333544bba06ffa2a1ba65139e658271a88', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"185000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-15 08:07:49.061319+00', + updatedAt: '2023-02-22 10:48:35.316589+00', + id: 278, + deviceId: 11, + generationStartTime: 1674554400, + generationEndTime: 1674640800, + creationTime: 1676358480, + creationBlockHash: + '0xd16b261c19778edf9bf4e8f0cfade67e1564d29da83b564a7c2276c6414b9685', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"41000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c56aeb0a-ed02-4ba1-964f-52469986f8ff","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"11"}', + }, + { + createdAt: '2023-02-15 08:07:49.061319+00', + updatedAt: '2023-02-22 10:48:56.992204+00', + id: 279, + deviceId: 17, + generationStartTime: 1676113200, + generationEndTime: 1676116800, + creationTime: 1677062895, + creationBlockHash: + '0xce654cc55b4176c4703b521ef7f88630021f29833ba667ab7f332adb6d24f1eb', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"18000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-15 08:07:49.061319+00', + updatedAt: '2023-02-22 10:49:29.608227+00', + id: 280, + deviceId: 12, + generationStartTime: 1667241001, + generationEndTime: 1669832999, + creationTime: 1676358480, + creationBlockHash: + '0xa443dd238a4a19f56466df1d7011e75ca8bbf4484ee2bef6b012ae84355bdc10', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"3920000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"1205deab-2255-46d7-950d-117bba7d88cf","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[206],"groupId":"12"}', + }, + { + createdAt: '2023-02-15 08:07:49.061319+00', + updatedAt: '2023-02-15 08:07:49.061319+00', + id: 281, + deviceId: 14, + generationStartTime: 1675310400, + generationEndTime: 1675314000, + creationTime: 1676358480, + creationBlockHash: + '0xdf628303b6ea5806f60f2f02594005b726cfcf7927778ccd92025050229c1cc8', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"114000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-15 08:07:49.061319+00', + updatedAt: '2023-02-22 10:50:31.218841+00', + id: 282, + deviceId: 14, + generationStartTime: 1675298700, + generationEndTime: 1675303200, + creationTime: 1676358480, + creationBlockHash: + '0x7c041c9e2c7f307cf826d638ed0035e4e8651720b536a3f01f91d929bb667720', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"b03f2ed1-0998-43ea-a995-5f407e8fcfae","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[204,203,202],"groupId":"14"}', + }, + { + createdAt: '2023-02-15 08:07:49.061319+00', + updatedAt: '2023-02-22 10:50:54.371429+00', + id: 283, + deviceId: 17, + generationStartTime: 1676167200, + generationEndTime: 1676170800, + creationTime: 1677063025, + creationBlockHash: + '0x047a037663156fe4c028a735bf5f238b39be7f38d3551447e26f3ef6cbd1c2b0', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"31000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-15 08:07:49.061319+00', + updatedAt: '2023-02-22 10:52:13.821523+00', + id: 284, + deviceId: 17, + generationStartTime: 1676170800, + generationEndTime: 1676174400, + creationTime: 1677063115, + creationBlockHash: + '0x9b8aba9a16982c46e4b69e6a566d0c8928db4f1e94d4710f9ad5ba8bc98d9577', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"64000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-22 10:53:47.710023+00', + updatedAt: '2023-02-22 10:53:47.710023+00', + id: 285, + deviceId: 17, + generationStartTime: 1676174400, + generationEndTime: 1676178000, + creationTime: 1677063200, + creationBlockHash: + '0x40b67de0aff7bfadf08e924eafacc94617c6cd1c209ad6c8a86e909989ad50ec', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"90000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-22 10:55:15.710137+00', + updatedAt: '2023-02-22 10:55:27.309692+00', + id: 286, + deviceId: 17, + generationStartTime: 1676178000, + generationEndTime: 1676181600, + creationTime: 1677063300, + creationBlockHash: + '0x5f700b2747fcb73d51b4529d6d13d404704ec6b913d01a3da5230366b9afe35f', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"107000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-22 10:56:49.907521+00', + updatedAt: '2023-02-22 10:56:55.030504+00', + id: 287, + deviceId: 17, + generationStartTime: 1676185200, + generationEndTime: 1676188800, + creationTime: 1677063385, + creationBlockHash: + '0x4971e4b77262971bf91cc16e14eccf81bcaf90e6a56f0dfbde96fd87aa2fbe29', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"96000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-22 10:58:18.718832+00', + updatedAt: '2023-02-22 10:58:18.718832+00', + id: 288, + deviceId: 17, + generationStartTime: 1676188800, + generationEndTime: 1676192400, + creationTime: 1677063480, + creationBlockHash: + '0x00506614ab3f25b80d2fc3e6989d1b2ee775bfba3e9c4142c3dea3ccd10d351e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"93000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-22 10:59:51.913789+00', + updatedAt: '2023-02-22 10:59:51.913789+00', + id: 289, + deviceId: 17, + generationStartTime: 1676192400, + generationEndTime: 1676196000, + creationTime: 1677063565, + creationBlockHash: + '0x70e09a6217d42aeca785e044fe7614c6e9cb2bd805ddb22ad6a8601e8c6ec0a8', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"78000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-22 11:01:32.910073+00', + updatedAt: '2023-02-22 11:01:33.68855+00', + id: 290, + deviceId: 17, + generationStartTime: 1676199600, + generationEndTime: 1676203200, + creationTime: 1677063665, + creationBlockHash: + '0xb7d9e1250c6097f088370585ce0425a9012e52c29b1191935bcb04e2b5cbb98e', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"20000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-22 11:03:05.92423+00', + updatedAt: '2023-02-22 11:03:05.92423+00', + id: 291, + deviceId: 17, + generationStartTime: 1676203200, + generationEndTime: 1676206200, + creationTime: 1677063760, + creationBlockHash: + '0x350aa785c6d7912183f017c2460573f92dd61f4c64f9e8541f5ed9cd489ef9b5', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"2000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"c87208a2-119b-43ee-9cf7-95f41b206ffa","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[203,202],"groupId":"17"}', + }, + { + createdAt: '2023-02-23 07:29:45.634561+00', + updatedAt: '2023-02-23 07:29:45.634561+00', + id: 292, + deviceId: 9, + generationStartTime: 1, + generationEndTime: 1, + creationTime: 1677063760, + creationBlockHash: + '0x3ece329d69310a2b0326062a0a051071baef11ab9e1f23a6790b93efa554b14b', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"15322600"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}', + }, + { + createdAt: '2023-02-23 07:29:45.634561+00', + updatedAt: '2023-02-23 07:29:45.634561+00', + id: 293, + deviceId: 9, + generationStartTime: 1, + generationEndTime: 1, + creationTime: 1677063760, + creationBlockHash: + '0x00bcfecf2b7ef0d1e96bdd345f10105998d6badb29a4e0d7b516879519ff2cc0', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"9542000"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + '{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[9],"groupId":"9"}', + }, + { + createdAt: '2023-02-23 07:29:45.634561+00', + updatedAt: '2023-02-23 07:29:45.634561+00', + id: 294, + deviceId: 9, + generationStartTime: 1, + generationEndTime: 1, + creationTime: 1677063760, + creationBlockHash: + '0x23ee3782de16d444d13a55973b43ab70bcf12c1c7e6199f850f6a0bc3f2decbb', + owners: '{"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437":"1801700"}', + claimers: null, + claims: null, + latestCommitment: null, + issuedPrivately: false, + blockchainNetId: 246, + metadata: + ':{"version":"v1.0","buyerReservationId":"95e06592-f52d-4acf-94d8-c5e655ff85c0","isStandardIssuanceRequested":"I-REC","type":"REC","deviceIds":[13],"groupId":"9"}', + }, +]; diff --git a/apps/drec-api/src/pods/countrycode/countrycode.controller.ts b/apps/drec-api/src/pods/countrycode/countrycode.controller.ts index 0e0aefd4c..94ae56861 100755 --- a/apps/drec-api/src/pods/countrycode/countrycode.controller.ts +++ b/apps/drec-api/src/pods/countrycode/countrycode.controller.ts @@ -1,52 +1,47 @@ import { - Controller, - Get, - HttpStatus, - ValidationPipe, - Query, - Logger, - } from '@nestjs/common'; - - import { - ApiBearerAuth, - ApiResponse, - ApiSecurity, - ApiTags, - } from '@nestjs/swagger'; -import {CountrycodeService}from './countrycode.service'; -import {CountryCodeNameDTO ,FilterKeyDTO} from './dto' + Controller, + Get, + HttpStatus, + ValidationPipe, + Query, + Logger, +} from '@nestjs/common'; + +import { + ApiBearerAuth, + ApiResponse, + ApiSecurity, + ApiTags, +} from '@nestjs/swagger'; +import { CountrycodeService } from './countrycode.service'; +import { CountryCodeNameDTO, FilterKeyDTO } from './dto'; /* -* It is Controller of CountrCode with the endpoints of countrycode operations. -*/ + * It is Controller of CountrCode with the endpoints of countrycode operations. + */ @ApiTags('CountryList') @ApiBearerAuth('access-token') @ApiSecurity('drec') @Controller('countrycode') export class CountrycodeController { - private readonly logger = new Logger(CountrycodeController.name); - constructor( -private readonly countrycodeService:CountrycodeService - ){} + constructor(private readonly countrycodeService: CountrycodeService) {} - /* - * It is GET api to get list of all country codes with filteration by pattern(string) - * @return { Array} returns array of countrycode - */ - @Get('/list') + /* + * It is GET api to get list of all country codes with filteration by pattern(string) + * @return { Array} returns array of countrycode + */ + @Get('/list') @ApiResponse({ status: HttpStatus.OK, type: [CountryCodeNameDTO], description: 'Returns all Country code List', }) async getCountryCode( - @Query(ValidationPipe) filterDto: FilterKeyDTO - ):Promise< CountryCodeNameDTO[] >{ + @Query(ValidationPipe) filterDto: FilterKeyDTO, + ): Promise { this.logger.verbose(`With in getCountryCode`); return this.countrycodeService.getCountryCode(filterDto); - } - } diff --git a/apps/drec-api/src/pods/countrycode/countrycode.module.ts b/apps/drec-api/src/pods/countrycode/countrycode.module.ts index ee3b0987f..e7c6ce50e 100755 --- a/apps/drec-api/src/pods/countrycode/countrycode.module.ts +++ b/apps/drec-api/src/pods/countrycode/countrycode.module.ts @@ -1,11 +1,9 @@ import { Module } from '@nestjs/common'; -import {CountrycodeController} from './countrycode.controller'; -import {CountrycodeService}from './countrycode.service' +import { CountrycodeController } from './countrycode.controller'; +import { CountrycodeService } from './countrycode.service'; @Module({ - - providers: [CountrycodeService], - exports: [CountrycodeService], - controllers: [CountrycodeController], - + providers: [CountrycodeService], + exports: [CountrycodeService], + controllers: [CountrycodeController], }) export class CountrycodeModule {} diff --git a/apps/drec-api/src/pods/countrycode/countrycode.service.spec.ts b/apps/drec-api/src/pods/countrycode/countrycode.service.spec.ts index 493e99ff1..59893de84 100644 --- a/apps/drec-api/src/pods/countrycode/countrycode.service.spec.ts +++ b/apps/drec-api/src/pods/countrycode/countrycode.service.spec.ts @@ -1,19 +1,18 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { CountrycodeService } from './countrycode.service'; - -describe('CountrycodeService', () => { - let service: CountrycodeService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [CountrycodeService, - ], - }).compile(); - - service = module.get(CountrycodeService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { CountrycodeService } from './countrycode.service'; + +describe('CountrycodeService', () => { + let service: CountrycodeService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [CountrycodeService], + }).compile(); + + service = module.get(CountrycodeService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/countrycode/countrycode.service.ts b/apps/drec-api/src/pods/countrycode/countrycode.service.ts index b6247cefe..699f21253 100755 --- a/apps/drec-api/src/pods/countrycode/countrycode.service.ts +++ b/apps/drec-api/src/pods/countrycode/countrycode.service.ts @@ -1,21 +1,23 @@ -import { Injectable, Logger, } from '@nestjs/common'; -import { CountryCodeNameDTO, FilterKeyDTO } from './dto' -import { countryCodesList } from '../../models/country-code' +import { Injectable, Logger } from '@nestjs/common'; +import { CountryCodeNameDTO, FilterKeyDTO } from './dto'; +import { countryCodesList } from '../../models/country-code'; @Injectable() export class CountrycodeService { + private readonly logger = new Logger(CountrycodeService.name); - private readonly logger = new Logger(CountrycodeService.name); - - //@InjectRepository(Device) private readonly repository: Repository, - public async getCountryCode(filterDto: FilterKeyDTO): Promise { - this.logger.verbose(`With in getCountryCode`); - let countries = countryCodesList; - if (filterDto.searchKeyWord && filterDto.searchKeyWord.length > 0) { - const regex = new RegExp(`${filterDto.searchKeyWord}`, 'i') - return countries.filter(ele => regex.test(ele.country) || regex.test(ele.countryCode)) - } - else { - return countries; - } + //@InjectRepository(Device) private readonly repository: Repository, + public async getCountryCode( + filterDto: FilterKeyDTO, + ): Promise { + this.logger.verbose(`With in getCountryCode`); + let countries = countryCodesList; + if (filterDto.searchKeyWord && filterDto.searchKeyWord.length > 0) { + const regex = new RegExp(`${filterDto.searchKeyWord}`, 'i'); + return countries.filter( + (ele) => regex.test(ele.country) || regex.test(ele.countryCode), + ); + } else { + return countries; } + } } diff --git a/apps/drec-api/src/pods/countrycode/dto/country-code.dto.ts b/apps/drec-api/src/pods/countrycode/dto/country-code.dto.ts index 43413c318..fece06983 100755 --- a/apps/drec-api/src/pods/countrycode/dto/country-code.dto.ts +++ b/apps/drec-api/src/pods/countrycode/dto/country-code.dto.ts @@ -32,10 +32,10 @@ export class CountryCodeNameDTO { @IsNotEmpty() @Expose() countryCode: string; - - @ApiProperty({ type: [Object] }) + + @ApiProperty({ type: [Object] }) @IsArray() @IsNotEmpty() @Expose() timezones: { name: string; offset: number }[]; -} \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/countrycode/dto/filterKeyDTO.dto.ts b/apps/drec-api/src/pods/countrycode/dto/filterKeyDTO.dto.ts index b2f14aaa5..a7c4eb0c6 100755 --- a/apps/drec-api/src/pods/countrycode/dto/filterKeyDTO.dto.ts +++ b/apps/drec-api/src/pods/countrycode/dto/filterKeyDTO.dto.ts @@ -2,8 +2,7 @@ import { IsOptional } from 'class-validator'; import { ApiPropertyOptional } from '@nestjs/swagger'; export class FilterKeyDTO { - @IsOptional() - @ApiPropertyOptional({ type: String, description: 'country name' }) - searchKeyWord: string; - -} \ No newline at end of file + @IsOptional() + @ApiPropertyOptional({ type: String, description: 'country name' }) + searchKeyWord: string; +} diff --git a/apps/drec-api/src/pods/countrycode/dto/index.ts b/apps/drec-api/src/pods/countrycode/dto/index.ts index f040d02fa..06c920cb5 100755 --- a/apps/drec-api/src/pods/countrycode/dto/index.ts +++ b/apps/drec-api/src/pods/countrycode/dto/index.ts @@ -1,2 +1,2 @@ export * from './country-code.dto'; -export * from './filterKeyDTO.dto' \ No newline at end of file +export * from './filterKeyDTO.dto'; diff --git a/apps/drec-api/src/pods/device-group/buyer-reservation.controller.ts b/apps/drec-api/src/pods/device-group/buyer-reservation.controller.ts index fb3d265d3..7b6fdd5d1 100644 --- a/apps/drec-api/src/pods/device-group/buyer-reservation.controller.ts +++ b/apps/drec-api/src/pods/device-group/buyer-reservation.controller.ts @@ -1,868 +1,1029 @@ -import { - Controller, - Get, - Post, - Patch, - HttpStatus, - Param, - Body, - UseGuards, - Delete, - Query, - ValidationPipe, - ConflictException, - BadRequestException, - UnauthorizedException, - DefaultValuePipe, - ParseIntPipe, - Logger, -} from '@nestjs/common'; -import { - ApiBearerAuth, - ApiNotFoundResponse, - ApiResponse, - ApiOkResponse, - ApiSecurity, - ApiTags, - ApiBody, - ApiQuery -} from '@nestjs/swagger'; -import { AuthGuard } from '@nestjs/passport'; -import { DeviceGroupService } from './device-group.service'; -import { - AddGroupDTO, - DeviceGroupDTO, - UnreservedDeviceGroupsFilterDTO, - CSVBulkUploadDTO, - JobFailedRowsDTO, - EndReservationdateDTO, - NewUpdateDeviceGroupDTO, - ResponseDeviceGroupDTO -} from './dto'; -import { Roles } from '../user/decorators/roles.decorator'; -import { Role } from '../../utils/enums'; -import { isValidUTCDateFormat } from '../../utils/checkForISOStringFormat'; -import { RolesGuard } from '../../guards/RolesGuard'; -import { UserDecorator } from '../user/decorators/user.decorator'; -import { ILoggedInUser, BuyerReservationCertificateGenerationFrequency } from '../../models'; -import { FileService } from '../file'; - -import { parse } from 'csv-parse'; -import csv from 'csv-parser'; -import { DeviceCsvFileProcessingJobsEntity, StatusCSV } from './device_csv_processing_jobs.entity'; -import { Permission } from '../permission/decorators/permission.decorator'; -import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator'; -import { PermissionGuard } from '../../guards'; -import { DeviceGroupNextIssueCertificate } from './device_group_issuecertificate.entity'; -import { CheckCertificateIssueDateLogForDeviceGroupEntity } from './check_certificate_issue_date_log_for_device_group.entity' -import { OrganizationService } from '../organization/organization.service'; -import { UserService } from '../user/user.service'; - -@ApiTags('buyer-reservation') -@ApiBearerAuth('access-token') -@ApiSecurity('drec') -@Controller('/buyer-reservation') -export class BuyerReservationController { - - private readonly logger = new Logger(BuyerReservationController.name); - - csvParser = csv({ separator: ',' }); - - parser = parse({ - delimiter: ',' - }); - constructor(private readonly deviceGroupService: DeviceGroupService, - private readonly fileService: FileService, - private organizationService: OrganizationService, - private readonly userService: UserService, - ) { } - - /** - * It is GET api to list all device group in reservation data - * @returns {Array} - */ - @Get() - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), RolesGuard,PermissionGuard) - @ACLModules('BUYER_RESERVATION_MANAGEMENT_CRUDL') - @Permission('Read') - @Roles(Role.Admin,Role.ApiUser) - @ApiQuery({ name: 'organizationId', type: Number, required: false, description: "This query parameter is used for Apiuser" }) - @ApiQuery({ name: 'apiuserId', type: String, required: false, description: "This query parameter is used for Admin to list the reservations by ApiUser" }) - @ApiQuery({ name: 'pageNumber', type: Number, required: false }) - @ApiQuery({ name: 'limit', type: Number, required: false }) - @ApiOkResponse({ - type: [DeviceGroupDTO], - description: 'Returns all Device groups', - }) - async getAll( - @UserDecorator() user: ILoggedInUser, - @Query('organizationId', new DefaultValuePipe(null)) organizationId: number | null, - @Query('apiuserId', new DefaultValuePipe(null)) apiuserId: string | null, - @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) pageNumber: number, - @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit: number, - @Query(new ValidationPipe({ - transform: true, - whitelist: true, - })) filterDto: UnreservedDeviceGroupsFilterDTO, - )/*: Promise*/ { - // return new Promise((resolve,reject)=>{ - // resolve([]); - // }); - /* for now commenting because ui is giving error because it has removed fields sectors standard complaince of devices */ - this.logger.verbose("With in getAll"); - let organization : any; - if(!apiuserId) { - apiuserId = user.api_user_id; - } - - if(organizationId) { - organization = await this.organizationService.findOne(organizationId); - if(user.role === Role.ApiUser) { - - if(organization.api_user_id != user.api_user_id) { - this.logger.error(`Organization requested is belongs to other apiuser`); - throw new BadRequestException({ - success: false, - message: 'Organization requested is belongs to other apiuser', - }); - } - } - } - - if(apiuserId) { - if(user.role === Role.ApiUser) { - if(apiuserId != user.api_user_id) { - this.logger.error(`An apiuser is unauthorized to request for other apiuser`); - throw new UnauthorizedException({ - success: false, - message: 'An apiuser is unauthorized to request for other apiuser', - }); - } - } - - if(organizationId && apiuserId != organization.api_user_id) { - this.logger.error(`The requested organization is not belongs to the apiuser`); - throw new UnauthorizedException({ - success: false, - message: 'The requested organization is not belongs to the apiuser', - }); - } - } - return this.deviceGroupService.getAll(user, organizationId, apiuserId, pageNumber, limit, filterDto); - } - - - /** - * It is GET api to list all device groups of loggedIn user - * @param param0 is getting userId, organizationId and user role from user at request - * @param filterDto is filteration fields to retrieve records - * @param pagenumber is for pagination - * @returns {Array} - */ - @Get('/my') - @UseGuards(AuthGuard('jwt'), RolesGuard) -//@Roles(Role.OrganizationAdmin, Role.DeviceOwner, Role.Buyer,Role.SubBuyer) - @ApiQuery({ name: 'pagenumber', type: Number, required: false }) - @ApiResponse({ - status: HttpStatus.OK, - type: [DeviceGroupDTO], - description: 'Returns my Device groups', - }) - async getMyDevices( - @UserDecorator() { id, organizationId, role }: ILoggedInUser, - @Query(new ValidationPipe({ - transform: true, - whitelist: true, - })) filterDto: UnreservedDeviceGroupsFilterDTO, - - @Query('pagenumber') pagenumber: number| null, - )/*: Promise */{ - this.logger.verbose(`With in getMyDevices`); - switch (role) { - case Role.DeviceOwner: - return await this.deviceGroupService.getOrganizationDeviceGroups( - organizationId); - case Role.Buyer: - return await this.deviceGroupService.getBuyerDeviceGroups(id,pagenumber,filterDto); - case Role.SubBuyer: - return await this.deviceGroupService.getBuyerDeviceGroups(id,pagenumber,filterDto); - case Role.OrganizationAdmin: - return await this.deviceGroupService.getAll(); - default: - return await this.deviceGroupService.getOrganizationDeviceGroups( - organizationId); - } - } - - /** - * It is GET api to fetch device group by id - * @param id is unique identifier of device groupId - * @returns {DeviceGroupDTO | null} DeviceGroupDto is when the record found, returns null when the record not found by id - */ - @Get('/:id') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) - @Permission('Read') - @ACLModules('BUYER_RESERVATION_MANAGEMENT_CRUDL') - @ApiQuery({ name: 'organizationId', type: Number, required: false, description: "This query parameter is used for Apiuser"}) - @ApiOkResponse({ - type: DeviceGroupDTO, - description: 'Returns a Device group', - }) - @ApiNotFoundResponse({ description: `No device group found` }) - async get(@Param('id') id: number, - @Query('organizationId', new DefaultValuePipe(null)) organizationId: number | null, - @UserDecorator() user: ILoggedInUser, - ): Promise { - this.logger.verbose(`With in get`); - if(organizationId) { - const organization = await this.organizationService.findOne(organizationId); - if(user.role === Role.ApiUser) { - if(user.api_user_id != organization.api_user_id) { - this.logger.error(`Organization requested is belongs to other apiuser`); - throw new BadRequestException({ - success: false, - message: 'Organization requested is belongs to other apiuser', - }); - } - else { - user.organizationId = organizationId; - } - } - else { - if(organizationId != user.organizationId) { - this.logger.error(`Organization requested is not same as logged in user organization`); - throw new BadRequestException({ - success: false, - message: 'Organization requested is not same as logged in user organization', - }); - } - } - } - return this.deviceGroupService.findById(id, user); - } - - /** - * It is POSTb api to create an device group - * @param param0 is getting organization Id from user request - * @param user is getting uset from user request - * @param deviceGroupToRegister body payload to create device group - * @returns {ResponseDeviceGroupDTO | null} - */ - @Post() - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), RolesGuard) - // @Roles(Role.DeviceOwner, Role.Admin,Role.Buyer) - @Roles(Role.Admin, Role.ApiUser, Role.Buyer) - @ApiQuery({ name: 'orgId', type: Number, required: false, description: "This query parameter is used for Apiuser" }) - @ApiResponse({ - status: HttpStatus.OK, - type: DeviceGroupDTO, - description: 'Returns a new created Device group', - }) - public async createOne( - @UserDecorator() { organizationId }: ILoggedInUser, - @UserDecorator() user: ILoggedInUser, - @Body() deviceGroupToRegister: AddGroupDTO, - @Query('orgId') orgId : number | null, - ): Promise { - this.logger.verbose(`With in createOne`); - if (orgId) { - const organization = await this.organizationService.findOne(orgId); - const orguser = await this.userService.findByEmail(organization.orgEmail); - if (user.role === Role.ApiUser) { - - if (organization.api_user_id !== user.api_user_id) { - this.logger.error(`Organization requested belongs to other apiuser`); - throw new BadRequestException({ - success: false, - message: 'Organization requested belongs to other apiuser', - }); - } - - if (orguser.role === Role.Buyer) { - organizationId = orgId; - deviceGroupToRegister.api_user_id = user.api_user_id; - } - - if(orguser.role != Role.Buyer) { - this.logger.error(`Unauthorized for ${orguser.role}`); - throw new UnauthorizedException({ - success: false, - message: `Unauthorized for ${orguser.role}`, - }); - } - } - else { - if (user.role === Role.Buyer) { - - if (organizationId !== organization.id) { - this.logger.error(`User does not associated with the requested organization`); - throw new BadRequestException({ - success: false, - message: 'User does not associated with the requested organization', - }); - } - } - } - } - //integer range which is for deviceId in device(id) table - //-2147483648 to +2147483647 - //https://www.postgresql.org/docs/9.1/datatype-numeric.html - - if (!Array.isArray(deviceGroupToRegister.deviceIds) || deviceGroupToRegister.deviceIds.filter(ele => ele >= -2147483648 && ele <= 2147483647).length !== deviceGroupToRegister.deviceIds.length) { - this.logger.error(`One or more device ids are invalid`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: 'One or more device ids are invalid', - }), - ); - }); - } - if (deviceGroupToRegister.deviceIds.length == 0) { - this.logger.error(`Please provide devices for reservation, deviceIds is empty atleast one device is required`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: 'Please provide devices for reservation, deviceIds is empty atleast one device is required', - }), - ); - }); - - } - - if (isNaN(deviceGroupToRegister.targetCapacityInMegaWattHour) || deviceGroupToRegister.targetCapacityInMegaWattHour <= 0 || deviceGroupToRegister.targetCapacityInMegaWattHour == -0) { - this.logger.error(`targetCapacityInMegaWattHour should be valid number can include decimal but should be greater than 0`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: 'targetCapacityInMegaWattHour should be valid number can include decimal but should be greater than 0', - }), - ); - }); - } - - if (typeof deviceGroupToRegister.reservationStartDate === "string") { - if (!isValidUTCDateFormat(deviceGroupToRegister.reservationStartDate)) { - this.logger.error(`Invalid reservationStartDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: ' Invalid reservationStartDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', - }), - ); - }); - } - deviceGroupToRegister.reservationStartDate = new Date(deviceGroupToRegister.reservationStartDate); - } - if (typeof deviceGroupToRegister.reservationEndDate === "string") { - if (!isValidUTCDateFormat(deviceGroupToRegister.reservationEndDate)) { - this.logger.error(`Invalid reservationEndDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: ' Invalid reservationEndDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', - }), - ); - }); - } - deviceGroupToRegister.reservationEndDate = new Date(deviceGroupToRegister.reservationEndDate); - } - if (typeof deviceGroupToRegister.reservationExpiryDate === "string") { - if (!isValidUTCDateFormat(deviceGroupToRegister.reservationExpiryDate)) { - this.logger.error(`Invalid reservationExpiryDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: ' Invalid reservationExpiryDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', - }), - ); - }); - } - deviceGroupToRegister.reservationExpiryDate = new Date(deviceGroupToRegister.reservationExpiryDate); - } - if (deviceGroupToRegister.reservationStartDate && deviceGroupToRegister.reservationEndDate && deviceGroupToRegister.reservationStartDate.getTime() >= deviceGroupToRegister.reservationEndDate.getTime()) { - this.logger.error(`start date cannot be less than or same as end date`); - throw new ConflictException({ - success: false, - message: 'start date cannot be less than or same as end date', - }); - } - if (deviceGroupToRegister.reservationStartDate && deviceGroupToRegister.reservationEndDate && deviceGroupToRegister.reservationExpiryDate&&(deviceGroupToRegister.reservationExpiryDate.getTime() <= deviceGroupToRegister.reservationStartDate.getTime()||deviceGroupToRegister.reservationExpiryDate.getTime() < deviceGroupToRegister.reservationEndDate.getTime())) { - this.logger.error(`Expiry date cannot be less than from start and end date`); - throw new ConflictException({ - success: false, - message: 'Expiry date cannot be less than from start and end date', - }); - } - - let maximumBackDateForReservation: Date = new Date(new Date().getTime() - (3.164e+10 * 3)); - if (deviceGroupToRegister.reservationStartDate.getTime() <= maximumBackDateForReservation.getTime() || deviceGroupToRegister.reservationEndDate.getTime() <= maximumBackDateForReservation.getTime()) { - this.logger.error(`start date or end date cannot be less than 3 year from current date`); - throw new ConflictException({ - success: false, - message: 'start date or end date cannot be less than 3 year from current date', - }); - } - if (organizationId === null || organizationId === undefined) { - this.logger.error(`User does not has organization associated`); - throw new ConflictException({ - success: false, - message: 'User does not has organization associated', - }); - } - const frequency = deviceGroupToRegister.frequency.toLowerCase(); - if (frequency === BuyerReservationCertificateGenerationFrequency.monthly || frequency === BuyerReservationCertificateGenerationFrequency.quarterly||frequency === BuyerReservationCertificateGenerationFrequency.weekly) { - this.logger.error(`This frequency is currently not supported`); - throw new ConflictException({ - success: false, - message: 'This frequency is currently not supported', - }); - } - - return await this.deviceGroupService.createOne( - organizationId, - deviceGroupToRegister, - user.id, - //@ts-ignore - process.env.DREC_BLOCKCHAIN_ADDRESS, - - ); - // if (deviceGroupToRegister.blockchainAddress !== null && deviceGroupToRegister.blockchainAddress !== undefined && deviceGroupToRegister.blockchainAddress.trim() !== "") { - // console.log("deviceGroupToRegister.blockchainAddress"); - // deviceGroupToRegister.blockchainAddress = deviceGroupToRegister.blockchainAddress.trim(); - - // return await this.deviceGroupService.createOne( - // organizationId, - // deviceGroupToRegister, - // user.id, - // deviceGroupToRegister.blockchainAddress - // ); - - // } else { - // console.log(user.blockchainAccountAddress); - // if (user.blockchainAccountAddress !== null && user.blockchainAccountAddress !== undefined) { - // console.log("user.blockchainAddress") - // return await this.deviceGroupService.createOne( - // organizationId, - // deviceGroupToRegister, - // user.id, - // user.blockchainAccountAddress - // ); - - // } else { - - // throw new ConflictException({ - // success: false, - // message: 'No blockchain address sent and no blockchain address attached to this account', - // }); - // } - // } - - } - - - - /** - * It is POST api to create device group - * @param user from user request - * @param param1 is getting organizationId from loggedIn user - * @param fileToProcess uploaded csv file - * @returns {DeviceCsvFileProcessingJobsEntity} - */ - @Post('process-creation-bulk-devices-csv') - @UseGuards(AuthGuard('jwt')) - //@UseGuards(AuthGuard('jwt'), PermissionGuard) - //@Permission('Write') - //@ACLModules('DEVICE_BULK_MANAGEMENT_CRUDL') - //@Roles(Role.Admin, Role.DeviceOwner,Role.OrganizationAdmin) - @ApiResponse({ - status: HttpStatus.OK, - type: [DeviceCsvFileProcessingJobsEntity], - description: 'Returns created devices from csv', - }) - @ApiBody({ type: CSVBulkUploadDTO }) - public async processCreationBulkFromCSV - (@UserDecorator() user: ILoggedInUser, - @UserDecorator() { organizationId }: ILoggedInUser, - @Body() fileToProcess: CSVBulkUploadDTO): Promise { - this.logger.verbose(`With in processCreationBulkFromCSV`); - if (user.organizationId === null || user.organizationId === undefined) { - this.logger.error(`User needs to have organization added`); - throw new ConflictException({ - success: false, - message: - 'User needs to have organization added' - }) - } - - //let response:any = await this.fileService.GetuploadS3(fileToProcess.fileName); - // let response = await this.fileService.get(fileToProcess.fileName, user); - - - if (fileToProcess.fileName == undefined) { - //throw new Error("file not found"); - this.logger.error(`File Not Found`); - throw new ConflictException({ - success: false, - message: - 'File Not Found' - }) - - } - if (!fileToProcess.fileName.endsWith('.csv')) { - //throw new Error("file not found"); - this.logger.error(`Invalid file`); - throw new ConflictException({ - success: false, - message: - 'Invalid file' - }) - - } - let jobCreated = await this.deviceGroupService.createCSVJobForFile(user.id, organizationId, StatusCSV.Added, fileToProcess.fileName); - - //let jobCreated = await this.deviceGroupService.createCSVJobForFile(user.id, organizationId, StatusCSV.Added, response.filename); - - return jobCreated; - } - - /** - * It is PATCH api to update device group by id - * @param id is identifier of device group in type number - * @param loggedUser user from request - * @param groupToUpdate body payload to update an device group - * @returns - */ - @Patch('/:id') - @UseGuards(AuthGuard('jwt')) - // @Roles(Role.DeviceOwner, Role.Admin) - @ApiResponse({ - status: HttpStatus.OK, - type: NewUpdateDeviceGroupDTO, - description: 'Returns an updated Device Group', - }) - @ApiNotFoundResponse({ description: `No device group found` }) - public async update( - @Param('id') id: number, - @UserDecorator() loggedUser: ILoggedInUser, - @Body() groupToUpdate: NewUpdateDeviceGroupDTO, - ): Promise { - this.logger.verbose(`With in update`); - let devicenextissuence: DeviceGroupNextIssueCertificate | null = await this.deviceGroupService.getGroupiCertificateIssueDate({ groupId: id }); - if (devicenextissuence === null) { - this.logger.error(`This device groups reservation has already ended`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `This device groups reservation has already ended `, - }) - ); - }); - } - if (new Date(groupToUpdate.reservationEndDate).getTime() < new Date(devicenextissuence.start_date).getTime()) { - this.logger.error(`Certificates are already generated or in progress for device group, cannot reduce below start time:${devicenextissuence.start_date}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Certificates are already generated or in progress for device group, cannot reduce below start time:${devicenextissuence.start_date}`, - }) - ); - }); - } - - return await this.deviceGroupService.update( - id, - loggedUser, - groupToUpdate, - ); - } - - /** - * It is DELETE api to delete an device group by id. - * @param id is unique identifier of device group in type number - * @param param1 is getting organizationId from loggedIn user - * @returns {void} - */ - @Delete('/:id') - @UseGuards(AuthGuard('jwt'), RolesGuard) - @Roles(Role.DeviceOwner, Role.Admin,Role.Buyer,Role.SubBuyer) - @ApiResponse({ - status: HttpStatus.OK, - description: 'Remove device group', - }) - @ApiNotFoundResponse({ description: `No device group found` }) - public async remove( - @Param('id') id: number, - @UserDecorator() { organizationId }: ILoggedInUser, - ): Promise { - this.logger.verbose(`With in remove`); - return await this.deviceGroupService.remove(id, organizationId); - } - - /** - * It is GET api to list the status of jobs - * @param jobId is unique identifier of jobId - * @param param1 organizationId from loggedIn User - * @returns {JobFailedRowsDTO | undefined} - */ - @Get('/bulk-upload-status/:id') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard)//, PermissionGuard) - @Permission('Read') - @ACLModules('DEVICE_BULK_MANAGEMENT_CRUDL') - @ApiQuery({ name: 'orgId', type: Number, required: false, description: "This query parameter is used for Apiuser" }) - @ApiResponse({ - status: HttpStatus.OK, - type: JobFailedRowsDTO, - description: 'Returns status of job id for bulk upload', - }) - public async getBulkUploadJobStatus( - @Param('id') jobId: number, - @UserDecorator() { organizationId, role, api_user_id }: ILoggedInUser, - @Query('orgId', new DefaultValuePipe(null)) orgId: number | null - ): Promise { - this.logger.verbose(`With in getBulkUploadJobStatus`); - - if(orgId) { - const organization = await this.organizationService.findOne(orgId); - const orguser = await this.userService.findByEmail(organization.orgEmail); - - if(role === Role.ApiUser) { - if(organization.api_user_id != api_user_id) { - this.logger.error(`The requested organization is belongs to other apiuser`); - throw new BadRequestException({ - success: false, - message:'The requested organization is belongs to other apiuser' - }); - } - - if(orguser.role != Role.OrganizationAdmin) { - this.logger.error(`Unauthorized`); - throw new UnauthorizedException({ - success: false, - message:'Unauthorized' - }); - } - } - else { - if(orgId != organizationId) { - this.logger.error(`The organizationId in query params should be same as user's organizationId`); - throw new BadRequestException({ - success: false, - message:`The organizationId in query params should be same as user's organizationId` - }); - } - - if(role === Role.Admin) { - orgId = null; - } - } - } - else { - if(role === Role.ApiUser) { - this.logger.error(`Add the orgId at query param`); - throw new BadRequestException({ - success: false, - message:`Add the orgId at query param` - }); - } - } - /* - let data = await this.deviceGroupService.getFailedRowDetailsForCSVJob( - jobId - ); - console.log("data", data); */ - - return await this.deviceGroupService.getFailedRowDetailsForCSVJob( - jobId, orgId - ); - } - - /** - * It is GET api to list all jobs by organization - * @param user is user from request - * @param param1 is getting organization Id from user request - * @returns {Array} - */ - @Get('/bulk-upload/get-all-csv-jobs-of-organization') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) - //@UseGuards(AuthGuard('jwt'),PermissionGuard) - @Permission('Read') - @ACLModules('DEVICE_BULK_MANAGEMENT_CRUDL') - @ApiQuery({ name: 'orgId', type: Number, required: false, description: "This query parameter is used for Apiuser" }) - @ApiQuery({ name: 'pageNumber', type: Number, required: false }) - @ApiQuery({ name: 'limit', type: Number, required: false }) - @ApiResponse({ - status: HttpStatus.OK, - type: [DeviceCsvFileProcessingJobsEntity], - description: 'Returns created jobs of an organization', - }) - public async getAllCsvJobsBelongingToOrganization( - @UserDecorator() user: ILoggedInUser, - @UserDecorator() { organizationId }: ILoggedInUser, - @Query('orgId', new DefaultValuePipe(null)) orgId: number | null, - @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) pageNumber: number, - @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit: number, - - )/*: Promise>*/ { - this.logger.verbose(`With in getAllCsvJobsBelongingToOrganization`); - if (user.organizationId === null || user.organizationId === undefined) { - this.logger.error(`User needs to have organization added`); - throw new ConflictException({ - success: false, - message: - 'User needs to have organization added' - }) - } - - if(orgId) { - const organization = await this.organizationService.findOne(orgId); - const orguser = await this.userService.findByEmail(organization.orgEmail); - - if(user.role === Role.ApiUser) { - if(organization.api_user_id != user.api_user_id) { - this.logger.error(`The requested organization is belongs to other apiuser`); - throw new BadRequestException({ - success: false, - message:'The requested organization is belongs to other apiuser' - }); - } - - if(orguser.role != Role.OrganizationAdmin) { - this.logger.error(`Unauthorized`); - throw new UnauthorizedException({ - success: false, - message:'Unauthorized' - }); - } - } - else { - if(user.role != Role.Admin) { - if(orgId != organizationId) { - this.logger.error(`The orgId at query param is not same as user's organization`); - throw new BadRequestException({ - success: false, - message:`The orgId at query param is not same as user's organization` - }); - } - } - } - } - - if(user.role==='Admin'){ - return this.deviceGroupService.getAllCSVJobsForAdmin(orgId, pageNumber, limit); - } - else if(user.role === Role.ApiUser) { - return this.deviceGroupService.getAllCSVJobsForApiUser(user.api_user_id, orgId, pageNumber, limit); - } - else { - return this.deviceGroupService.getAllCSVJobsForOrganization(organizationId, pageNumber, limit); - } - } - - /** - * It is GET api to fetch an certificate log of an device - * @param id is unique identifier of device group - * @returns {CheckCertificateIssueDateLogForDeviceGroupEntity} - */ - @Get('certificatelog/:id') - @ApiOkResponse({ - type: DeviceGroupDTO, - description: 'Returns a Device group', - }) - @ApiNotFoundResponse({ description: `No device group found` }) - async getdevciegrouplog(@Param('id') id: number): Promise { - this.logger.verbose(`With in getdevciegrouplog`); - return this.deviceGroupService.getDeviceGrouplog(id); - } - // @Post('/buyer-reservation') - // @UseGuards(AuthGuard('jwt'),PermissionGuard) - // @Permission('Write') - // @ACLModules('DEVICE_BUYER_RESERVATION_MANAGEMENT_CRUDL') - // @ApiResponse({ - // status: HttpStatus.OK, - // type: JobFailedRowsDTO, - // description: 'Returns status of job id for bulk upload', - // }) - // public async createBuyerReservationGroups( - // @UserDecorator() { organizationId }: ILoggedInUser - // ): Promise { - - // } - - /** - * It is DELETE api to delete an device reservation - * @param id is unique identifier of an device group - * @param endresavationdate is date of end reservation - * @param param2 is getting organization Id of loggedIn user - * @returns {void} - */ - @Delete('endreservation/:id') - @UseGuards(AuthGuard('jwt')) - - @ApiResponse({ - status: HttpStatus.OK, - type: EndReservationdateDTO, - description: 'Reservation End', - }) - @ApiNotFoundResponse({ description: `No Reservation found` }) - public async endresavation( - @Param('id') id: number, - @Body() endresavationdate: EndReservationdateDTO, - @UserDecorator() { organizationId }: ILoggedInUser, - ): Promise { - this.logger.verbose(`With in endresavation`); - return await this.deviceGroupService.EndReservationGroup(id, organizationId, endresavationdate); - } - - /** - * It is GET api to fetch current information of reservation - * @param groupuId is an identifier of device - * @param param1 - * @returns {any} - */ - @Get('current-information/:groupUid') - @UseGuards(AuthGuard('jwt')) - @ApiQuery({ name: 'pagenumber', type: Number, required: false }) - @ApiResponse({ - status: HttpStatus.OK - }) - public async getReservationcurrentinformation( - @Param('groupUid') groupuId: string, - @Query('pagenumber') pagenumber: number, - @UserDecorator() { organizationId }: ILoggedInUser - ): Promise { - this.logger.verbose(`With in getReservationcurrentinformation`); - const regexExp = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/; - if (groupuId === null || !regexExp.test(groupuId)) { - this.logger.error(`Please Add the valid UID ,invalid group uid value was sent`); - return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: ' Please Add the valid UID ,invalid group uid value was sent', - })) - }) - } - // const devicegroup = await this.deviceGroupService.findOne({ devicegroup_uid: groupuId }) - // if (devicegroup === null || devicegroup.buyerId != user.id) { - // return new Promise((resolve, reject) => { - // reject(new ConflictException({ - // success: false, - // message: 'Group UId is not of this buyer, invalid value was sent', - // })) - // }) - // } - - - return await this.deviceGroupService.getcurrentInformationofDevicesInReservation( - groupuId,pagenumber - ); - } -} +import { + Controller, + Get, + Post, + Patch, + HttpStatus, + Param, + Body, + UseGuards, + Delete, + Query, + ValidationPipe, + ConflictException, + BadRequestException, + UnauthorizedException, + DefaultValuePipe, + ParseIntPipe, + Logger, +} from '@nestjs/common'; +import { + ApiBearerAuth, + ApiNotFoundResponse, + ApiResponse, + ApiOkResponse, + ApiSecurity, + ApiTags, + ApiBody, + ApiQuery, +} from '@nestjs/swagger'; +import { AuthGuard } from '@nestjs/passport'; +import { DeviceGroupService } from './device-group.service'; +import { + AddGroupDTO, + DeviceGroupDTO, + UnreservedDeviceGroupsFilterDTO, + CSVBulkUploadDTO, + JobFailedRowsDTO, + EndReservationdateDTO, + NewUpdateDeviceGroupDTO, + ResponseDeviceGroupDTO, +} from './dto'; +import { Roles } from '../user/decorators/roles.decorator'; +import { Role } from '../../utils/enums'; +import { isValidUTCDateFormat } from '../../utils/checkForISOStringFormat'; +import { RolesGuard } from '../../guards/RolesGuard'; +import { UserDecorator } from '../user/decorators/user.decorator'; +import { + ILoggedInUser, + BuyerReservationCertificateGenerationFrequency, +} from '../../models'; +import { FileService } from '../file'; + +import { parse } from 'csv-parse'; +import csv from 'csv-parser'; +import { + DeviceCsvFileProcessingJobsEntity, + StatusCSV, +} from './device_csv_processing_jobs.entity'; +import { Permission } from '../permission/decorators/permission.decorator'; +import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator'; +import { PermissionGuard } from '../../guards'; +import { DeviceGroupNextIssueCertificate } from './device_group_issuecertificate.entity'; +import { CheckCertificateIssueDateLogForDeviceGroupEntity } from './check_certificate_issue_date_log_for_device_group.entity'; +import { OrganizationService } from '../organization/organization.service'; +import { UserService } from '../user/user.service'; + +@ApiTags('buyer-reservation') +@ApiBearerAuth('access-token') +@ApiSecurity('drec') +@Controller('/buyer-reservation') +export class BuyerReservationController { + private readonly logger = new Logger(BuyerReservationController.name); + + csvParser = csv({ separator: ',' }); + + parser = parse({ + delimiter: ',', + }); + constructor( + private readonly deviceGroupService: DeviceGroupService, + private readonly fileService: FileService, + private organizationService: OrganizationService, + private readonly userService: UserService, + ) {} + + /** + * It is GET api to list all device group in reservation data + * @returns {Array} + */ + @Get() + @UseGuards( + AuthGuard(['jwt', 'oauth2-client-password']), + RolesGuard, + PermissionGuard, + ) + @ACLModules('BUYER_RESERVATION_MANAGEMENT_CRUDL') + @Permission('Read') + @Roles(Role.Admin, Role.ApiUser) + @ApiQuery({ + name: 'organizationId', + type: Number, + required: false, + description: 'This query parameter is used for Apiuser', + }) + @ApiQuery({ + name: 'apiuserId', + type: String, + required: false, + description: + 'This query parameter is used for Admin to list the reservations by ApiUser', + }) + @ApiQuery({ name: 'pageNumber', type: Number, required: false }) + @ApiQuery({ name: 'limit', type: Number, required: false }) + @ApiOkResponse({ + type: [DeviceGroupDTO], + description: 'Returns all Device groups', + }) + async getAll( + @UserDecorator() user: ILoggedInUser, + @Query('organizationId', new DefaultValuePipe(null)) + organizationId: number | null, + @Query('apiuserId', new DefaultValuePipe(null)) apiuserId: string | null, + @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) + pageNumber: number, + @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit: number, + @Query( + new ValidationPipe({ + transform: true, + whitelist: true, + }), + ) + filterDto: UnreservedDeviceGroupsFilterDTO, + ) /*: Promise*/ { + // return new Promise((resolve,reject)=>{ + // resolve([]); + // }); + /* for now commenting because ui is giving error because it has removed fields sectors standard complaince of devices */ + this.logger.verbose('With in getAll'); + let organization: any; + if (!apiuserId) { + apiuserId = user.api_user_id; + } + + if (organizationId) { + organization = await this.organizationService.findOne(organizationId); + if (user.role === Role.ApiUser) { + if (organization.api_user_id != user.api_user_id) { + this.logger.error( + `Organization requested is belongs to other apiuser`, + ); + throw new BadRequestException({ + success: false, + message: 'Organization requested is belongs to other apiuser', + }); + } + } + } + + if (apiuserId) { + if (user.role === Role.ApiUser) { + if (apiuserId != user.api_user_id) { + this.logger.error( + `An apiuser is unauthorized to request for other apiuser`, + ); + throw new UnauthorizedException({ + success: false, + message: 'An apiuser is unauthorized to request for other apiuser', + }); + } + } + + if (organizationId && apiuserId != organization.api_user_id) { + this.logger.error( + `The requested organization is not belongs to the apiuser`, + ); + throw new UnauthorizedException({ + success: false, + message: 'The requested organization is not belongs to the apiuser', + }); + } + } + return this.deviceGroupService.getAll( + user, + organizationId, + apiuserId, + pageNumber, + limit, + filterDto, + ); + } + + /** + * It is GET api to list all device groups of loggedIn user + * @param param0 is getting userId, organizationId and user role from user at request + * @param filterDto is filteration fields to retrieve records + * @param pagenumber is for pagination + * @returns {Array} + */ + @Get('/my') + @UseGuards(AuthGuard('jwt'), RolesGuard) + //@Roles(Role.OrganizationAdmin, Role.DeviceOwner, Role.Buyer,Role.SubBuyer) + @ApiQuery({ name: 'pagenumber', type: Number, required: false }) + @ApiResponse({ + status: HttpStatus.OK, + type: [DeviceGroupDTO], + description: 'Returns my Device groups', + }) + async getMyDevices( + @UserDecorator() { id, organizationId, role }: ILoggedInUser, + @Query( + new ValidationPipe({ + transform: true, + whitelist: true, + }), + ) + filterDto: UnreservedDeviceGroupsFilterDTO, + + @Query('pagenumber') pagenumber: number | null, + ) /*: Promise */ { + this.logger.verbose(`With in getMyDevices`); + switch (role) { + case Role.DeviceOwner: + return await this.deviceGroupService.getOrganizationDeviceGroups( + organizationId, + ); + case Role.Buyer: + return await this.deviceGroupService.getBuyerDeviceGroups( + id, + pagenumber, + filterDto, + ); + case Role.SubBuyer: + return await this.deviceGroupService.getBuyerDeviceGroups( + id, + pagenumber, + filterDto, + ); + case Role.OrganizationAdmin: + return await this.deviceGroupService.getAll(); + default: + return await this.deviceGroupService.getOrganizationDeviceGroups( + organizationId, + ); + } + } + + /** + * It is GET api to fetch device group by id + * @param id is unique identifier of device groupId + * @returns {DeviceGroupDTO | null} DeviceGroupDto is when the record found, returns null when the record not found by id + */ + @Get('/:id') + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) + @Permission('Read') + @ACLModules('BUYER_RESERVATION_MANAGEMENT_CRUDL') + @ApiQuery({ + name: 'organizationId', + type: Number, + required: false, + description: 'This query parameter is used for Apiuser', + }) + @ApiOkResponse({ + type: DeviceGroupDTO, + description: 'Returns a Device group', + }) + @ApiNotFoundResponse({ description: `No device group found` }) + async get( + @Param('id') id: number, + @Query('organizationId', new DefaultValuePipe(null)) + organizationId: number | null, + @UserDecorator() user: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in get`); + if (organizationId) { + const organization = + await this.organizationService.findOne(organizationId); + if (user.role === Role.ApiUser) { + if (user.api_user_id != organization.api_user_id) { + this.logger.error( + `Organization requested is belongs to other apiuser`, + ); + throw new BadRequestException({ + success: false, + message: 'Organization requested is belongs to other apiuser', + }); + } else { + user.organizationId = organizationId; + } + } else { + if (organizationId != user.organizationId) { + this.logger.error( + `Organization requested is not same as logged in user organization`, + ); + throw new BadRequestException({ + success: false, + message: + 'Organization requested is not same as logged in user organization', + }); + } + } + } + return this.deviceGroupService.findById(id, user); + } + + /** + * It is POSTb api to create an device group + * @param param0 is getting organization Id from user request + * @param user is getting uset from user request + * @param deviceGroupToRegister body payload to create device group + * @returns {ResponseDeviceGroupDTO | null} + */ + @Post() + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), RolesGuard) + // @Roles(Role.DeviceOwner, Role.Admin,Role.Buyer) + @Roles(Role.Admin, Role.ApiUser, Role.Buyer) + @ApiQuery({ + name: 'orgId', + type: Number, + required: false, + description: 'This query parameter is used for Apiuser', + }) + @ApiResponse({ + status: HttpStatus.OK, + type: DeviceGroupDTO, + description: 'Returns a new created Device group', + }) + public async createOne( + @UserDecorator() { organizationId }: ILoggedInUser, + @UserDecorator() user: ILoggedInUser, + @Body() deviceGroupToRegister: AddGroupDTO, + @Query('orgId') orgId: number | null, + ): Promise { + this.logger.verbose(`With in createOne`); + if (orgId) { + const organization = await this.organizationService.findOne(orgId); + const orguser = await this.userService.findByEmail(organization.orgEmail); + if (user.role === Role.ApiUser) { + if (organization.api_user_id !== user.api_user_id) { + this.logger.error(`Organization requested belongs to other apiuser`); + throw new BadRequestException({ + success: false, + message: 'Organization requested belongs to other apiuser', + }); + } + + if (orguser.role === Role.Buyer) { + organizationId = orgId; + deviceGroupToRegister.api_user_id = user.api_user_id; + } + + if (orguser.role != Role.Buyer) { + this.logger.error(`Unauthorized for ${orguser.role}`); + throw new UnauthorizedException({ + success: false, + message: `Unauthorized for ${orguser.role}`, + }); + } + } else { + if (user.role === Role.Buyer) { + if (organizationId !== organization.id) { + this.logger.error( + `User does not associated with the requested organization`, + ); + throw new BadRequestException({ + success: false, + message: + 'User does not associated with the requested organization', + }); + } + } + } + } + //integer range which is for deviceId in device(id) table + //-2147483648 to +2147483647 + //https://www.postgresql.org/docs/9.1/datatype-numeric.html + + if ( + !Array.isArray(deviceGroupToRegister.deviceIds) || + deviceGroupToRegister.deviceIds.filter( + (ele) => ele >= -2147483648 && ele <= 2147483647, + ).length !== deviceGroupToRegister.deviceIds.length + ) { + this.logger.error(`One or more device ids are invalid`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: 'One or more device ids are invalid', + }), + ); + }); + } + if (deviceGroupToRegister.deviceIds.length == 0) { + this.logger.error( + `Please provide devices for reservation, deviceIds is empty atleast one device is required`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + 'Please provide devices for reservation, deviceIds is empty atleast one device is required', + }), + ); + }); + } + + if ( + isNaN(deviceGroupToRegister.targetCapacityInMegaWattHour) || + deviceGroupToRegister.targetCapacityInMegaWattHour <= 0 || + deviceGroupToRegister.targetCapacityInMegaWattHour == -0 + ) { + this.logger.error( + `targetCapacityInMegaWattHour should be valid number can include decimal but should be greater than 0`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + 'targetCapacityInMegaWattHour should be valid number can include decimal but should be greater than 0', + }), + ); + }); + } + + if (typeof deviceGroupToRegister.reservationStartDate === 'string') { + if (!isValidUTCDateFormat(deviceGroupToRegister.reservationStartDate)) { + this.logger.error( + `Invalid reservationStartDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Invalid reservationStartDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + }), + ); + }); + } + deviceGroupToRegister.reservationStartDate = new Date( + deviceGroupToRegister.reservationStartDate, + ); + } + if (typeof deviceGroupToRegister.reservationEndDate === 'string') { + if (!isValidUTCDateFormat(deviceGroupToRegister.reservationEndDate)) { + this.logger.error( + `Invalid reservationEndDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Invalid reservationEndDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + }), + ); + }); + } + deviceGroupToRegister.reservationEndDate = new Date( + deviceGroupToRegister.reservationEndDate, + ); + } + if (typeof deviceGroupToRegister.reservationExpiryDate === 'string') { + if (!isValidUTCDateFormat(deviceGroupToRegister.reservationExpiryDate)) { + this.logger.error( + `Invalid reservationExpiryDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Invalid reservationExpiryDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + }), + ); + }); + } + deviceGroupToRegister.reservationExpiryDate = new Date( + deviceGroupToRegister.reservationExpiryDate, + ); + } + if ( + deviceGroupToRegister.reservationStartDate && + deviceGroupToRegister.reservationEndDate && + deviceGroupToRegister.reservationStartDate.getTime() >= + deviceGroupToRegister.reservationEndDate.getTime() + ) { + this.logger.error(`start date cannot be less than or same as end date`); + throw new ConflictException({ + success: false, + message: 'start date cannot be less than or same as end date', + }); + } + if ( + deviceGroupToRegister.reservationStartDate && + deviceGroupToRegister.reservationEndDate && + deviceGroupToRegister.reservationExpiryDate && + (deviceGroupToRegister.reservationExpiryDate.getTime() <= + deviceGroupToRegister.reservationStartDate.getTime() || + deviceGroupToRegister.reservationExpiryDate.getTime() < + deviceGroupToRegister.reservationEndDate.getTime()) + ) { + this.logger.error( + `Expiry date cannot be less than from start and end date`, + ); + throw new ConflictException({ + success: false, + message: 'Expiry date cannot be less than from start and end date', + }); + } + + let maximumBackDateForReservation: Date = new Date( + new Date().getTime() - 3.164e10 * 3, + ); + if ( + deviceGroupToRegister.reservationStartDate.getTime() <= + maximumBackDateForReservation.getTime() || + deviceGroupToRegister.reservationEndDate.getTime() <= + maximumBackDateForReservation.getTime() + ) { + this.logger.error( + `start date or end date cannot be less than 3 year from current date`, + ); + throw new ConflictException({ + success: false, + message: + 'start date or end date cannot be less than 3 year from current date', + }); + } + if (organizationId === null || organizationId === undefined) { + this.logger.error(`User does not has organization associated`); + throw new ConflictException({ + success: false, + message: 'User does not has organization associated', + }); + } + const frequency = deviceGroupToRegister.frequency.toLowerCase(); + if ( + frequency === BuyerReservationCertificateGenerationFrequency.monthly || + frequency === BuyerReservationCertificateGenerationFrequency.quarterly || + frequency === BuyerReservationCertificateGenerationFrequency.weekly + ) { + this.logger.error(`This frequency is currently not supported`); + throw new ConflictException({ + success: false, + message: 'This frequency is currently not supported', + }); + } + + return await this.deviceGroupService.createOne( + organizationId, + deviceGroupToRegister, + user.id, + //@ts-ignore + process.env.DREC_BLOCKCHAIN_ADDRESS, + ); + // if (deviceGroupToRegister.blockchainAddress !== null && deviceGroupToRegister.blockchainAddress !== undefined && deviceGroupToRegister.blockchainAddress.trim() !== "") { + // console.log("deviceGroupToRegister.blockchainAddress"); + // deviceGroupToRegister.blockchainAddress = deviceGroupToRegister.blockchainAddress.trim(); + + // return await this.deviceGroupService.createOne( + // organizationId, + // deviceGroupToRegister, + // user.id, + // deviceGroupToRegister.blockchainAddress + // ); + + // } else { + // console.log(user.blockchainAccountAddress); + // if (user.blockchainAccountAddress !== null && user.blockchainAccountAddress !== undefined) { + // console.log("user.blockchainAddress") + // return await this.deviceGroupService.createOne( + // organizationId, + // deviceGroupToRegister, + // user.id, + // user.blockchainAccountAddress + // ); + + // } else { + + // throw new ConflictException({ + // success: false, + // message: 'No blockchain address sent and no blockchain address attached to this account', + // }); + // } + // } + } + + /** + * It is POST api to create device group + * @param user from user request + * @param param1 is getting organizationId from loggedIn user + * @param fileToProcess uploaded csv file + * @returns {DeviceCsvFileProcessingJobsEntity} + */ + @Post('process-creation-bulk-devices-csv') + @UseGuards(AuthGuard('jwt')) + //@UseGuards(AuthGuard('jwt'), PermissionGuard) + //@Permission('Write') + //@ACLModules('DEVICE_BULK_MANAGEMENT_CRUDL') + //@Roles(Role.Admin, Role.DeviceOwner,Role.OrganizationAdmin) + @ApiResponse({ + status: HttpStatus.OK, + type: [DeviceCsvFileProcessingJobsEntity], + description: 'Returns created devices from csv', + }) + @ApiBody({ type: CSVBulkUploadDTO }) + public async processCreationBulkFromCSV( + @UserDecorator() user: ILoggedInUser, + @UserDecorator() { organizationId }: ILoggedInUser, + @Body() fileToProcess: CSVBulkUploadDTO, + ): Promise { + this.logger.verbose(`With in processCreationBulkFromCSV`); + if (user.organizationId === null || user.organizationId === undefined) { + this.logger.error(`User needs to have organization added`); + throw new ConflictException({ + success: false, + message: 'User needs to have organization added', + }); + } + + //let response:any = await this.fileService.GetuploadS3(fileToProcess.fileName); + // let response = await this.fileService.get(fileToProcess.fileName, user); + + if (fileToProcess.fileName == undefined) { + //throw new Error("file not found"); + this.logger.error(`File Not Found`); + throw new ConflictException({ + success: false, + message: 'File Not Found', + }); + } + if (!fileToProcess.fileName.endsWith('.csv')) { + //throw new Error("file not found"); + this.logger.error(`Invalid file`); + throw new ConflictException({ + success: false, + message: 'Invalid file', + }); + } + let jobCreated = await this.deviceGroupService.createCSVJobForFile( + user.id, + organizationId, + StatusCSV.Added, + fileToProcess.fileName, + ); + + //let jobCreated = await this.deviceGroupService.createCSVJobForFile(user.id, organizationId, StatusCSV.Added, response.filename); + + return jobCreated; + } + + /** + * It is PATCH api to update device group by id + * @param id is identifier of device group in type number + * @param loggedUser user from request + * @param groupToUpdate body payload to update an device group + * @returns + */ + @Patch('/:id') + @UseGuards(AuthGuard('jwt')) + // @Roles(Role.DeviceOwner, Role.Admin) + @ApiResponse({ + status: HttpStatus.OK, + type: NewUpdateDeviceGroupDTO, + description: 'Returns an updated Device Group', + }) + @ApiNotFoundResponse({ description: `No device group found` }) + public async update( + @Param('id') id: number, + @UserDecorator() loggedUser: ILoggedInUser, + @Body() groupToUpdate: NewUpdateDeviceGroupDTO, + ): Promise { + this.logger.verbose(`With in update`); + let devicenextissuence: DeviceGroupNextIssueCertificate | null = + await this.deviceGroupService.getGroupiCertificateIssueDate({ + groupId: id, + }); + if (devicenextissuence === null) { + this.logger.error(`This device groups reservation has already ended`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `This device groups reservation has already ended `, + }), + ); + }); + } + if ( + new Date(groupToUpdate.reservationEndDate).getTime() < + new Date(devicenextissuence.start_date).getTime() + ) { + this.logger.error( + `Certificates are already generated or in progress for device group, cannot reduce below start time:${devicenextissuence.start_date}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Certificates are already generated or in progress for device group, cannot reduce below start time:${devicenextissuence.start_date}`, + }), + ); + }); + } + + return await this.deviceGroupService.update(id, loggedUser, groupToUpdate); + } + + /** + * It is DELETE api to delete an device group by id. + * @param id is unique identifier of device group in type number + * @param param1 is getting organizationId from loggedIn user + * @returns {void} + */ + @Delete('/:id') + @UseGuards(AuthGuard('jwt'), RolesGuard) + @Roles(Role.DeviceOwner, Role.Admin, Role.Buyer, Role.SubBuyer) + @ApiResponse({ + status: HttpStatus.OK, + description: 'Remove device group', + }) + @ApiNotFoundResponse({ description: `No device group found` }) + public async remove( + @Param('id') id: number, + @UserDecorator() { organizationId }: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in remove`); + return await this.deviceGroupService.remove(id, organizationId); + } + + /** + * It is GET api to list the status of jobs + * @param jobId is unique identifier of jobId + * @param param1 organizationId from loggedIn User + * @returns {JobFailedRowsDTO | undefined} + */ + @Get('/bulk-upload-status/:id') + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) //, PermissionGuard) + @Permission('Read') + @ACLModules('DEVICE_BULK_MANAGEMENT_CRUDL') + @ApiQuery({ + name: 'orgId', + type: Number, + required: false, + description: 'This query parameter is used for Apiuser', + }) + @ApiResponse({ + status: HttpStatus.OK, + type: JobFailedRowsDTO, + description: 'Returns status of job id for bulk upload', + }) + public async getBulkUploadJobStatus( + @Param('id') jobId: number, + @UserDecorator() { organizationId, role, api_user_id }: ILoggedInUser, + @Query('orgId', new DefaultValuePipe(null)) orgId: number | null, + ): Promise { + this.logger.verbose(`With in getBulkUploadJobStatus`); + + if (orgId) { + const organization = await this.organizationService.findOne(orgId); + const orguser = await this.userService.findByEmail(organization.orgEmail); + + if (role === Role.ApiUser) { + if (organization.api_user_id != api_user_id) { + this.logger.error( + `The requested organization is belongs to other apiuser`, + ); + throw new BadRequestException({ + success: false, + message: 'The requested organization is belongs to other apiuser', + }); + } + + if (orguser.role != Role.OrganizationAdmin) { + this.logger.error(`Unauthorized`); + throw new UnauthorizedException({ + success: false, + message: 'Unauthorized', + }); + } + } else { + if (orgId != organizationId) { + this.logger.error( + `The organizationId in query params should be same as user's organizationId`, + ); + throw new BadRequestException({ + success: false, + message: `The organizationId in query params should be same as user's organizationId`, + }); + } + + if (role === Role.Admin) { + orgId = null; + } + } + } else { + if (role === Role.ApiUser) { + this.logger.error(`Add the orgId at query param`); + throw new BadRequestException({ + success: false, + message: `Add the orgId at query param`, + }); + } + } + /* + let data = await this.deviceGroupService.getFailedRowDetailsForCSVJob( + jobId + ); + console.log("data", data); */ + + return await this.deviceGroupService.getFailedRowDetailsForCSVJob( + jobId, + orgId, + ); + } + + /** + * It is GET api to list all jobs by organization + * @param user is user from request + * @param param1 is getting organization Id from user request + * @returns {Array} + */ + @Get('/bulk-upload/get-all-csv-jobs-of-organization') + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) + //@UseGuards(AuthGuard('jwt'),PermissionGuard) + @Permission('Read') + @ACLModules('DEVICE_BULK_MANAGEMENT_CRUDL') + @ApiQuery({ + name: 'orgId', + type: Number, + required: false, + description: 'This query parameter is used for Apiuser', + }) + @ApiQuery({ name: 'pageNumber', type: Number, required: false }) + @ApiQuery({ name: 'limit', type: Number, required: false }) + @ApiResponse({ + status: HttpStatus.OK, + type: [DeviceCsvFileProcessingJobsEntity], + description: 'Returns created jobs of an organization', + }) + public async getAllCsvJobsBelongingToOrganization( + @UserDecorator() user: ILoggedInUser, + @UserDecorator() { organizationId }: ILoggedInUser, + @Query('orgId', new DefaultValuePipe(null)) orgId: number | null, + @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) + pageNumber: number, + @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit: number, + ) /*: Promise>*/ { + this.logger.verbose(`With in getAllCsvJobsBelongingToOrganization`); + if (user.organizationId === null || user.organizationId === undefined) { + this.logger.error(`User needs to have organization added`); + throw new ConflictException({ + success: false, + message: 'User needs to have organization added', + }); + } + + if (orgId) { + const organization = await this.organizationService.findOne(orgId); + const orguser = await this.userService.findByEmail(organization.orgEmail); + + if (user.role === Role.ApiUser) { + if (organization.api_user_id != user.api_user_id) { + this.logger.error( + `The requested organization is belongs to other apiuser`, + ); + throw new BadRequestException({ + success: false, + message: 'The requested organization is belongs to other apiuser', + }); + } + + if (orguser.role != Role.OrganizationAdmin) { + this.logger.error(`Unauthorized`); + throw new UnauthorizedException({ + success: false, + message: 'Unauthorized', + }); + } + } else { + if (user.role != Role.Admin) { + if (orgId != organizationId) { + this.logger.error( + `The orgId at query param is not same as user's organization`, + ); + throw new BadRequestException({ + success: false, + message: `The orgId at query param is not same as user's organization`, + }); + } + } + } + } + + if (user.role === 'Admin') { + return this.deviceGroupService.getAllCSVJobsForAdmin( + orgId, + pageNumber, + limit, + ); + } else if (user.role === Role.ApiUser) { + return this.deviceGroupService.getAllCSVJobsForApiUser( + user.api_user_id, + orgId, + pageNumber, + limit, + ); + } else { + return this.deviceGroupService.getAllCSVJobsForOrganization( + organizationId, + pageNumber, + limit, + ); + } + } + + /** + * It is GET api to fetch an certificate log of an device + * @param id is unique identifier of device group + * @returns {CheckCertificateIssueDateLogForDeviceGroupEntity} + */ + @Get('certificatelog/:id') + @ApiOkResponse({ + type: DeviceGroupDTO, + description: 'Returns a Device group', + }) + @ApiNotFoundResponse({ description: `No device group found` }) + async getdevciegrouplog( + @Param('id') id: number, + ): Promise { + this.logger.verbose(`With in getdevciegrouplog`); + return this.deviceGroupService.getDeviceGrouplog(id); + } + // @Post('/buyer-reservation') + // @UseGuards(AuthGuard('jwt'),PermissionGuard) + // @Permission('Write') + // @ACLModules('DEVICE_BUYER_RESERVATION_MANAGEMENT_CRUDL') + // @ApiResponse({ + // status: HttpStatus.OK, + // type: JobFailedRowsDTO, + // description: 'Returns status of job id for bulk upload', + // }) + // public async createBuyerReservationGroups( + // @UserDecorator() { organizationId }: ILoggedInUser + // ): Promise { + + // } + + /** + * It is DELETE api to delete an device reservation + * @param id is unique identifier of an device group + * @param endresavationdate is date of end reservation + * @param param2 is getting organization Id of loggedIn user + * @returns {void} + */ + @Delete('endreservation/:id') + @UseGuards(AuthGuard('jwt')) + @ApiResponse({ + status: HttpStatus.OK, + type: EndReservationdateDTO, + description: 'Reservation End', + }) + @ApiNotFoundResponse({ description: `No Reservation found` }) + public async endresavation( + @Param('id') id: number, + @Body() endresavationdate: EndReservationdateDTO, + @UserDecorator() { organizationId }: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in endresavation`); + return await this.deviceGroupService.EndReservationGroup( + id, + organizationId, + endresavationdate, + ); + } + + /** + * It is GET api to fetch current information of reservation + * @param groupuId is an identifier of device + * @param param1 + * @returns {any} + */ + @Get('current-information/:groupUid') + @UseGuards(AuthGuard('jwt')) + @ApiQuery({ name: 'pagenumber', type: Number, required: false }) + @ApiResponse({ + status: HttpStatus.OK, + }) + public async getReservationcurrentinformation( + @Param('groupUid') groupuId: string, + @Query('pagenumber') pagenumber: number, + @UserDecorator() { organizationId }: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in getReservationcurrentinformation`); + const regexExp = + /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/; + if (groupuId === null || !regexExp.test(groupuId)) { + this.logger.error( + `Please Add the valid UID ,invalid group uid value was sent`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Please Add the valid UID ,invalid group uid value was sent', + }), + ); + }); + } + // const devicegroup = await this.deviceGroupService.findOne({ devicegroup_uid: groupuId }) + // if (devicegroup === null || devicegroup.buyerId != user.id) { + // return new Promise((resolve, reject) => { + // reject(new ConflictException({ + // success: false, + // message: 'Group UId is not of this buyer, invalid value was sent', + // })) + // }) + // } + + return await this.deviceGroupService.getcurrentInformationofDevicesInReservation( + groupuId, + pagenumber, + ); + } +} diff --git a/apps/drec-api/src/pods/device-group/check_certificate_issue_date_log_for_device_group.entity.ts b/apps/drec-api/src/pods/device-group/check_certificate_issue_date_log_for_device_group.entity.ts index 234c09c13..5addbf17d 100755 --- a/apps/drec-api/src/pods/device-group/check_certificate_issue_date_log_for_device_group.entity.ts +++ b/apps/drec-api/src/pods/device-group/check_certificate_issue_date_log_for_device_group.entity.ts @@ -7,31 +7,31 @@ import { IsBoolean, IsNumber, IsOptional, - IsDate + IsDate, } from 'class-validator'; - @Entity('check_certificate_issue_date_log_for_device_group') export class CheckCertificateIssueDateLogForDeviceGroupEntity extends ExtendedBaseEntity { @PrimaryGeneratedColumn() id: number; - @Column({ - type: 'timestamp', - precision: 3 + @Column({ + type: 'timestamp', + precision: 3, }) - certificate_issuance_startdate:Date; + certificate_issuance_startdate: Date; - @Column({ - type: 'timestamp', - precision: 3 + @Column({ + type: 'timestamp', + precision: 3, }) - certificate_issuance_enddate:Date;a + certificate_issuance_enddate: Date; + a; @Column() @IsNumber() readvalue_watthour: number; - + @Column() @IsString() status: string; @@ -45,7 +45,7 @@ export class CheckCertificateIssueDateLogForDeviceGroupEntity extends ExtendedBa @Column() @IsNumber() - issuer_certificate_id:number; + issuer_certificate_id: number; @Column() @IsString() @@ -53,5 +53,5 @@ export class CheckCertificateIssueDateLogForDeviceGroupEntity extends ExtendedBa @Column() @IsString() - certificateTransactionUID:string -} \ No newline at end of file + certificateTransactionUID: string; +} diff --git a/apps/drec-api/src/pods/device-group/device-group.controller.ts b/apps/drec-api/src/pods/device-group/device-group.controller.ts index 588afbaa1..8145c3bf1 100755 --- a/apps/drec-api/src/pods/device-group/device-group.controller.ts +++ b/apps/drec-api/src/pods/device-group/device-group.controller.ts @@ -10,7 +10,7 @@ import { Delete, Query, ValidationPipe, - ConflictException + ConflictException, } from '@nestjs/common'; import { ApiBearerAuth, @@ -37,7 +37,6 @@ import { Max, } from 'class-validator'; - import { DeviceGroupService } from './device-group.service'; import { AddGroupDTO, @@ -51,14 +50,24 @@ import { JobFailedRowsDTO, EndReservationdateDTO, NewUpdateDeviceGroupDTO, - ResponseDeviceGroupDTO + ResponseDeviceGroupDTO, } from './dto'; import { Roles } from '../user/decorators/roles.decorator'; -import { Installation, OffTaker, Role, Sector, StandardCompliance } from '../../utils/enums'; +import { + Installation, + OffTaker, + Role, + Sector, + StandardCompliance, +} from '../../utils/enums'; import { isValidUTCDateFormat } from '../../utils/checkForISOStringFormat'; import { RolesGuard } from '../../guards/RolesGuard'; import { UserDecorator } from '../user/decorators/user.decorator'; -import { DeviceDescription, ILoggedInUser,BuyerReservationCertificateGenerationFrequency } from '../../models'; +import { + DeviceDescription, + ILoggedInUser, + BuyerReservationCertificateGenerationFrequency, +} from '../../models'; import { NewDeviceDTO } from '../device/dto'; import { File, FileService } from '../file'; @@ -67,12 +76,15 @@ import * as fs from 'fs'; import { Readable } from 'stream'; import csv from 'csv-parser'; -import { DeviceCsvFileProcessingJobsEntity, StatusCSV } from './device_csv_processing_jobs.entity'; +import { + DeviceCsvFileProcessingJobsEntity, + StatusCSV, +} from './device_csv_processing_jobs.entity'; import { Permission } from '../permission/decorators/permission.decorator'; import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator'; import { PermissionGuard } from '../../guards'; import { DeviceGroupNextIssueCertificate } from './device_group_issuecertificate.entity'; -import { CheckCertificateIssueDateLogForDeviceGroupEntity } from './check_certificate_issue_date_log_for_device_group.entity' +import { CheckCertificateIssueDateLogForDeviceGroupEntity } from './check_certificate_issue_date_log_for_device_group.entity'; import { OrganizationService } from '../organization/organization.service'; @ApiTags('device-group') @@ -83,9 +95,13 @@ export class DeviceGroupController { csvParser = csv({ separator: ',' }); parser = parse({ - delimiter: ',' + delimiter: ',', }); - constructor(private readonly deviceGroupService: DeviceGroupService, private readonly fileService: FileService, private organizationService: OrganizationService) { } + constructor( + private readonly deviceGroupService: DeviceGroupService, + private readonly fileService: FileService, + private organizationService: OrganizationService, + ) {} /** * It is GET api to list all device group data @@ -107,7 +123,6 @@ export class DeviceGroupController { return this.deviceGroupService.getAll(); } - /** * It is GET api to list all device groups of loggedIn user * @param param0 is getting userId, organizationId and user role from user at request @@ -116,7 +131,7 @@ export class DeviceGroupController { * @returns {Array} */ @Get('/my') - @UseGuards(AuthGuard('jwt'), RolesGuard,PermissionGuard) + @UseGuards(AuthGuard('jwt'), RolesGuard, PermissionGuard) @Roles(Role.OrganizationAdmin, Role.DeviceOwner, Role.Buyer) @Permission('Read') @ACLModules('DEVICE_GROUP_MANAGEMENT_CRUDL') @@ -128,28 +143,37 @@ export class DeviceGroupController { }) async getMyDevices( @UserDecorator() { id, organizationId, role }: ILoggedInUser, - @Query(new ValidationPipe({ - transform: true, - whitelist: true, - })) filterDto: UnreservedDeviceGroupsFilterDTO, - - @Query('pagenumber') pagenumber: number| null, - )/*: Promise */{ + @Query( + new ValidationPipe({ + transform: true, + whitelist: true, + }), + ) + filterDto: UnreservedDeviceGroupsFilterDTO, + + @Query('pagenumber') pagenumber: number | null, + ) /*: Promise */ { switch (role) { case Role.DeviceOwner: return await this.deviceGroupService.getOrganizationDeviceGroups( - organizationId); + organizationId, + ); case Role.Buyer: - return await this.deviceGroupService.getBuyerDeviceGroups(id,pagenumber,filterDto); + return await this.deviceGroupService.getBuyerDeviceGroups( + id, + pagenumber, + filterDto, + ); case Role.OrganizationAdmin: return await this.deviceGroupService.getAll(); default: return await this.deviceGroupService.getOrganizationDeviceGroups( - organizationId); + organizationId, + ); } } - - /** + + /** * It is GET api to fetch device group by id * @param id is unique identifier of device groupId * @returns {DeviceGroupDTO | null} DeviceGroupDto is when the record found, returns null when the record not found by id @@ -167,7 +191,7 @@ export class DeviceGroupController { return this.deviceGroupService.findById(id); } -/** + /** * It is POSTb api to create an device group * @param param0 is getting organization Id from user request * @param user is getting uset from user request @@ -175,7 +199,7 @@ export class DeviceGroupController { * @returns {ResponseDeviceGroupDTO | null} */ @Post() - @UseGuards(AuthGuard('jwt'),PermissionGuard)//, RolesGuard) + @UseGuards(AuthGuard('jwt'), PermissionGuard) //, RolesGuard) // @Roles(Role.DeviceOwner, Role.Admin,Role.Buyer) @Permission('Write') @ACLModules('DEVICE_GROUP_MANAGEMENT_CRUDL') @@ -189,12 +213,16 @@ export class DeviceGroupController { @UserDecorator() user: ILoggedInUser, @Body() deviceGroupToRegister: AddGroupDTO, ): Promise { - //integer range which is for deviceId in device(id) table //-2147483648 to +2147483647 //https://www.postgresql.org/docs/9.1/datatype-numeric.html - if (!Array.isArray(deviceGroupToRegister.deviceIds) || deviceGroupToRegister.deviceIds.filter(ele => ele >= -2147483648 && ele <= 2147483647).length !== deviceGroupToRegister.deviceIds.length) { + if ( + !Array.isArray(deviceGroupToRegister.deviceIds) || + deviceGroupToRegister.deviceIds.filter( + (ele) => ele >= -2147483648 && ele <= 2147483647, + ).length !== deviceGroupToRegister.deviceIds.length + ) { return new Promise((resolve, reject) => { reject( new ConflictException({ @@ -209,63 +237,87 @@ export class DeviceGroupController { reject( new ConflictException({ success: false, - message: 'Please provide devices for reservation, deviceIds is empty atleast one device is required', + message: + 'Please provide devices for reservation, deviceIds is empty atleast one device is required', }), ); }); - } - if (isNaN(deviceGroupToRegister.targetCapacityInMegaWattHour) || deviceGroupToRegister.targetCapacityInMegaWattHour <= 0 || deviceGroupToRegister.targetCapacityInMegaWattHour == -0) { + if ( + isNaN(deviceGroupToRegister.targetCapacityInMegaWattHour) || + deviceGroupToRegister.targetCapacityInMegaWattHour <= 0 || + deviceGroupToRegister.targetCapacityInMegaWattHour == -0 + ) { return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: 'targetCapacityInMegaWattHour should be valid number can include decimal but should be greater than 0', + message: + 'targetCapacityInMegaWattHour should be valid number can include decimal but should be greater than 0', }), ); }); } - if (typeof deviceGroupToRegister.reservationStartDate === "string") { + if (typeof deviceGroupToRegister.reservationStartDate === 'string') { if (!isValidUTCDateFormat(deviceGroupToRegister.reservationStartDate)) { return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid reservationStartDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + message: + ' Invalid reservationStartDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', }), ); }); } - deviceGroupToRegister.reservationStartDate = new Date(deviceGroupToRegister.reservationStartDate); + deviceGroupToRegister.reservationStartDate = new Date( + deviceGroupToRegister.reservationStartDate, + ); } - if (typeof deviceGroupToRegister.reservationEndDate === "string") { + if (typeof deviceGroupToRegister.reservationEndDate === 'string') { if (!isValidUTCDateFormat(deviceGroupToRegister.reservationEndDate)) { return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid reservationEndDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + message: + ' Invalid reservationEndDate, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', }), ); }); } - deviceGroupToRegister.reservationEndDate = new Date(deviceGroupToRegister.reservationEndDate); + deviceGroupToRegister.reservationEndDate = new Date( + deviceGroupToRegister.reservationEndDate, + ); } //console.log("188"); - if (deviceGroupToRegister.reservationStartDate && deviceGroupToRegister.reservationEndDate && deviceGroupToRegister.reservationStartDate.getTime() >= deviceGroupToRegister.reservationEndDate.getTime()) { + if ( + deviceGroupToRegister.reservationStartDate && + deviceGroupToRegister.reservationEndDate && + deviceGroupToRegister.reservationStartDate.getTime() >= + deviceGroupToRegister.reservationEndDate.getTime() + ) { throw new ConflictException({ success: false, message: 'start date cannot be less than or same as end date', }); } - let maximumBackDateForReservation: Date = new Date(new Date().getTime() - (3.164e+10 * 3)); - if (deviceGroupToRegister.reservationStartDate.getTime() <= maximumBackDateForReservation.getTime() || deviceGroupToRegister.reservationEndDate.getTime() <= maximumBackDateForReservation.getTime()) { + let maximumBackDateForReservation: Date = new Date( + new Date().getTime() - 3.164e10 * 3, + ); + if ( + deviceGroupToRegister.reservationStartDate.getTime() <= + maximumBackDateForReservation.getTime() || + deviceGroupToRegister.reservationEndDate.getTime() <= + maximumBackDateForReservation.getTime() + ) { //console.log("198"); throw new ConflictException({ success: false, - message: 'start date or end date cannot be less than 3 year from current date', + message: + 'start date or end date cannot be less than 3 year from current date', }); } if (organizationId === null || organizationId === undefined) { @@ -276,8 +328,11 @@ export class DeviceGroupController { }); } const frequency = deviceGroupToRegister.frequency.toLowerCase(); - if (frequency === BuyerReservationCertificateGenerationFrequency.monthly || frequency === BuyerReservationCertificateGenerationFrequency.quarterly||frequency === BuyerReservationCertificateGenerationFrequency.weekly) { - + if ( + frequency === BuyerReservationCertificateGenerationFrequency.monthly || + frequency === BuyerReservationCertificateGenerationFrequency.quarterly || + frequency === BuyerReservationCertificateGenerationFrequency.weekly + ) { throw new ConflictException({ success: false, message: 'This frequency is currently not supported', @@ -290,7 +345,6 @@ export class DeviceGroupController { user.id, //@ts-ignore process.env.DREC_BLOCKCHAIN_ADDRESS, - ); // if (deviceGroupToRegister.blockchainAddress !== null && deviceGroupToRegister.blockchainAddress !== undefined && deviceGroupToRegister.blockchainAddress.trim() !== "") { // console.log("deviceGroupToRegister.blockchainAddress"); @@ -322,10 +376,9 @@ export class DeviceGroupController { // }); // } // } - } - /** + /** * It is POST api to create device group * @param user from user request * @param param1 is getting organizationId from loggedIn user @@ -344,58 +397,56 @@ export class DeviceGroupController { description: 'Returns created devices from csv', }) @ApiBody({ type: CSVBulkUploadDTO }) - public async processCreationBulkFromCSV - (@UserDecorator() user: ILoggedInUser, - @UserDecorator() { organizationId }: ILoggedInUser, - @Body() fileToProcess: CSVBulkUploadDTO): Promise { + public async processCreationBulkFromCSV( + @UserDecorator() user: ILoggedInUser, + @UserDecorator() { organizationId }: ILoggedInUser, + @Body() fileToProcess: CSVBulkUploadDTO, + ): Promise { if (user.organizationId === null || user.organizationId === undefined) { throw new ConflictException({ success: false, - message: - 'User needs to have organization added' - }) + message: 'User needs to have organization added', + }); } //let response:any = await this.fileService.GetuploadS3(fileToProcess.fileName); // let response = await this.fileService.get(fileToProcess.fileName, user); - if (fileToProcess.fileName == undefined) { //throw new Error("file not found"); throw new ConflictException({ success: false, - message: - 'File Not Found' - }) - + message: 'File Not Found', + }); } if (!fileToProcess.fileName.endsWith('.csv')) { //throw new Error("file not found"); throw new ConflictException({ success: false, - message: - 'Invalid file' - }) - + message: 'Invalid file', + }); } - let jobCreated = await this.deviceGroupService.createCSVJobForFile(user.id, organizationId, StatusCSV.Added, fileToProcess.fileName); + let jobCreated = await this.deviceGroupService.createCSVJobForFile( + user.id, + organizationId, + StatusCSV.Added, + fileToProcess.fileName, + ); //let jobCreated = await this.deviceGroupService.createCSVJobForFile(user.id, organizationId, StatusCSV.Added, response.filename); return jobCreated; } - - - /** + /** * It is PATCH api to update device group by id - * @param id is identifier of device group in type number + * @param id is identifier of device group in type number * @param loggedUser user from request * @param groupToUpdate body payload to update an device group - * @returns + * @returns */ @Patch('/:id') - @UseGuards(AuthGuard('jwt'),PermissionGuard) + @UseGuards(AuthGuard('jwt'), PermissionGuard) // @Roles(Role.DeviceOwner, Role.Admin) @Permission('Update') @ACLModules('DEVICE_GROUP_MANAGEMENT_CRUDL') @@ -410,34 +461,35 @@ export class DeviceGroupController { @UserDecorator() loggedUser: ILoggedInUser, @Body() groupToUpdate: NewUpdateDeviceGroupDTO, ): Promise { - - let devicenextissuence: DeviceGroupNextIssueCertificate | null = await this.deviceGroupService.getGroupiCertificateIssueDate({ groupId: id }); + let devicenextissuence: DeviceGroupNextIssueCertificate | null = + await this.deviceGroupService.getGroupiCertificateIssueDate({ + groupId: id, + }); if (devicenextissuence === null) { return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: `This device groups reservation has already ended `, - }) + }), ); }); } - if (new Date(groupToUpdate.reservationEndDate).getTime() < new Date(devicenextissuence.start_date).getTime()) { + if ( + new Date(groupToUpdate.reservationEndDate).getTime() < + new Date(devicenextissuence.start_date).getTime() + ) { return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: `Certificates are already generated or in progress for device group, cannot reduce below start time:${devicenextissuence.start_date}`, - }) + }), ); }); } - return await this.deviceGroupService.update( - id, - loggedUser, - groupToUpdate, - ); + return await this.deviceGroupService.update(id, loggedUser, groupToUpdate); } /** @@ -447,7 +499,7 @@ export class DeviceGroupController { * @returns {void} */ @Delete('/:id') - @UseGuards(AuthGuard('jwt'), RolesGuard,PermissionGuard) + @UseGuards(AuthGuard('jwt'), RolesGuard, PermissionGuard) @Roles(Role.DeviceOwner, Role.Admin) @Permission('Delete') @ACLModules('DEVICE_GROUP_MANAGEMEMT_CRUDL') @@ -480,17 +532,14 @@ export class DeviceGroupController { }) public async getBulkUploadJobStatus( @Param('id') jobId: number, - @UserDecorator() { organizationId }: ILoggedInUser + @UserDecorator() { organizationId }: ILoggedInUser, ): Promise { //console.log("jobId", jobId); - let data = await this.deviceGroupService.getFailedRowDetailsForCSVJob( - jobId - ); + let data = + await this.deviceGroupService.getFailedRowDetailsForCSVJob(jobId); //console.log("data", data); - return await this.deviceGroupService.getFailedRowDetailsForCSVJob( - jobId - ); + return await this.deviceGroupService.getFailedRowDetailsForCSVJob(jobId); } /** @@ -501,7 +550,7 @@ export class DeviceGroupController { */ @Get('/bulk-upload/get-all-csv-jobs-of-organization') //@UseGuards(AuthGuard('jwt')) - @UseGuards(AuthGuard('jwt'),PermissionGuard) + @UseGuards(AuthGuard('jwt'), PermissionGuard) @Permission('Read') @ACLModules('DEVICE_GROUP_BULK_MANAGEMENT_CRUDL') @ApiResponse({ @@ -509,16 +558,18 @@ export class DeviceGroupController { type: [DeviceCsvFileProcessingJobsEntity], description: 'Returns created jobs of an organization', }) - public async getAllCsvJobsBelongingToOrganization(@UserDecorator() user: ILoggedInUser, @UserDecorator() { organizationId }: ILoggedInUser): Promise> { + public async getAllCsvJobsBelongingToOrganization( + @UserDecorator() user: ILoggedInUser, + @UserDecorator() { organizationId }: ILoggedInUser, + ): Promise> { //console.log("user", user); //console.log("organization", organizationId); if (user.organizationId === null || user.organizationId === undefined) { throw new ConflictException({ success: false, - message: - 'User needs to have organization added' - }) + message: 'User needs to have organization added', + }); } return this.deviceGroupService.getAllCSVJobsForOrganization(organizationId); } @@ -537,7 +588,9 @@ export class DeviceGroupController { description: 'Returns a Device group', }) @ApiNotFoundResponse({ description: `No device group found` }) - async getdevciegrouplog(@Param('id') id: number): Promise { + async getdevciegrouplog( + @Param('id') id: number, + ): Promise { return this.deviceGroupService.getDeviceGrouplog(id); } // @Post('/buyer-reservation') @@ -554,16 +607,16 @@ export class DeviceGroupController { // ): Promise { // } - + /** - * It is DELETE api to delete an device reservation - * @param id is unique identifier of an device group - * @param endresavationdate is date of end reservation - * @param param2 is getting organization Id of loggedIn user - * @returns {void} - */ + * It is DELETE api to delete an device reservation + * @param id is unique identifier of an device group + * @param endresavationdate is date of end reservation + * @param param2 is getting organization Id of loggedIn user + * @returns {void} + */ @Delete('endreservation/:id') - @UseGuards(AuthGuard('jwt'),PermissionGuard) + @UseGuards(AuthGuard('jwt'), PermissionGuard) @Permission('Delete') @ACLModules('DEVICE_GROUP_MANAGEMENT_CRUDL') @ApiResponse({ @@ -577,6 +630,10 @@ export class DeviceGroupController { @Body() endresavationdate: EndReservationdateDTO, @UserDecorator() { organizationId }: ILoggedInUser, ): Promise { - return await this.deviceGroupService.EndReservationGroup(id, organizationId, endresavationdate); + return await this.deviceGroupService.EndReservationGroup( + id, + organizationId, + endresavationdate, + ); } } diff --git a/apps/drec-api/src/pods/device-group/device-group.entity.ts b/apps/drec-api/src/pods/device-group/device-group.entity.ts index eb4f504c0..3252feb53 100755 --- a/apps/drec-api/src/pods/device-group/device-group.entity.ts +++ b/apps/drec-api/src/pods/device-group/device-group.entity.ts @@ -1,5 +1,12 @@ import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; -import { Column, Entity, PrimaryGeneratedColumn, CreateDateColumn, ManyToMany, JoinTable } from 'typeorm'; +import { + Column, + Entity, + PrimaryGeneratedColumn, + CreateDateColumn, + ManyToMany, + JoinTable, +} from 'typeorm'; import { IsString, IsNotEmpty, @@ -7,7 +14,7 @@ import { IsBoolean, IsNumber, IsOptional, - IsArray + IsArray, } from 'class-validator'; import { IDeviceGroup, IFullOrganization } from '../../models'; import { @@ -17,11 +24,11 @@ import { OffTaker, Sector, StandardCompliance, - FuelCode + FuelCode, } from '../../utils/enums'; //import { Device } from '../device'; import { Exclude } from 'class-transformer'; -import {Device} from '../device/device.entity' +import { Device } from '../device/device.entity'; @Entity() export class DeviceGroup extends ExtendedBaseEntity implements IDeviceGroup { @PrimaryGeneratedColumn() @@ -107,7 +114,7 @@ export class DeviceGroup extends ExtendedBaseEntity implements IDeviceGroup { leftoverReads: number; @Column({ - type: 'json' + type: 'json', }) @IsOptional() leftoverReadsByCountryCode: any; @@ -151,35 +158,33 @@ export class DeviceGroup extends ExtendedBaseEntity implements IDeviceGroup { @CreateDateColumn({ type: 'timestamp', - precision: 3 + precision: 3, }) reservationStartDate: Date; @CreateDateColumn({ type: 'timestamp', - precision: 3 + precision: 3, }) reservationEndDate: Date; @Column('int', { array: true }) deviceIdsInt: number[]; - - @Column({ type: 'boolean'}) + @Column({ type: 'boolean' }) @IsOptional() reservationActive: boolean; - // @ManyToMany(() => Device) // @JoinTable() // device: Device[]; @Column({ nullable: true, default: null }) - api_user_id : string; + api_user_id: string; @CreateDateColumn({ type: 'timestamp', - precision: 3 - }) - reservationExpiryDate:Date; + precision: 3, + }) + reservationExpiryDate: Date; } diff --git a/apps/drec-api/src/pods/device-group/device-group.module.ts b/apps/drec-api/src/pods/device-group/device-group.module.ts index 1b0b4415b..54f8abed3 100644 --- a/apps/drec-api/src/pods/device-group/device-group.module.ts +++ b/apps/drec-api/src/pods/device-group/device-group.module.ts @@ -1,47 +1,45 @@ -import { Module, forwardRef } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { DeviceModule } from '../device/device.module'; -import {ReadsModule} from '../reads/reads.module'; -//import { DeviceGroupController } from './device-group.controller'; -import { BuyerReservationController} from './buyer-reservation.controller' -import { DeviceGroup } from './device-group.entity'; -import { DeviceGroupService } from './device-group.service'; -import { OrganizationModule } from '../organization/organization.module'; -import { FileModule } from '../file'; -import { DeviceCsvProcessingFailedRowsEntity } from './device_csv_processing_failed_rows.entity'; -import { DeviceCsvFileProcessingJobsEntity } from './device_csv_processing_jobs.entity'; -import { YieldConfigModule } from '../yield-config/yieldconfig.module'; -import {DeviceGroupNextIssueCertificate} from './device_group_issuecertificate.entity'; -import {CheckCertificateIssueDateLogForDeviceGroupEntity} from './check_certificate_issue_date_log_for_device_group.entity'; -import {HistoryDeviceGroupNextIssueCertificate} from './history_next_issuance_date_log.entity'; -import { CertificateReadModelEntity } from '@energyweb/origin-247-certificate/dist/js/src/offchain-certificate/repositories/CertificateReadModel/CertificateReadModel.entity'; -import {CheckCertificateIssueDateLogForDeviceEntity} from '../device/check_certificate_issue_date_log_for_device.entity' -import {Certificate} from '@energyweb/issuer-api'; -import { UserModule } from '../user/user.module'; -@Module({ - imports: [ - - TypeOrmModule.forFeature([ - DeviceGroup, - DeviceCsvFileProcessingJobsEntity, - DeviceCsvProcessingFailedRowsEntity, - DeviceGroupNextIssueCertificate, - CheckCertificateIssueDateLogForDeviceGroupEntity, - HistoryDeviceGroupNextIssueCertificate, - CertificateReadModelEntity, - CheckCertificateIssueDateLogForDeviceEntity, - Certificate, - ]), - forwardRef(() => DeviceModule), - - OrganizationModule, - YieldConfigModule, - FileModule, - UserModule, - ], - providers: [DeviceGroupService], - exports: [DeviceGroupService], - controllers: [BuyerReservationController], -}) -export class DeviceGroupModule {} - \ No newline at end of file +import { Module, forwardRef } from '@nestjs/common'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { DeviceModule } from '../device/device.module'; +import { ReadsModule } from '../reads/reads.module'; +//import { DeviceGroupController } from './device-group.controller'; +import { BuyerReservationController } from './buyer-reservation.controller'; +import { DeviceGroup } from './device-group.entity'; +import { DeviceGroupService } from './device-group.service'; +import { OrganizationModule } from '../organization/organization.module'; +import { FileModule } from '../file'; +import { DeviceCsvProcessingFailedRowsEntity } from './device_csv_processing_failed_rows.entity'; +import { DeviceCsvFileProcessingJobsEntity } from './device_csv_processing_jobs.entity'; +import { YieldConfigModule } from '../yield-config/yieldconfig.module'; +import { DeviceGroupNextIssueCertificate } from './device_group_issuecertificate.entity'; +import { CheckCertificateIssueDateLogForDeviceGroupEntity } from './check_certificate_issue_date_log_for_device_group.entity'; +import { HistoryDeviceGroupNextIssueCertificate } from './history_next_issuance_date_log.entity'; +import { CertificateReadModelEntity } from '@energyweb/origin-247-certificate/dist/js/src/offchain-certificate/repositories/CertificateReadModel/CertificateReadModel.entity'; +import { CheckCertificateIssueDateLogForDeviceEntity } from '../device/check_certificate_issue_date_log_for_device.entity'; +import { Certificate } from '@energyweb/issuer-api'; +import { UserModule } from '../user/user.module'; +@Module({ + imports: [ + TypeOrmModule.forFeature([ + DeviceGroup, + DeviceCsvFileProcessingJobsEntity, + DeviceCsvProcessingFailedRowsEntity, + DeviceGroupNextIssueCertificate, + CheckCertificateIssueDateLogForDeviceGroupEntity, + HistoryDeviceGroupNextIssueCertificate, + CertificateReadModelEntity, + CheckCertificateIssueDateLogForDeviceEntity, + Certificate, + ]), + forwardRef(() => DeviceModule), + + OrganizationModule, + YieldConfigModule, + FileModule, + UserModule, + ], + providers: [DeviceGroupService], + exports: [DeviceGroupService], + controllers: [BuyerReservationController], +}) +export class DeviceGroupModule {} diff --git a/apps/drec-api/src/pods/device-group/device-group.service.spec.ts b/apps/drec-api/src/pods/device-group/device-group.service.spec.ts index a24e69ee8..d9dd3da87 100644 --- a/apps/drec-api/src/pods/device-group/device-group.service.spec.ts +++ b/apps/drec-api/src/pods/device-group/device-group.service.spec.ts @@ -1,99 +1,101 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { Repository } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { OrganizationService } from '../organization/organization.service'; -import { UserService } from '../user/user.service'; -import { DeviceGroupService } from './device-group.service'; -import { DeviceGroup } from './device-group.entity'; -import { DeviceCsvProcessingFailedRowsEntity } from './device_csv_processing_failed_rows.entity'; -import { DeviceCsvFileProcessingJobsEntity } from './device_csv_processing_jobs.entity'; -import { DeviceGroupNextIssueCertificate } from './device_group_issuecertificate.entity'; -import { FileService } from '../file'; -import { YieldConfigService } from '../yield-config/yieldconfig.service'; -import { CheckCertificateIssueDateLogForDeviceGroupEntity } from './check_certificate_issue_date_log_for_device_group.entity'; -import { HistoryDeviceGroupNextIssueCertificate } from './history_next_issuance_date_log.entity'; -import { CertificateReadModelEntity } from '@energyweb/origin-247-certificate/dist/js/src/offchain-certificate/repositories/CertificateReadModel/CertificateReadModel.entity'; -import { DeviceService } from '../device/device.service'; -import { IrecErrorLogInformationEntity } from '../device/irec_error_log_information.entity'; - -describe('DeviceGroupService', () => { - let service: DeviceGroupService; - let repository: Repository; - let repositoryJobFailedRows: Repository; - let repositoyCSVJobProcessing: Repository; - let repositorynextDeviceGroupcertificate: Repository; - let organizationService: OrganizationService; - let deviceService: DeviceService; - let fileService: FileService; - let yieldConfigService: YieldConfigService; - let userService: UserService; - let checkdevciegrouplogcertificaterepository: Repository; - let historynextissuancedaterepository: Repository; - let certificateReadModelEntity: Repository>; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [DeviceGroupService, - { - provide: getRepositoryToken(DeviceGroup), - useClass: Repository, - }, - { - provide: getRepositoryToken(DeviceCsvProcessingFailedRowsEntity), - useClass: Repository, - }, - { - provide: getRepositoryToken(DeviceCsvFileProcessingJobsEntity), - useClass: Repository, - }, - { - provide: getRepositoryToken(DeviceGroupNextIssueCertificate), - useClass: Repository, - }, - { - provide: getRepositoryToken(IrecErrorLogInformationEntity), - useClass: Repository, - }, - { - provide: OrganizationService, - useValue: {} as any, - }, - { - provide: UserService, - useValue: {} as any, - }, - { - provide: DeviceService, - useValue: {} as any, - }, - { - provide: FileService, - useValue: {} as any, - }, - { - provide: YieldConfigService, - useValue: {} as any, - }, - { - provide: getRepositoryToken(CheckCertificateIssueDateLogForDeviceGroupEntity), - useClass: Repository, - }, - { - provide: getRepositoryToken(HistoryDeviceGroupNextIssueCertificate), - useClass: Repository, - }, - { - provide: getRepositoryToken(CertificateReadModelEntity), - useClass: Repository, - } - ], - }).compile(); - - service = module.get(DeviceGroupService); - - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { Repository } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { OrganizationService } from '../organization/organization.service'; +import { UserService } from '../user/user.service'; +import { DeviceGroupService } from './device-group.service'; +import { DeviceGroup } from './device-group.entity'; +import { DeviceCsvProcessingFailedRowsEntity } from './device_csv_processing_failed_rows.entity'; +import { DeviceCsvFileProcessingJobsEntity } from './device_csv_processing_jobs.entity'; +import { DeviceGroupNextIssueCertificate } from './device_group_issuecertificate.entity'; +import { FileService } from '../file'; +import { YieldConfigService } from '../yield-config/yieldconfig.service'; +import { CheckCertificateIssueDateLogForDeviceGroupEntity } from './check_certificate_issue_date_log_for_device_group.entity'; +import { HistoryDeviceGroupNextIssueCertificate } from './history_next_issuance_date_log.entity'; +import { CertificateReadModelEntity } from '@energyweb/origin-247-certificate/dist/js/src/offchain-certificate/repositories/CertificateReadModel/CertificateReadModel.entity'; +import { DeviceService } from '../device/device.service'; +import { IrecErrorLogInformationEntity } from '../device/irec_error_log_information.entity'; + +describe('DeviceGroupService', () => { + let service: DeviceGroupService; + let repository: Repository; + let repositoryJobFailedRows: Repository; + let repositoyCSVJobProcessing: Repository; + let repositorynextDeviceGroupcertificate: Repository; + let organizationService: OrganizationService; + let deviceService: DeviceService; + let fileService: FileService; + let yieldConfigService: YieldConfigService; + let userService: UserService; + let checkdevciegrouplogcertificaterepository: Repository; + let historynextissuancedaterepository: Repository; + let certificateReadModelEntity: Repository>; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + DeviceGroupService, + { + provide: getRepositoryToken(DeviceGroup), + useClass: Repository, + }, + { + provide: getRepositoryToken(DeviceCsvProcessingFailedRowsEntity), + useClass: Repository, + }, + { + provide: getRepositoryToken(DeviceCsvFileProcessingJobsEntity), + useClass: Repository, + }, + { + provide: getRepositoryToken(DeviceGroupNextIssueCertificate), + useClass: Repository, + }, + { + provide: getRepositoryToken(IrecErrorLogInformationEntity), + useClass: Repository, + }, + { + provide: OrganizationService, + useValue: {} as any, + }, + { + provide: UserService, + useValue: {} as any, + }, + { + provide: DeviceService, + useValue: {} as any, + }, + { + provide: FileService, + useValue: {} as any, + }, + { + provide: YieldConfigService, + useValue: {} as any, + }, + { + provide: getRepositoryToken( + CheckCertificateIssueDateLogForDeviceGroupEntity, + ), + useClass: Repository, + }, + { + provide: getRepositoryToken(HistoryDeviceGroupNextIssueCertificate), + useClass: Repository, + }, + { + provide: getRepositoryToken(CertificateReadModelEntity), + useClass: Repository, + }, + ], + }).compile(); + + service = module.get(DeviceGroupService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/device-group/device-group.service.ts b/apps/drec-api/src/pods/device-group/device-group.service.ts index b4801335d..2ad7f29b9 100755 --- a/apps/drec-api/src/pods/device-group/device-group.service.ts +++ b/apps/drec-api/src/pods/device-group/device-group.service.ts @@ -15,7 +15,10 @@ import { FindOperator, Raw, LessThan, - In, Between, Brackets, SelectQueryBuilder + In, + Between, + Brackets, + SelectQueryBuilder, } from 'typeorm'; import { DeviceService } from '../device/device.service'; import { @@ -27,13 +30,17 @@ import { UnreservedDeviceGroupsFilterDTO, EndReservationdateDTO, NewUpdateDeviceGroupDTO, - ResponseDeviceGroupDTO + ResponseDeviceGroupDTO, } from './dto'; //import { jsonbBuildObject, jsonbBuildArray, jsonbPath, jsonbArrayElements } from 'typeorm-plus'; import { defaults, cloneDeep } from 'lodash'; import { DeviceGroup } from './device-group.entity'; import { Device } from '../device/device.entity'; -import { DeviceDescription, IDevice, BuyerReservationCertificateGenerationFrequency } from '../../models'; +import { + DeviceDescription, + IDevice, + BuyerReservationCertificateGenerationFrequency, +} from '../../models'; import { DeviceDTO, NewDeviceDTO, FilterDTO } from '../device/dto'; import { CommissioningDateRange, @@ -42,7 +49,7 @@ import { Sector, FuelCode, DevicetypeCode, - Role + Role, } from '../../utils/enums'; import moment from 'moment'; @@ -52,7 +59,7 @@ import { getDateRangeFromYear } from '../../utils/get-commissioning-date-range'; import cleanDeep from 'clean-deep'; import { OrganizationService } from '../organization/organization.service'; import { nanoid } from 'nanoid'; -import { HistoryNextInssuanceStatus } from '../../utils/enums/history_next_issuance.enum' +import { HistoryNextInssuanceStatus } from '../../utils/enums/history_next_issuance.enum'; import { Cron, CronExpression } from '@nestjs/schedule'; import { DeviceCsvProcessingFailedRowsEntity } from './device_csv_processing_failed_rows.entity'; import { @@ -63,26 +70,22 @@ import { DeviceGroupNextIssueCertificate } from './device_group_issuecertificate import { Readable } from 'stream'; import csv from 'csv-parser'; -import csvtojsonV2 from "csvtojson"; +import csvtojsonV2 from 'csvtojson'; -import { countryCodesList } from '../../models/country-code' +import { countryCodesList } from '../../models/country-code'; import { FileService } from '../file'; import { ILoggedInUser, LoggedInUser } from '../../models'; -import { - validate, -} from 'class-validator'; +import { validate } from 'class-validator'; import { YieldConfigService } from '../yield-config/yieldconfig.service'; import { DateTime } from 'luxon'; -import { CheckCertificateIssueDateLogForDeviceGroupEntity } from './check_certificate_issue_date_log_for_device_group.entity' +import { CheckCertificateIssueDateLogForDeviceGroupEntity } from './check_certificate_issue_date_log_for_device_group.entity'; import { HistoryDeviceGroupNextIssueCertificate } from './history_next_issuance_date_log.entity'; import { isValidUTCDateFormat } from '../../utils/checkForISOStringFormat'; import { CertificateReadModelEntity } from '@energyweb/origin-247-certificate/dist/js/src/offchain-certificate/repositories/CertificateReadModel/CertificateReadModel.entity'; import { Certificate } from '@energyweb/issuer-api'; import { UserService } from '../user/user.service'; - - @Injectable() export class DeviceGroupService { csvParser = csv({ separator: ',' }); @@ -105,12 +108,27 @@ export class DeviceGroupService { private readonly checkdevciegrouplogcertificaterepository: Repository, @InjectRepository(HistoryDeviceGroupNextIssueCertificate) private readonly historynextissuancedaterepository: Repository, - @InjectRepository(CertificateReadModelEntity) private readonly cretificatereadmoduleRepository, + @InjectRepository(CertificateReadModelEntity) + private readonly cretificatereadmoduleRepository, private readonly userService: UserService, + ) {} - ) { } - - async getAll(user?: ILoggedInUser, organizationId?: number, apiuserId?: string, pageNumber?: number, limit?: number, filterDto?: UnreservedDeviceGroupsFilterDTO): Promise<{ devicegroups: DeviceGroupDTO[], currentPage: number, totalPages: number, totalCount: number } | any> { + async getAll( + user?: ILoggedInUser, + organizationId?: number, + apiuserId?: string, + pageNumber?: number, + limit?: number, + filterDto?: UnreservedDeviceGroupsFilterDTO, + ): Promise< + | { + devicegroups: DeviceGroupDTO[]; + currentPage: number; + totalPages: number; + totalCount: number; + } + | any + > { this.logger.verbose(`With in dg service ${filterDto}`); let query: SelectQueryBuilder = await this.repository .createQueryBuilder('group') @@ -122,8 +140,7 @@ export class DeviceGroupService { if (apiuserId) { if (user.role === Role.Admin && apiuserId === user.api_user_id) { query.andWhere(`group.api_user_id IS NULL`); - } - else { + } else { query.andWhere(`group.api_user_id = '${apiuserId}'`); } } @@ -133,111 +150,176 @@ export class DeviceGroupService { } if (filterDto) { - if (filterDto.start_date != undefined && filterDto.end_date != undefined) { - if ((filterDto.start_date != null && filterDto.end_date === null)) { + if ( + filterDto.start_date != undefined && + filterDto.end_date != undefined + ) { + if (filterDto.start_date != null && filterDto.end_date === null) { this.logger.error(`End Date should be mandatory`); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: `End Date should be mandatory`, - })) - }) + reject( + new ConflictException({ + success: false, + message: `End Date should be mandatory`, + }), + ); + }); } - if (!(new Date(filterDto.start_date).getTime() < new Date(filterDto.end_date).getTime())) { + if ( + !( + new Date(filterDto.start_date).getTime() < + new Date(filterDto.end_date).getTime() + ) + ) { this.logger.error(`End date should be greater then from Start date`); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: `End date should be greater then from Start date `, - })) - }) + reject( + new ConflictException({ + success: false, + message: `End date should be greater then from Start date `, + }), + ); + }); } - if (!(new Date(filterDto.start_date).getTime() < new Date(filterDto.end_date).getTime())) { + if ( + !( + new Date(filterDto.start_date).getTime() < + new Date(filterDto.end_date).getTime() + ) + ) { this.logger.error(`End date should be greater then from Start date`); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: `End date should be greater then from Start date `, - })) - }) + reject( + new ConflictException({ + success: false, + message: `End date should be greater then from Start date `, + }), + ); + }); } } if (filterDto.country) { const countrystr = filterDto.country; - const values = countrystr.split(","); + const values = countrystr.split(','); let invalidCountry = false; - values.forEach(element => { + values.forEach((element) => { filterDto.country = element.toUpperCase(); - if (filterDto.country && typeof (filterDto.country) === 'string' && filterDto.country.length === 3) { + if ( + filterDto.country && + typeof filterDto.country === 'string' && + filterDto.country.length === 3 + ) { let countries = countryCodesList; - if (countries.find(element => element.countryCode === filterDto.country) === undefined) { + if ( + countries.find( + (element) => element.countryCode === filterDto.country, + ) === undefined + ) { invalidCountry = true; } } }); if (!invalidCountry) { - query.andWhere('group.countryCode @> ARRAY[:...countryCodes]', { countryCodes: values }); + query.andWhere('group.countryCode @> ARRAY[:...countryCodes]', { + countryCodes: values, + }); } } if (filterDto.fuelCode) { if (typeof filterDto.fuelCode === 'string') { - query.andWhere('group.fuelCode = :fuelcode', { fuelcode: [filterDto.fuelCode] }); + query.andWhere('group.fuelCode = :fuelcode', { + fuelcode: [filterDto.fuelCode], + }); } else if (typeof filterDto.fuelCode === 'object') { - query.andWhere('group.fuelCode @> ARRAY[:...fuelcode]', { fuelcode: filterDto.fuelCode }) + query.andWhere('group.fuelCode @> ARRAY[:...fuelcode]', { + fuelcode: filterDto.fuelCode, + }); } } if (filterDto.offTaker) { const newoffTaker = filterDto.offTaker.toString(); const offTakerArray = newoffTaker.split(','); - query.andWhere(new Brackets(qb => { - - offTakerArray.forEach((offTaker, index) => { - if (index === 0) { - qb.orWhere(`EXISTS (SELECT 1 FROM unnest(group.offTakers) ot WHERE ot LIKE :offtaker${index})`, { [`offtaker${index}`]: `%${offTaker}%` }); - - } else { - qb.orWhere(`EXISTS (SELECT 1 FROM unnest(group.offTakers) ot WHERE ot LIKE :offtaker${index})`, { [`offtaker${index}`]: `%${offTaker}%` }); - - } - }); - })); + query.andWhere( + new Brackets((qb) => { + offTakerArray.forEach((offTaker, index) => { + if (index === 0) { + qb.orWhere( + `EXISTS (SELECT 1 FROM unnest(group.offTakers) ot WHERE ot LIKE :offtaker${index})`, + { [`offtaker${index}`]: `%${offTaker}%` }, + ); + } else { + qb.orWhere( + `EXISTS (SELECT 1 FROM unnest(group.offTakers) ot WHERE ot LIKE :offtaker${index})`, + { [`offtaker${index}`]: `%${offTaker}%` }, + ); + } + }); + }), + ); } if (filterDto.start_date && filterDto.end_date) { - query.andWhere(new Brackets((db) => { - db.where( - new Brackets((db1) => { - db1.where("group.reservationStartDate BETWEEN :reservationStartDate1 AND :reservationEndDate1", { reservationStartDate1: filterDto.start_date, reservationEndDate1: filterDto.end_date }) - .orWhere("group.reservationStartDate = :reservationStartDate", { reservationStartDate: filterDto.start_date }) - }) - ) - .andWhere( + query.andWhere( + new Brackets((db) => { + db.where( + new Brackets((db1) => { + db1 + .where( + 'group.reservationStartDate BETWEEN :reservationStartDate1 AND :reservationEndDate1', + { + reservationStartDate1: filterDto.start_date, + reservationEndDate1: filterDto.end_date, + }, + ) + .orWhere( + 'group.reservationStartDate = :reservationStartDate', + { reservationStartDate: filterDto.start_date }, + ); + }), + ).andWhere( new Brackets((db2) => { - db2.where("group.reservationEndDate BETWEEN :reservationStartDate2 AND :reservationEndDate2", { reservationStartDate2: filterDto.start_date, reservationEndDate2: filterDto.end_date }) - .orWhere("group.reservationEndDate = :reservationStartDate ", { reservationStartDate: filterDto.end_date }) - }) - ) - })) + db2 + .where( + 'group.reservationEndDate BETWEEN :reservationStartDate2 AND :reservationEndDate2', + { + reservationStartDate2: filterDto.start_date, + reservationEndDate2: filterDto.end_date, + }, + ) + .orWhere( + 'group.reservationEndDate = :reservationStartDate ', + { reservationStartDate: filterDto.end_date }, + ); + }), + ); + }), + ); } if (filterDto.sdgbenefit) { const sdgstr = filterDto.sdgbenefit.toString(); const sdgBenefitsArray = sdgstr.split(','); - query.andWhere(new Brackets(qb => { - sdgBenefitsArray.forEach((benefit, index) => { - if (index === 0) { - qb.where(`device.SDGBenefits ILIKE :benefit${index}`, { [`benefit${index}`]: `%${benefit}%` }); - } else { - qb.orWhere(`device.SDGBenefits ILIKE :benefit${index}`, { [`benefit${index}`]: `%${benefit}%` }); - } - }); - })) + query.andWhere( + new Brackets((qb) => { + sdgBenefitsArray.forEach((benefit, index) => { + if (index === 0) { + qb.where(`device.SDGBenefits ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${benefit}%`, + }); + } else { + qb.orWhere(`device.SDGBenefits ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${benefit}%`, + }); + } + }); + }), + ); } if (filterDto.reservationActive) { @@ -245,7 +327,9 @@ export class DeviceGroupService { query.andWhere('group.reservationActive = :active', { active: true }); } if (filterDto.reservationActive === 'Deactive') { - query.andWhere('group.reservationActive = :active', { active: false }); + query.andWhere('group.reservationActive = :active', { + active: false, + }); } } } @@ -271,8 +355,8 @@ export class DeviceGroupService { groupedData: groupsWithOrganization, currentPage: pageNumber, totalPages, - totalCount - } + totalCount, + }; } async findById(id: number, user?: ILoggedInUser): Promise { @@ -286,44 +370,66 @@ export class DeviceGroupService { } if (user) { if (user.role === Role.ApiUser) { - const organization = await this.organizationService.findOne(user.organizationId); - const orguser = await this.userService.findByEmail(organization.orgEmail); - if (orguser.role === Role.OrganizationAdmin || orguser.role === Role.DeviceOwner) { - const isMyDevice = await this.checkdeveloperorganization(deviceGroup.deviceIdsInt, user.organizationId); + const organization = await this.organizationService.findOne( + user.organizationId, + ); + const orguser = await this.userService.findByEmail( + organization.orgEmail, + ); + if ( + orguser.role === Role.OrganizationAdmin || + orguser.role === Role.DeviceOwner + ) { + const isMyDevice = await this.checkdeveloperorganization( + deviceGroup.deviceIdsInt, + user.organizationId, + ); if (!isMyDevice) { - this.logger.error(`Unauthorized to view the reservation of other's devices`); + this.logger.error( + `Unauthorized to view the reservation of other's devices`, + ); throw new UnauthorizedException({ success: false, message: `Unauthorized to view the reservation of other's devices`, }); } - } - else if (orguser.role === Role.Buyer || orguser.role === Role.SubBuyer) { + } else if ( + orguser.role === Role.Buyer || + orguser.role === Role.SubBuyer + ) { if (deviceGroup.organizationId != user.organizationId) { - this.logger.error(`Unauthorized to view the reservation of other organizations`); + this.logger.error( + `Unauthorized to view the reservation of other organizations`, + ); throw new UnauthorizedException({ success: false, message: `Unauthorized to view the reservation of other organizations`, }); } } - - } - - else { - if (user.role === Role.OrganizationAdmin || user.role === Role.DeviceOwner) { - const isMyDevice = await this.checkdeveloperorganization(deviceGroup.deviceIdsInt, user.organizationId); + } else { + if ( + user.role === Role.OrganizationAdmin || + user.role === Role.DeviceOwner + ) { + const isMyDevice = await this.checkdeveloperorganization( + deviceGroup.deviceIdsInt, + user.organizationId, + ); if (!isMyDevice) { - this.logger.error(`Unauthorized to view the reservation of other's devices`); + this.logger.error( + `Unauthorized to view the reservation of other's devices`, + ); throw new UnauthorizedException({ success: false, message: `Unauthorized to view the reservation of other's devices`, }); } - } - else if (user.role === Role.Buyer || user.role === Role.SubBuyer) { + } else if (user.role === Role.Buyer || user.role === Role.SubBuyer) { if (deviceGroup.organizationId != user.organizationId) { - this.logger.error(`Unauthorized to view the reservation of other organizations`); + this.logger.error( + `Unauthorized to view the reservation of other organizations`, + ); throw new UnauthorizedException({ success: false, message: `Unauthorized to view the reservation of other organizations`, @@ -360,7 +466,6 @@ export class DeviceGroupService { buyerId: number, pageNumber?: number, groupfilterDto?: UnreservedDeviceGroupsFilterDTO, - ): Promise { this.logger.verbose(`With in getBuyerDeviceGroups`); let deviceGroups: any; @@ -368,97 +473,126 @@ export class DeviceGroupService { const pageSize = 10; if (!groupfilterDto || Object.keys(groupfilterDto).length === 0) { - queryBuilder = this.repository .createQueryBuilder('dg') .innerJoin(Device, 'd', 'd.id = ANY(dg."deviceIdsInt")') .addSelect('ARRAY_AGG(d."SDGBenefits")', 'sdgBenefits') .orderBy('dg.id', 'ASC') - .groupBy('dg.id') + .groupBy('dg.id'); queryBuilder.where((qb) => { qb.where(`dg.buyerId = :buyerid `, { - buyerid: buyerId - }) + buyerid: buyerId, + }); }); - } - else { + } else { const skip = (pageNumber - 1) * pageSize; - if (groupfilterDto.start_date != undefined && groupfilterDto.end_date != undefined) { - if ((groupfilterDto.start_date != null && groupfilterDto.end_date === null)) { + if ( + groupfilterDto.start_date != undefined && + groupfilterDto.end_date != undefined + ) { + if ( + groupfilterDto.start_date != null && + groupfilterDto.end_date === null + ) { this.logger.error(`End Date should be mandatory`); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: `End Date should be mandatory`, - })) - }) + reject( + new ConflictException({ + success: false, + message: `End Date should be mandatory`, + }), + ); + }); } - if (!(new Date(groupfilterDto.start_date).getTime() < new Date(groupfilterDto.end_date).getTime())) { + if ( + !( + new Date(groupfilterDto.start_date).getTime() < + new Date(groupfilterDto.end_date).getTime() + ) + ) { this.logger.error(`End date should be greater then from Start date`); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: `End date should be greater then from Start date `, - })) - }) + reject( + new ConflictException({ + success: false, + message: `End date should be greater then from Start date `, + }), + ); + }); } } - this.logger.debug("Line No: 187"); + this.logger.debug('Line No: 187'); queryBuilder = this.repository .createQueryBuilder('dg') .innerJoin(Device, 'd', 'd.id = ANY(dg."deviceIdsInt")') .addSelect('ARRAY_AGG(d."SDGBenefits")', 'sdgBenefits') .orderBy('dg.id', 'ASC') - .groupBy('dg.id') + .groupBy('dg.id'); queryBuilder.where((qb) => { qb.where(`dg.buyerId = :buyerid `, { - buyerid: buyerId - }) - .andWhere(new Brackets(qb => { - + buyerid: buyerId, + }).andWhere( + new Brackets((qb) => { if (groupfilterDto.country) { const string = groupfilterDto.country; - const values = string.split(","); + const values = string.split(','); let CountryInvalid = false; - values.forEach(ele => { + values.forEach((ele) => { groupfilterDto.country = ele.toUpperCase(); - if (groupfilterDto.country && typeof groupfilterDto.country === "string" && groupfilterDto.country.length === 3) { + if ( + groupfilterDto.country && + typeof groupfilterDto.country === 'string' && + groupfilterDto.country.length === 3 + ) { let countries = countryCodesList; - if (countries.find(ele => ele.countryCode === groupfilterDto.country) === undefined) { + if ( + countries.find( + (ele) => ele.countryCode === groupfilterDto.country, + ) === undefined + ) { CountryInvalid = true; } } }); if (!CountryInvalid) { - - qb.orWhere('dg.countryCode @> ARRAY[:...countrycode]', { countrycode: values }) - + qb.orWhere('dg.countryCode @> ARRAY[:...countrycode]', { + countrycode: values, + }); } } - if ((groupfilterDto.fuelCode)) { + if (groupfilterDto.fuelCode) { if (typeof groupfilterDto.fuelCode === 'string') { - qb.orWhere('dg.fuelCode = :fuelcode', { fuelcode: [groupfilterDto.fuelCode] }); + qb.orWhere('dg.fuelCode = :fuelcode', { + fuelcode: [groupfilterDto.fuelCode], + }); } else if (typeof groupfilterDto.fuelCode === 'object') { - qb.orWhere('dg.fuelCode @> ARRAY[:...fuelcode]', { fuelcode: groupfilterDto.fuelCode }) + qb.orWhere('dg.fuelCode @> ARRAY[:...fuelcode]', { + fuelcode: groupfilterDto.fuelCode, + }); } } if (groupfilterDto.offTaker) { - const newoffTaker = groupfilterDto.offTaker.toString() + const newoffTaker = groupfilterDto.offTaker.toString(); const offTakerArray = newoffTaker.split(','); - qb.orWhere(new Brackets(qb => { - - offTakerArray.forEach((offTaker, index) => { - if (index === 0) { - qb.orWhere(`EXISTS (SELECT 1 FROM unnest(dg.offTakers) ot WHERE ot LIKE :offtaker${index})`, { [`offtaker${index}`]: `%${offTaker}%` }); - - } else { - qb.orWhere(`EXISTS (SELECT 1 FROM unnest(dg.offTakers) ot WHERE ot LIKE :offtaker${index})`, { [`offtaker${index}`]: `%${offTaker}%` }); - - } - }); - })); + qb.orWhere( + new Brackets((qb) => { + offTakerArray.forEach((offTaker, index) => { + if (index === 0) { + qb.orWhere( + `EXISTS (SELECT 1 FROM unnest(dg.offTakers) ot WHERE ot LIKE :offtaker${index})`, + { [`offtaker${index}`]: `%${offTaker}%` }, + ); + } else { + qb.orWhere( + `EXISTS (SELECT 1 FROM unnest(dg.offTakers) ot WHERE ot LIKE :offtaker${index})`, + { [`offtaker${index}`]: `%${offTaker}%` }, + ); + } + }); + }), + ); } // if (groupfilterDto.start_date) { @@ -468,40 +602,67 @@ export class DeviceGroupService { // qb.orWhere("dg.reservationEndDate BETWEEN :reservationStartDate2 AND :reservationEndDate2", { reservationStartDate2: groupfilterDto.start_date, reservationEndDate2: groupfilterDto.end_date }) // } if (groupfilterDto.start_date && groupfilterDto.end_date) { - qb.orWhere(new Brackets((db) => { - db.where( - new Brackets((db1) => { - db1.where("dg.reservationStartDate BETWEEN :reservationStartDate1 AND :reservationEndDate1", { reservationStartDate1: groupfilterDto.start_date, reservationEndDate1: groupfilterDto.end_date }) - .orWhere("dg.reservationStartDate = :reservationStartDate", { reservationStartDate: groupfilterDto.start_date }) - }) - ) - .andWhere( + qb.orWhere( + new Brackets((db) => { + db.where( + new Brackets((db1) => { + db1 + .where( + 'dg.reservationStartDate BETWEEN :reservationStartDate1 AND :reservationEndDate1', + { + reservationStartDate1: groupfilterDto.start_date, + reservationEndDate1: groupfilterDto.end_date, + }, + ) + .orWhere( + 'dg.reservationStartDate = :reservationStartDate', + { reservationStartDate: groupfilterDto.start_date }, + ); + }), + ).andWhere( new Brackets((db2) => { - db2.where("dg.reservationEndDate BETWEEN :reservationStartDate2 AND :reservationEndDate2", { reservationStartDate2: groupfilterDto.start_date, reservationEndDate2: groupfilterDto.end_date }) - .orWhere("dg.reservationEndDate = :reservationStartDate ", { reservationStartDate: groupfilterDto.end_date }) - }) - ) - })) + db2 + .where( + 'dg.reservationEndDate BETWEEN :reservationStartDate2 AND :reservationEndDate2', + { + reservationStartDate2: groupfilterDto.start_date, + reservationEndDate2: groupfilterDto.end_date, + }, + ) + .orWhere( + 'dg.reservationEndDate = :reservationStartDate ', + { reservationStartDate: groupfilterDto.end_date }, + ); + }), + ); + }), + ); } if (groupfilterDto.sdgbenefit) { - - const newsdg = groupfilterDto.sdgbenefit.toString() + const newsdg = groupfilterDto.sdgbenefit.toString(); const sdgBenefitsArray = newsdg.split(','); - const sdgBenefitString = sdgBenefitsArray.map((benefit) => benefit).join(','); - - qb.orWhere(new Brackets(qb => { - sdgBenefitsArray.forEach((benefit, index) => { - if (index === 0) { - qb.where(`d.SDGBenefits ILIKE :benefit${index}`, { [`benefit${index}`]: `%${benefit}%` }); - } else { - qb.orWhere(`d.SDGBenefits ILIKE :benefit${index}`, { [`benefit${index}`]: `%${benefit}%` }); - } - }); - })); - + const sdgBenefitString = sdgBenefitsArray + .map((benefit) => benefit) + .join(','); + + qb.orWhere( + new Brackets((qb) => { + sdgBenefitsArray.forEach((benefit, index) => { + if (index === 0) { + qb.where(`d.SDGBenefits ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${benefit}%`, + }); + } else { + qb.orWhere(`d.SDGBenefits ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${benefit}%`, + }); + } + }); + }), + ); } if (groupfilterDto.reservationActive) { if (groupfilterDto.reservationActive === 'Active') { @@ -511,31 +672,36 @@ export class DeviceGroupService { qb.orWhere('dg.reservationActive = :active', { active: false }); } } - - })); - }) + }), + ); + }); const groupedDatasql = await queryBuilder.getSql(); } const skip = (pageNumber - 1) * pageSize; - let groupedData = await queryBuilder.offset(skip).limit(pageSize).getRawMany(); + let groupedData = await queryBuilder + .offset(skip) + .limit(pageSize) + .getRawMany(); this.logger.debug(queryBuilder.getSql()); // console.log(groupedData); - const totalCountQuery = await queryBuilder - .getCount() + const totalCountQuery = await queryBuilder.getCount(); const totalPages = Math.ceil(totalCountQuery / pageSize); if (totalCountQuery > 0) { if (pageNumber > totalPages) { this.logger.error(`Page number out of range`); - throw new HttpException('Page number out of range', HttpStatus.NOT_FOUND); + throw new HttpException( + 'Page number out of range', + HttpStatus.NOT_FOUND, + ); } } // If deviceGroups is not an array, return an empty array const finalreservation = groupedData.map((deviceGroup) => ({ id: deviceGroup.dg_id, - createdAt:deviceGroup.dg_createdAt, + createdAt: deviceGroup.dg_createdAt, name: deviceGroup.dg_name, organizationId: deviceGroup.dg_organizationId, fuelCode: deviceGroup.dg_fuelCode, @@ -555,22 +721,24 @@ export class DeviceGroupService { reservationEndDate: deviceGroup.dg_reservationEndDate, reservationActive: deviceGroup.dg_reservationActive, targetVolumeInMegaWattHour: deviceGroup.dg_targetVolumeInMegaWattHour, - targetVolumeCertificateGenerationRequestedInMegaWattHour: deviceGroup.dg_targetVolumeCertificateGenerationRequestedInMegaWattHour, - targetVolumeCertificateGenerationSucceededInMegaWattHour: deviceGroup.dg_targetVolumeCertificateGenerationSucceededInMegaWattHour, - targetVolumeCertificateGenerationFailedInMegaWattHour: deviceGroup.dg_targetVolumeCertificateGenerationFailedInMegaWattHour, + targetVolumeCertificateGenerationRequestedInMegaWattHour: + deviceGroup.dg_targetVolumeCertificateGenerationRequestedInMegaWattHour, + targetVolumeCertificateGenerationSucceededInMegaWattHour: + deviceGroup.dg_targetVolumeCertificateGenerationSucceededInMegaWattHour, + targetVolumeCertificateGenerationFailedInMegaWattHour: + deviceGroup.dg_targetVolumeCertificateGenerationFailedInMegaWattHour, authorityToExceed: deviceGroup.dg_authorityToExceed, leftoverReadsByCountryCode: deviceGroup.dg_leftoverReadsByCountryCode, devicegroup_uid: deviceGroup.dg_devicegroup_uid, type: deviceGroup.dg_type, deviceIds: deviceGroup.dg_deviceIdsInt, - SDGBenefits: Array.from(new Set(deviceGroup.sdgBenefits)) - + SDGBenefits: Array.from(new Set(deviceGroup.sdgBenefits)), })); const response = { groupedData: finalreservation, pageNumber, totalPages, - totalCount: totalCountQuery + totalCount: totalCountQuery, }; return response; } @@ -582,7 +750,6 @@ export class DeviceGroupService { return (await this.repository.findOne(conditions)) ?? null; } - async createCSVJobForFile( userId: number, organizationId: number, @@ -604,16 +771,25 @@ export class DeviceGroupService { organizationId: number, pageNumber?: number, limit?: number, - ): Promise<{ csvJobs: Array, currentPage: number, totalPages: number, totalCount: number } | any> { + ): Promise< + | { + csvJobs: Array; + currentPage: number; + totalPages: number; + totalCount: number; + } + | any + > { this.logger.verbose(`With in getAllCSVJobsForOrganization`); - const [csvjobs, totalCount] = await this.repositoyCSVJobProcessing.findAndCount({ - where: { organizationId }, - order: { - createdAt: 'DESC', - }, - skip: (pageNumber - 1) * limit, - take: limit - }); + const [csvjobs, totalCount] = + await this.repositoyCSVJobProcessing.findAndCount({ + where: { organizationId }, + order: { + createdAt: 'DESC', + }, + skip: (pageNumber - 1) * limit, + take: limit, + }); const totalPages = Math.ceil(totalCount / limit); @@ -634,14 +810,22 @@ export class DeviceGroupService { csvJobs: csvjobsWithOrganization, currentPage: pageNumber, totalPages, - totalCount - } + totalCount, + }; } async getAllCSVJobsForAdmin( orgId?: number, pageNumber?: number, limit?: number, - ): Promise<{ csvJobs: Array, currentPage: number, totalPages: number, totalCount: number } | any> { + ): Promise< + | { + csvJobs: Array; + currentPage: number; + totalPages: number; + totalCount: number; + } + | any + > { this.logger.verbose(`With in getAllCSVJobsForAdmin`); let whereConditions: any = {}; @@ -649,14 +833,15 @@ export class DeviceGroupService { whereConditions.organizationId = orgId; } - const [csvjobs, totalCount] = await this.repositoyCSVJobProcessing.findAndCount({ - where: whereConditions, - order: { - createdAt: 'DESC', - }, - skip: (pageNumber - 1) * limit, - take: limit - }); + const [csvjobs, totalCount] = + await this.repositoyCSVJobProcessing.findAndCount({ + where: whereConditions, + order: { + createdAt: 'DESC', + }, + skip: (pageNumber - 1) * limit, + take: limit, + }); const totalPages = Math.ceil(totalCount / limit); @@ -677,18 +862,23 @@ export class DeviceGroupService { csvJobs: csvjobsWithOrganization, currentPage: pageNumber, totalPages, - totalCount - } + totalCount, + }; } async createFailedRowDetailsForCSVJob( jobId: number, errorDetails: Array, - successfullyAddedRowsAndExternalIds: Array<{ rowNumber: number, externalId: string }> + successfullyAddedRowsAndExternalIds: Array<{ + rowNumber: number; + externalId: string; + }>, ): Promise { this.logger.verbose(`With in createFailedRowDetailsForCSVJob`); return await this.repositoryJobFailedRows.save({ jobId, - errorDetails: { log: { errorDetails, successfullyAddedRowsAndExternalIds } } + errorDetails: { + log: { errorDetails, successfullyAddedRowsAndExternalIds }, + }, }); } @@ -707,7 +897,7 @@ export class DeviceGroupService { this.logger.error(`The job requested is belongs to other organization`); throw new UnauthorizedException({ success: false, - message: `The job requested is belongs to other organization` + message: `The job requested is belongs to other organization`, }); } } @@ -733,33 +923,41 @@ export class DeviceGroupService { const devices = await this.deviceService.findByIds(data.deviceIds); let reservationIsStartingInHistoryForAtleastOneDevice: boolean = false; let allDevicesHaveHistoricalIssuanceAndNoNextIssuance: boolean = false; - devices.filter(ele => { - if ((new Date(data.reservationStartDate).getTime() < new Date(ele.createdAt).getTime()) && (new Date(data.reservationEndDate).getTime() <= new Date(ele.createdAt).getTime())) { - + devices.filter((ele) => { + if ( + new Date(data.reservationStartDate).getTime() < + new Date(ele.createdAt).getTime() && + new Date(data.reservationEndDate).getTime() <= + new Date(ele.createdAt).getTime() + ) { return true; } - }).length === devices.length ? (allDevicesHaveHistoricalIssuanceAndNoNextIssuance = true) : (allDevicesHaveHistoricalIssuanceAndNoNextIssuance = false); + }).length === devices.length + ? (allDevicesHaveHistoricalIssuanceAndNoNextIssuance = true) + : (allDevicesHaveHistoricalIssuanceAndNoNextIssuance = false); if (!allDevicesHaveHistoricalIssuanceAndNoNextIssuance) { //find minimum reservation start date for next issuance but also exclude in cron whose devices onbaorded date are greater than reservation start date //there will be single device which will have next issuance - let minimumDeviceCreatedAtDate: Date = new Date(2993430403962);// future date in 2064 just to find minimum + let minimumDeviceCreatedAtDate: Date = new Date(2993430403962); // future date in 2064 just to find minimum let minimumDeviceCreatedAtIndex: number = 0; devices.forEach((ele, index) => { - let eleDate = new Date(ele.createdAt) + let eleDate = new Date(ele.createdAt); if (eleDate.getTime() < minimumDeviceCreatedAtDate.getTime()) { minimumDeviceCreatedAtDate = eleDate; minimumDeviceCreatedAtIndex = index; } }); ////console.log(minimumDeviceCreatedAtDate) - //if minimum device created at i.e onboarded date is lesser than reservation start date then that will be next issuance start date else we take minimum - //as we will start issuance for next issuance for devices only whose createdAt is before next issuance start date + //if minimum device created at i.e onboarded date is lesser than reservation start date then that will be next issuance start date else we take minimum + //as we will start issuance for next issuance for devices only whose createdAt is before next issuance start date let startDate: string = ''; - if (minimumDeviceCreatedAtDate.getTime() < new Date(data.reservationStartDate).getTime()) { - startDate = new Date(data.reservationStartDate).toISOString() - } - else { - startDate = minimumDeviceCreatedAtDate.toISOString() + if ( + minimumDeviceCreatedAtDate.getTime() < + new Date(data.reservationStartDate).getTime() + ) { + startDate = new Date(data.reservationStartDate).toISOString(); + } else { + startDate = minimumDeviceCreatedAtDate.toISOString(); } ////console.log(minimumDeviceCreatedAtDate) let hours = 1; @@ -767,76 +965,103 @@ export class DeviceGroupService { const frequency = group.frequency.toLowerCase(); if (frequency === BuyerReservationCertificateGenerationFrequency.daily) { hours = 1 * 24; - } else if (frequency === BuyerReservationCertificateGenerationFrequency.monthly) { + } else if ( + frequency === BuyerReservationCertificateGenerationFrequency.monthly + ) { hours = 30 * 24; - } else if (frequency === BuyerReservationCertificateGenerationFrequency.weekly) { + } else if ( + frequency === BuyerReservationCertificateGenerationFrequency.weekly + ) { hours = 7 * 24; - } else if (frequency === BuyerReservationCertificateGenerationFrequency.quarterly) { + } else if ( + frequency === BuyerReservationCertificateGenerationFrequency.quarterly + ) { hours = 91 * 24; } let newEndDate: string = ''; - let end_date = new Date((new Date(startDate).getTime() + (hours * 3.6e+6))).toISOString() - - if (new Date(end_date).getTime() < new Date(data.reservationEndDate).getTime()) { + let end_date = new Date( + new Date(startDate).getTime() + hours * 3.6e6, + ).toISOString(); + + if ( + new Date(end_date).getTime() < + new Date(data.reservationEndDate).getTime() + ) { newEndDate = end_date; - } - else { + } else { newEndDate = data.reservationEndDate.toISOString(); } ////console.log("newEndDate",newEndDate) - //when there are multiple devices and there is device next to minimumCreatedAt but less than next possible end date + //when there are multiple devices and there is device next to minimumCreatedAt but less than next possible end date //then we consider that as end_date for next issuance else we might loose data for that particular device when next issuance frequency is added in cron let nextMinimumCreatedWhichIsLessThanEndDate: boolean = false; let nextMinimumCreatedAtString: string = ''; devices.forEach((ele, index) => { if (index != minimumDeviceCreatedAtIndex) { - if (new Date(ele.createdAt).getTime() < new Date(newEndDate).getTime()) { + if ( + new Date(ele.createdAt).getTime() < new Date(newEndDate).getTime() + ) { nextMinimumCreatedWhichIsLessThanEndDate = true; if (nextMinimumCreatedAtString === '') { //newEndDate - nextMinimumCreatedAtString = new Date(ele.createdAt).toISOString(); - } - else { - //check if nextMinimum is not minimum then change else leave it - if (new Date(ele.createdAt).getTime() < new Date(nextMinimumCreatedAtString).getTime()) { - nextMinimumCreatedAtString = new Date(ele.createdAt).toISOString(); + nextMinimumCreatedAtString = new Date( + ele.createdAt, + ).toISOString(); + } else { + //check if nextMinimum is not minimum then change else leave it + if ( + new Date(ele.createdAt).getTime() < + new Date(nextMinimumCreatedAtString).getTime() + ) { + nextMinimumCreatedAtString = new Date( + ele.createdAt, + ).toISOString(); } } - } } - }) + }); ////console.log("nextMinimumCreatedAtString",nextMinimumCreatedAtString) if (nextMinimumCreatedWhichIsLessThanEndDate) { - - if (new Date(startDate).getTime() > new Date(nextMinimumCreatedAtString).getTime()) { + if ( + new Date(startDate).getTime() > + new Date(nextMinimumCreatedAtString).getTime() + ) { newEndDate = newEndDate; - } - else { + } else { newEndDate = nextMinimumCreatedAtString; } } - const nextgroupcrtifecateissue = this.repositorynextDeviceGroupcertificate.save({ - start_date: startDate, - end_date: newEndDate, - groupId: group.id - }); + const nextgroupcrtifecateissue = + this.repositorynextDeviceGroupcertificate.save({ + start_date: startDate, + end_date: newEndDate, + groupId: group.id, + }); } await Promise.all( devices.map(async (device: Device) => { - if (new Date(data.reservationStartDate).getTime() < new Date(device.createdAt).getTime()) { - const nexthistorydevicecrtifecateissue = await this.historynextissuancedaterepository.save({ - groupId: group.id, - device_externalid: device.externalId, - reservationStartDate: data.reservationStartDate, - reservationEndDate: new Date(data.reservationEndDate).getTime() < new Date(device.createdAt).getTime() ? data.reservationEndDate : device.createdAt, - device_createdAt: device.createdAt, - status: HistoryNextInssuanceStatus.Pending - }); + if ( + new Date(data.reservationStartDate).getTime() < + new Date(device.createdAt).getTime() + ) { + const nexthistorydevicecrtifecateissue = + await this.historynextissuancedaterepository.save({ + groupId: group.id, + device_externalid: device.externalId, + reservationStartDate: data.reservationStartDate, + reservationEndDate: + new Date(data.reservationEndDate).getTime() < + new Date(device.createdAt).getTime() + ? data.reservationEndDate + : device.createdAt, + device_createdAt: device.createdAt, + status: HistoryNextInssuanceStatus.Pending, + }); } return await this.deviceService.addGroupIdToDeviceForReserving( device, - group.id + group.id, ); }), ); @@ -848,95 +1073,167 @@ export class DeviceGroupService { organizationId: number, group: AddGroupDTO, buyerId?: number, - buyerAddress?: string + buyerAddress?: string, ): Promise { this.logger.verbose(`With in createOne`); - let smallHackAsEvenAfterReturnReservationGettingCreatedWillUseBoolean: boolean = false; - let devices = await this.deviceService.findByIdsWithoutGroupIdsAssignedImpliesWithoutReservation(group.deviceIds); - let unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation: Array = []; - devices.forEach(ele => ele.groupId != null ? unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.push(ele.id) : ""); - devices = devices.filter(ele => ele.groupId === null); + let smallHackAsEvenAfterReturnReservationGettingCreatedWillUseBoolean: boolean = + false; + let devices = + await this.deviceService.findByIdsWithoutGroupIdsAssignedImpliesWithoutReservation( + group.deviceIds, + ); + let unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation: Array = + []; + devices.forEach((ele) => + ele.groupId != null + ? unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.push( + ele.id, + ) + : '', + ); + devices = devices.filter((ele) => ele.groupId === null); if (devices.length === 0) { smallHackAsEvenAfterReturnReservationGettingCreatedWillUseBoolean = true; - this.logger.error(`Devices ${unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.join(' , ')} are already included in buyer reservation, please add other devices`); + this.logger.error( + `Devices ${unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.join(' , ')} are already included in buyer reservation, please add other devices`, + ); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: `Devices ${unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.join(' , ')} are already included in buyer reservation, please add other devices`, - })) - }) + reject( + new ConflictException({ + success: false, + message: `Devices ${unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.join(' , ')} are already included in buyer reservation, please add other devices`, + }), + ); + }); } let allDevicesAvailableforBuyerReservation: boolean = true; let unavailableDeviceIds: Array = []; let unavailableDeviceIdsDueToCertificateAlreadyIssued: Array = []; if (devices.length === 0) { smallHackAsEvenAfterReturnReservationGettingCreatedWillUseBoolean = true; - this.logger.error(`Devices ${unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.join(' , ')} are already included in buyer reservation, please add other devices`); + this.logger.error( + `Devices ${unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.join(' , ')} are already included in buyer reservation, please add other devices`, + ); return new Promise((resolve, reject) => { let message = ''; - if (unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.length > 0) { - message = message + `Devices ${unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.join(' , ')} are already included in buyer reservation, please add other devices`; + if ( + unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.length > 0 + ) { + message = + message + + `Devices ${unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.join(' , ')} are already included in buyer reservation, please add other devices`; } - this.logger.error(`Devices ${unavailableDeviceIdsDueToCertificateAlreadyIssued.join(' , ')} have already certified data in that date range and please add other devices or select different date range`); - message = message + `Devices ${unavailableDeviceIdsDueToCertificateAlreadyIssued.join(' , ')} have already certified data in that date range and please add other devices or select different date range`; - reject(new ConflictException({ - success: false, - message: message - })) - }) + this.logger.error( + `Devices ${unavailableDeviceIdsDueToCertificateAlreadyIssued.join(' , ')} have already certified data in that date range and please add other devices or select different date range`, + ); + message = + message + + `Devices ${unavailableDeviceIdsDueToCertificateAlreadyIssued.join(' , ')} have already certified data in that date range and please add other devices or select different date range`; + reject( + new ConflictException({ + success: false, + message: message, + }), + ); + }); } - group.deviceIds.forEach(ele => { - if (!devices.find(deviceSingle => deviceSingle.id === ele)) { + group.deviceIds.forEach((ele) => { + if (!devices.find((deviceSingle) => deviceSingle.id === ele)) { allDevicesAvailableforBuyerReservation = false; unavailableDeviceIds.push(ele); } }); - if (!group.continueWithReservationIfOneOrMoreDevicesUnavailableForReservation) { + if ( + !group.continueWithReservationIfOneOrMoreDevicesUnavailableForReservation + ) { if (!allDevicesAvailableforBuyerReservation) { - smallHackAsEvenAfterReturnReservationGettingCreatedWillUseBoolean = true; - this.logger.error(`One or more devices device Ids: ' + unavailableDeviceIds.join(',') + ' are already included in buyer reservation, please add other devices`); + smallHackAsEvenAfterReturnReservationGettingCreatedWillUseBoolean = + true; + this.logger.error( + `One or more devices device Ids: ' + unavailableDeviceIds.join(',') + ' are already included in buyer reservation, please add other devices`, + ); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: 'One or more devices device Ids: ' + unavailableDeviceIds.join(',') + ' are already included in buyer reservation, please add other devices', - })) - }) + reject( + new ConflictException({ + success: false, + message: + 'One or more devices device Ids: ' + + unavailableDeviceIds.join(',') + + ' are already included in buyer reservation, please add other devices', + }), + ); + }); } } - if (!group.continueWithReservationIfTargetCapacityIsLessThanDeviceTotalCapacityBetweenDuration) { + if ( + !group.continueWithReservationIfTargetCapacityIsLessThanDeviceTotalCapacityBetweenDuration + ) { let aggregatedCapacity = 0; - devices.forEach(ele => aggregatedCapacity = ele.capacity + aggregatedCapacity); - let reservationStartDate = DateTime.fromISO(new Date(group.reservationStartDate).toISOString()); - let reservationEndDate = DateTime.fromISO(new Date(group.reservationEndDate).toISOString()); + devices.forEach( + (ele) => (aggregatedCapacity = ele.capacity + aggregatedCapacity), + ); + let reservationStartDate = DateTime.fromISO( + new Date(group.reservationStartDate).toISOString(), + ); + let reservationEndDate = DateTime.fromISO( + new Date(group.reservationEndDate).toISOString(), + ); const meteredTimePeriodInHours = Math.abs( - reservationEndDate.diff(reservationStartDate, ['hours']).toObject()?.hours || 0, + reservationEndDate.diff(reservationStartDate, ['hours']).toObject() + ?.hours || 0, ); // hours - let targetCapacityInKiloWattHour = group.targetCapacityInMegaWattHour * 1000; - if (aggregatedCapacity * meteredTimePeriodInHours < targetCapacityInKiloWattHour) { - smallHackAsEvenAfterReturnReservationGettingCreatedWillUseBoolean = true; - this.logger.error(`Target Capacity Cannot be reached by selected devices within provided start date and end date, either add more devices or increase the end date duration`); + let targetCapacityInKiloWattHour = + group.targetCapacityInMegaWattHour * 1000; + if ( + aggregatedCapacity * meteredTimePeriodInHours < + targetCapacityInKiloWattHour + ) { + smallHackAsEvenAfterReturnReservationGettingCreatedWillUseBoolean = + true; + this.logger.error( + `Target Capacity Cannot be reached by selected devices within provided start date and end date, either add more devices or increase the end date duration`, + ); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: 'Target Capacity Cannot be reached by selected devices within provided start date and end date, either add more devices or increase the end date duration', - details: { meteredTimePeriodInHours, targetCapacityInMegaWattHour: group.targetCapacityInMegaWattHour, probablyAchievableCapacityInMegaWattHour: aggregatedCapacity * meteredTimePeriodInHours * 0.001 } - })) - }) + reject( + new ConflictException({ + success: false, + message: + 'Target Capacity Cannot be reached by selected devices within provided start date and end date, either add more devices or increase the end date duration', + details: { + meteredTimePeriodInHours, + targetCapacityInMegaWattHour: + group.targetCapacityInMegaWattHour, + probablyAchievableCapacityInMegaWattHour: + aggregatedCapacity * meteredTimePeriodInHours * 0.001, + }, + }), + ); + }); } } - if (smallHackAsEvenAfterReturnReservationGettingCreatedWillUseBoolean === false) { - let deviceGroup: NewDeviceGroupDTO = this.createDeviceGroupFromDevices(devices, group.name); + if ( + smallHackAsEvenAfterReturnReservationGettingCreatedWillUseBoolean === + false + ) { + let deviceGroup: NewDeviceGroupDTO = this.createDeviceGroupFromDevices( + devices, + group.name, + ); deviceGroup['reservationStartDate'] = group.reservationStartDate; deviceGroup['reservationEndDate'] = group.reservationEndDate; deviceGroup['authorityToExceed'] = group.authorityToExceed; - deviceGroup['targetVolumeInMegaWattHour'] = group.targetCapacityInMegaWattHour; + deviceGroup['targetVolumeInMegaWattHour'] = + group.targetCapacityInMegaWattHour; deviceGroup['targetVolumeCertificateGenerationFailedInMegaWattHour'] = 0; - deviceGroup['targetVolumeCertificateGenerationSucceededInMegaWattHour'] = 0; - deviceGroup['targetVolumeCertificateGenerationRequestedInMegaWattHour'] = 0; - deviceGroup['targetVolumeCertificateGenerationRequestedInMegaWattHour'] = 0; + deviceGroup['targetVolumeCertificateGenerationSucceededInMegaWattHour'] = + 0; + deviceGroup['targetVolumeCertificateGenerationRequestedInMegaWattHour'] = + 0; + deviceGroup['targetVolumeCertificateGenerationRequestedInMegaWattHour'] = + 0; deviceGroup['frequency'] = group.frequency; deviceGroup['deviceIdsInt'] = group.deviceIds; - deviceGroup['reservationActive'] = true + deviceGroup['reservationActive'] = true; if (buyerId && buyerAddress) { deviceGroup['buyerId'] = buyerId; deviceGroup['buyerAddress'] = buyerAddress; @@ -945,20 +1242,23 @@ export class DeviceGroupService { deviceGroup['api_user_id'] = group.api_user_id; } if (group.reservationExpiryDate) { - deviceGroup['reservationExpiryDate'] = group.reservationExpiryDate; } let responseDeviceGroupDTO: ResponseDeviceGroupDTO = await this.create( organizationId, deviceGroup, ); - responseDeviceGroupDTO.unavailableDeviceIDsDueToAreIncludedInBuyerReservation = unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.length > 0 ? unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.join(' , ') : ''; - delete responseDeviceGroupDTO["deviceIdsInt"]; + responseDeviceGroupDTO.unavailableDeviceIDsDueToAreIncludedInBuyerReservation = + unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.length > 0 + ? unavailableDeviceIdsDueToAlreadyIncludedInBuyerReservation.join( + ' , ', + ) + : ''; + delete responseDeviceGroupDTO['deviceIdsInt']; return responseDeviceGroupDTO; } } - async update( id: number, User: ILoggedInUser, @@ -987,14 +1287,18 @@ export class DeviceGroupService { organizationId: number, targetVolumeCertificateGenerationRequestedInMegaWattHour: number, ) { - this.logger.verbose(`With in updateTotalReadingRequestedForCertificateIssuance`); + this.logger.verbose( + `With in updateTotalReadingRequestedForCertificateIssuance`, + ); const deviceGroup = await this.findDeviceGroupById(groupId, organizationId); //console.log(deviceGroup); //@ts-ignore //console.log("updatetargetmwh") //console.log(deviceGroup.targetVolumeCertificateGenerationRequestedInMegaWattHour); //console.log(targetVolumeCertificateGenerationRequestedInMegaWattHour); - deviceGroup.targetVolumeCertificateGenerationRequestedInMegaWattHour = deviceGroup.targetVolumeCertificateGenerationRequestedInMegaWattHour + targetVolumeCertificateGenerationRequestedInMegaWattHour; + deviceGroup.targetVolumeCertificateGenerationRequestedInMegaWattHour = + deviceGroup.targetVolumeCertificateGenerationRequestedInMegaWattHour + + targetVolumeCertificateGenerationRequestedInMegaWattHour; //console.log("afterupdatetargetmwh") //console.log(deviceGroup.targetVolumeCertificateGenerationRequestedInMegaWattHour); const updatedGroup = await this.repository.save(deviceGroup); @@ -1016,18 +1320,26 @@ export class DeviceGroupService { async updateLeftOverReadByCountryCode( id: number, leftOverRead: number, - countryCodeKey: string + countryCodeKey: string, ): Promise { this.logger.verbose(`With in updateLeftOverReadByCountryCode`); const deviceGroup = await this.findById(id); - if (deviceGroup.leftoverReadsByCountryCode === null || deviceGroup.leftoverReadsByCountryCode === undefined || deviceGroup.leftoverReadsByCountryCode === '') { + if ( + deviceGroup.leftoverReadsByCountryCode === null || + deviceGroup.leftoverReadsByCountryCode === undefined || + deviceGroup.leftoverReadsByCountryCode === '' + ) { deviceGroup.leftoverReadsByCountryCode = {}; } if (typeof deviceGroup.leftoverReadsByCountryCode === 'string') { - deviceGroup.leftoverReadsByCountryCode = JSON.parse(deviceGroup.leftoverReadsByCountryCode); + deviceGroup.leftoverReadsByCountryCode = JSON.parse( + deviceGroup.leftoverReadsByCountryCode, + ); } deviceGroup.leftoverReadsByCountryCode[countryCodeKey] = leftOverRead; - deviceGroup.leftoverReadsByCountryCode = JSON.stringify(deviceGroup.leftoverReadsByCountryCode); + deviceGroup.leftoverReadsByCountryCode = JSON.stringify( + deviceGroup.leftoverReadsByCountryCode, + ); const updatedGroup = await this.repository.save(deviceGroup); return updatedGroup; } @@ -1050,7 +1362,7 @@ export class DeviceGroupService { public async checkIfDeviceExisting( newDevices: NewDeviceDTO[], - organizationId: number + organizationId: number, ): Promise> { this.logger.verbose(`With in checkIfDeviceExisting`); const allExternalIds: Array = []; @@ -1061,12 +1373,14 @@ export class DeviceGroupService { const existingDevices = await this.deviceService.findMultipleDevicesBasedExternalId( allExternalIds, - organizationId + organizationId, ); //////console.log("existingDevices",existingDevices); if (existingDevices && existingDevices.length > 0) { //@ts-ignore - existingDevices.forEach((ele) => existingDeviceIds.push(ele?.developerExternalId)); + existingDevices.forEach((ele) => + existingDeviceIds.push(ele?.developerExternalId), + ); } return existingDeviceIds; } @@ -1087,9 +1401,13 @@ export class DeviceGroupService { try { if (api_user_id == null) { return await this.deviceService.register(orgCode, device); - } - else { - return await this.deviceService.register(orgCode, device, api_user_id, Role.ApiUser); + } else { + return await this.deviceService.register( + orgCode, + device, + api_user_id, + Role.ApiUser, + ); } } catch (e) { //console.log(e); @@ -1137,7 +1455,9 @@ export class DeviceGroupService { organizationId, }); if (!deviceGroup) { - this.logger.error(`No device group found with id ${id} and organization ${organizationId}`); + this.logger.error( + `No device group found with id ${id} and organization ${organizationId}`, + ); throw new NotFoundException( `No device group found with id ${id} and organization ${organizationId}`, ); @@ -1199,14 +1519,25 @@ export class DeviceGroupService { ); const fuelCode = Array.from( - new Set(devices.map((device: DeviceDTO) => device.fuelCode ? device.fuelCode.trim() : '' - )), + new Set( + devices.map((device: DeviceDTO) => + device.fuelCode ? device.fuelCode.trim() : '', + ), + ), ); const countryCode = Array.from( - new Set(devices.map((device: DeviceDTO) => device.countryCode ? device.countryCode.trim() : '')), + new Set( + devices.map((device: DeviceDTO) => + device.countryCode ? device.countryCode.trim() : '', + ), + ), ); const deviceTypeCodes = Array.from( - new Set(devices.map((device: DeviceDTO) => device.deviceTypeCode ? device.deviceTypeCode.trim() : '')), + new Set( + devices.map((device: DeviceDTO) => + device.deviceTypeCode ? device.deviceTypeCode.trim() : '', + ), + ), ); const offTakers = Array.from( new Set(devices.map((device: DeviceDTO) => device.offTaker)), @@ -1218,12 +1549,12 @@ export class DeviceGroupService { const deviceGroup: NewDeviceGroupDTO = { name: groupName, deviceIds: devices.map((device: DeviceDTO) => device.id), - fuelCode: fuelCode,//[devices.map((device: DeviceDTO) => device.fuelCode ? device.fuelCode : '').join(' , ')], - countryCode: countryCode,// [devices.map((device: DeviceDTO) => device.countryCode ? device.countryCode : '').join(' , ')], + fuelCode: fuelCode, //[devices.map((device: DeviceDTO) => device.fuelCode ? device.fuelCode : '').join(' , ')], + countryCode: countryCode, // [devices.map((device: DeviceDTO) => device.countryCode ? device.countryCode : '').join(' , ')], //standardCompliance: devices[0].standardCompliance, deviceTypeCodes: deviceTypeCodes, //@ts-ignore - offTakers: offTakers,//[devices.map((device: DeviceDTO) => device.offTaker ? device.offTaker : '').join(' , ')], + offTakers: offTakers, //[devices.map((device: DeviceDTO) => device.offTaker ? device.offTaker : '').join(' , ')], //installationConfigurations: [devices[0].installationConfiguration], //sectors, gridInterconnection, @@ -1240,7 +1571,7 @@ export class DeviceGroupService { private getreservationFilteredQuery( buyerId: number, - filter?: UnreservedDeviceGroupsFilterDTO + filter?: UnreservedDeviceGroupsFilterDTO, ): FindManyOptions { this.logger.verbose(`With in getreservationFilteredQuery`); const where: FindConditions = cleanDeep({ @@ -1336,7 +1667,9 @@ export class DeviceGroupService { }); data.id = filesAddedForProcessing.userId; data.organizationId = filesAddedForProcessing.organizationId; - const response = await this.fileService.GetuploadS3(filesAddedForProcessing.fileId); + const response = await this.fileService.GetuploadS3( + filesAddedForProcessing.fileId, + ); // const response = await this.fileService.get( // filesAddedForProcessing.fileId, @@ -1554,292 +1887,416 @@ export class DeviceGroupService { this.logger.verbose(`With in processCsvFileAnotherLibrary`); this.logger.debug(file.data.Body.toString('utf-8')); const records: Array = []; - const recordsErrors: Array<{ externalId: string; rowNumber: number; isError: boolean; errorsList: Array }> = - []; + const recordsErrors: Array<{ + externalId: string; + rowNumber: number; + isError: boolean; + errorsList: Array; + }> = []; let rowsConvertedToCsvCount = 0; //https://stackoverflow.com/questions/13230487/converting-a-buffer-into-a-readablestream-in-node-js/44091532#44091532 const readableStream = new Readable(); - readableStream._read = () => { }; // _read is required but you can noop it + readableStream._read = () => {}; // _read is required but you can noop it readableStream .pipe(this.csvParser) - .on('data', async (data) => { - - }) - .on('end', async () => { - - - }); - this.logger.debug("file?.data.toString()", file?.data.toString()); - const filedata = file.data.Body.toString('utf-8') + .on('data', async (data) => {}) + .on('end', async () => {}); + this.logger.debug('file?.data.toString()', file?.data.toString()); + const filedata = file.data.Body.toString('utf-8'); this.csvStringToJSON(filedata); - csvtojsonV2().fromString(filedata).subscribe(async (data: any, lineNumber: any) => { - ////console.log("csvLine",data,"sdsds",lineNumber); - rowsConvertedToCsvCount++; - data.images = []; - data.groupId = null; - const dataToStore = new NewDeviceDTO(); - dataToStore.SDGBenefits = []; - dataToStore.version = '1.0'; - - const dataKeyForValidation: NewDeviceDTO = { - externalId: '', - projectName: '', - address: '', - latitude: '', - longitude: '', - countryCode: '', - fuelCode: FuelCode.ES100, - deviceTypeCode: DevicetypeCode.TC150, - capacity: 0, - commissioningDate: '', - gridInterconnection: false, - offTaker: OffTaker.Commercial, - //yieldValue: 0, - //labels: '', - impactStory: '', - // data: '', - images: [], - deviceDescription: DeviceDescription.GroundmountSolar, - energyStorage: true, - energyStorageCapacity: 0, - qualityLabels: '', - SDGBenefits: [], - version: "1.0", - //groupId: 0, - }; - for (const key in dataKeyForValidation) { - if (key === "SDGBenefits" || key === "version") { - continue; - } - //@ts-ignore - if (typeof dataKeyForValidation[key] === 'string') { - //@ts-ignore - dataToStore[key] = data[key]; - } - //@ts-ignore - else if (typeof dataKeyForValidation[key] === 'boolean') { - //@ts-ignore - dataToStore[key] = - data[key].toLowerCase() === 'true' ? true : false; - } - //@ts-ignore - else if (typeof dataKeyForValidation[key] === 'number') { - //@ts-ignore - dataToStore[key] = - Number.isNaN(data[key]) ? 0 : parseFloat(data[key]); - //@ts-ignore - if (key == 'yieldValue' && dataToStore[key] === 0) { - // dataToStore[key] = 1500; - dataToStore[key] = 2000; - } - - if (key === "SdgBenefits") { - ////console.log("data[key]",data[key]); - ////console.log("dataToStore[key]",dataToStore[key]); - } - } - if (key == 'yieldValue' && data.countryCode) { - let yieldByCountryCode = await this.yieldConfigService.findByCountryCode(data.countryCode); - if (yieldByCountryCode) { - //@ts-ignore - dataToStore.yieldValue = yieldByCountryCode.yieldValue; - } - } - } - for (let key in dataToStore) { - //@ts-ignore - dataToStore[key] === '' ? dataToStore[key] = null : ''; - } - - // console.log("records", JSON.stringify(records)); - - records.push(dataToStore); - recordsErrors.push({ externalId: '', rowNumber: rowsConvertedToCsvCount, isError: false, errorsList: [] }); - - // csvLine => "1,2,3" and "4,5,6" - }).on('done', async (error: any) => { - - for (let index = 0; index < records.length; index++) { - let singleRecord = records[index]; - if (records[index].externalId) { - records[index].externalId = records[index].externalId.trim(); - } - const errors = await validate(singleRecord); - if (errors.length > 0) { - - errors.forEach(ele => { - delete ele.target; - delete ele.children; - }) - recordsErrors[index] = { externalId: records[index].externalId, rowNumber: index, isError: true, errorsList: errors }; - } else { - recordsErrors[index] = { externalId: records[index].externalId, rowNumber: index, isError: false, errorsList: errors }; - } - // if (singleRecord.externalId != undefined || singleRecord.externalId != null) { - // const Regex = /^[a-zA-Z\d\-_\s]+$/; + csvtojsonV2() + .fromString(filedata) + .subscribe(async (data: any, lineNumber: any) => { + ////console.log("csvLine",data,"sdsds",lineNumber); + rowsConvertedToCsvCount++; + data.images = []; + data.groupId = null; + const dataToStore = new NewDeviceDTO(); + dataToStore.SDGBenefits = []; + dataToStore.version = '1.0'; - // if(!Regex.test(singleRecord.externalId)){ - // recordsErrors[index].isError = true; - // recordsErrors[index].errorsList.push({ value: singleRecord.externalId, property: "externalId", constraints: { invalidExternalId: "external id can contain only alphabets( lower and upper case included), numeric(0 to 9), hyphen(-), underscore(_) and spaces in between" } }) + const dataKeyForValidation: NewDeviceDTO = { + externalId: '', + projectName: '', + address: '', + latitude: '', + longitude: '', + countryCode: '', + fuelCode: FuelCode.ES100, + deviceTypeCode: DevicetypeCode.TC150, + capacity: 0, + commissioningDate: '', + gridInterconnection: false, + offTaker: OffTaker.Commercial, + //yieldValue: 0, + //labels: '', + impactStory: '', + // data: '', + images: [], + deviceDescription: DeviceDescription.GroundmountSolar, + energyStorage: true, + energyStorageCapacity: 0, + qualityLabels: '', + SDGBenefits: [], + version: '1.0', + //groupId: 0, + }; + for (const key in dataKeyForValidation) { + if (key === 'SDGBenefits' || key === 'version') { + continue; + } + //@ts-ignore + if (typeof dataKeyForValidation[key] === 'string') { + //@ts-ignore + dataToStore[key] = data[key]; + } + //@ts-ignore + else if (typeof dataKeyForValidation[key] === 'boolean') { + //@ts-ignore + dataToStore[key] = + data[key].toLowerCase() === 'true' ? true : false; + } + //@ts-ignore + else if (typeof dataKeyForValidation[key] === 'number') { + //@ts-ignore + dataToStore[key] = Number.isNaN(data[key]) + ? 0 + : parseFloat(data[key]); + //@ts-ignore + if (key == 'yieldValue' && dataToStore[key] === 0) { + // dataToStore[key] = 1500; + dataToStore[key] = 2000; + } - // } + if (key === 'SdgBenefits') { + ////console.log("data[key]",data[key]); + ////console.log("dataToStore[key]",dataToStore[key]); + } + } + if (key == 'yieldValue' && data.countryCode) { + let yieldByCountryCode = + await this.yieldConfigService.findByCountryCode(data.countryCode); + if (yieldByCountryCode) { + //@ts-ignore + dataToStore.yieldValue = yieldByCountryCode.yieldValue; + } + } + } + for (let key in dataToStore) { + //@ts-ignore + dataToStore[key] === '' ? (dataToStore[key] = null) : ''; + } + + // console.log("records", JSON.stringify(records)); + + records.push(dataToStore); + recordsErrors.push({ + externalId: '', + rowNumber: rowsConvertedToCsvCount, + isError: false, + errorsList: [], + }); + + // csvLine => "1,2,3" and "4,5,6" + }) + .on('done', async (error: any) => { + for (let index = 0; index < records.length; index++) { + let singleRecord = records[index]; + if (records[index].externalId) { + records[index].externalId = records[index].externalId.trim(); + } + const errors = await validate(singleRecord); + if (errors.length > 0) { + errors.forEach((ele) => { + delete ele.target; + delete ele.children; + }); + recordsErrors[index] = { + externalId: records[index].externalId, + rowNumber: index, + isError: true, + errorsList: errors, + }; + } else { + recordsErrors[index] = { + externalId: records[index].externalId, + rowNumber: index, + isError: false, + errorsList: errors, + }; + } + // if (singleRecord.externalId != undefined || singleRecord.externalId != null) { + // const Regex = /^[a-zA-Z\d\-_\s]+$/; - // } - if (singleRecord.countryCode != undefined) { + // if(!Regex.test(singleRecord.externalId)){ + // recordsErrors[index].isError = true; + // recordsErrors[index].errorsList.push({ value: singleRecord.externalId, property: "externalId", constraints: { invalidExternalId: "external id can contain only alphabets( lower and upper case included), numeric(0 to 9), hyphen(-), underscore(_) and spaces in between" } }) - singleRecord.countryCode = singleRecord.countryCode.toUpperCase(); - if (singleRecord.countryCode && typeof singleRecord.countryCode === "string" && singleRecord.countryCode.length === 3) { + // } - if (countryCodesList.find(ele => ele.countryCode === singleRecord.countryCode) === undefined) { + // } + if (singleRecord.countryCode != undefined) { + singleRecord.countryCode = singleRecord.countryCode.toUpperCase(); + if ( + singleRecord.countryCode && + typeof singleRecord.countryCode === 'string' && + singleRecord.countryCode.length === 3 + ) { + if ( + countryCodesList.find( + (ele) => ele.countryCode === singleRecord.countryCode, + ) === undefined + ) { + recordsErrors[index].isError = true; + recordsErrors[index].errorsList.push({ + value: singleRecord.countryCode, + property: 'countryCode', + constraints: { invalidCountryCode: 'Invalid countryCode' }, + }); + } + } else { recordsErrors[index].isError = true; - recordsErrors[index].errorsList.push({ value: singleRecord.countryCode, property: "countryCode", constraints: { invalidCountryCode: "Invalid countryCode" } }) + recordsErrors[index].errorsList.push({ + value: singleRecord.countryCode, + property: 'countryCode', + constraints: { invalidCountryCode: 'Invalid countryCode' }, + }); } } else { recordsErrors[index].isError = true; - recordsErrors[index].errorsList.push({ value: singleRecord.countryCode, property: "countryCode", constraints: { invalidCountryCode: "Invalid countryCode" } }) + recordsErrors[index].errorsList.push({ + value: singleRecord.countryCode, + property: 'countryCode', + constraints: { invalidCountryCode: 'Invalid countryCode' }, + }); } - } else { - recordsErrors[index].isError = true; - recordsErrors[index].errorsList.push({ value: singleRecord.countryCode, property: "countryCode", constraints: { invalidCountryCode: "Invalid countryCode" } }) - } - if (singleRecord.commissioningDate && typeof singleRecord.commissioningDate === "string") { - - this.logger.debug(!isValidUTCDateFormat(singleRecord.commissioningDate)); - if (!isValidUTCDateFormat(singleRecord.commissioningDate)) { - const hasValidSeconds = moment(singleRecord.commissioningDate).seconds() < 60; - const hasValidMinutes = moment(singleRecord.commissioningDate).minutes() < 60; - recordsErrors[index].isError = true; - if (!hasValidMinutes) { - recordsErrors[index].errorsList.push({ value: singleRecord.commissioningDate, property: "commissioningDate", constraints: { invalidDate: "Invalid minutes value." } }) + if ( + singleRecord.commissioningDate && + typeof singleRecord.commissioningDate === 'string' + ) { + this.logger.debug( + !isValidUTCDateFormat(singleRecord.commissioningDate), + ); + if (!isValidUTCDateFormat(singleRecord.commissioningDate)) { + const hasValidSeconds = + moment(singleRecord.commissioningDate).seconds() < 60; + const hasValidMinutes = + moment(singleRecord.commissioningDate).minutes() < 60; + recordsErrors[index].isError = true; + if (!hasValidMinutes) { + recordsErrors[index].errorsList.push({ + value: singleRecord.commissioningDate, + property: 'commissioningDate', + constraints: { invalidDate: 'Invalid minutes value.' }, + }); + } else if (!hasValidSeconds) { + recordsErrors[index].errorsList.push({ + value: singleRecord.commissioningDate, + property: 'commissioningDate', + constraints: { invalidDate: 'Invalid seconds value.' }, + }); + } + recordsErrors[index].errorsList.push({ + value: singleRecord.commissioningDate, + property: 'commissioningDate', + constraints: { + invalidDate: + 'Invalid commission date sent.Format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z', + }, + }); } - else if (!hasValidSeconds) { - recordsErrors[index].errorsList.push({ value: singleRecord.commissioningDate, property: "commissioningDate", constraints: { invalidDate: "Invalid seconds value." } }) + if ( + new Date(singleRecord.commissioningDate).getTime() > + new Date().getTime() + ) { + recordsErrors[index].isError = true; + recordsErrors[index].errorsList.push({ + value: singleRecord.commissioningDate, + property: 'commissioningDate', + constraints: { + invalidDate: + 'Invalid commissioning date, commissioning is greater than current date', + }, + }); } - recordsErrors[index].errorsList.push({ value: singleRecord.commissioningDate, property: "commissioningDate", constraints: { invalidDate: "Invalid commission date sent.Format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z" } }) } - if (new Date(singleRecord.commissioningDate).getTime() > new Date().getTime()) { + if (singleRecord.capacity <= 0) { recordsErrors[index].isError = true; - recordsErrors[index].errorsList.push({ value: singleRecord.commissioningDate, property: "commissioningDate", constraints: { invalidDate: "Invalid commissioning date, commissioning is greater than current date" } }) + recordsErrors[index].errorsList.push({ + value: singleRecord.capacity, + property: 'capacity', + constraints: { + greaterThanZero: 'Capacity should be greater than 0', + }, + }); + } + if (singleRecord.energyStorageCapacity < 0) { + recordsErrors[index].isError = true; + recordsErrors[index].errorsList.push({ + value: singleRecord.energyStorageCapacity, + property: 'energyStorageCapacity', + constraints: { + greaterThanZero: + 'Energy Storage Capacity should be greater than 0', + }, + }); } } - if (singleRecord.capacity <= 0) { - recordsErrors[index].isError = true; - recordsErrors[index].errorsList.push({ value: singleRecord.capacity, property: "capacity", constraints: { greaterThanZero: "Capacity should be greater than 0" } }) - } - if (singleRecord.energyStorageCapacity < 0) { - recordsErrors[index].isError = true; - recordsErrors[index].errorsList.push({ value: singleRecord.energyStorageCapacity, property: "energyStorageCapacity", constraints: { greaterThanZero: "Energy Storage Capacity should be greater than 0" } }) - } - } - - records.forEach((singleRecord, index) => { - recordsErrors[index].errorsList.forEach(error => { - singleRecord[error.property] = null;//making null field if it has any validation issue - }) - }); - - const noErrorRecords = records.filter( - (record, index) => recordsErrors[index].isError === false, - ); - const listofExistingDevices = await this.checkIfDeviceExisting(records, organizationId); - if (listofExistingDevices.length > 0) { records.forEach((singleRecord, index) => { - if (listofExistingDevices.find( - (ele) => ele === singleRecord.externalId, - )) { - recordsErrors[index].isError = true; - recordsErrors[index].errorsList.push( - { value: singleRecord.externalId, property: "externalId", constraints: { externalIdExists: "ExternalId already exist, cant add entry with same external id" } } - ); - } + recordsErrors[index].errorsList.forEach((error) => { + singleRecord[error.property] = null; //making null field if it has any validation issue + }); }); - } - var recordsCopy = cloneDeep(records); - recordsCopy.forEach(ele => ele['statusDuplicate'] = false) - const duplicatesExternalId: any = []; - for (let i = 0; i < recordsCopy.length - 1; i++) { - this.logger.debug(recordsCopy[i].externalId); - for (let j = i + 1; j < recordsCopy.length; j++) { - this.logger.debug(recordsCopy[j].externalId); - if (recordsCopy[i].externalId != null && recordsCopy[j].externalId != null) { - if (recordsCopy[i].externalId.toLowerCase() === recordsCopy[j].externalId.toLowerCase() && recordsCopy[j]['statusDuplicate'] === false) { - recordsCopy[j]['statusDuplicate'] = true; - duplicatesExternalId.push({ - duplicateIndex: j, - duplicateWith: i, - projectName: records[j].projectName, - externalId: records[j].externalId + + const noErrorRecords = records.filter( + (record, index) => recordsErrors[index].isError === false, + ); + const listofExistingDevices = await this.checkIfDeviceExisting( + records, + organizationId, + ); + + if (listofExistingDevices.length > 0) { + records.forEach((singleRecord, index) => { + if ( + listofExistingDevices.find( + (ele) => ele === singleRecord.externalId, + ) + ) { + recordsErrors[index].isError = true; + recordsErrors[index].errorsList.push({ + value: singleRecord.externalId, + property: 'externalId', + constraints: { + externalIdExists: + 'ExternalId already exist, cant add entry with same external id', + }, }); - recordsErrors[j].isError = true; - recordsErrors[j].errorsList.push( - { value: recordsCopy[j].externalId, property: "externalId", constraints: { externalIdExists: "Row " + (j + 1) + " Duplicate with row " + (i + 1) + " Exists with externalId " + records[j].externalId } } - ); } - } - + }); } - } - - let successfullyAddedRowsAndExternalIds: Array<{ rowNumber: number, externalId: string }> = []; - //noErrorRecords= records.filter((record,index)=> recordsErrors[index].isError === false); - let recordsToRegister = records.filter((ele, index) => { - if (recordsErrors[index].errorsList.length > 0) { - //these are required fields and if one is having error we cannot try to insert the record - if (recordsErrors[index].errorsList.find(errorRec => errorRec.property === "externalId" || errorRec.property === "commissioningDate" || errorRec.property === "capacity" || errorRec.property === "countryCode")) { - return false; - } - else { - return true; + var recordsCopy = cloneDeep(records); + recordsCopy.forEach((ele) => (ele['statusDuplicate'] = false)); + const duplicatesExternalId: any = []; + for (let i = 0; i < recordsCopy.length - 1; i++) { + this.logger.debug(recordsCopy[i].externalId); + for (let j = i + 1; j < recordsCopy.length; j++) { + this.logger.debug(recordsCopy[j].externalId); + if ( + recordsCopy[i].externalId != null && + recordsCopy[j].externalId != null + ) { + if ( + recordsCopy[i].externalId.toLowerCase() === + recordsCopy[j].externalId.toLowerCase() && + recordsCopy[j]['statusDuplicate'] === false + ) { + recordsCopy[j]['statusDuplicate'] = true; + duplicatesExternalId.push({ + duplicateIndex: j, + duplicateWith: i, + projectName: records[j].projectName, + externalId: records[j].externalId, + }); + recordsErrors[j].isError = true; + recordsErrors[j].errorsList.push({ + value: recordsCopy[j].externalId, + property: 'externalId', + constraints: { + externalIdExists: + 'Row ' + + (j + 1) + + ' Duplicate with row ' + + (i + 1) + + ' Exists with externalId ' + + records[j].externalId, + }, + }); + } + } } } - else - return true; - }) - - const devicesRegistered = await this.registerCSVBulkDevices( - organizationId, - recordsToRegister, - filesAddedForProcessing.api_user_id, - ); - //@ts-ignore - devicesRegistered.filter(ele => ele.isError === undefined).forEach(ele => { + let successfullyAddedRowsAndExternalIds: Array<{ + rowNumber: number; + externalId: string; + }> = []; + //noErrorRecords= records.filter((record,index)=> recordsErrors[index].isError === false); + let recordsToRegister = records.filter((ele, index) => { + if (recordsErrors[index].errorsList.length > 0) { + //these are required fields and if one is having error we cannot try to insert the record + if ( + recordsErrors[index].errorsList.find( + (errorRec) => + errorRec.property === 'externalId' || + errorRec.property === 'commissioningDate' || + errorRec.property === 'capacity' || + errorRec.property === 'countryCode', + ) + ) { + return false; + } else { + return true; + } + } else return true; + }); + const devicesRegistered = await this.registerCSVBulkDevices( + organizationId, + recordsToRegister, + filesAddedForProcessing.api_user_id, + ); //@ts-ignore - successfullyAddedRowsAndExternalIds.push({ externalId: ele.externalId, rowNumber: records.findIndex(recEle => recEle.developerExternalId === ele.externalId) }); - }) - recordsErrors.forEach((ele, index) => { - if (ele.isError === false) { ele["status"] = 'Success'; } + devicesRegistered + .filter((ele) => ele.isError === undefined) + .forEach((ele) => { + //@ts-ignore + successfullyAddedRowsAndExternalIds.push({ + externalId: ele.externalId, + rowNumber: records.findIndex( + (recEle) => recEle.developerExternalId === ele.externalId, + ), + }); + }); - else if (ele.isError === true && successfullyAddedRowsAndExternalIds.find(successEle => (successEle.externalId === ele.externalId && successEle.rowNumber === index))) { - ele['status'] = 'Success with validation errors, please update fields'; - } - else { - ele['status'] = 'Failed'; - } + recordsErrors.forEach((ele, index) => { + if (ele.isError === false) { + ele['status'] = 'Success'; + } else if ( + ele.isError === true && + successfullyAddedRowsAndExternalIds.find( + (successEle) => + successEle.externalId === ele.externalId && + successEle.rowNumber === index, + ) + ) { + ele['status'] = + 'Success with validation errors, please update fields'; + } else { + ele['status'] = 'Failed'; + } + }); + //console.log(recordsErrors); + this.createFailedRowDetailsForCSVJob( + filesAddedForProcessing.jobId, + recordsErrors, + successfullyAddedRowsAndExternalIds, + ); + this.updateJobStatus( + filesAddedForProcessing.jobId, + StatusCSV.Completed, + ); }); - //console.log(recordsErrors); - this.createFailedRowDetailsForCSVJob( - filesAddedForProcessing.jobId, - recordsErrors, - successfullyAddedRowsAndExternalIds - ); - this.updateJobStatus( - filesAddedForProcessing.jobId, - StatusCSV.Completed, - ); - }) - } csvStringToJSON(csvFileContentInString: string) { this.logger.verbose(`With in csvStringToJSON`); // Convert the data to String and // split it in an array - var array = csvFileContentInString.split("\r"); + var array = csvFileContentInString.split('\r'); // All the rows of the CSV will be // converted to JSON objects which @@ -1849,12 +2306,12 @@ export class DeviceGroupService { // The array[0] contains all the // header columns so we store them // in headers array - let headers = array[0].split(", ") + let headers = array[0].split(', '); // Since headers are separated, we // need to traverse remaining n-1 rows. for (let i = 1; i < array.length - 1; i++) { - let obj = {} + let obj = {}; // Create an empty object to later add // values of the current row to it @@ -1862,8 +2319,8 @@ export class DeviceGroupService { // value to change the delimiter and // store the generated string in a new // string s - let str = array[i] - let s = '' + let str = array[i]; + let s = ''; // By Default, we get the comma separated // values of a cell in quotes " " so we @@ -1874,31 +2331,30 @@ export class DeviceGroupService { // we replace them with pipe | // We keep adding the characters we // traverse to a String s - let flag = 0 + let flag = 0; for (let ch of str) { if (ch === '"' && flag === 0) { - flag = 1 - } - else if (ch === '"' && flag == 1) flag = 0 - if (ch === ', ' && flag === 0) ch = '|' - if (ch !== '"') s += ch + flag = 1; + } else if (ch === '"' && flag == 1) flag = 0; + if (ch === ', ' && flag === 0) ch = '|'; + if (ch !== '"') s += ch; } // Split the string using pipe delimiter | // and store the values in a properties array - let properties = s.split("|") + let properties = s.split('|'); // For each header, if the value contains // multiple comma separated data, then we // store it in the form of array otherwise // directly the value is stored for (let j in headers) { - if (properties[j].includes(", ")) { + if (properties[j].includes(', ')) { //@ts-ignore obj[headers[j]] = properties[j] - .split(", ").map(item => item.trim()) - } - else { + .split(', ') + .map((item) => item.trim()); + } else { //@ts-ignore obj[headers[j]] = properties[j]; } @@ -1906,7 +2362,7 @@ export class DeviceGroupService { // Add the generated object to our // result array - result.push(obj) + result.push(obj); } //////console.log(result); @@ -1922,35 +2378,36 @@ export class DeviceGroupService { // }); // } - - async checkIfOrganizationHasBlockhainAddressAdded(organizationId: number): Promise { + async checkIfOrganizationHasBlockhainAddressAdded( + organizationId: number, + ): Promise { this.logger.verbose(`With in checkIfOrganizationHasBlockhainAddressAdded`); - const organization = await this.organizationService.findOne( - organizationId, - ); + const organization = await this.organizationService.findOne(organizationId); if (organization.blockchainAccountAddress) { return true; - } - else { + } else { return false; } - } async getGroupiCertificateIssueDate( conditions: FindConditions, ): Promise { - this.logger.verbose(`With in getGroupiCertificateIssueDate`) - this.logger.log("Line No: 1883"); - return (await this.repositorynextDeviceGroupcertificate.findOne(conditions)) ?? null; + this.logger.verbose(`With in getGroupiCertificateIssueDate`); + this.logger.log('Line No: 1883'); + return ( + (await this.repositorynextDeviceGroupcertificate.findOne(conditions)) ?? + null + ); } - async getAllNextrequestCertificate( - ): Promise { + async getAllNextrequestCertificate(): Promise< + DeviceGroupNextIssueCertificate[] + > { this.logger.verbose(`With in getAllNextrequestCertificate`); const groupId = await this.repositorynextDeviceGroupcertificate.find({ where: { end_date: LessThan(new Date()) }, }); ////console.log(groupId) - return groupId + return groupId; } async updatecertificateissuedate( @@ -1960,15 +2417,15 @@ export class DeviceGroupService { ): Promise { this.logger.verbose(`With in updatecertificateissuenextdate`); // await this.checkNameConflict(data.name); - const deviceGroupdate = await this.getGroupiCertificateIssueDate({ id: id }); + const deviceGroupdate = await this.getGroupiCertificateIssueDate({ + id: id, + }); let updatedissuedate = new DeviceGroupNextIssueCertificate(); if (deviceGroupdate) { - deviceGroupdate.start_date = startdate; deviceGroupdate.end_date = enddate; - updatedissuedate = await this.repositorynextDeviceGroupcertificate.save(deviceGroupdate); - - + updatedissuedate = + await this.repositorynextDeviceGroupcertificate.save(deviceGroupdate); } return updatedissuedate; } @@ -1981,40 +2438,42 @@ export class DeviceGroupService { deviceGroupIssueNextDateDTO?: DeviceGroupNextIssueCertificate, ): Promise { this.logger.verbose(`With in EndReservationGroup`); - if (!group) - group = await this.findDeviceGroupById(groupId, organizationId); + if (!group) group = await this.findDeviceGroupById(groupId, organizationId); //@ts-ignore ////console.log("new Date(group?.reservationEndDate).getTime() === new Date(reservationend).getTime()", "group?.reservationEndDate", group?.reservationEndDate, "reservationend", reservationend, "new Date(group?.reservationEndDate).getTime()", new Date(group?.reservationEndDate).getTime(), "new Date(reservationend).getTime()", new Date(reservationend).getTime(), new Date(group?.reservationEndDate).getTime() === new Date(reservationend).getTime()); //@ts-ignore - if (new Date(group?.reservationEndDate).getTime() === new Date(reservationend.endresavationdate).getTime()) { + if ( + new Date(group?.reservationEndDate).getTime() === + new Date(reservationend.endresavationdate).getTime() + ) { ////console.log("came inside ending reservation"); if (!deviceGroupIssueNextDateDTO) - deviceGroupIssueNextDateDTO = await this.getGroupiCertificateIssueDate({ groupId: groupId }); + deviceGroupIssueNextDateDTO = await this.getGroupiCertificateIssueDate({ + groupId: groupId, + }); //@ts-ignore - this.endReservation(groupId, group, deviceGroupIssueNextDateDTO) + this.endReservation(groupId, group, deviceGroupIssueNextDateDTO); return; } - } - async endReservation( groupId: number, group: DeviceGroup, - deviceGroupIssueNextDateDTO: DeviceGroupNextIssueCertificate + deviceGroupIssueNextDateDTO: DeviceGroupNextIssueCertificate, ): Promise { this.logger.verbose(`With in endReservation`); let updatedissuedatestatus = new DeviceGroup(); if (group) { - - group.reservationActive = false + group.reservationActive = false; updatedissuedatestatus = await this.repository.save(group); - } - await this.repositorynextDeviceGroupcertificate.delete(deviceGroupIssueNextDateDTO.id); + await this.repositorynextDeviceGroupcertificate.delete( + deviceGroupIssueNextDateDTO.id, + ); let devices = await this.deviceService.findForGroup(groupId); if (!devices?.length) { @@ -2034,11 +2493,10 @@ export class DeviceGroupService { //console.log(group); let updatedissuedatestatus = new DeviceGroup(); if (group) { - group.reservationActive = false + group.reservationActive = false; updatedissuedatestatus = await this.repository.save(group); return; } - } public async getDeviceGrouplog( @@ -2052,28 +2510,29 @@ export class DeviceGroupService { }); } - public async AddCertificateIssueDateLogForDeviceGroup(params: CheckCertificateIssueDateLogForDeviceGroupEntity + public async AddCertificateIssueDateLogForDeviceGroup( + params: CheckCertificateIssueDateLogForDeviceGroupEntity, ): Promise { - this.logger.verbose(`With in AddCertificateIssueDateLogForDeviceGroup`) + this.logger.verbose(`With in AddCertificateIssueDateLogForDeviceGroup`); return await this.checkdevciegrouplogcertificaterepository.save({ ...params, - }); } - - public async getNextHistoryissuanceDevicelog( - - ): Promise { + public async getNextHistoryissuanceDevicelog(): Promise< + HistoryDeviceGroupNextIssueCertificate[] | undefined + > { this.logger.verbose(`With in getNextHistoryissuanceDevicelog`); return this.historynextissuancedaterepository.find({ where: { - status: HistoryNextInssuanceStatus.Pending - } + status: HistoryNextInssuanceStatus.Pending, + }, }); } - public async countgroupIdHistoryissuanceDevicelog(groupId: number): Promise { + public async countgroupIdHistoryissuanceDevicelog( + groupId: number, + ): Promise { this.logger.verbose(`With in countgroupIdHistoryissuanceDevicelog`); //const repository = getRepository(HistoryDeviceGroupNextIssueCertificate); const count = await this.historynextissuancedaterepository.count({ @@ -2086,42 +2545,45 @@ export class DeviceGroupService { return count; } - - public async getNextHistoryissuanceDevicelogafterreservation( developerExternalId: any, - groupId: any + groupId: any, ): Promise { - this.logger.verbose(`With in getNextHistoryissuanceDevicelogafterreservation`); + this.logger.verbose( + `With in getNextHistoryissuanceDevicelogafterreservation`, + ); const result = await this.historynextissuancedaterepository.findOne({ device_externalid: developerExternalId, groupId: groupId, - status: 'Completed' + status: 'Completed', }); - return result + return result; } async getHistoryCertificateIssueDate( conditions: FindConditions, ): Promise { this.logger.verbose(`With in getHistoryCertificateIssueDate`); - return (await this.historynextissuancedaterepository.findOne(conditions)) ?? null; + return ( + (await this.historynextissuancedaterepository.findOne(conditions)) ?? null + ); } async HistoryUpdatecertificateissuedate( id: number, - Status: HistoryNextInssuanceStatus + Status: HistoryNextInssuanceStatus, ): Promise { this.logger.verbose(`With in HistoryUpdatecertificateissuedate`); ////console.log("HistoryUpdatecertificateissuedate") // await this.checkNameConflict(data.name); - const historynextdate = await this.getHistoryCertificateIssueDate({ id: id }); + const historynextdate = await this.getHistoryCertificateIssueDate({ + id: id, + }); let updatedissuedatestatus = new HistoryDeviceGroupNextIssueCertificate(); if (historynextdate) { - - historynextdate.status = Status - updatedissuedatestatus = await this.historynextissuancedaterepository.save(historynextdate); - + historynextdate.status = Status; + updatedissuedatestatus = + await this.historynextissuancedaterepository.save(historynextdate); } return updatedissuedatestatus; } @@ -2130,25 +2592,35 @@ export class DeviceGroupService { this.logger.verbose(`With in getallReservationactive`); const activeresvation = await this.repository.find({ where: { - reservationActive: true - } - }) + reservationActive: true, + }, + }); - return activeresvation + return activeresvation; } - async getcurrentInformationofDevicesInReservation(groupuid, pageNumber?): Promise { + async getcurrentInformationofDevicesInReservation( + groupuid, + pageNumber?, + ): Promise { this.logger.verbose(`With in getcurrentInformationofDevicesInReservation`); - const group = await this.findOne({ devicegroup_uid: groupuid, reservationActive: true }) + const group = await this.findOne({ + devicegroup_uid: groupuid, + reservationActive: true, + }); // console.log(group) if (group === null) { - this.logger.error(`Group UId is not of this buyer, invalid value was sent`); + this.logger.error( + `Group UId is not of this buyer, invalid value was sent`, + ); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: 'Group UId is not of this buyer, invalid value was sent', - })) - }) + reject( + new ConflictException({ + success: false, + message: 'Group UId is not of this buyer, invalid value was sent', + }), + ); + }); } const devices = await this.deviceService.findByIds(group.deviceIdsInt); const device_historynextissuance = []; @@ -2168,7 +2640,8 @@ export class DeviceGroupService { 'hni.* AS historynextissuance', ]) .where('hni.groupId = :groupId', { groupId: group.id }) - .offset(skip).limit(pageSize) + .offset(skip) + .limit(pageSize); //await this.historynextissuancedaterepository.find( // { // where: { @@ -2181,47 +2654,55 @@ export class DeviceGroupService { const count = await queryBuilder.getCount(); const result = await queryBuilder.getRawMany(); - const historynext_issuancer = result - - historynext_issuancer.forEach(element => { - element.device_externalid = element.externalId - delete element["createdAt"]; - delete element["groupId"]; - delete element["id"]; - delete element["updatedAt"]; - + const historynext_issuancer = result; + + historynext_issuancer.forEach((element) => { + element.device_externalid = element.externalId; + delete element['createdAt']; + delete element['groupId']; + delete element['id']; + delete element['updatedAt']; }); device_historynextissuance.push({ historynext_issuancer, - - }) + }); // }), // ); - let AllDeviceshistnextissuansinfo: any = [] - device_historynextissuance.forEach(ele => ele.historynext_issuancer.forEach(he => AllDeviceshistnextissuansinfo.push(he))) + let AllDeviceshistnextissuansinfo: any = []; + device_historynextissuance.forEach((ele) => + ele.historynext_issuancer.forEach((he) => + AllDeviceshistnextissuansinfo.push(he), + ), + ); //console.log(group.id) const totalPages = Math.ceil(count / pageSize); let nextissuance = {}; - nextissuance = await this.repositorynextDeviceGroupcertificate.findOne({ - where: { - groupId: group.id - } - }) ?? null; + nextissuance = + (await this.repositorynextDeviceGroupcertificate.findOne({ + where: { + groupId: group.id, + }, + })) ?? null; //console.log(nextissuance) return { - historynextissuansinfo: { AllDeviceshistnextissuansinfo: AllDeviceshistnextissuansinfo, totalItems: count, currentPage: pageNumber, totalPages: totalPages, }, - ongoing_next_issuance: nextissuance - } + ongoing_next_issuance: nextissuance, + }; } - async getReservationInforDeveloperBsise(orgId, role, filterDto, pageNumber, apiuser_id?): Promise { + async getReservationInforDeveloperBsise( + orgId, + role, + filterDto, + pageNumber, + apiuser_id?, + ): Promise { this.logger.verbose(`With in getReservationInforDeveloperBsise`); const pageSize = 10; if (pageNumber <= 0) { @@ -2231,194 +2712,260 @@ export class DeviceGroupService { const skip = (pageNumber - 1) * pageSize; let queryBuilder: any; - queryBuilder = this.repository.createQueryBuilder('dg') + queryBuilder = this.repository + .createQueryBuilder('dg') .innerJoin(Device, 'd', 'd.id = ANY(dg.deviceIdsInt)') .innerJoin( CheckCertificateIssueDateLogForDeviceGroupEntity, 'dg_log', - 'dg_log.groupId = dg.id' + 'dg_log.groupId = dg.id', ) .innerJoin( CertificateReadModelEntity, 'crm', - 'dg_log.certificateTransactionUID = (crm.metadata::jsonb)->>\'certificateTransactionUID\'' + "dg_log.certificateTransactionUID = (crm.metadata::jsonb)->>'certificateTransactionUID'", + ) + .select( + 'DISTINCT ON (dg.id, crm.internalCertificateId) dg.id AS deviceGroupId, dg.name, dg.deviceIdsInt, d.*, dg_log.readvalue_watthour, crm.internalCertificateId', ) - .select('DISTINCT ON (dg.id, crm.internalCertificateId) dg.id AS deviceGroupId, dg.name, dg.deviceIdsInt, d.*, dg_log.readvalue_watthour, crm.internalCertificateId') - .orderBy('dg.id, crm.internalCertificateId, dg_log.readvalue_watthour', 'ASC') + .orderBy( + 'dg.id, crm.internalCertificateId, dg_log.readvalue_watthour', + 'ASC', + ); queryBuilder.where((qb) => { let where_orgnaizationId: any; if (role === 'OrganizationAdmin') { - where_orgnaizationId = qb.where(`d.organizationId = :orgId`, { orgId: orgId }) + where_orgnaizationId = qb.where(`d.organizationId = :orgId`, { + orgId: orgId, + }); } if (role === 'Buyer') { - where_orgnaizationId = qb.where(`dg.organizationId = :orgId`, { orgId: orgId }) + where_orgnaizationId = qb.where(`dg.organizationId = :orgId`, { + orgId: orgId, + }); } if (role === 'ApiUser') { - where_orgnaizationId = qb.where(`dg.api_user_id = :api_user_id`, { api_user_id: apiuser_id }); + where_orgnaizationId = qb.where(`dg.api_user_id = :api_user_id`, { + api_user_id: apiuser_id, + }); } where_orgnaizationId - .andWhere('EXISTS(SELECT 1 FROM jsonb_array_elements_text(CAST(crm.metadata AS jsonb)->\'deviceIds\') AS ids(deviceId) WHERE CAST(ids.deviceId AS INTEGER) = d.id)') - .andWhere(new Brackets(qb => { - if (filterDto.country) { - const string = filterDto.country; - const values = string.split(","); - let CountryInvalid = false; - filterDto.country = filterDto.country.toUpperCase(); - if (filterDto.country && typeof filterDto.country === "string" && filterDto.country.length === 3) { - let countries = countryCodesList; - if (countries.find(ele => ele.countryCode === filterDto.country) === undefined) { - CountryInvalid = true; + .andWhere( + "EXISTS(SELECT 1 FROM jsonb_array_elements_text(CAST(crm.metadata AS jsonb)->'deviceIds') AS ids(deviceId) WHERE CAST(ids.deviceId AS INTEGER) = d.id)", + ) + .andWhere( + new Brackets((qb) => { + if (filterDto.country) { + const string = filterDto.country; + const values = string.split(','); + let CountryInvalid = false; + filterDto.country = filterDto.country.toUpperCase(); + if ( + filterDto.country && + typeof filterDto.country === 'string' && + filterDto.country.length === 3 + ) { + let countries = countryCodesList; + if ( + countries.find( + (ele) => ele.countryCode === filterDto.country, + ) === undefined + ) { + CountryInvalid = true; + } } - } - - if (!CountryInvalid) { - const newCountry = filterDto.country.toString() - const CountryArray = newCountry.split(','); - qb.orWhere(new Brackets(qb => { - - CountryArray.forEach((country, index) => { - if (index === 0) { - qb.where(`d.countryCode ILIKE :benefit${index}`, { [`benefit${index}`]: `%${country}%` }); - } else { - qb.orWhere(`d.countryCode ILIKE :benefit${index}`, { [`benefit${index}`]: `%${country}%` }); - } - }); - })); - - // qb.orWhere('d.countryCode LIKE = :countrycode', { countrycode: `%${filterDto.country}%` }); + if (!CountryInvalid) { + const newCountry = filterDto.country.toString(); + const CountryArray = newCountry.split(','); + qb.orWhere( + new Brackets((qb) => { + CountryArray.forEach((country, index) => { + if (index === 0) { + qb.where(`d.countryCode ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${country}%`, + }); + } else { + qb.orWhere(`d.countryCode ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${country}%`, + }); + } + }); + }), + ); + + // qb.orWhere('d.countryCode LIKE = :countrycode', { countrycode: `%${filterDto.country}%` }); + } } - } - if ((filterDto.fuelCode)) { - const newfuelCode = filterDto.fuelCode.toString() - const fuelCodeArray = newfuelCode.split(','); - qb.orWhere(new Brackets(qb => { - - fuelCodeArray.forEach((fuelCode, index) => { - if (index === 0) { - qb.where(`d.fuelCode ILIKE :benefit${index}`, { [`benefit${index}`]: `%${fuelCode}%` }); - } else { - qb.orWhere(`d.fuelCode ILIKE :benefit${index}`, { [`benefit${index}`]: `%${fuelCode}%` }); - } + if (filterDto.fuelCode) { + const newfuelCode = filterDto.fuelCode.toString(); + const fuelCodeArray = newfuelCode.split(','); + qb.orWhere( + new Brackets((qb) => { + fuelCodeArray.forEach((fuelCode, index) => { + if (index === 0) { + qb.where(`d.fuelCode ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${fuelCode}%`, + }); + } else { + qb.orWhere(`d.fuelCode ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${fuelCode}%`, + }); + } + }); + }), + ); + // qb.orWhere(`d.fuelCode LIKE = :fuelcode`, `%${filterDto.fuelCode}%`); + } + if (filterDto.offTaker) { + // console.log(typeof filterDto.offTaker); + const newoffTaker = filterDto.offTaker.toString(); + const offTakerArray = newoffTaker.split(','); + qb.orWhere( + new Brackets((qb) => { + offTakerArray.forEach((offTaker, index) => { + if (index === 0) { + qb.where(`d.offTaker ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${offTaker}%`, + }); + } else { + qb.orWhere(`d.offTaker ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${offTaker}%`, + }); + } + }); + }), + ); + // qb.orWhere('d.offTakers LIKE = :offTaker', `%${filterDto.offTaker}%`); + } + const startTimestamp = + new Date(filterDto.start_date).getTime() / 1000; + const endTimestamp = new Date(filterDto.end_date).getTime() / 1000; + if (filterDto.start_date && filterDto.end_date === undefined) { + qb.orWhere('crm.generationStartTime > :certificateStartDate ', { + certificateStartDate: startTimestamp, }); - })); - // qb.orWhere(`d.fuelCode LIKE = :fuelcode`, `%${filterDto.fuelCode}%`); - - } - if (filterDto.offTaker) { - // console.log(typeof filterDto.offTaker); - const newoffTaker = filterDto.offTaker.toString() - const offTakerArray = newoffTaker.split(','); - qb.orWhere(new Brackets(qb => { - - offTakerArray.forEach((offTaker, index) => { - if (index === 0) { - qb.where(`d.offTaker ILIKE :benefit${index}`, { [`benefit${index}`]: `%${offTaker}%` }); - } else { - qb.orWhere(`d.offTaker ILIKE :benefit${index}`, { [`benefit${index}`]: `%${offTaker}%` }); - } + } + if (filterDto.end_date && filterDto.start_date === undefined) { + qb.orWhere('crm.generationEndTime <:certificateEndDate', { + certificateEndDate: endTimestamp, }); - })); - // qb.orWhere('d.offTakers LIKE = :offTaker', `%${filterDto.offTaker}%`); - - } - const startTimestamp = new Date(filterDto.start_date).getTime() / 1000; - const endTimestamp = new Date(filterDto.end_date).getTime() / 1000; - if (filterDto.start_date && filterDto.end_date === undefined) { - qb.orWhere("crm.generationStartTime > :certificateStartDate ", { certificateStartDate: startTimestamp }) - } - if (filterDto.end_date && filterDto.start_date === undefined) { - qb.orWhere("crm.generationEndTime <:certificateEndDate", { certificateEndDate: endTimestamp }) - } - if (filterDto.start_date && filterDto.end_date) { - qb.orWhere("crm.generationStartTime BETWEEN :certificateStartDate1 AND :certificateEndDate1", { certificateStartDate1: startTimestamp, certificateEndDate1: endTimestamp }) - } - if (filterDto.SDGBenefits) { - - const newsdg = filterDto.SDGBenefits.toString() - const sdgBenefitsArray = newsdg.split(','); - const sdgBenefitString = sdgBenefitsArray.map((benefit) => benefit).join(','); - qb.orWhere(new Brackets(qb => { - sdgBenefitsArray.forEach((benefit, index) => { - if (index === 0) { - qb.where(`d.SDGBenefits ILIKE :benefit${index}`, { [`benefit${index}`]: `%${benefit}%` }); - } else { - qb.orWhere(`d.SDGBenefits ILIKE :benefit${index}`, { [`benefit${index}`]: `%${benefit}%` }); - } + } + if (filterDto.start_date && filterDto.end_date) { + qb.orWhere( + 'crm.generationStartTime BETWEEN :certificateStartDate1 AND :certificateEndDate1', + { + certificateStartDate1: startTimestamp, + certificateEndDate1: endTimestamp, + }, + ); + } + if (filterDto.SDGBenefits) { + const newsdg = filterDto.SDGBenefits.toString(); + const sdgBenefitsArray = newsdg.split(','); + const sdgBenefitString = sdgBenefitsArray + .map((benefit) => benefit) + .join(','); + qb.orWhere( + new Brackets((qb) => { + sdgBenefitsArray.forEach((benefit, index) => { + if (index === 0) { + qb.where(`d.SDGBenefits ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${benefit}%`, + }); + } else { + qb.orWhere(`d.SDGBenefits ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${benefit}%`, + }); + } + }); + }), + ); + } + if (filterDto.fromAmountread && filterDto.toAmountread) { + qb.orWhere( + 'dg_log.readvalue_watthour BETWEEN :fromAmountread AND :toAmountread', + { + fromAmountread: filterDto.fromAmountread, + toAmountread: filterDto.toAmountread, + }, + ); + } + if ( + filterDto.fromAmountread != null && + filterDto.toAmountread === undefined + ) { + qb.orWhere('dg_log.readvalue_watthour > :fromAmountread', { + fromAmountread: filterDto.fromAmountread, }); - })); - - } - if (filterDto.fromAmountread && filterDto.toAmountread) { - qb.orWhere("dg_log.readvalue_watthour BETWEEN :fromAmountread AND :toAmountread", { fromAmountread: filterDto.fromAmountread, toAmountread: filterDto.toAmountread }) - } - if (filterDto.fromAmountread != null && filterDto.toAmountread === undefined) { - qb.orWhere("dg_log.readvalue_watthour > :fromAmountread", { fromAmountread: filterDto.fromAmountread }) - } - if (filterDto.fromAmountread === undefined && filterDto.toAmountread != null) { - qb.orWhere("dg_log.readvalue_watthour < :toAmountread", { toAmountread: filterDto.toAmountread }) - } - })); - - }) + } + if ( + filterDto.fromAmountread === undefined && + filterDto.toAmountread != null + ) { + qb.orWhere('dg_log.readvalue_watthour < :toAmountread', { + toAmountread: filterDto.toAmountread, + }); + } + }), + ); + }); const totalCountQuery = await queryBuilder.getRawMany(); - const groupedDatasql = await queryBuilder.offset(skip).limit(pageSize).getSql(); + const groupedDatasql = await queryBuilder + .offset(skip) + .limit(pageSize) + .getSql(); this.logger.debug(groupedDatasql); - const groupedData = await queryBuilder.offset(skip).limit(pageSize).getRawMany(); + const groupedData = await queryBuilder + .offset(skip) + .limit(pageSize) + .getRawMany(); const totalCount = totalCountQuery.length; - this.logger.debug("totalCountQuery", totalCount); + this.logger.debug('totalCountQuery', totalCount); const totalPages = Math.ceil(totalCount / pageSize); - let deviceGroups: any; if (role === 'OrganizationAdmin') { deviceGroups = groupedData.reduce((acc, curr) => { - - const existing = acc.find(item => item.dg_id === curr.devicegroupid); + const existing = acc.find((item) => item.dg_id === curr.devicegroupid); if (existing) { let newobj = {}; - const existing1 = acc.find(item => item.id === curr.id); + const existing1 = acc.find((item) => item.id === curr.id); if (existing1) { existing.developerdeviceIds.push(curr.id); } - existing.internalCertificateId.push(curr.internalCertificateId) - + existing.internalCertificateId.push(curr.internalCertificateId); } else { - acc.push({ dg_id: curr.devicegroupid, name: curr.name, deviceIdsInt: curr.deviceIdsInt, // deviceIdsInt: curr.deviceIdsInt, developerdeviceIds: [curr.id], - internalCertificateId: [curr.internalCertificateId] + internalCertificateId: [curr.internalCertificateId], }); - } return acc; }, []); } if (role === 'Buyer' || role === Role.ApiUser) { deviceGroups = groupedData.reduce((acc, curr) => { - - const existing = acc.find(item => item.dg_id === curr.devicegroupid); + const existing = acc.find((item) => item.dg_id === curr.devicegroupid); if (existing) { - existing.internalCertificateId.push(curr.internalCertificateId) + existing.internalCertificateId.push(curr.internalCertificateId); } else { - acc.push({ dg_id: curr.devicegroupid, name: curr.name, deviceIdsInt: curr.deviceIdsInt, - internalCertificateId: [curr.internalCertificateId] + internalCertificateId: [curr.internalCertificateId], }); - } return acc; }, []); @@ -2428,11 +2975,17 @@ export class DeviceGroupService { deviceGroups, pageNumber, totalPages, - totalCount + totalCount, }; return response; } - async getoldReservationInforDeveloperBsise(orgId, role, filterDto, pageNumber, apiuser_id?): Promise { + async getoldReservationInforDeveloperBsise( + orgId, + role, + filterDto, + pageNumber, + apiuser_id?, + ): Promise { this.logger.verbose(`With in getoldReservationInforDeveloperBsise`); const pageSize = 10; // const pageNumber = 2 @@ -2444,155 +2997,230 @@ export class DeviceGroupService { const skip = (pageNumber - 1) * pageSize; let queryBuilder: any; - queryBuilder = this.repository.createQueryBuilder('dg') + queryBuilder = this.repository + .createQueryBuilder('dg') .innerJoin(Device, 'd', 'd.id = ANY(dg.deviceIdsInt)') .innerJoin( CheckCertificateIssueDateLogForDeviceGroupEntity, 'dg_log', - 'dg_log.groupId = dg.id' + 'dg_log.groupId = dg.id', + ) + .innerJoin( + Certificate, + 'issuer', + 'CAST(issuer.deviceId AS INTEGER) = dg.id', + ) + .select( + 'DISTINCT ON (dg.id, issuer.id) dg.id AS deviceGroupId, dg.name, dg.deviceIdsInt, d.*, dg_log.readvalue_watthour, issuer.id', ) - .innerJoin(Certificate, 'issuer', 'CAST(issuer.deviceId AS INTEGER) = dg.id') - .select('DISTINCT ON (dg.id, issuer.id) dg.id AS deviceGroupId, dg.name, dg.deviceIdsInt, d.*, dg_log.readvalue_watthour, issuer.id') - .orderBy('dg.id, issuer.id, dg_log.readvalue_watthour', 'ASC') + .orderBy('dg.id, issuer.id, dg_log.readvalue_watthour', 'ASC'); queryBuilder.where((qb) => { let where_orgnaizationId: any; if (role === 'OrganizationAdmin') { - where_orgnaizationId = qb.where(`d.organizationId = :orgId`, { orgId: orgId }) + where_orgnaizationId = qb.where(`d.organizationId = :orgId`, { + orgId: orgId, + }); } if (role === 'Buyer') { - where_orgnaizationId = qb.where(`dg.organizationId = :orgId`, { orgId: orgId }) + where_orgnaizationId = qb.where(`dg.organizationId = :orgId`, { + orgId: orgId, + }); } if (role === 'ApiUser') { - where_orgnaizationId = qb.where(`dg.api_user_id = :api_user_id`, { api_user_id: apiuser_id }) + where_orgnaizationId = qb.where(`dg.api_user_id = :api_user_id`, { + api_user_id: apiuser_id, + }); } where_orgnaizationId - .andWhere('EXISTS(SELECT 1 FROM jsonb_array_elements_text(CAST(issuer.metadata AS jsonb)->\'deviceIds\') AS ids(deviceId) WHERE CAST(ids.deviceId AS INTEGER) = d.id)') - .andWhere(new Brackets(qb => { - if (filterDto.country) { - const string = filterDto.country; - const values = string.split(","); - let CountryInvalid = false; - filterDto.country = filterDto.country.toUpperCase(); - if (filterDto.country && typeof filterDto.country === "string" && filterDto.country.length === 3) { - let countries = countryCodesList; - if (countries.find(ele => ele.countryCode === filterDto.country) === undefined) { - CountryInvalid = true; + .andWhere( + "EXISTS(SELECT 1 FROM jsonb_array_elements_text(CAST(issuer.metadata AS jsonb)->'deviceIds') AS ids(deviceId) WHERE CAST(ids.deviceId AS INTEGER) = d.id)", + ) + .andWhere( + new Brackets((qb) => { + if (filterDto.country) { + const string = filterDto.country; + const values = string.split(','); + let CountryInvalid = false; + filterDto.country = filterDto.country.toUpperCase(); + if ( + filterDto.country && + typeof filterDto.country === 'string' && + filterDto.country.length === 3 + ) { + let countries = countryCodesList; + if ( + countries.find( + (ele) => ele.countryCode === filterDto.country, + ) === undefined + ) { + CountryInvalid = true; + } } - } - - if (!CountryInvalid) { - const newCountry = filterDto.country.toString() - const CountryArray = newCountry.split(','); - qb.orWhere(new Brackets(qb => { - - CountryArray.forEach((country, index) => { - if (index === 0) { - qb.where(`d.countryCode ILIKE :benefit${index}`, { [`benefit${index}`]: `%${country}%` }); - } else { - qb.orWhere(`d.countryCode ILIKE :benefit${index}`, { [`benefit${index}`]: `%${country}%` }); - } - }); - })); - - // qb.orWhere('d.countryCode LIKE = :countrycode', { countrycode: `%${filterDto.country}%` }); + if (!CountryInvalid) { + const newCountry = filterDto.country.toString(); + const CountryArray = newCountry.split(','); + qb.orWhere( + new Brackets((qb) => { + CountryArray.forEach((country, index) => { + if (index === 0) { + qb.where(`d.countryCode ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${country}%`, + }); + } else { + qb.orWhere(`d.countryCode ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${country}%`, + }); + } + }); + }), + ); + + // qb.orWhere('d.countryCode LIKE = :countrycode', { countrycode: `%${filterDto.country}%` }); + } } - } - if ((filterDto.fuelCode)) { - const newfuelCode = filterDto.fuelCode.toString() - const fuelCodeArray = newfuelCode.split(','); - qb.orWhere(new Brackets(qb => { - - fuelCodeArray.forEach((fuelCode, index) => { - if (index === 0) { - qb.where(`d.fuelCode ILIKE :fuelcode${index}`, { [`fuelcode${index}`]: `%${fuelCode}%` }); - } else { - qb.orWhere(`d.fuelCode ILIKE :fuelcode${index}`, { [`fuelcode${index}`]: `%${fuelCode}%` }); - } + if (filterDto.fuelCode) { + const newfuelCode = filterDto.fuelCode.toString(); + const fuelCodeArray = newfuelCode.split(','); + qb.orWhere( + new Brackets((qb) => { + fuelCodeArray.forEach((fuelCode, index) => { + if (index === 0) { + qb.where(`d.fuelCode ILIKE :fuelcode${index}`, { + [`fuelcode${index}`]: `%${fuelCode}%`, + }); + } else { + qb.orWhere(`d.fuelCode ILIKE :fuelcode${index}`, { + [`fuelcode${index}`]: `%${fuelCode}%`, + }); + } + }); + }), + ); + // qb.orWhere(`d.fuelCode LIKE = :fuelcode`, `%${filterDto.fuelCode}%`); + } + if (filterDto.offTaker) { + // console.log(typeof filterDto.offTaker); + const newoffTaker = filterDto.offTaker.toString(); + const offTakerArray = newoffTaker.split(','); + qb.orWhere( + new Brackets((qb) => { + offTakerArray.forEach((offTaker, index) => { + if (index === 0) { + qb.where(`d.offTaker ILIKE :offtaker${index}`, { + [`offtaker${index}`]: `%${offTaker}%`, + }); + } else { + qb.orWhere(`d.offTaker ILIKE :offtaker${index}`, { + [`offtaker${index}`]: `%${offTaker}%`, + }); + } + }); + }), + ); + // qb.orWhere('d.offTakers LIKE = :offTaker', `%${filterDto.offTaker}%`); + } + const startTimestamp = + new Date(filterDto.start_date).getTime() / 1000; + const endTimestamp = new Date(filterDto.end_date).getTime() / 1000; + if (filterDto.start_date && filterDto.end_date === undefined) { + qb.orWhere( + 'issuer.generationStartTime > :certificateStartDate ', + { certificateStartDate: startTimestamp }, + ); + } + if (filterDto.end_date && filterDto.start_date === undefined) { + qb.orWhere('issuer.generationEndTime <:certificateEndDate', { + certificateEndDate: endTimestamp, }); - })); - // qb.orWhere(`d.fuelCode LIKE = :fuelcode`, `%${filterDto.fuelCode}%`); - - } - if (filterDto.offTaker) { - // console.log(typeof filterDto.offTaker); - const newoffTaker = filterDto.offTaker.toString() - const offTakerArray = newoffTaker.split(','); - qb.orWhere(new Brackets(qb => { - - offTakerArray.forEach((offTaker, index) => { - if (index === 0) { - qb.where(`d.offTaker ILIKE :offtaker${index}`, { [`offtaker${index}`]: `%${offTaker}%` }); - } else { - qb.orWhere(`d.offTaker ILIKE :offtaker${index}`, { [`offtaker${index}`]: `%${offTaker}%` }); - } + } + if (filterDto.start_date && filterDto.end_date) { + qb.orWhere( + 'issuer.generationStartTime BETWEEN :certificateStartDate1 AND :certificateEndDate1', + { + certificateStartDate1: startTimestamp, + certificateEndDate1: endTimestamp, + }, + ); + } + if (filterDto.SDGBenefits) { + const newsdg = filterDto.SDGBenefits.toString(); + const sdgBenefitsArray = newsdg.split(','); + const sdgBenefitString = sdgBenefitsArray + .map((benefit) => benefit) + .join(','); + qb.orWhere( + new Brackets((qb) => { + sdgBenefitsArray.forEach((benefit, index) => { + if (index === 0) { + qb.where(`d.SDGBenefits ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${benefit}%`, + }); + } else { + qb.orWhere(`d.SDGBenefits ILIKE :benefit${index}`, { + [`benefit${index}`]: `%${benefit}%`, + }); + } + }); + }), + ); + } + if (filterDto.fromAmountread && filterDto.toAmountread) { + qb.orWhere( + 'dg_log.readvalue_watthour BETWEEN :fromAmountread AND :toAmountread', + { + fromAmountread: filterDto.fromAmountread, + toAmountread: filterDto.toAmountread, + }, + ); + } + if ( + filterDto.fromAmountread != null && + filterDto.toAmountread === undefined + ) { + qb.orWhere('dg_log.readvalue_watthour > :fromAmountread', { + fromAmountread: filterDto.fromAmountread, }); - })); - // qb.orWhere('d.offTakers LIKE = :offTaker', `%${filterDto.offTaker}%`); - - } - const startTimestamp = new Date(filterDto.start_date).getTime() / 1000; - const endTimestamp = new Date(filterDto.end_date).getTime() / 1000; - if (filterDto.start_date && filterDto.end_date === undefined) { - qb.orWhere("issuer.generationStartTime > :certificateStartDate ", { certificateStartDate: startTimestamp }) - } - if (filterDto.end_date && filterDto.start_date === undefined) { - qb.orWhere("issuer.generationEndTime <:certificateEndDate", { certificateEndDate: endTimestamp }) - } - if (filterDto.start_date && filterDto.end_date) { - qb.orWhere("issuer.generationStartTime BETWEEN :certificateStartDate1 AND :certificateEndDate1", { certificateStartDate1: startTimestamp, certificateEndDate1: endTimestamp }) - } - if (filterDto.SDGBenefits) { - - const newsdg = filterDto.SDGBenefits.toString() - const sdgBenefitsArray = newsdg.split(','); - const sdgBenefitString = sdgBenefitsArray.map((benefit) => benefit).join(','); - qb.orWhere(new Brackets(qb => { - sdgBenefitsArray.forEach((benefit, index) => { - if (index === 0) { - qb.where(`d.SDGBenefits ILIKE :benefit${index}`, { [`benefit${index}`]: `%${benefit}%` }); - } else { - qb.orWhere(`d.SDGBenefits ILIKE :benefit${index}`, { [`benefit${index}`]: `%${benefit}%` }); - } + } + if ( + filterDto.fromAmountread === undefined && + filterDto.toAmountread != null + ) { + qb.orWhere('dg_log.readvalue_watthour < :toAmountread', { + toAmountread: filterDto.toAmountread, }); - })); - - } - if (filterDto.fromAmountread && filterDto.toAmountread) { - qb.orWhere("dg_log.readvalue_watthour BETWEEN :fromAmountread AND :toAmountread", { fromAmountread: filterDto.fromAmountread, toAmountread: filterDto.toAmountread }) - } - if (filterDto.fromAmountread != null && filterDto.toAmountread === undefined) { - qb.orWhere("dg_log.readvalue_watthour > :fromAmountread", { fromAmountread: filterDto.fromAmountread }) - } - if (filterDto.fromAmountread === undefined && filterDto.toAmountread != null) { - qb.orWhere("dg_log.readvalue_watthour < :toAmountread", { toAmountread: filterDto.toAmountread }) - } - })); - - }) + } + }), + ); + }); const totalCountQuery = await queryBuilder.getRawMany(); - const groupedDatasql = await queryBuilder.offset(skip).limit(pageSize).getSql(); + const groupedDatasql = await queryBuilder + .offset(skip) + .limit(pageSize) + .getSql(); this.logger.debug(groupedDatasql); - const groupedData = await queryBuilder.offset(skip).limit(pageSize).getRawMany(); + const groupedData = await queryBuilder + .offset(skip) + .limit(pageSize) + .getRawMany(); const totalCount = totalCountQuery.length; - this.logger.debug("totalCountQuery", totalCount); + this.logger.debug('totalCountQuery', totalCount); const totalPages = Math.ceil(totalCount / pageSize); // if (pageNumber > totalPages) { // throw new HttpException('Page number out of range', HttpStatus.NOT_FOUND); // } - let deviceGroups = groupedData.reduce((acc, curr) => { - const existing = acc.find(item => item.dg_id === curr.dg_id); + const existing = acc.find((item) => item.dg_id === curr.dg_id); if (existing) { let newobj = {}; - const existing1 = acc.find(item => item.id === curr.id); + const existing1 = acc.find((item) => item.id === curr.id); if (existing1) { existing.developerdeviceIds.push(curr.id); } - existing.internalCertificateId.push(curr.id) + existing.internalCertificateId.push(curr.id); // existing.certificatelog.push(newobj); } else { acc.push({ @@ -2601,7 +3229,7 @@ export class DeviceGroupService { deviceIdsInt: curr.deviceIdsInt, // deviceIdsInt: curr.deviceIdsInt, developerdeviceIds: [curr.id], - internalCertificateId: [curr.id] + internalCertificateId: [curr.id], }); // console.log(acc); } @@ -2612,26 +3240,45 @@ export class DeviceGroupService { deviceGroups, pageNumber, totalPages, - totalCount + totalCount, }; return response; } - public async checkdeveloperorganization(deviceIds: number[], organizationId: number): Promise { + public async checkdeveloperorganization( + deviceIds: number[], + organizationId: number, + ): Promise { this.logger.verbose(`With in checkdeveloperorganization`); - const isMyDevice = await Promise.all(await deviceIds.map(async (deviceId) => { - const device = await this.deviceService.findOne(Number(deviceId)); - return device.organizationId === Number(organizationId); - })); + const isMyDevice = await Promise.all( + await deviceIds.map(async (deviceId) => { + const device = await this.deviceService.findOne(Number(deviceId)); + return device.organizationId === Number(organizationId); + }), + ); return isMyDevice.some((result) => result); } - async getAllCSVJobsForApiUser(apiuserId: string, organizationId?: number, pageNumber?: number, limit?: number): Promise<{ csvJobs: Array, currentPage: number, totalPages: number, totalCount: number } | any> { + async getAllCSVJobsForApiUser( + apiuserId: string, + organizationId?: number, + pageNumber?: number, + limit?: number, + ): Promise< + | { + csvJobs: Array; + currentPage: number; + totalPages: number; + totalCount: number; + } + | any + > { this.logger.verbose(`With in getAllCSVJobsForApiUser`); - let query: SelectQueryBuilder = await this.repositoyCSVJobProcessing - .createQueryBuilder('csvjobs') - .orderBy('csvjobs.createdAt', 'DESC'); + let query: SelectQueryBuilder = + await this.repositoyCSVJobProcessing + .createQueryBuilder('csvjobs') + .orderBy('csvjobs.createdAt', 'DESC'); if (apiuserId) { query.andWhere(`csvjobs.api_user_id = '${apiuserId}'`); @@ -2665,7 +3312,7 @@ export class DeviceGroupService { csvJobs: csvjobsWithOrganization, currentPage: pageNumber, totalPages, - totalCount - } + totalCount, + }; } -} \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/device-group/device_csv_processing_jobs.entity.ts b/apps/drec-api/src/pods/device-group/device_csv_processing_jobs.entity.ts index 2096c97a7..2b27b06d4 100755 --- a/apps/drec-api/src/pods/device-group/device_csv_processing_jobs.entity.ts +++ b/apps/drec-api/src/pods/device-group/device_csv_processing_jobs.entity.ts @@ -42,7 +42,7 @@ export class DeviceCsvFileProcessingJobsEntity extends ExtendedBaseEntity { @IsEnum(StatusCSV) status: StatusCSV; - @Column({nullable: true, default: null}) + @Column({ nullable: true, default: null }) @IsOptional() api_user_id: string; } diff --git a/apps/drec-api/src/pods/device-group/device_group_issuecertificate.entity.ts b/apps/drec-api/src/pods/device-group/device_group_issuecertificate.entity.ts index 0129af8a1..5f0c40f6f 100755 --- a/apps/drec-api/src/pods/device-group/device_group_issuecertificate.entity.ts +++ b/apps/drec-api/src/pods/device-group/device_group_issuecertificate.entity.ts @@ -7,9 +7,12 @@ import { IsBoolean, IsNumber, IsOptional, - IsDate + IsDate, } from 'class-validator'; -import { IDeviceGroupNextIssueCertificate, IFullOrganization } from '../../models'; +import { + IDeviceGroupNextIssueCertificate, + IFullOrganization, +} from '../../models'; import { CapacityRange, CommissioningDateRange, @@ -21,7 +24,10 @@ import { import { Device } from '../device'; @Entity('next_issuance_date_log_for_device_group') -export class DeviceGroupNextIssueCertificate extends ExtendedBaseEntity implements IDeviceGroupNextIssueCertificate { +export class DeviceGroupNextIssueCertificate + extends ExtendedBaseEntity + implements IDeviceGroupNextIssueCertificate +{ @PrimaryGeneratedColumn() id: number; @@ -35,5 +41,4 @@ export class DeviceGroupNextIssueCertificate extends ExtendedBaseEntity implemen @Column() @IsDate() end_date: string; - } diff --git a/apps/drec-api/src/pods/device-group/dto/add-device-group.dto.ts b/apps/drec-api/src/pods/device-group/dto/add-device-group.dto.ts index acc5e3662..c33d70ee8 100755 --- a/apps/drec-api/src/pods/device-group/dto/add-device-group.dto.ts +++ b/apps/drec-api/src/pods/device-group/dto/add-device-group.dto.ts @@ -1,5 +1,12 @@ -import { ApiProperty ,ApiPropertyOptional} from '@nestjs/swagger'; -import { IsInt, IsString,IsOptional, Min,IsBoolean,IsEnum } from 'class-validator'; +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { + IsInt, + IsString, + IsOptional, + Min, + IsBoolean, + IsEnum, +} from 'class-validator'; import { BuyerReservationCertificateGenerationFrequency } from '../../../models'; export class AddGroupDTO { @@ -12,40 +19,35 @@ export class AddGroupDTO { @Min(1, { each: true }) deviceIds: number[]; - - @ApiProperty({ type: Number }) - targetCapacityInMegaWattHour:number; + targetCapacityInMegaWattHour: number; - @ApiProperty({ type: Date }) - reservationStartDate:Date; + reservationStartDate: Date; - @ApiProperty({ type: Date }) - reservationEndDate:Date; + reservationEndDate: Date; @ApiProperty({ type: Boolean }) - continueWithReservationIfOneOrMoreDevicesUnavailableForReservation:boolean; + continueWithReservationIfOneOrMoreDevicesUnavailableForReservation: boolean; @ApiProperty({ type: Boolean }) - continueWithReservationIfTargetCapacityIsLessThanDeviceTotalCapacityBetweenDuration:boolean; + continueWithReservationIfTargetCapacityIsLessThanDeviceTotalCapacityBetweenDuration: boolean; @ApiProperty({ type: Boolean }) - authorityToExceed:boolean; + authorityToExceed: boolean; @ApiProperty() @IsEnum(BuyerReservationCertificateGenerationFrequency) - frequency:BuyerReservationCertificateGenerationFrequency; + frequency: BuyerReservationCertificateGenerationFrequency; - // @ApiPropertyOptional({ type: String }) + // @ApiPropertyOptional({ type: String }) @IsString() @IsOptional() blockchainAddress?: string; - api_user_id ?: string; - + api_user_id?: string; - @ApiPropertyOptional({ type: Date }) - reservationExpiryDate:Date; + @ApiPropertyOptional({ type: Date }) + reservationExpiryDate: Date; } diff --git a/apps/drec-api/src/pods/device-group/dto/device-group.dto.ts b/apps/drec-api/src/pods/device-group/dto/device-group.dto.ts index 47122bb53..adcb973a7 100755 --- a/apps/drec-api/src/pods/device-group/dto/device-group.dto.ts +++ b/apps/drec-api/src/pods/device-group/dto/device-group.dto.ts @@ -97,12 +97,10 @@ export class DeviceGroupDTO implements IDeviceGroup { @IsNotEmpty() commissioningDateRange: CommissioningDateRange[]; - - -// @ApiProperty({ type: [String] }) -// @IsArray() -// @IsOptional() -// labels: string[]; + // @ApiProperty({ type: [String] }) + // @IsArray() + // @IsOptional() + // labels: string[]; @ApiPropertyOptional({ type: [DeviceDTO] }) @IsArray() @@ -124,7 +122,6 @@ export class DeviceGroupDTO implements IDeviceGroup { @ApiProperty({ type: Date }) @IsOptional() reservationEndDate?: Date; - @ApiProperty({ type: Number }) @IsOptional() @@ -138,7 +135,6 @@ export class DeviceGroupDTO implements IDeviceGroup { @IsOptional() targetVolumeCertificateGenerationRequestedInMegaWattHour?: number; - @ApiProperty({ type: Number }) @IsOptional() targetVolumeCertificateGenerationFailedInMegaWattHour?: number; @@ -147,12 +143,10 @@ export class DeviceGroupDTO implements IDeviceGroup { @IsOptional() authorityToExceed?: boolean; - @ApiProperty() @IsOptional() leftoverReadsByCountryCode?: any; - @IsOptional() @ApiPropertyOptional({ type: Number }) @IsNumber() @@ -170,10 +164,10 @@ export class DeviceGroupDTO implements IDeviceGroup { @IsBoolean() reservationActive?: boolean; - + @ApiPropertyOptional({ type: Date }) @IsOptional() - reservationExpiryDate:Date; + reservationExpiryDate: Date; } export class CSVBulkUploadDTO { @@ -182,9 +176,7 @@ export class CSVBulkUploadDTO { fileName: string; } - -export class ResponseDeviceGroupDTO extends DeviceGroupDTO -{ +export class ResponseDeviceGroupDTO extends DeviceGroupDTO { @IsOptional() @ApiPropertyOptional({ type: String }) @IsString() @@ -194,4 +186,4 @@ export class ResponseDeviceGroupDTO extends DeviceGroupDTO @ApiPropertyOptional({ type: String }) @IsString() unavailableDeviceIDsDueToAreIncludedInBuyerReservation?: string; -} \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/device-group/dto/job-failed-rows.dto.ts b/apps/drec-api/src/pods/device-group/dto/job-failed-rows.dto.ts index 124483785..ce67abf07 100755 --- a/apps/drec-api/src/pods/device-group/dto/job-failed-rows.dto.ts +++ b/apps/drec-api/src/pods/device-group/dto/job-failed-rows.dto.ts @@ -1,27 +1,23 @@ -import { - IsString, - IsNumber, - IsEnum, - IsArray, - IsNotEmpty, - IsBoolean, - IsOptional, - } from 'class-validator'; - import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; - - - export class JobFailedRowsDTO { - @ApiProperty() - @IsNumber() - id: number; - - @ApiProperty() - @IsNumber() - jobId: number; - - @ApiProperty() - errorDetails: any; - - } - - \ No newline at end of file +import { + IsString, + IsNumber, + IsEnum, + IsArray, + IsNotEmpty, + IsBoolean, + IsOptional, +} from 'class-validator'; +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; + +export class JobFailedRowsDTO { + @ApiProperty() + @IsNumber() + id: number; + + @ApiProperty() + @IsNumber() + jobId: number; + + @ApiProperty() + errorDetails: any; +} diff --git a/apps/drec-api/src/pods/device-group/dto/new-device-group.dto.ts b/apps/drec-api/src/pods/device-group/dto/new-device-group.dto.ts index a829c7fde..0a58f83e9 100755 --- a/apps/drec-api/src/pods/device-group/dto/new-device-group.dto.ts +++ b/apps/drec-api/src/pods/device-group/dto/new-device-group.dto.ts @@ -9,7 +9,7 @@ import { IsNumber, IsOptional, } from 'class-validator'; -import { ApiProperty ,ApiPropertyOptional} from '@nestjs/swagger'; +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IDeviceGroup } from '../../../models'; import { StandardCompliance, @@ -106,7 +106,6 @@ export class NewDeviceGroupDTO // @IsOptional() // labels: string[]; - @ApiProperty({ type: String }) @IsOptional() frequency?: string; @@ -159,9 +158,8 @@ export class NewDeviceGroupDTO @ApiPropertyOptional({ type: Date }) @IsOptional() - reservationExpiryDate?:Date; + reservationExpiryDate?: Date; // @ApiProperty({ type: String }) // @IsOptional() // type?: string; - } diff --git a/apps/drec-api/src/pods/device-group/dto/unreserved-filter.dto.ts b/apps/drec-api/src/pods/device-group/dto/unreserved-filter.dto.ts index 90233b09a..55778f39c 100755 --- a/apps/drec-api/src/pods/device-group/dto/unreserved-filter.dto.ts +++ b/apps/drec-api/src/pods/device-group/dto/unreserved-filter.dto.ts @@ -8,20 +8,23 @@ import { Sector, StandardCompliance, FuelCode, - SDGBenefitsList + SDGBenefitsList, } from '../../../utils/enums'; -import { countryCodesList } from '../../../models/country-code' +import { countryCodesList } from '../../../models/country-code'; //import {SDGBenefits} from '../../../models/Sdgbenefit' export class UnreservedDeviceGroupsFilterDTO { @IsOptional() - @ApiPropertyOptional({ type: String, description: 'Filter with multiple Country Code :"IND,CAN"' }) + @ApiPropertyOptional({ + type: String, + description: 'Filter with multiple Country Code :"IND,CAN"', + }) country: string; @IsOptional() - @ApiPropertyOptional({ + @ApiPropertyOptional({ description: 'Fuel Code', enum: FuelCode, - isArray:true + isArray: true, }) fuelCode: string[]; @@ -30,12 +33,14 @@ export class UnreservedDeviceGroupsFilterDTO { type: OffTaker, description: 'Off-taker', enum: OffTaker, - isArray:true + isArray: true, }) offTaker: OffTaker; @IsOptional() - @ApiPropertyOptional({ description: 'Start date reservationStartDate filter' }) + @ApiPropertyOptional({ + description: 'Start date reservationStartDate filter', + }) start_date: Date; @IsOptional() @@ -46,14 +51,13 @@ export class UnreservedDeviceGroupsFilterDTO { @ApiPropertyOptional({ description: 'SDG Benefit', enum: SDGBenefitsList, - isArray:true + isArray: true, }) sdgbenefit: string[]; @ApiPropertyOptional({ description: 'Reservation Active or Deactive', - enum:['All','Active','Deactive'], - + enum: ['All', 'Active', 'Deactive'], }) @IsOptional() reservationActive: string; @@ -64,7 +68,6 @@ export class UnreservedDeviceGroupsFilterDTO { // enum: OffTaker, // }) // SDG: OffTaker; - // @IsOptional() // @ApiPropertyOptional({ type: Boolean, description: 'Grid Interconnection' }) diff --git a/apps/drec-api/src/pods/device-group/dto/update-device.dto.ts b/apps/drec-api/src/pods/device-group/dto/update-device.dto.ts index 87d0922f6..9b678a7ef 100755 --- a/apps/drec-api/src/pods/device-group/dto/update-device.dto.ts +++ b/apps/drec-api/src/pods/device-group/dto/update-device.dto.ts @@ -1,5 +1,11 @@ -import { IsNotEmpty, IsString,IsDate,IsEnum ,IsOptional} from 'class-validator'; -import { ApiProperty,ApiPropertyOptional } from '@nestjs/swagger'; +import { + IsNotEmpty, + IsString, + IsDate, + IsEnum, + IsOptional, +} from 'class-validator'; +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { BuyerReservationCertificateGenerationFrequency } from '../../../models'; export class UpdateDeviceGroupDTO { @@ -13,25 +19,22 @@ export class NewUpdateDeviceGroupDTO { @IsString() @IsNotEmpty() name: string; - + @ApiProperty({ type: Number }) - targetCapacityInMegaWattHour:number; + targetCapacityInMegaWattHour: number; - // @ApiProperty({ type: Date }) // reservationStartDate:Date; - @ApiProperty({ type: Date }) - reservationEndDate:Date; - + reservationEndDate: Date; @ApiProperty({ type: Boolean }) - authorityToExceed:boolean; + authorityToExceed: boolean; @ApiPropertyOptional({ type: Date }) @IsOptional() - reservationExpiryDate:Date; + reservationExpiryDate: Date; // @ApiProperty() // @IsEnum(BuyerReservationCertificateGenerationFrequency) // frequency:BuyerReservationCertificateGenerationFrequency; diff --git a/apps/drec-api/src/pods/device-group/history_next_issuance_date_log.entity.ts b/apps/drec-api/src/pods/device-group/history_next_issuance_date_log.entity.ts index 2e41969f5..291a7b644 100755 --- a/apps/drec-api/src/pods/device-group/history_next_issuance_date_log.entity.ts +++ b/apps/drec-api/src/pods/device-group/history_next_issuance_date_log.entity.ts @@ -23,7 +23,7 @@ // @Entity('history_next_issuance_date_log') // // export class HistoryDeviceGroupNextIssueCertificate extends ExtendedBaseEntity { - + // // @PrimaryGeneratedColumn() // // id: number; @@ -49,7 +49,6 @@ // export class reservationEndDate - import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; import { @@ -59,13 +58,11 @@ import { IsBoolean, IsNumber, IsOptional, - IsDate + IsDate, } from 'class-validator'; - @Entity('history_next_issueance_log') export class HistoryDeviceGroupNextIssueCertificate extends ExtendedBaseEntity { - @PrimaryGeneratedColumn() id: number; @@ -90,5 +87,5 @@ export class HistoryDeviceGroupNextIssueCertificate extends ExtendedBaseEntity { @Column() @IsString() - status:string; + status: string; } diff --git a/apps/drec-api/src/pods/device/check_certificate_issue_date_log_for_device.entity.ts b/apps/drec-api/src/pods/device/check_certificate_issue_date_log_for_device.entity.ts index 1e3170dcf..8978ce28d 100755 --- a/apps/drec-api/src/pods/device/check_certificate_issue_date_log_for_device.entity.ts +++ b/apps/drec-api/src/pods/device/check_certificate_issue_date_log_for_device.entity.ts @@ -7,31 +7,30 @@ import { IsBoolean, IsNumber, IsOptional, - IsDate + IsDate, } from 'class-validator'; - @Entity('check_certificate_issue_date_log_for_device') export class CheckCertificateIssueDateLogForDeviceEntity extends ExtendedBaseEntity { @PrimaryGeneratedColumn() id: number; - @Column({ - type: 'timestamp', - precision: 3 + @Column({ + type: 'timestamp', + precision: 3, }) - certificate_issuance_startdate:Date; + certificate_issuance_startdate: Date; - @Column({ - type: 'timestamp', - precision: 3 + @Column({ + type: 'timestamp', + precision: 3, }) - certificate_issuance_enddate:Date; + certificate_issuance_enddate: Date; @Column() @IsNumber() readvalue_watthour: number; - + @Column() @IsString() status: string; @@ -39,15 +38,14 @@ export class CheckCertificateIssueDateLogForDeviceEntity extends ExtendedBaseEnt @Column() @IsString() externalId: string; - + @Column() @IsNumber() groupId: number | null; - + @Column() @IsString() - certificateTransactionUID:string - + certificateTransactionUID: string; @Column() @IsDate() @@ -56,4 +54,4 @@ export class CheckCertificateIssueDateLogForDeviceEntity extends ExtendedBaseEnt @Column() @IsDate() ongoing_end_date: string; -} \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/device/device.controller.ts b/apps/drec-api/src/pods/device/device.controller.ts index 2cc2910f8..3245c55e9 100755 --- a/apps/drec-api/src/pods/device/device.controller.ts +++ b/apps/drec-api/src/pods/device/device.controller.ts @@ -26,7 +26,7 @@ import { ApiSecurity, ApiTags, ApiQuery, - ApiBody + ApiBody, } from '@nestjs/swagger'; import { AuthGuard } from '@nestjs/passport'; import { plainToClass } from 'class-transformer'; @@ -40,13 +40,10 @@ import { DeviceGroupByDTO, GroupedDevicesDTO, } from './dto'; -import { - CSVBulkUploadDTO, - -} from '../device-group/dto'; +import { CSVBulkUploadDTO } from '../device-group/dto'; import { Role } from '../../utils/enums'; import { RolesGuard } from '../../guards/RolesGuard'; -import { PermissionGuard } from '../../guards/PermissionGuard' +import { PermissionGuard } from '../../guards/PermissionGuard'; import { ILoggedInUser } from '../../models'; import { CodeNameDTO } from './dto/code-name.dto'; import { ActiveUserGuard } from '../../guards'; @@ -56,23 +53,25 @@ import { DeviceGroupService } from '../device-group/device-group.service'; import { Permission } from '../permission/decorators/permission.decorator'; import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator'; import { CountrycodeService } from '../countrycode/countrycode.service'; -import { countryCodesList } from '../../models/country-code' +import { countryCodesList } from '../../models/country-code'; import { isValidUTCDateFormat } from '../../utils/checkForISOStringFormat'; import { DeviceGroup } from '../device-group/device-group.entity'; -import { DeviceCsvFileProcessingJobsEntity, StatusCSV } from '../device-group/device_csv_processing_jobs.entity'; +import { + DeviceCsvFileProcessingJobsEntity, + StatusCSV, +} from '../device-group/device_csv_processing_jobs.entity'; import { Device } from './device.entity'; import { OrganizationService } from '../organization/organization.service'; import { UserService } from '../user/user.service'; /** -* It is Controller of device with the endpoints of device operations. -*/ + * It is Controller of device with the endpoints of device operations. + */ @ApiTags('device') @ApiBearerAuth('access-token') @ApiSecurity('drec') @Controller('/device') export class DeviceController { - private readonly logger = new Logger(DeviceController.name); constructor( @@ -80,11 +79,11 @@ export class DeviceController { private readonly deviceService: DeviceService, private readonly organizationService: OrganizationService, private readonly userService: UserService, - ) { } + ) {} /** - * It is GET api to list all devices with paginatiion and fiteration by organization and filterationDto - */ + * It is GET api to list all devices with paginatiion and fiteration by organization and filterationDto + */ @Get() @UseGuards(AuthGuard('jwt'), ActiveUserGuard, RolesGuard, PermissionGuard) @Roles(Role.Admin) @@ -97,17 +96,21 @@ export class DeviceController { @Query(ValidationPipe) filterDto: FilterDTO, @Query('pagenumber') pagenumber: number | null, @Query('OrganizationId') OrgId: number | null, - )/*: Promise*/ { + ) /*: Promise*/ { this.logger.verbose(`With in getAll`); return this.deviceService.find(filterDto, pagenumber, OrgId); } /** - * It is GET api to list all devices for reservation - * @return {Array} return array of devices for reservation - */ + * It is GET api to list all devices for reservation + * @return {Array} return array of devices for reservation + */ @Get('/ungrouped/buyerreservation') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard, RolesGuard) + @UseGuards( + AuthGuard(['jwt', 'oauth2-client-password']), + PermissionGuard, + RolesGuard, + ) @Permission('Read') @ACLModules('DEVICE_MANAGEMENT_CRUDL') @Roles(Role.Buyer, Role.SubBuyer, Role.ApiUser) @@ -123,28 +126,38 @@ export class DeviceController { //@ts-ignore if (filterDto.organizationId) { //@ts-ignore - const organization = await this.organizationService.findOne(filterDto.organizationId); + const organization = await this.organizationService.findOne( + filterDto.organizationId, + ); const orguser = await this.userService.findByEmail(organization.orgEmail); if (role === Role.ApiUser) { if (organization.api_user_id != api_user_id) { - this.logger.error(`The requested organization is belongs to other apiuser`); + this.logger.error( + `The requested organization is belongs to other apiuser`, + ); throw new UnauthorizedException({ success: false, message: `The requested organization is belongs to other apiuser`, }); } - if (orguser.role === Role.OrganizationAdmin || orguser.role === Role.DeviceOwner) { - this.logger.error(`Unauthorized... The requested user is developer or device owner`); + if ( + orguser.role === Role.OrganizationAdmin || + orguser.role === Role.DeviceOwner + ) { + this.logger.error( + `Unauthorized... The requested user is developer or device owner`, + ); throw new UnauthorizedException({ success: false, message: `Unauthorized`, }); } - } - else { + } else { if (organizationId != organization.id) { - this.logger.error(`The requested organization is not same as user's organization`); + this.logger.error( + `The requested organization is not same as user's organization`, + ); throw new UnauthorizedException({ success: false, message: `The requested organization is not same as user's organization`, @@ -157,13 +170,17 @@ export class DeviceController { api_user_id = null; } - return this.deviceService.finddeviceForBuyer(filterDto, pagenumber, api_user_id); + return this.deviceService.finddeviceForBuyer( + filterDto, + pagenumber, + api_user_id, + ); } /** - * It is GET api to list all ungrouped devices with filteration - * @return {GroupedDevicesDTO} returns ungrouped devices - */ + * It is GET api to list all ungrouped devices with filteration + * @return {GroupedDevicesDTO} returns ungrouped devices + */ @Get('/ungrouped') @UseGuards(AuthGuard('jwt'), ActiveUserGuard, RolesGuard, PermissionGuard) @Roles(Role.Admin, Role.DeviceOwner) @@ -182,9 +199,9 @@ export class DeviceController { } /** - * It is GET to list all device code types in dropdown - * @returns {Array} - */ + * It is GET to list all device code types in dropdown + * @returns {Array} + */ @Get('/device-type') @ApiResponse({ status: HttpStatus.OK, @@ -221,7 +238,11 @@ export class DeviceController { * @returns {Array} */ @Get('/my') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), ActiveUserGuard, PermissionGuard) + @UseGuards( + AuthGuard(['jwt', 'oauth2-client-password']), + ActiveUserGuard, + PermissionGuard, + ) @Permission('Read') @ACLModules('DEVICE_MANAGEMENT_CRUDL') //@Roles(Role.OrganizationAdmin, Role.DeviceOwner) @@ -234,32 +255,45 @@ export class DeviceController { async getMyDevices( @Query(ValidationPipe) filterDto: FilterDTO, @UserDecorator() { organizationId, api_user_id, role }: ILoggedInUser, - @Query('pagenumber') pagenumber: number | null - )/*: Promise*/ { + @Query('pagenumber') pagenumber: number | null, + ) /*: Promise*/ { this.logger.verbose(`With in getMyDevices`); if (filterDto.country) { filterDto.country = filterDto.country.toUpperCase(); - if (filterDto.country && typeof filterDto.country === "string" && filterDto.country.length === 3) { + if ( + filterDto.country && + typeof filterDto.country === 'string' && + filterDto.country.length === 3 + ) { let countries = countryCodesList; - if (countries.find(ele => ele.countryCode === filterDto.country) === undefined) { - this.logger.error(`Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`); + if ( + countries.find((ele) => ele.countryCode === filterDto.country) === + undefined + ) { + this.logger.error( + `Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', + message: + ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', }), ); }); } } else { - this.logger.error(`Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`); + this.logger.error( + `Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', + message: + ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', }), ); }); @@ -269,42 +303,54 @@ export class DeviceController { if (filterDto.organizationId) { if (role === Role.ApiUser) { //@ts-ignore - const organization = await this.organizationService.findOne(filterDto.organizationId); - const orguser = await this.userService.findByEmail(organization.orgEmail); + const organization = await this.organizationService.findOne( + filterDto.organizationId, + ); + const orguser = await this.userService.findByEmail( + organization.orgEmail, + ); if (organization.api_user_id != api_user_id) { - this.logger.error(`The organization Id in param is belongs to other apiuser`); + this.logger.error( + `The organization Id in param is belongs to other apiuser`, + ); throw new UnauthorizedException({ success: false, message: 'The organization Id in param is belongs to other apiuser', - }) + }); } else { if (orguser.role != Role.OrganizationAdmin) { this.logger.error(`Unauthorized`); throw new UnauthorizedException({ success: false, message: 'Unauthorized', - }) + }); } } - } - else { + } else { //@ts-ignore if (filterDto.organizationId != organizationId) { - this.logger.error(`The organization Id in param should be same as user's organization`); + this.logger.error( + `The organization Id in param should be same as user's organization`, + ); throw new UnauthorizedException({ success: false, message: `The organization Id in param should be same as user's organization`, - }) + }); } } //@ts-ignore organizationId = filterDto.organizationId; - } - this.logger.log("In devices before calling service"); - return await this.deviceService.getOrganizationDevices(organizationId, api_user_id, role, filterDto, pagenumber); + this.logger.log('In devices before calling service'); + return await this.deviceService.getOrganizationDevices( + organizationId, + api_user_id, + role, + filterDto, + pagenumber, + ); } /** @@ -313,7 +359,11 @@ export class DeviceController { * @returns {DeviceDTO | null} DeviceDto for success response and null when there is no device found by the id */ @Get('/:id') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), ActiveUserGuard, PermissionGuard) + @UseGuards( + AuthGuard(['jwt', 'oauth2-client-password']), + ActiveUserGuard, + PermissionGuard, + ) @Permission('Read') @ACLModules('DEVICE_MANAGEMENT_CRUDL') //@Roles(Role.Admin) @@ -323,7 +373,8 @@ export class DeviceController { @ApiNotFoundResponse({ description: `The device with the code doesn't exist`, }) - async get(@Param('id') id: number, + async get( + @Param('id') id: number, @Query('apiUserId') api_user_id: string | null, @Query('organizationId') organizationId: number | null, ): Promise { @@ -333,22 +384,21 @@ export class DeviceController { devicedata = await this.deviceService.findOne(id, { where: { api_user_id: api_user_id, - organizationId: organizationId - } + organizationId: organizationId, + }, }); - } - else { + } else { devicedata = await this.deviceService.findOne(id); } devicedata.externalId = devicedata.developerExternalId; - delete devicedata["developerExternalId"]; - return devicedata + delete devicedata['developerExternalId']; + return devicedata; } /** * It is GET api to fetch an device by externalId in param - * @param id is externalId in device - * @param param1 + * @param id is externalId in device + * @param param1 * @returns {DeviceDTO | null} DeviceDto for success response and null when there is no device found by the id */ @Get('externalId/:id') @@ -359,13 +409,17 @@ export class DeviceController { @ApiNotFoundResponse({ description: `The device with the code doesn't exist`, }) - async getByExternalId(@Param('id') id: string, + async getByExternalId( + @Param('id') id: string, @UserDecorator() { organizationId }: ILoggedInUser, ): Promise { this.logger.verbose(`With in getByExternalId`); - const devicedata = await this.deviceService.findDeviceByDeveloperExternalId(id, organizationId); + const devicedata = await this.deviceService.findDeviceByDeveloperExternalId( + id, + organizationId, + ); devicedata.externalId = devicedata.developerExternalId; - delete devicedata["developerExternalId"]; + delete devicedata['developerExternalId']; return devicedata; } @@ -376,7 +430,7 @@ export class DeviceController { * @returns {DeviceDTO} */ @Post() - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) @Permission('Write') @ACLModules('DEVICE_MANAGEMENT_CRUDL') //@Roles(Role.Admin, Role.DeviceOwner, Role.OrganizationAdmin) @@ -391,38 +445,45 @@ export class DeviceController { ): Promise { this.logger.verbose(`With in create`); deviceToRegister.externalId = deviceToRegister.externalId.trim(); - if (deviceToRegister.externalId.trim() === "") { + if (deviceToRegister.externalId.trim() === '') { this.logger.error(`externalId should not be empty`); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: `externalId should not be empty`, - }) + }), ); }); } - if (!isValidUTCDateFormat(deviceToRegister.commissioningDate)) { - this.logger.error(`Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`); + this.logger.error( + `Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + message: + ' Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', }), ); }); } - if (new Date(deviceToRegister.commissioningDate).getTime() > new Date().getTime()) { - this.logger.error(`Invalid commissioning date, commissioning is greater than current date`); + if ( + new Date(deviceToRegister.commissioningDate).getTime() > + new Date().getTime() + ) { + this.logger.error( + `Invalid commissioning date, commissioning is greater than current date`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: ` Invalid commissioning date, commissioning is greater than current date`, - }) + }), ); }); } @@ -430,26 +491,40 @@ export class DeviceController { deviceToRegister['groupId'] = null; } deviceToRegister.countryCode = deviceToRegister.countryCode.toUpperCase(); - if (deviceToRegister.countryCode && typeof deviceToRegister.countryCode === "string" && deviceToRegister.countryCode.length === 3) { + if ( + deviceToRegister.countryCode && + typeof deviceToRegister.countryCode === 'string' && + deviceToRegister.countryCode.length === 3 + ) { let countries = countryCodesList; - if (countries.find(ele => ele.countryCode === deviceToRegister.countryCode) === undefined) { - this.logger.error(`Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`); + if ( + countries.find( + (ele) => ele.countryCode === deviceToRegister.countryCode, + ) === undefined + ) { + this.logger.error( + `Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', + message: + ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', }), ); }); } } else { - this.logger.error(`Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`); + this.logger.error( + `Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', + message: + ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', }), ); }); @@ -465,30 +540,41 @@ export class DeviceController { ); }); } - if (deviceToRegister.capacity <= 0 || deviceToRegister.energyStorageCapacity < 0) { - this.logger.error(`Invalid Capacity or energy Storage Capacity, it should be greater than 0`); + if ( + deviceToRegister.capacity <= 0 || + deviceToRegister.energyStorageCapacity < 0 + ) { + this.logger.error( + `Invalid Capacity or energy Storage Capacity, it should be greater than 0`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid Capacity or energy Storage Capacity, it should be greater than 0', + message: + ' Invalid Capacity or energy Storage Capacity, it should be greater than 0', }), ); }); } - if (deviceToRegister.version === null || deviceToRegister.version === undefined || deviceToRegister.version === '0') { + if ( + deviceToRegister.version === null || + deviceToRegister.version === undefined || + deviceToRegister.version === '0' + ) { deviceToRegister.version = '1.0'; } - if (role === Role.Admin||role === Role.ApiUser) { + if (role === Role.Admin || role === Role.ApiUser) { //@ts-ignore if (deviceToRegister.organizationId) { - this.logger.debug("Line No: 314"); + this.logger.debug('Line No: 314'); //@ts-ignore - organizationId = deviceToRegister.organizationId + organizationId = deviceToRegister.organizationId; } else { - this.logger.error(`Organization id is required,please add your developer's Organization`); + this.logger.error( + `Organization id is required,please add your developer's Organization`, + ); return new Promise((resolve, reject) => { - reject( new ConflictException({ success: false, @@ -498,8 +584,12 @@ export class DeviceController { }); } } - return await this.deviceService.register(organizationId, deviceToRegister, api_user_id, role); - + return await this.deviceService.register( + organizationId, + deviceToRegister, + api_user_id, + role, + ); } /** @@ -528,31 +618,34 @@ export class DeviceController { if (deviceToUpdate.externalId) { deviceToUpdate.externalId = deviceToUpdate.externalId.trim(); - if (deviceToUpdate.externalId === "") { + if (deviceToUpdate.externalId === '') { this.logger.error(`externalId should not be empty`); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: `externalId should not be empty`, - }) + }), ); }); } - const checkexternalid = await this.deviceService.findDeviceByDeveloperExternalId( - deviceToUpdate.externalId, - user.organizationId - ); - if (checkexternalid != undefined && checkexternalid.developerExternalId === externalId.trim()) { - this.logger.log("Line No: 236"); + const checkexternalid = + await this.deviceService.findDeviceByDeveloperExternalId( + deviceToUpdate.externalId, + user.organizationId, + ); + if ( + checkexternalid != undefined && + checkexternalid.developerExternalId === externalId.trim() + ) { + this.logger.log('Line No: 236'); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: `ExternalId already exist in this organization, can't update with same external id ${deviceToUpdate.externalId}`, - - }) + }), ); }); } @@ -560,33 +653,46 @@ export class DeviceController { if (deviceToUpdate.countryCode != undefined) { deviceToUpdate.countryCode = deviceToUpdate.countryCode.toUpperCase(); - if (deviceToUpdate.countryCode && typeof deviceToUpdate.countryCode === "string" && deviceToUpdate.countryCode.length === 3) { + if ( + deviceToUpdate.countryCode && + typeof deviceToUpdate.countryCode === 'string' && + deviceToUpdate.countryCode.length === 3 + ) { let countries = countryCodesList; - if (countries.find(ele => ele.countryCode === deviceToUpdate.countryCode) === undefined) { - this.logger.error(`Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`); + if ( + countries.find( + (ele) => ele.countryCode === deviceToUpdate.countryCode, + ) === undefined + ) { + this.logger.error( + `Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', + message: + ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', }), ); }); } } else { - this.logger.error(`Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`); + this.logger.error( + `Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', + message: + ' Invalid countryCode, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', }), ); }); } } - if (deviceToUpdate.capacity <= 0) { this.logger.error(`Invalid Capacity, it should be greater than 0`); return new Promise((resolve, reject) => { @@ -600,52 +706,80 @@ export class DeviceController { } // var commissioningDate = moment(deviceToUpdate.commissioningDate); - if (!isValidUTCDateFormat(deviceToUpdate.commissioningDate) && deviceToUpdate.commissioningDate !== undefined) { - this.logger.error(`Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`); + if ( + !isValidUTCDateFormat(deviceToUpdate.commissioningDate) && + deviceToUpdate.commissioningDate !== undefined + ) { + this.logger.error( + `Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + message: + ' Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', }), ); }); } - if (new Date(deviceToUpdate.commissioningDate).getTime() > new Date().getTime()) { - this.logger.error(`Invalid commissioning date, commissioning is greater than current date`); + if ( + new Date(deviceToUpdate.commissioningDate).getTime() > + new Date().getTime() + ) { + this.logger.error( + `Invalid commissioning date, commissioning is greater than current date`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: ` Invalid commissioning date, commissioning is greater than current date`, - }) + }), ); }); } if (deviceToUpdate.commissioningDate) { - const checkexternalid = await this.deviceService.findDeviceByDeveloperExternalId( - externalId, - user.organizationId - ); - const noOfHistRead: number = await this.deviceService.getNumberOfHistReads(checkexternalid.externalId); - const noOfOnGoingRead: number = await this.deviceService.getNumberOfOngReads(checkexternalid.externalId, checkexternalid.createdAt); + const checkexternalid = + await this.deviceService.findDeviceByDeveloperExternalId( + externalId, + user.organizationId, + ); + const noOfHistRead: number = + await this.deviceService.getNumberOfHistReads( + checkexternalid.externalId, + ); + const noOfOnGoingRead: number = + await this.deviceService.getNumberOfOngReads( + checkexternalid.externalId, + checkexternalid.createdAt, + ); - if (deviceToUpdate.commissioningDate != checkexternalid.commissioningDate) { + if ( + deviceToUpdate.commissioningDate != checkexternalid.commissioningDate + ) { if (noOfHistRead > 0 || noOfOnGoingRead > 0) { - this.logger.error(`Commissioning date cannot be changed due to existing meter reads available for ${checkexternalid.developerExternalId}`); + this.logger.error( + `Commissioning date cannot be changed due to existing meter reads available for ${checkexternalid.developerExternalId}`, + ); throw new ConflictException({ success: false, message: ` Commissioning date cannot be changed due to existing meter reads available for ${checkexternalid.developerExternalId}`, - }) + }); } - if (new Date(deviceToUpdate.commissioningDate).getTime() > new Date(checkexternalid.createdAt).getTime()) { - this.logger.error(`Invalid commissioning date, commissioning is greater than device onboarding date`); + if ( + new Date(deviceToUpdate.commissioningDate).getTime() > + new Date(checkexternalid.createdAt).getTime() + ) { + this.logger.error( + `Invalid commissioning date, commissioning is greater than device onboarding date`, + ); throw new ConflictException({ success: false, - message: `Invalid commissioning date, commissioning is greater than device onboarding date` - }) + message: `Invalid commissioning date, commissioning is greater than device onboarding date`, + }); } } } @@ -678,23 +812,21 @@ export class DeviceController { @UserDecorator() { organizationId, role }: ILoggedInUser, ): Promise { this.logger.verbose(`With in remove`); - const checkisungroup = this.deviceService.findUngroupedById(id) + const checkisungroup = this.deviceService.findUngroupedById(id); if (checkisungroup) { let fitlerop: any; if (role === 'Admin') { fitlerop = { - groupId: null - } + groupId: null, + }; } else { fitlerop = { groupId: null, - organizationId: organizationId - } + organizationId: organizationId, + }; } return await this.deviceService.remove(id, fitlerop); - } - } /** @@ -719,7 +851,6 @@ export class DeviceController { return await this.deviceService.getOrganizationDevicesTotal(organizationId); } - /** * It is PUT api tp update the device onboarding date by deviceId * @param param0 is getting organizationId from user request @@ -735,35 +866,47 @@ export class DeviceController { status: HttpStatus.OK, description: "change the device's OnBoarding date", }) - @ApiQuery({ name: 'deviceId', description: 'Device Id' }) - @ApiQuery({ name: 'givenDate', description: 'Update the OnBoarding date', type: Date, }) + @ApiQuery({ + name: 'givenDate', + description: 'Update the OnBoarding date', + type: Date, + }) async changeOnBoardingDate( @UserDecorator() { organizationId }: ILoggedInUser, @Query('deviceId') deviceId, - @Query('givenDate') givenDate + @Query('givenDate') givenDate, ) { this.logger.verbose(`With in changeOnBoardingDate`); if (process.env.MODE != 'dev') { this.logger.error(`Currently not in dev environment`); - throw new HttpException("Currently not in dev environment", 400) + throw new HttpException('Currently not in dev environment', 400); } - let device: DeviceDTO | null = await this.deviceService.findDeviceByDeveloperExternalId(deviceId, organizationId); - this.logger.debug("THE DEVICE FROM ExTERNALID IS::::::::::::" + device.externalId); + let device: DeviceDTO | null = + await this.deviceService.findDeviceByDeveloperExternalId( + deviceId, + organizationId, + ); + this.logger.debug( + 'THE DEVICE FROM ExTERNALID IS::::::::::::' + device.externalId, + ); if (!device) { this.logger.error(`Device dosen't exist`); throw new HttpException("Device dosen't exist", 400); } const deviceExternalId = device.externalId; const deviceOnboardedDate = device.createdAt; - return this.deviceService.changeDeviceCreatedAt(deviceExternalId, deviceOnboardedDate, givenDate); + return this.deviceService.changeDeviceCreatedAt( + deviceExternalId, + deviceOnboardedDate, + givenDate, + ); } /* */ ////////////////////////////////////////////////// - // @Get('/autocomplete') // @UseGuards(AuthGuard('jwt'), ActiveUserGuard, PermissionGuard) // @Permission('Read') @@ -800,13 +943,10 @@ export class DeviceController { status: HttpStatus.OK, description: 'Returns Auto-Complete', }) - @ApiQuery({ name: 'externalId', description: 'externalId', type: String }) - async autocomplete( @UserDecorator() { organizationId }: ILoggedInUser, @Query('externalId') externalId: String, - ) { this.logger.verbose(`With in autocomplete`); return await this.deviceService.atto(organizationId, externalId); @@ -816,7 +956,7 @@ export class DeviceController { * It is GET api to fetch the certified device records with in the range of date * @param user is loggedIn user at request * @param externalId is unique identifier of device - * @param groupuId + * @param groupuId * @returns {any} */ @Get('/certifiedlog/first&lastdate') @@ -833,54 +973,72 @@ export class DeviceController { @UserDecorator() user: ILoggedInUser, @Query('groupUid') groupuId: string, @Query('pagenumber') pagenumber: number, - @Query('externalId') externalId?: number + @Query('externalId') externalId?: number, ): Promise { // console.log(externalId); // console.log(groupuId) this.logger.verbose(`With in certifiedlogdaterang`); - const regexExp = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/; + const regexExp = + /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/; if (groupuId === null || !regexExp.test(groupuId)) { - this.logger.error(`Please Add the valid UID ,invalid group uid value was sent`); + this.logger.error( + `Please Add the valid UID ,invalid group uid value was sent`, + ); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: ' Please Add the valid UID ,invalid group uid value was sent', - })) - }) + reject( + new ConflictException({ + success: false, + message: + ' Please Add the valid UID ,invalid group uid value was sent', + }), + ); + }); } - - let group: DeviceGroup | null - group = await this.deviceGroupService.findOne({ devicegroup_uid: groupuId }) + let group: DeviceGroup | null; + group = await this.deviceGroupService.findOne({ + devicegroup_uid: groupuId, + }); // console.log(group); if (group === null || group.buyerId != user.id) { - this.logger.error(`Group UId is not of this buyer, invalid value was sent`); + this.logger.error( + `Group UId is not of this buyer, invalid value was sent`, + ); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: 'Group UId is not of this buyer, invalid value was sent', - })) - }) + reject( + new ConflictException({ + success: false, + message: 'Group UId is not of this buyer, invalid value was sent', + }), + ); + }); } if (externalId != null || externalId != undefined) { - let device: DeviceDTO | null + let device: DeviceDTO | null; device = await this.deviceService.findOne(externalId); /// console.log(device); if (device === null) { this.logger.error(`device not found, invalid value was sent`); return new Promise((resolve, reject) => { - reject(new ConflictException({ - success: false, - message: 'device not found, invalid value was sent', - })) - }) + reject( + new ConflictException({ + success: false, + message: 'device not found, invalid value was sent', + }), + ); + }); } - return await this.deviceService.getcertifieddevicedaterange(device, group.id); + return await this.deviceService.getcertifieddevicedaterange( + device, + group.id, + ); } else { - return await this.deviceService.getcertifieddevicedaterangeBygroupid(group.id, pagenumber); + return await this.deviceService.getcertifieddevicedaterangeBygroupid( + group.id, + pagenumber, + ); } - } // @Get('/certified/date-range-log') // @UseGuards(AuthGuard('jwt')) @@ -894,14 +1052,14 @@ export class DeviceController { // } ///////////////////////////////////////////////// /** - * It is POST api to create array of devices by uploading csv files with device data + * It is POST api to create array of devices by uploading csv files with device data * @param user is loggedIn user from request * @param organizationId is organization unique identifier with number type to map with the respective organization * @param fileToProcess is parsed data of uploaded csv file * @returns {DeviceCsvFileProcessingJobsEntity} */ @Post('addByAdmin/process-creation-bulk-devices-csv/:organizationId') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) //@UseGuards(AuthGuard('jwt'), PermissionGuard) @Permission('Write') @ACLModules('DEVICE_BULK_MANAGEMENT_CRUDL') @@ -912,18 +1070,18 @@ export class DeviceController { description: 'Returns created devices from csv', }) @ApiBody({ type: CSVBulkUploadDTO }) - public async processCreationBulkFromCSV - (@UserDecorator() user: ILoggedInUser, - @Param('organizationId') organizationId: number | null, - @Body() fileToProcess: CSVBulkUploadDTO): Promise { + public async processCreationBulkFromCSV( + @UserDecorator() user: ILoggedInUser, + @Param('organizationId') organizationId: number | null, + @Body() fileToProcess: CSVBulkUploadDTO, + ): Promise { this.logger.verbose(`With in processCreationBulkFromCSV`); if (organizationId === null || organizationId === undefined) { this.logger.error(`User needs to have organization added`); throw new ConflictException({ success: false, - message: - 'User needs to have organization added' - }) + message: 'User needs to have organization added', + }); } if (fileToProcess.fileName == undefined) { @@ -931,31 +1089,30 @@ export class DeviceController { //throw new Error("file not found"); throw new ConflictException({ success: false, - message: - 'File Not Found' - }) - + message: 'File Not Found', + }); } if (!fileToProcess.fileName.endsWith('.csv')) { this.logger.error(`Invalid file`); //throw new Error("file not found"); throw new ConflictException({ success: false, - message: - 'Invalid file' - }) - + message: 'Invalid file', + }); } let jobCreated: any; if (user.role === Role.ApiUser) { - const organization = await this.organizationService.findOne(organizationId); + const organization = + await this.organizationService.findOne(organizationId); const orguser = await this.userService.findByEmail(organization.orgEmail); if (organization.api_user_id != user.api_user_id) { - this.logger.error(`The requested organization is belongs to other apiuser`); + this.logger.error( + `The requested organization is belongs to other apiuser`, + ); throw new BadRequestException({ success: false, - message: 'The requested organization is belongs to other apiuser' + message: 'The requested organization is belongs to other apiuser', }); } @@ -963,19 +1120,28 @@ export class DeviceController { this.logger.error(`Unauthorized`); throw new UnauthorizedException({ success: false, - message: 'Unauthorized' + message: 'Unauthorized', }); } - jobCreated = await this.deviceGroupService.createCSVJobForFile(user.id, organizationId, StatusCSV.Added, fileToProcess.fileName, user.api_user_id); - } - else { - jobCreated = await this.deviceGroupService.createCSVJobForFile(user.id, organizationId, StatusCSV.Added, fileToProcess.fileName); + jobCreated = await this.deviceGroupService.createCSVJobForFile( + user.id, + organizationId, + StatusCSV.Added, + fileToProcess.fileName, + user.api_user_id, + ); + } else { + jobCreated = await this.deviceGroupService.createCSVJobForFile( + user.id, + organizationId, + StatusCSV.Added, + fileToProcess.fileName, + ); } //let jobCreated = await this.deviceGroupService.createCSVJobForFile(user.id, organizationId, StatusCSV.Added, response.filename); return jobCreated; } - -} \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/device/device.entity.ts b/apps/drec-api/src/pods/device/device.entity.ts index e7dc3a0d5..934191c39 100755 --- a/apps/drec-api/src/pods/device/device.entity.ts +++ b/apps/drec-api/src/pods/device/device.entity.ts @@ -1,5 +1,12 @@ import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; -import { Column, Entity, PrimaryGeneratedColumn,BeforeUpdate,ManyToOne, JoinColumn } from 'typeorm'; +import { + Column, + Entity, + PrimaryGeneratedColumn, + BeforeUpdate, + ManyToOne, + JoinColumn, +} from 'typeorm'; import { DeviceStatus, Installation, @@ -8,14 +15,19 @@ import { Sector, StandardCompliance, FuelCode, - DevicetypeCode + DevicetypeCode, } from '../../utils/enums'; import { - IsEnum, IsBoolean,IsString, IsNotEmpty, IsNumber,IsArray + IsEnum, + IsBoolean, + IsString, + IsNotEmpty, + IsNumber, + IsArray, } from 'class-validator'; import { Exclude } from 'class-transformer'; import { DeviceDescription, IDevice } from '../../models'; -import {Organization} from '../organization/organization.entity' +import { Organization } from '../organization/organization.entity'; @Entity() export class Device extends ExtendedBaseEntity implements IDevice { constructor(device: Partial) { @@ -44,7 +56,7 @@ export class Device extends ExtendedBaseEntity implements IDevice { organizationId: number; @ManyToOne(() => Organization, { eager: true }) // Make sure you have the correct type for Organization @JoinColumn({ name: 'organizationId' }) // Make sure the column name matches your database schema - organization: Organization; + organization: Organization; @Column({ nullable: true }) @IsString() @@ -74,7 +86,6 @@ export class Device extends ExtendedBaseEntity implements IDevice { @IsEnum(FuelCode) fuelCode: FuelCode; - @Column({ nullable: true }) @IsEnum(DevicetypeCode) deviceTypeCode: DevicetypeCode; @@ -91,7 +102,6 @@ export class Device extends ExtendedBaseEntity implements IDevice { @IsArray() SDGBenefits?: string[]; - @Column({ nullable: true }) @IsString() commissioningDate: string; @@ -154,10 +164,10 @@ export class Device extends ExtendedBaseEntity implements IDevice { @Column({ type: 'varchar', nullable: true }) qualityLabels: string; - @Column({ type: 'varchar', nullable: true}) + @Column({ type: 'varchar', nullable: true }) meterReadtype: string; - @Column({ type: 'varchar', nullable: true}) + @Column({ type: 'varchar', nullable: true }) timezone: string; @Column() @@ -180,6 +190,6 @@ export class Device extends ExtendedBaseEntity implements IDevice { // this.updatedAt = new Date(); // Set the updatedAt field to the current date and time // } - @Column({ nullable: true}) - api_user_id : string; + @Column({ nullable: true }) + api_user_id: string; } diff --git a/apps/drec-api/src/pods/device/device.module.ts b/apps/drec-api/src/pods/device/device.module.ts index fa7bc65e4..7129fda11 100755 --- a/apps/drec-api/src/pods/device/device.module.ts +++ b/apps/drec-api/src/pods/device/device.module.ts @@ -3,15 +3,15 @@ import { TypeOrmModule } from '@nestjs/typeorm'; import { DeviceGroupModule } from '../device-group/device-group.module'; import { DeviceController } from './device.controller'; import { Device } from './device.entity'; -import { ACLModulePermissions } from '../permission/permission.entity' +import { ACLModulePermissions } from '../permission/permission.entity'; import { DeviceService } from './device.service'; import { PermissionService } from '../permission/permission.service'; -import { CheckCertificateIssueDateLogForDeviceEntity } from './check_certificate_issue_date_log_for_device.entity' -import { CountrycodeModule } from '../countrycode/countrycode.module' +import { CheckCertificateIssueDateLogForDeviceEntity } from './check_certificate_issue_date_log_for_device.entity'; +import { CountrycodeModule } from '../countrycode/countrycode.module'; import { HistoryIntermediate_MeterRead } from '../reads/history_intermideate_meterread.entity'; import { APP_INTERCEPTOR } from '@nestjs/core'; import { IrecDevicesInformationEntity } from './irec_devices_information.entity'; -import { IrecErrorLogInformationEntity } from './irec_error_log_information.entity' +import { IrecErrorLogInformationEntity } from './irec_error_log_information.entity'; import { UserModule } from '../user/user.module'; import { OrganizationModule } from '../organization/organization.module'; import { DeviceLateongoingIssueCertificateEntity } from './device_lateongoing_certificate.entity'; @@ -20,20 +20,20 @@ import { DeviceLateongoingIssueCertificateEntity } from './device_lateongoing_ce forwardRef(() => DeviceGroupModule), CountrycodeModule, HttpModule, - TypeOrmModule.forFeature([Device, ACLModulePermissions, + TypeOrmModule.forFeature([ + Device, + ACLModulePermissions, CheckCertificateIssueDateLogForDeviceEntity, HistoryIntermediate_MeterRead, IrecDevicesInformationEntity, IrecErrorLogInformationEntity, - DeviceLateongoingIssueCertificateEntity - + DeviceLateongoingIssueCertificateEntity, ]), UserModule, - OrganizationModule + OrganizationModule, ], providers: [DeviceService], exports: [DeviceService], controllers: [DeviceController], - }) -export class DeviceModule { } +export class DeviceModule {} diff --git a/apps/drec-api/src/pods/device/device.service.spec.ts b/apps/drec-api/src/pods/device/device.service.spec.ts index 8e56e645e..34f6f7ef3 100644 --- a/apps/drec-api/src/pods/device/device.service.spec.ts +++ b/apps/drec-api/src/pods/device/device.service.spec.ts @@ -1,1039 +1,1065 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { DeviceService } from './device.service'; -import { Repository, FindManyOptions } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { HistoryIntermediate_MeterRead } from '../reads/history_intermideate_meterread.entity'; -import { Device } from './device.entity'; -import { CheckCertificateIssueDateLogForDeviceEntity } from './check_certificate_issue_date_log_for_device.entity'; -import { HttpService, UnauthorizedException, ConflictException } from '@nestjs/common'; -import { IrecDevicesInformationEntity } from './irec_devices_information.entity'; -import { IrecErrorLogInformationEntity } from './irec_error_log_information.entity'; -import { OrganizationService } from '../organization/organization.service'; -import { UserService } from '../user/user.service'; -import { Role } from '../../utils/enums/role.enum'; -import { FilterDTO, NewDeviceDTO } from './dto'; -import { DevicetypeCode, FuelCode, OffTaker, OrganizationStatus } from '../../utils/enums'; -import { DeviceDescription } from '../../models'; -import { Organization } from '../organization/organization.entity'; - -describe('DeviceService', () => { - let service: DeviceService; - let historyrepository: Repository; - let repository: Repository; - let checkdevcielogcertificaterepository: Repository; - let httpService: HttpService; - let irecinforepository: Repository; - let irecerrorlogrepository: Repository; - let organizationService: OrganizationService; - let userService: UserService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [DeviceService, - { - provide: getRepositoryToken(Device), - useClass: Repository, - useValue: { - findOne: jest.fn(), - save: jest.fn(), - } as any, - }, - { - provide: getRepositoryToken(HistoryIntermediate_MeterRead), - useClass: Repository, - }, - { - provide: getRepositoryToken(CheckCertificateIssueDateLogForDeviceEntity), - useClass: Repository, - }, - { - provide: HttpService, - useValue: {} as any, - }, - { - provide: getRepositoryToken(IrecDevicesInformationEntity), - useClass: Repository, - }, - { - provide: getRepositoryToken(IrecErrorLogInformationEntity), - useClass: Repository, - }, - { - provide: OrganizationService, - useValue: {} as any, - }, - { - provide: UserService, - useValue: {} as any, - }, - ], - }).compile(); - - service = module.get(DeviceService); - repository = module.get>(getRepositoryToken(Device)); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); - - describe('register', ()=> { - it('should register a new device with valid inputs', async () => { - const orgCode = 3; - const newDevice : NewDeviceDTO = { - externalId: 'ExternalId1', - projectName: 'sampleProject', - address: 'Bangalore', - latitude: '23.65362', - longitude: '25.43647', - //@ts-ignore - countryCodename: 'India', - fuelCode: FuelCode.ES100,//'ES100', - deviceTypeCode: DevicetypeCode.TC110,//'TC110', - capacity: 2500, - commissioningDate: '2024-02-01T06:59:11.000Z', - gridInterconnection: true, - offTaker: OffTaker.School,//'School', - impactStory: null, - data: null, - images: null, - deviceDescription: DeviceDescription.SolarLantern,//'Solar Lantern', - energyStorage: true, - energyStorageCapacity: 900, - qualityLabels: null, - SDGBenefits: [ 'SDG1' ], - version: '1.0', - countryCode: 'IND' - }; - const apiUserId = 'a8b6366e-ea5f-4ed7-8e9d-c5ae71c2d909'; - const role = Role.OrganizationAdmin; -/* - const organizationEntity = { - id: 1, - name: 'orgName', - //@ts-ignore - organizationType: Role.OrganizationAdmin, - //@ts-ignore - orgEmail: 'testsweya@gmail.com', - address: 'Chennai', - zipCode: '600001', - city: 'Chennai', - country: 'India', - blockchainAccountAddress: 'null', - blockchainAccountSignedMessage: 'null', - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: apiUserId, - } as Organization; -*/ - const deviceEntity = { - externalId: 'ExternalId1', - projectName: 'sampleProject', - address: 'Bangalore', - latitude: '23.65362', - longitude: '25.43647', - countryCodename: 'India', - fuelCode: 'ES100', - deviceTypeCode: 'TC110', - capacity: 2500, - commissioningDate: '2024-02-01T06:59:11.000Z', - gridInterconnection: true, - offTaker: 'School', - impactStory: null, - data: null, - images: null, - deviceDescription: 'Solar Lantern', - energyStorage: true, - energyStorageCapacity: 900, - qualityLabels: null, - SDGBenefits: [ 'No Poverty' ], - version: '1.0', - countryCode: 'IND', - organizationId: 3, - groupId: null, - meterReadtype: null, - timezone: null, - IREC_Status: null, - IREC_ID: null, - api_user_id: null, - createdAt: '2024-02-27T07:00:32.963Z', - updatedAt: '2024-02-27T07:00:32.963Z', - id: 44, - yieldValue: 1500 - }; - - jest.spyOn(repository, 'findOne').mockReturnValue(undefined); - const saveSpy = jest.spyOn(repository, 'save').mockResolvedValue(deviceEntity as any); - - const result = await service.register(orgCode, newDevice); - - const options = { - where: { - developerExternalId: newDevice.externalId, - organizationId: orgCode, - }, - }; - console.log("Result with in test file:",result); - expect(saveSpy).toHaveBeenCalledWith(expect.objectContaining(newDevice)); - expect(result).toEqual(deviceEntity); - }); - - it('should reject registration with existing external ID', async () => { - const orgCode = 3; - const newDevice : NewDeviceDTO = { - externalId: 'ExternalId1', - projectName: 'sampleProject', - address: 'Bangalore', - latitude: '23.65362', - longitude: '25.43647', - //@ts-ignore - countryCodename: 'India', - fuelCode: FuelCode.ES100,//'ES100', - deviceTypeCode: DevicetypeCode.TC110,//'TC110', - capacity: 2500, - commissioningDate: '2024-02-01T06:59:11.000Z', - gridInterconnection: true, - offTaker: OffTaker.School,//'School', - impactStory: null, - data: null, - images: null, - deviceDescription: DeviceDescription.SolarLantern,//'Solar Lantern', - energyStorage: true, - energyStorageCapacity: 900, - qualityLabels: null, - SDGBenefits: [ 'SDG1' ], - version: '1.0', - countryCode: 'IND' - }; - const apiUserId = 'a8b6366e-ea5f-4ed7-8e9d-c5ae71c2d909'; - const role = Role.OrganizationAdmin; -/* - const organizationEntity = { - id: 1, - name: 'orgName', - //@ts-ignore - organizationType: Role.OrganizationAdmin, - //@ts-ignore - orgEmail: 'testsweya@gmail.com', - address: 'Chennai', - zipCode: '600001', - city: 'Chennai', - country: 'India', - blockchainAccountAddress: 'null', - blockchainAccountSignedMessage: 'null', - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: apiUserId, - } as Organization; -*/ - const deviceEntity = { - externalId: 'ExternalId1', - projectName: 'sampleProject', - address: 'Bangalore', - latitude: '23.65362', - longitude: '25.43647', - countryCodename: 'India', - fuelCode: 'ES100', - deviceTypeCode: 'TC110', - capacity: 2500, - commissioningDate: '2024-02-01T06:59:11.000Z', - gridInterconnection: true, - offTaker: 'School', - impactStory: null, - data: null, - images: null, - deviceDescription: 'Solar Lantern', - energyStorage: true, - energyStorageCapacity: 900, - qualityLabels: null, - SDGBenefits: [ 'No Poverty' ], - version: '1.0', - countryCode: 'IND', - organizationId: 3, - groupId: null, - meterReadtype: null, - timezone: null, - IREC_Status: null, - IREC_ID: null, - api_user_id: null, - createdAt: '2024-02-27T07:00:32.963Z', - updatedAt: '2024-02-27T07:00:32.963Z', - id: 44, - yieldValue: 1500 - }; - - const findOneSpy = jest.spyOn(repository, 'findOne').mockResolvedValue(deviceEntity as any); - - const options = { - where: { - developerExternalId: newDevice.externalId, - organizationId: orgCode, - }, - }; - - await expect(service.register(orgCode, newDevice, apiUserId, role)).rejects.toThrowError(ConflictException); - - await expect(findOneSpy).toHaveBeenCalledWith(options); - await expect(findOneSpy).toBeDefined(); - }); - }); - - describe('find', ()=> { - let organizationEntity = { - id: 1, - name: 'orgName', - //@ts-ignore - organizationType: Role.OrganizationAdmin, - //@ts-ignore - orgEmail: 'testsweya@gmail.com', - address: 'Chennai', - zipCode: '600001', - city: 'Chennai', - country: 'India', - blockchainAccountAddress: 'null', - blockchainAccountSignedMessage: 'null', - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiUserId', - } as Organization; - - let deviceEntity = [ - { - createdAt: "2024-02-27T07:00:32.963Z", - updatedAt: "2024-02-27T07:00:32.963Z", - id: 44, - externalId: "ExternalId1", - organizationId: 3, - projectName: "sampleProject", - address: "Bangalore", - latitude: "23.65362", - longitude: "25.43647", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 2500, - SDGBenefits: ["No Poverty"], - commissioningDate: "2024-02-01T06:59:11.000Z", - gridInterconnection: true, - offTaker: "School", - yieldValue: 1500, - impactStory: null, - images: null, - groupId: null, - deviceDescription: "Solar Lantern", - energyStorage: true, - energyStorageCapacity: 900, - qualityLabels: null, - meterReadtype: null, - timezone: null, - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-12-13T13:01:00.885Z", - updatedAt: "2023-12-13T13:01:00.885Z", - id: 22, - externalId: "June4", - organizationId: 3, - projectName: "test4", - address: "Bangalore", - latitude: "99.09", - longitude: "889", - countryCode: "AFG", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 600, - SDGBenefits: [], - commissioningDate: "2020-09-04T21:08:21.890Z", - gridInterconnection: true, - offTaker: null, - yieldValue: 1500, - impactStory: null, - images: null, - groupId: null, - deviceDescription: null, - energyStorage: true, - energyStorageCapacity: 9000, - qualityLabels: null, - meterReadtype: null, - timezone: null, - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-12-13T13:01:00.883Z", - updatedAt: "2023-12-13T13:01:00.883Z", - id: 21, - externalId: "Ext22", - organizationId: 3, - projectName: "Test", - address: "Bangalore", - latitude: "67.89", - longitude: "89.09", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 500, - SDGBenefits: [], - commissioningDate: "2020-09-04T21:08:21.890Z", - gridInterconnection: true, - offTaker: null, - yieldValue: 1500, - impactStory: null, - images: null, - groupId: null, - deviceDescription: null, - energyStorage: true, - energyStorageCapacity: 9000, - qualityLabels: null, - meterReadtype: null, - timezone: null, - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-11-13T07:07:27.483Z", - updatedAt: "2023-11-13T07:07:27.483Z", - id: 10, - externalId: "Ext11", - organizationId: 3, - projectName: "SampleProje11", - address: "BLR", - latitude: "23.6685889", - longitude: "24.567568", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 9000, - SDGBenefits: [], - commissioningDate: "2022-11-26T10:06:56.640Z", - gridInterconnection: true, - offTaker: "Residential", - yieldValue: 1500, - impactStory: "string", - images: ["string"], - groupId: null, - deviceDescription: "Ground Mount Solar", - energyStorage: true, - energyStorageCapacity: 6000, - qualityLabels: "string", - meterReadtype: "Delta", - timezone: "Asia/Kolkata", - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-11-08T12:04:45.740Z", - updatedAt: "2023-11-08T12:04:45.740Z", - id: 9, - externalId: "Ext4", - organizationId: 3, - projectName: "SampleProj12", - address: "BLR", - latitude: "23.558758", - longitude: "24.657578", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 9000, - SDGBenefits: [], - commissioningDate: "1990-11-26T04:30:00.000Z", - gridInterconnection: true, - offTaker: "Residential", - yieldValue: 1500, - impactStory: "string", - images: [ - "string" - ], - groupId: null, - deviceDescription: "Ground Mount Solar", - energyStorage: true, - energyStorageCapacity: 5000, - qualityLabels: "string", - meterReadtype: "Delta", - timezone: "Asia/Kolkata", - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-11-08T11:55:33.919Z", - updatedAt: "2023-11-08T11:55:33.919Z", - id: 8, - externalId: "Ext3", - organizationId: 3, - projectName: "SampleProj12", - address: "BLR", - latitude: "23.558758", - longitude: "24.657578", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 9000, - SDGBenefits: [], - commissioningDate: "1990-11-26T04:30:00.000Z", - gridInterconnection: true, - offTaker: "Residential", - yieldValue: 1500, - impactStory: "string", - images: ["string"], - groupId: null, - deviceDescription: "Ground Mount Solar", - energyStorage: true, - energyStorageCapacity: 5000, - qualityLabels: "string", - meterReadtype: "Delta", - timezone: "Asia/Kolkata", - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-11-06T12:48:18.405Z", - updatedAt: "2023-11-06T12:48:18.405Z", - id: 6, - externalId: "Ext2", - organizationId: 3, - projectName: "Sampleproj12", - address: "string", - latitude: "23.6367447", - longitude: "24.5634276", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 2000, - SDGBenefits: [], - commissioningDate: "2022-11-26T11:00:00.640Z", - gridInterconnection: true, - offTaker: "Residential", - yieldValue: 1500, - impactStory: "string", - images: ["string"], - groupId: null, - deviceDescription: "Ground Mount Solar", - energyStorage: true, - energyStorageCapacity: 800, - qualityLabels: "string", - meterReadtype: "Delta", - timezone: "Asia/Kolkata", - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-11-03T10:40:45.486Z", - updatedAt: "2023-11-03T10:40:45.486Z", - id: 4, - externalId: "ext1", - organizationId: 3, - projectName: "sampleproj12", - address: "string", - latitude: "23.343535", - longitude: "24.5675786", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 2000, - SDGBenefits: [], - commissioningDate: "2022-10-18T11:35:27.640Z", - gridInterconnection: true, - offTaker: "Residential", - yieldValue: 1500, - impactStory: "string", - images: [ - "string" - ], - groupId: null, - deviceDescription: "Ground Mount Solar", - energyStorage: true, - energyStorageCapacity: 600, - qualityLabels: "string", - meterReadtype: "Delta", - timezone: "Asia/Kolkata", - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - ]; - it('should retrieve devices without pagination', async () => { - const filterDto: FilterDTO = { - fuelCode: undefined,//FuelCode.ES100, - deviceTypeCode: DevicetypeCode.TC110, - capacity: undefined,//600, - start_date: undefined,//'2023-02-01T06:59:11.000Z', - end_date: undefined,//'2024-02-26T06:59:11.000Z', - gridInterconnection: undefined,//false - offTaker: OffTaker.School, - country: 'India', - }; - const orgId = 4; -/* - const expectedQuery : FindManyOptions = { - where: { - deviceTypeCode: filterDto.deviceTypeCode, - offTaker: filterDto.offTaker, - countryCode: 'IND', - }, - order: { organizationId: 'DESC' }, - }; */ - const expectedQuery: FindManyOptions = { - where: { - capacity: { - _type: 'lessThanOrEqual', - _value: '200', - _useParameter: true, - }, - countryCode: 'IND', - organizationId: '4', - commissioningDate: { - _type: 'moreThanOrEqual', - _value: '2024-02-18T18:30:00.000Z', - _useParameter: true, - }, - SDGBenefits: { - _type: 'raw', - _value: [], - _useParameter: true, - _multipleParameters: true, - }, - deviceTypeCode: { - _type: 'raw', - _value: [], - _useParameter: true, - _multipleParameters: true, - }, - offTaker: { - _type: 'raw', - _value: [], - _useParameter: true, - _multipleParameters: true, - }, - }, - order: { organizationId: 'DESC' }, - }; - //const filterSpy = jest.spyOn(service, 'getFilteredQuery').mockResolvedValue(expectedQuery as FindManyOptions); - const getFilteredQueryMock = jest.fn().mockReturnValue(expectedQuery as FindManyOptions); - service.getFilteredQuery = getFilteredQueryMock; - const findSpy = jest.spyOn(repository, 'findAndCount').mockResolvedValue([deviceEntity, deviceEntity.length] as any); - const result = await service.find(filterDto, undefined, orgId); - - await expect(getFilteredQueryMock).toHaveBeenCalledWith(filterDto, orgId); - console.log(expectedQuery); - await expect(findSpy).toHaveBeenCalledWith({ - relations: ['organization'], - ...expectedQuery, - }); - - console.log("Received arguments in findAndCount:", findSpy.mock.calls[0], findSpy.mock.calls[1]); - - console.log("Result with in test:", result); - await expect(result).toBeDefined(); - await expect(result.devices).toHaveLength(result.devices.length); - }); - - it('should retrieve devices with pagination', async () => { - const organizationEntity = { - id: 1, - name: 'orgName', - //@ts-ignore - organizationType: Role.OrganizationAdmin, - //@ts-ignore - orgEmail: 'testsweya@gmail.com', - address: 'Chennai', - zipCode: '600001', - city: 'Chennai', - country: 'India', - blockchainAccountAddress: 'null', - blockchainAccountSignedMessage: 'null', - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiUserId', - } as Organization; - - const deviceEntity = [ - { - createdAt: "2024-02-27T07:00:32.963Z", - updatedAt: "2024-02-27T07:00:32.963Z", - id: 44, - externalId: "ExternalId1", - organizationId: 3, - projectName: "sampleProject", - address: "Bangalore", - latitude: "23.65362", - longitude: "25.43647", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 2500, - SDGBenefits: ["No Poverty"], - commissioningDate: "2024-02-01T06:59:11.000Z", - gridInterconnection: true, - offTaker: "School", - yieldValue: 1500, - impactStory: null, - images: null, - groupId: null, - deviceDescription: "Solar Lantern", - energyStorage: true, - energyStorageCapacity: 900, - qualityLabels: null, - meterReadtype: null, - timezone: null, - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-12-13T13:01:00.885Z", - updatedAt: "2023-12-13T13:01:00.885Z", - id: 22, - externalId: "June4", - organizationId: 3, - projectName: "test4", - address: "Bangalore", - latitude: "99.09", - longitude: "889", - countryCode: "AFG", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 600, - SDGBenefits: [], - commissioningDate: "2020-09-04T21:08:21.890Z", - gridInterconnection: true, - offTaker: null, - yieldValue: 1500, - impactStory: null, - images: null, - groupId: null, - deviceDescription: null, - energyStorage: true, - energyStorageCapacity: 9000, - qualityLabels: null, - meterReadtype: null, - timezone: null, - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-12-13T13:01:00.883Z", - updatedAt: "2023-12-13T13:01:00.883Z", - id: 21, - externalId: "Ext22", - organizationId: 3, - projectName: "Test", - address: "Bangalore", - latitude: "67.89", - longitude: "89.09", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 500, - SDGBenefits: [], - commissioningDate: "2020-09-04T21:08:21.890Z", - gridInterconnection: true, - offTaker: null, - yieldValue: 1500, - impactStory: null, - images: null, - groupId: null, - deviceDescription: null, - energyStorage: true, - energyStorageCapacity: 9000, - qualityLabels: null, - meterReadtype: null, - timezone: null, - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-11-13T07:07:27.483Z", - updatedAt: "2023-11-13T07:07:27.483Z", - id: 10, - externalId: "Ext11", - organizationId: 3, - projectName: "SampleProje11", - address: "BLR", - latitude: "23.6685889", - longitude: "24.567568", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 9000, - SDGBenefits: [], - commissioningDate: "2022-11-26T10:06:56.640Z", - gridInterconnection: true, - offTaker: "Residential", - yieldValue: 1500, - impactStory: "string", - images: ["string"], - groupId: null, - deviceDescription: "Ground Mount Solar", - energyStorage: true, - energyStorageCapacity: 6000, - qualityLabels: "string", - meterReadtype: "Delta", - timezone: "Asia/Kolkata", - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-11-08T12:04:45.740Z", - updatedAt: "2023-11-08T12:04:45.740Z", - id: 9, - externalId: "Ext4", - organizationId: 3, - projectName: "SampleProj12", - address: "BLR", - latitude: "23.558758", - longitude: "24.657578", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 9000, - SDGBenefits: [], - commissioningDate: "1990-11-26T04:30:00.000Z", - gridInterconnection: true, - offTaker: "Residential", - yieldValue: 1500, - impactStory: "string", - images: [ - "string" - ], - groupId: null, - deviceDescription: "Ground Mount Solar", - energyStorage: true, - energyStorageCapacity: 5000, - qualityLabels: "string", - meterReadtype: "Delta", - timezone: "Asia/Kolkata", - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-11-08T11:55:33.919Z", - updatedAt: "2023-11-08T11:55:33.919Z", - id: 8, - externalId: "Ext3", - organizationId: 3, - projectName: "SampleProj12", - address: "BLR", - latitude: "23.558758", - longitude: "24.657578", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 9000, - SDGBenefits: [], - commissioningDate: "1990-11-26T04:30:00.000Z", - gridInterconnection: true, - offTaker: "Residential", - yieldValue: 1500, - impactStory: "string", - images: ["string"], - groupId: null, - deviceDescription: "Ground Mount Solar", - energyStorage: true, - energyStorageCapacity: 5000, - qualityLabels: "string", - meterReadtype: "Delta", - timezone: "Asia/Kolkata", - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-11-06T12:48:18.405Z", - updatedAt: "2023-11-06T12:48:18.405Z", - id: 6, - externalId: "Ext2", - organizationId: 3, - projectName: "Sampleproj12", - address: "string", - latitude: "23.6367447", - longitude: "24.5634276", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 2000, - SDGBenefits: [], - commissioningDate: "2022-11-26T11:00:00.640Z", - gridInterconnection: true, - offTaker: "Residential", - yieldValue: 1500, - impactStory: "string", - images: ["string"], - groupId: null, - deviceDescription: "Ground Mount Solar", - energyStorage: true, - energyStorageCapacity: 800, - qualityLabels: "string", - meterReadtype: "Delta", - timezone: "Asia/Kolkata", - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - { - createdAt: "2023-11-03T10:40:45.486Z", - updatedAt: "2023-11-03T10:40:45.486Z", - id: 4, - externalId: "ext1", - organizationId: 3, - projectName: "sampleproj12", - address: "string", - latitude: "23.343535", - longitude: "24.5675786", - countryCode: "IND", - fuelCode: "ES100", - deviceTypeCode: "TC110", - capacity: 2000, - SDGBenefits: [], - commissioningDate: "2022-10-18T11:35:27.640Z", - gridInterconnection: true, - offTaker: "Residential", - yieldValue: 1500, - impactStory: "string", - images: [ - "string" - ], - groupId: null, - deviceDescription: "Ground Mount Solar", - energyStorage: true, - energyStorageCapacity: 600, - qualityLabels: "string", - meterReadtype: "Delta", - timezone: "Asia/Kolkata", - version: "1.0", - IREC_Status: "NotRegistered", - IREC_ID: null, - api_user_id: null, - organization: organizationEntity, - }, - ]; - const filterDto: FilterDTO = { - fuelCode: undefined,//FuelCode.ES100, - deviceTypeCode: DevicetypeCode.TC110, - capacity: undefined,//600, - start_date: undefined,//'2023-02-01T06:59:11.000Z', - end_date: undefined,//'2024-02-26T06:59:11.000Z', - gridInterconnection: undefined,//false - offTaker: OffTaker.School, - country: 'India', - }; - const pageNumber = 1; - const orgId = 4; -/* - const expectedQuery : FindManyOptions = { - where: { - deviceTypeCode: filterDto.deviceTypeCode, - offTaker: filterDto.offTaker, - countryCode: 'IND', - }, - order: { organizationId: 'DESC' }, - }; */ - - const limit = 20; - const expectedQuery: FindManyOptions = { - where: { - capacity: { - _type: 'lessThanOrEqual', - _value: '200', // Adjust as needed - _useParameter: true, - }, - countryCode: filterDto.country, - organizationId: orgId.toString(), // Use orgId provided dynamically - commissioningDate: { - _type: 'moreThanOrEqual', - _value: new Date().toISOString(), // Use current date or adjust as needed - _useParameter: true, - }, - SDGBenefits: { - _type: 'raw', - _value: [], - _useParameter: true, - _multipleParameters: true, - }, - deviceTypeCode: { - _type: 'raw', - _value: [filterDto.deviceTypeCode], // Adjust as needed - _useParameter: true, - _multipleParameters: true, - }, - offTaker: { - _type: 'raw', - _value: [filterDto.offTaker], // Adjust as needed - _useParameter: true, - _multipleParameters: true, - }, - }, - order: { organizationId: 'DESC' }, - skip: (pageNumber - 1) * limit, - take: limit, - }; - //const filterSpy = jest.spyOn(service, 'getFilteredQuery').mockResolvedValue(expectedQuery as FindManyOptions); - const getFilteredQueryMock = jest.fn().mockReturnValue(expectedQuery as FindManyOptions); - service.getFilteredQuery = getFilteredQueryMock; - const findSpy = jest.spyOn(repository, 'findAndCount').mockResolvedValue([deviceEntity, deviceEntity.length] as any); - const result = await service.find(filterDto, pageNumber, orgId); - - await expect(getFilteredQueryMock).toHaveBeenCalledWith(filterDto, orgId); - console.log(expectedQuery); - await expect(findSpy).toHaveBeenCalledWith({ - relations: ['organization'], - ...expectedQuery, - }); - - console.log("Received arguments in findAndCount:", findSpy.mock.calls[0], findSpy.mock.calls[1]); - - console.log("Result with in test:", result); - await expect(result).toBeDefined(); - await expect(result.devices).toHaveLength(result.devices.length); - }); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { DeviceService } from './device.service'; +import { Repository, FindManyOptions } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { HistoryIntermediate_MeterRead } from '../reads/history_intermideate_meterread.entity'; +import { Device } from './device.entity'; +import { CheckCertificateIssueDateLogForDeviceEntity } from './check_certificate_issue_date_log_for_device.entity'; +import { + HttpService, + UnauthorizedException, + ConflictException, +} from '@nestjs/common'; +import { IrecDevicesInformationEntity } from './irec_devices_information.entity'; +import { IrecErrorLogInformationEntity } from './irec_error_log_information.entity'; +import { OrganizationService } from '../organization/organization.service'; +import { UserService } from '../user/user.service'; +import { Role } from '../../utils/enums/role.enum'; +import { FilterDTO, NewDeviceDTO } from './dto'; +import { + DevicetypeCode, + FuelCode, + OffTaker, + OrganizationStatus, +} from '../../utils/enums'; +import { DeviceDescription } from '../../models'; +import { Organization } from '../organization/organization.entity'; + +describe('DeviceService', () => { + let service: DeviceService; + let historyrepository: Repository; + let repository: Repository; + let checkdevcielogcertificaterepository: Repository; + let httpService: HttpService; + let irecinforepository: Repository; + let irecerrorlogrepository: Repository; + let organizationService: OrganizationService; + let userService: UserService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + DeviceService, + { + provide: getRepositoryToken(Device), + useClass: Repository, + useValue: { + findOne: jest.fn(), + save: jest.fn(), + } as any, + }, + { + provide: getRepositoryToken(HistoryIntermediate_MeterRead), + useClass: Repository, + }, + { + provide: getRepositoryToken( + CheckCertificateIssueDateLogForDeviceEntity, + ), + useClass: Repository, + }, + { + provide: HttpService, + useValue: {} as any, + }, + { + provide: getRepositoryToken(IrecDevicesInformationEntity), + useClass: Repository, + }, + { + provide: getRepositoryToken(IrecErrorLogInformationEntity), + useClass: Repository, + }, + { + provide: OrganizationService, + useValue: {} as any, + }, + { + provide: UserService, + useValue: {} as any, + }, + ], + }).compile(); + + service = module.get(DeviceService); + repository = module.get>(getRepositoryToken(Device)); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); + + describe('register', () => { + it('should register a new device with valid inputs', async () => { + const orgCode = 3; + const newDevice: NewDeviceDTO = { + externalId: 'ExternalId1', + projectName: 'sampleProject', + address: 'Bangalore', + latitude: '23.65362', + longitude: '25.43647', + //@ts-ignore + countryCodename: 'India', + fuelCode: FuelCode.ES100, //'ES100', + deviceTypeCode: DevicetypeCode.TC110, //'TC110', + capacity: 2500, + commissioningDate: '2024-02-01T06:59:11.000Z', + gridInterconnection: true, + offTaker: OffTaker.School, //'School', + impactStory: null, + data: null, + images: null, + deviceDescription: DeviceDescription.SolarLantern, //'Solar Lantern', + energyStorage: true, + energyStorageCapacity: 900, + qualityLabels: null, + SDGBenefits: ['SDG1'], + version: '1.0', + countryCode: 'IND', + }; + const apiUserId = 'a8b6366e-ea5f-4ed7-8e9d-c5ae71c2d909'; + const role = Role.OrganizationAdmin; + /* + const organizationEntity = { + id: 1, + name: 'orgName', + //@ts-ignore + organizationType: Role.OrganizationAdmin, + //@ts-ignore + orgEmail: 'testsweya@gmail.com', + address: 'Chennai', + zipCode: '600001', + city: 'Chennai', + country: 'India', + blockchainAccountAddress: 'null', + blockchainAccountSignedMessage: 'null', + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: apiUserId, + } as Organization; +*/ + const deviceEntity = { + externalId: 'ExternalId1', + projectName: 'sampleProject', + address: 'Bangalore', + latitude: '23.65362', + longitude: '25.43647', + countryCodename: 'India', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 2500, + commissioningDate: '2024-02-01T06:59:11.000Z', + gridInterconnection: true, + offTaker: 'School', + impactStory: null, + data: null, + images: null, + deviceDescription: 'Solar Lantern', + energyStorage: true, + energyStorageCapacity: 900, + qualityLabels: null, + SDGBenefits: ['No Poverty'], + version: '1.0', + countryCode: 'IND', + organizationId: 3, + groupId: null, + meterReadtype: null, + timezone: null, + IREC_Status: null, + IREC_ID: null, + api_user_id: null, + createdAt: '2024-02-27T07:00:32.963Z', + updatedAt: '2024-02-27T07:00:32.963Z', + id: 44, + yieldValue: 1500, + }; + + jest.spyOn(repository, 'findOne').mockReturnValue(undefined); + const saveSpy = jest + .spyOn(repository, 'save') + .mockResolvedValue(deviceEntity as any); + + const result = await service.register(orgCode, newDevice); + + const options = { + where: { + developerExternalId: newDevice.externalId, + organizationId: orgCode, + }, + }; + console.log('Result with in test file:', result); + expect(saveSpy).toHaveBeenCalledWith(expect.objectContaining(newDevice)); + expect(result).toEqual(deviceEntity); + }); + + it('should reject registration with existing external ID', async () => { + const orgCode = 3; + const newDevice: NewDeviceDTO = { + externalId: 'ExternalId1', + projectName: 'sampleProject', + address: 'Bangalore', + latitude: '23.65362', + longitude: '25.43647', + //@ts-ignore + countryCodename: 'India', + fuelCode: FuelCode.ES100, //'ES100', + deviceTypeCode: DevicetypeCode.TC110, //'TC110', + capacity: 2500, + commissioningDate: '2024-02-01T06:59:11.000Z', + gridInterconnection: true, + offTaker: OffTaker.School, //'School', + impactStory: null, + data: null, + images: null, + deviceDescription: DeviceDescription.SolarLantern, //'Solar Lantern', + energyStorage: true, + energyStorageCapacity: 900, + qualityLabels: null, + SDGBenefits: ['SDG1'], + version: '1.0', + countryCode: 'IND', + }; + const apiUserId = 'a8b6366e-ea5f-4ed7-8e9d-c5ae71c2d909'; + const role = Role.OrganizationAdmin; + /* + const organizationEntity = { + id: 1, + name: 'orgName', + //@ts-ignore + organizationType: Role.OrganizationAdmin, + //@ts-ignore + orgEmail: 'testsweya@gmail.com', + address: 'Chennai', + zipCode: '600001', + city: 'Chennai', + country: 'India', + blockchainAccountAddress: 'null', + blockchainAccountSignedMessage: 'null', + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: apiUserId, + } as Organization; +*/ + const deviceEntity = { + externalId: 'ExternalId1', + projectName: 'sampleProject', + address: 'Bangalore', + latitude: '23.65362', + longitude: '25.43647', + countryCodename: 'India', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 2500, + commissioningDate: '2024-02-01T06:59:11.000Z', + gridInterconnection: true, + offTaker: 'School', + impactStory: null, + data: null, + images: null, + deviceDescription: 'Solar Lantern', + energyStorage: true, + energyStorageCapacity: 900, + qualityLabels: null, + SDGBenefits: ['No Poverty'], + version: '1.0', + countryCode: 'IND', + organizationId: 3, + groupId: null, + meterReadtype: null, + timezone: null, + IREC_Status: null, + IREC_ID: null, + api_user_id: null, + createdAt: '2024-02-27T07:00:32.963Z', + updatedAt: '2024-02-27T07:00:32.963Z', + id: 44, + yieldValue: 1500, + }; + + const findOneSpy = jest + .spyOn(repository, 'findOne') + .mockResolvedValue(deviceEntity as any); + + const options = { + where: { + developerExternalId: newDevice.externalId, + organizationId: orgCode, + }, + }; + + await expect( + service.register(orgCode, newDevice, apiUserId, role), + ).rejects.toThrowError(ConflictException); + + await expect(findOneSpy).toHaveBeenCalledWith(options); + await expect(findOneSpy).toBeDefined(); + }); + }); + + describe('find', () => { + let organizationEntity = { + id: 1, + name: 'orgName', + //@ts-ignore + organizationType: Role.OrganizationAdmin, + //@ts-ignore + orgEmail: 'testsweya@gmail.com', + address: 'Chennai', + zipCode: '600001', + city: 'Chennai', + country: 'India', + blockchainAccountAddress: 'null', + blockchainAccountSignedMessage: 'null', + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiUserId', + } as Organization; + + let deviceEntity = [ + { + createdAt: '2024-02-27T07:00:32.963Z', + updatedAt: '2024-02-27T07:00:32.963Z', + id: 44, + externalId: 'ExternalId1', + organizationId: 3, + projectName: 'sampleProject', + address: 'Bangalore', + latitude: '23.65362', + longitude: '25.43647', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 2500, + SDGBenefits: ['No Poverty'], + commissioningDate: '2024-02-01T06:59:11.000Z', + gridInterconnection: true, + offTaker: 'School', + yieldValue: 1500, + impactStory: null, + images: null, + groupId: null, + deviceDescription: 'Solar Lantern', + energyStorage: true, + energyStorageCapacity: 900, + qualityLabels: null, + meterReadtype: null, + timezone: null, + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-12-13T13:01:00.885Z', + updatedAt: '2023-12-13T13:01:00.885Z', + id: 22, + externalId: 'June4', + organizationId: 3, + projectName: 'test4', + address: 'Bangalore', + latitude: '99.09', + longitude: '889', + countryCode: 'AFG', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 600, + SDGBenefits: [], + commissioningDate: '2020-09-04T21:08:21.890Z', + gridInterconnection: true, + offTaker: null, + yieldValue: 1500, + impactStory: null, + images: null, + groupId: null, + deviceDescription: null, + energyStorage: true, + energyStorageCapacity: 9000, + qualityLabels: null, + meterReadtype: null, + timezone: null, + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-12-13T13:01:00.883Z', + updatedAt: '2023-12-13T13:01:00.883Z', + id: 21, + externalId: 'Ext22', + organizationId: 3, + projectName: 'Test', + address: 'Bangalore', + latitude: '67.89', + longitude: '89.09', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 500, + SDGBenefits: [], + commissioningDate: '2020-09-04T21:08:21.890Z', + gridInterconnection: true, + offTaker: null, + yieldValue: 1500, + impactStory: null, + images: null, + groupId: null, + deviceDescription: null, + energyStorage: true, + energyStorageCapacity: 9000, + qualityLabels: null, + meterReadtype: null, + timezone: null, + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-11-13T07:07:27.483Z', + updatedAt: '2023-11-13T07:07:27.483Z', + id: 10, + externalId: 'Ext11', + organizationId: 3, + projectName: 'SampleProje11', + address: 'BLR', + latitude: '23.6685889', + longitude: '24.567568', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 9000, + SDGBenefits: [], + commissioningDate: '2022-11-26T10:06:56.640Z', + gridInterconnection: true, + offTaker: 'Residential', + yieldValue: 1500, + impactStory: 'string', + images: ['string'], + groupId: null, + deviceDescription: 'Ground Mount Solar', + energyStorage: true, + energyStorageCapacity: 6000, + qualityLabels: 'string', + meterReadtype: 'Delta', + timezone: 'Asia/Kolkata', + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-11-08T12:04:45.740Z', + updatedAt: '2023-11-08T12:04:45.740Z', + id: 9, + externalId: 'Ext4', + organizationId: 3, + projectName: 'SampleProj12', + address: 'BLR', + latitude: '23.558758', + longitude: '24.657578', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 9000, + SDGBenefits: [], + commissioningDate: '1990-11-26T04:30:00.000Z', + gridInterconnection: true, + offTaker: 'Residential', + yieldValue: 1500, + impactStory: 'string', + images: ['string'], + groupId: null, + deviceDescription: 'Ground Mount Solar', + energyStorage: true, + energyStorageCapacity: 5000, + qualityLabels: 'string', + meterReadtype: 'Delta', + timezone: 'Asia/Kolkata', + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-11-08T11:55:33.919Z', + updatedAt: '2023-11-08T11:55:33.919Z', + id: 8, + externalId: 'Ext3', + organizationId: 3, + projectName: 'SampleProj12', + address: 'BLR', + latitude: '23.558758', + longitude: '24.657578', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 9000, + SDGBenefits: [], + commissioningDate: '1990-11-26T04:30:00.000Z', + gridInterconnection: true, + offTaker: 'Residential', + yieldValue: 1500, + impactStory: 'string', + images: ['string'], + groupId: null, + deviceDescription: 'Ground Mount Solar', + energyStorage: true, + energyStorageCapacity: 5000, + qualityLabels: 'string', + meterReadtype: 'Delta', + timezone: 'Asia/Kolkata', + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-11-06T12:48:18.405Z', + updatedAt: '2023-11-06T12:48:18.405Z', + id: 6, + externalId: 'Ext2', + organizationId: 3, + projectName: 'Sampleproj12', + address: 'string', + latitude: '23.6367447', + longitude: '24.5634276', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 2000, + SDGBenefits: [], + commissioningDate: '2022-11-26T11:00:00.640Z', + gridInterconnection: true, + offTaker: 'Residential', + yieldValue: 1500, + impactStory: 'string', + images: ['string'], + groupId: null, + deviceDescription: 'Ground Mount Solar', + energyStorage: true, + energyStorageCapacity: 800, + qualityLabels: 'string', + meterReadtype: 'Delta', + timezone: 'Asia/Kolkata', + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-11-03T10:40:45.486Z', + updatedAt: '2023-11-03T10:40:45.486Z', + id: 4, + externalId: 'ext1', + organizationId: 3, + projectName: 'sampleproj12', + address: 'string', + latitude: '23.343535', + longitude: '24.5675786', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 2000, + SDGBenefits: [], + commissioningDate: '2022-10-18T11:35:27.640Z', + gridInterconnection: true, + offTaker: 'Residential', + yieldValue: 1500, + impactStory: 'string', + images: ['string'], + groupId: null, + deviceDescription: 'Ground Mount Solar', + energyStorage: true, + energyStorageCapacity: 600, + qualityLabels: 'string', + meterReadtype: 'Delta', + timezone: 'Asia/Kolkata', + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + ]; + it('should retrieve devices without pagination', async () => { + const filterDto: FilterDTO = { + fuelCode: undefined, //FuelCode.ES100, + deviceTypeCode: DevicetypeCode.TC110, + capacity: undefined, //600, + start_date: undefined, //'2023-02-01T06:59:11.000Z', + end_date: undefined, //'2024-02-26T06:59:11.000Z', + gridInterconnection: undefined, //false + offTaker: OffTaker.School, + country: 'India', + }; + const orgId = 4; + /* + const expectedQuery : FindManyOptions = { + where: { + deviceTypeCode: filterDto.deviceTypeCode, + offTaker: filterDto.offTaker, + countryCode: 'IND', + }, + order: { organizationId: 'DESC' }, + }; */ + const expectedQuery: FindManyOptions = { + where: { + capacity: { + _type: 'lessThanOrEqual', + _value: '200', + _useParameter: true, + }, + countryCode: 'IND', + organizationId: '4', + commissioningDate: { + _type: 'moreThanOrEqual', + _value: '2024-02-18T18:30:00.000Z', + _useParameter: true, + }, + SDGBenefits: { + _type: 'raw', + _value: [], + _useParameter: true, + _multipleParameters: true, + }, + deviceTypeCode: { + _type: 'raw', + _value: [], + _useParameter: true, + _multipleParameters: true, + }, + offTaker: { + _type: 'raw', + _value: [], + _useParameter: true, + _multipleParameters: true, + }, + }, + order: { organizationId: 'DESC' }, + }; + //const filterSpy = jest.spyOn(service, 'getFilteredQuery').mockResolvedValue(expectedQuery as FindManyOptions); + const getFilteredQueryMock = jest + .fn() + .mockReturnValue(expectedQuery as FindManyOptions); + service.getFilteredQuery = getFilteredQueryMock; + const findSpy = jest + .spyOn(repository, 'findAndCount') + .mockResolvedValue([deviceEntity, deviceEntity.length] as any); + const result = await service.find(filterDto, undefined, orgId); + + await expect(getFilteredQueryMock).toHaveBeenCalledWith(filterDto, orgId); + console.log(expectedQuery); + await expect(findSpy).toHaveBeenCalledWith({ + relations: ['organization'], + ...expectedQuery, + }); + + console.log( + 'Received arguments in findAndCount:', + findSpy.mock.calls[0], + findSpy.mock.calls[1], + ); + + console.log('Result with in test:', result); + await expect(result).toBeDefined(); + await expect(result.devices).toHaveLength(result.devices.length); + }); + + it('should retrieve devices with pagination', async () => { + const organizationEntity = { + id: 1, + name: 'orgName', + //@ts-ignore + organizationType: Role.OrganizationAdmin, + //@ts-ignore + orgEmail: 'testsweya@gmail.com', + address: 'Chennai', + zipCode: '600001', + city: 'Chennai', + country: 'India', + blockchainAccountAddress: 'null', + blockchainAccountSignedMessage: 'null', + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiUserId', + } as Organization; + + const deviceEntity = [ + { + createdAt: '2024-02-27T07:00:32.963Z', + updatedAt: '2024-02-27T07:00:32.963Z', + id: 44, + externalId: 'ExternalId1', + organizationId: 3, + projectName: 'sampleProject', + address: 'Bangalore', + latitude: '23.65362', + longitude: '25.43647', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 2500, + SDGBenefits: ['No Poverty'], + commissioningDate: '2024-02-01T06:59:11.000Z', + gridInterconnection: true, + offTaker: 'School', + yieldValue: 1500, + impactStory: null, + images: null, + groupId: null, + deviceDescription: 'Solar Lantern', + energyStorage: true, + energyStorageCapacity: 900, + qualityLabels: null, + meterReadtype: null, + timezone: null, + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-12-13T13:01:00.885Z', + updatedAt: '2023-12-13T13:01:00.885Z', + id: 22, + externalId: 'June4', + organizationId: 3, + projectName: 'test4', + address: 'Bangalore', + latitude: '99.09', + longitude: '889', + countryCode: 'AFG', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 600, + SDGBenefits: [], + commissioningDate: '2020-09-04T21:08:21.890Z', + gridInterconnection: true, + offTaker: null, + yieldValue: 1500, + impactStory: null, + images: null, + groupId: null, + deviceDescription: null, + energyStorage: true, + energyStorageCapacity: 9000, + qualityLabels: null, + meterReadtype: null, + timezone: null, + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-12-13T13:01:00.883Z', + updatedAt: '2023-12-13T13:01:00.883Z', + id: 21, + externalId: 'Ext22', + organizationId: 3, + projectName: 'Test', + address: 'Bangalore', + latitude: '67.89', + longitude: '89.09', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 500, + SDGBenefits: [], + commissioningDate: '2020-09-04T21:08:21.890Z', + gridInterconnection: true, + offTaker: null, + yieldValue: 1500, + impactStory: null, + images: null, + groupId: null, + deviceDescription: null, + energyStorage: true, + energyStorageCapacity: 9000, + qualityLabels: null, + meterReadtype: null, + timezone: null, + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-11-13T07:07:27.483Z', + updatedAt: '2023-11-13T07:07:27.483Z', + id: 10, + externalId: 'Ext11', + organizationId: 3, + projectName: 'SampleProje11', + address: 'BLR', + latitude: '23.6685889', + longitude: '24.567568', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 9000, + SDGBenefits: [], + commissioningDate: '2022-11-26T10:06:56.640Z', + gridInterconnection: true, + offTaker: 'Residential', + yieldValue: 1500, + impactStory: 'string', + images: ['string'], + groupId: null, + deviceDescription: 'Ground Mount Solar', + energyStorage: true, + energyStorageCapacity: 6000, + qualityLabels: 'string', + meterReadtype: 'Delta', + timezone: 'Asia/Kolkata', + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-11-08T12:04:45.740Z', + updatedAt: '2023-11-08T12:04:45.740Z', + id: 9, + externalId: 'Ext4', + organizationId: 3, + projectName: 'SampleProj12', + address: 'BLR', + latitude: '23.558758', + longitude: '24.657578', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 9000, + SDGBenefits: [], + commissioningDate: '1990-11-26T04:30:00.000Z', + gridInterconnection: true, + offTaker: 'Residential', + yieldValue: 1500, + impactStory: 'string', + images: ['string'], + groupId: null, + deviceDescription: 'Ground Mount Solar', + energyStorage: true, + energyStorageCapacity: 5000, + qualityLabels: 'string', + meterReadtype: 'Delta', + timezone: 'Asia/Kolkata', + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-11-08T11:55:33.919Z', + updatedAt: '2023-11-08T11:55:33.919Z', + id: 8, + externalId: 'Ext3', + organizationId: 3, + projectName: 'SampleProj12', + address: 'BLR', + latitude: '23.558758', + longitude: '24.657578', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 9000, + SDGBenefits: [], + commissioningDate: '1990-11-26T04:30:00.000Z', + gridInterconnection: true, + offTaker: 'Residential', + yieldValue: 1500, + impactStory: 'string', + images: ['string'], + groupId: null, + deviceDescription: 'Ground Mount Solar', + energyStorage: true, + energyStorageCapacity: 5000, + qualityLabels: 'string', + meterReadtype: 'Delta', + timezone: 'Asia/Kolkata', + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-11-06T12:48:18.405Z', + updatedAt: '2023-11-06T12:48:18.405Z', + id: 6, + externalId: 'Ext2', + organizationId: 3, + projectName: 'Sampleproj12', + address: 'string', + latitude: '23.6367447', + longitude: '24.5634276', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 2000, + SDGBenefits: [], + commissioningDate: '2022-11-26T11:00:00.640Z', + gridInterconnection: true, + offTaker: 'Residential', + yieldValue: 1500, + impactStory: 'string', + images: ['string'], + groupId: null, + deviceDescription: 'Ground Mount Solar', + energyStorage: true, + energyStorageCapacity: 800, + qualityLabels: 'string', + meterReadtype: 'Delta', + timezone: 'Asia/Kolkata', + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + { + createdAt: '2023-11-03T10:40:45.486Z', + updatedAt: '2023-11-03T10:40:45.486Z', + id: 4, + externalId: 'ext1', + organizationId: 3, + projectName: 'sampleproj12', + address: 'string', + latitude: '23.343535', + longitude: '24.5675786', + countryCode: 'IND', + fuelCode: 'ES100', + deviceTypeCode: 'TC110', + capacity: 2000, + SDGBenefits: [], + commissioningDate: '2022-10-18T11:35:27.640Z', + gridInterconnection: true, + offTaker: 'Residential', + yieldValue: 1500, + impactStory: 'string', + images: ['string'], + groupId: null, + deviceDescription: 'Ground Mount Solar', + energyStorage: true, + energyStorageCapacity: 600, + qualityLabels: 'string', + meterReadtype: 'Delta', + timezone: 'Asia/Kolkata', + version: '1.0', + IREC_Status: 'NotRegistered', + IREC_ID: null, + api_user_id: null, + organization: organizationEntity, + }, + ]; + const filterDto: FilterDTO = { + fuelCode: undefined, //FuelCode.ES100, + deviceTypeCode: DevicetypeCode.TC110, + capacity: undefined, //600, + start_date: undefined, //'2023-02-01T06:59:11.000Z', + end_date: undefined, //'2024-02-26T06:59:11.000Z', + gridInterconnection: undefined, //false + offTaker: OffTaker.School, + country: 'India', + }; + const pageNumber = 1; + const orgId = 4; + /* + const expectedQuery : FindManyOptions = { + where: { + deviceTypeCode: filterDto.deviceTypeCode, + offTaker: filterDto.offTaker, + countryCode: 'IND', + }, + order: { organizationId: 'DESC' }, + }; */ + + const limit = 20; + const expectedQuery: FindManyOptions = { + where: { + capacity: { + _type: 'lessThanOrEqual', + _value: '200', // Adjust as needed + _useParameter: true, + }, + countryCode: filterDto.country, + organizationId: orgId.toString(), // Use orgId provided dynamically + commissioningDate: { + _type: 'moreThanOrEqual', + _value: new Date().toISOString(), // Use current date or adjust as needed + _useParameter: true, + }, + SDGBenefits: { + _type: 'raw', + _value: [], + _useParameter: true, + _multipleParameters: true, + }, + deviceTypeCode: { + _type: 'raw', + _value: [filterDto.deviceTypeCode], // Adjust as needed + _useParameter: true, + _multipleParameters: true, + }, + offTaker: { + _type: 'raw', + _value: [filterDto.offTaker], // Adjust as needed + _useParameter: true, + _multipleParameters: true, + }, + }, + order: { organizationId: 'DESC' }, + skip: (pageNumber - 1) * limit, + take: limit, + }; + //const filterSpy = jest.spyOn(service, 'getFilteredQuery').mockResolvedValue(expectedQuery as FindManyOptions); + const getFilteredQueryMock = jest + .fn() + .mockReturnValue(expectedQuery as FindManyOptions); + service.getFilteredQuery = getFilteredQueryMock; + const findSpy = jest + .spyOn(repository, 'findAndCount') + .mockResolvedValue([deviceEntity, deviceEntity.length] as any); + const result = await service.find(filterDto, pageNumber, orgId); + + await expect(getFilteredQueryMock).toHaveBeenCalledWith(filterDto, orgId); + console.log(expectedQuery); + await expect(findSpy).toHaveBeenCalledWith({ + relations: ['organization'], + ...expectedQuery, + }); + + console.log( + 'Received arguments in findAndCount:', + findSpy.mock.calls[0], + findSpy.mock.calls[1], + ); + + console.log('Result with in test:', result); + await expect(result).toBeDefined(); + await expect(result.devices).toHaveLength(result.devices.length); + }); + }); +}); diff --git a/apps/drec-api/src/pods/device/device.service.ts b/apps/drec-api/src/pods/device/device.service.ts index b063ad976..23b95b7d6 100755 --- a/apps/drec-api/src/pods/device/device.service.ts +++ b/apps/drec-api/src/pods/device/device.service.ts @@ -11,8 +11,22 @@ import { } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { - FindOneOptions, Repository, In, IsNull, Not, FindOperator,LessThan, - Raw, Brackets, SelectQueryBuilder, FindConditions, FindManyOptions, Between, LessThanOrEqual, MoreThanOrEqual, ILike + FindOneOptions, + Repository, + In, + IsNull, + Not, + FindOperator, + LessThan, + Raw, + Brackets, + SelectQueryBuilder, + FindConditions, + FindManyOptions, + Between, + LessThanOrEqual, + MoreThanOrEqual, + ILike, } from 'typeorm'; import { Device } from './device.entity'; import { NewDeviceDTO } from './dto/new-device.dto'; @@ -24,7 +38,13 @@ import { UngroupedDeviceDTO, UpdateDeviceDTO, } from './dto'; -import { DeviceOrderBy, Integrator, ReadType, Role, IRECDeviceStatus } from '../../utils/enums'; +import { + DeviceOrderBy, + Integrator, + ReadType, + Role, + IRECDeviceStatus, +} from '../../utils/enums'; import cleanDeep from 'clean-deep'; import { DeviceKey, @@ -43,23 +63,24 @@ import { getDeviceTypeFromCode } from '../../utils/getDeviceTypeFromCode'; import { regenerateToken } from '../../utils/evident-login'; import { CheckCertificateIssueDateLogForDeviceEntity } from './check_certificate_issue_date_log_for_device.entity'; import { InfluxDB } from '@influxdata/influxdb-client'; -import { SDGBenefits } from '../../models/Sdgbenefit' +import { SDGBenefits } from '../../models/Sdgbenefit'; import { v4 as uuid } from 'uuid'; import { HistoryIntermediate_MeterRead } from '../reads/history_intermideate_meterread.entity'; import { Observable } from 'rxjs'; import { AxiosRequestConfig } from 'axios'; -import { IrecDevicesInformationEntity } from './irec_devices_information.entity' -import { IrecErrorLogInformationEntity } from './irec_error_log_information.entity' +import { IrecDevicesInformationEntity } from './irec_devices_information.entity'; +import { IrecErrorLogInformationEntity } from './irec_error_log_information.entity'; import { getLocalTimeZoneFromDevice } from '../../utils/localTimeDetailsForDevice'; import { OrganizationService } from '../organization/organization.service'; import { UserService } from '../user/user.service'; -import { DeviceLateongoingIssueCertificateEntity } from './device_lateongoing_certificate.entity' +import { DeviceLateongoingIssueCertificateEntity } from './device_lateongoing_certificate.entity'; @Injectable() export class DeviceService { private readonly logger = new Logger(DeviceService.name); constructor( - @InjectRepository(HistoryIntermediate_MeterRead) private readonly historyrepository: Repository, + @InjectRepository(HistoryIntermediate_MeterRead) + private readonly historyrepository: Repository, @InjectRepository(Device) private readonly repository: Repository, @InjectRepository(CheckCertificateIssueDateLogForDeviceEntity) private readonly checkdevcielogcertificaterepository: Repository, @@ -72,22 +93,27 @@ export class DeviceService { private readonly userService: UserService, @InjectRepository(DeviceLateongoingIssueCertificateEntity) private readonly latedevciecertificaterepository: Repository, - ) { } + ) {} - public async find(filterDto: FilterDTO, pagenumber: number, OrgId?: number): Promise<{ devices: Device[], currentPage, totalPages, totalCount }> { + public async find( + filterDto: FilterDTO, + pagenumber: number, + OrgId?: number, + ): Promise<{ devices: Device[]; currentPage; totalPages; totalCount }> { this.logger.verbose(`With in find`); const limit = 20; - let query = await this.getFilteredQuery(filterDto, OrgId) + let query = await this.getFilteredQuery(filterDto, OrgId); if (pagenumber) { query = { - ...query, skip: (pagenumber - 1) * limit, - take: limit - } + ...query, + skip: (pagenumber - 1) * limit, + take: limit, + }; } const [devices, totalCount] = await this.repository.findAndCount({ relations: ['organization'], - ...query + ...query, }); // const [devices, totalCount] = await this.repository.findAndCount({relations: ['organization'],query}); //devices.externalId = devices.developerExternalId @@ -96,17 +122,17 @@ export class DeviceService { const newDevices = []; await devices.map((device: Device) => { - device['organizationname'] = device.organization.name + device['organizationname'] = device.organization.name; // device.externalId = device.developerExternalId - delete device["organization"]; + delete device['organization']; newDevices.push(device); - }) + }); return { devices: newDevices, currentPage, totalPages, - totalCount + totalCount, }; } @@ -117,14 +143,20 @@ export class DeviceService { integrator, }, }); - delete result["organization"]; + delete result['organization']; return result; } - async getOrganizationDevices(organizationId: number, api_user_id: string, role: Role, filterDto: FilterDTO, pagenumber: number): Promise { + async getOrganizationDevices( + organizationId: number, + api_user_id: string, + role: Role, + filterDto: FilterDTO, + pagenumber: number, + ): Promise { this.logger.verbose(`With in getOrganizationDevices`); if (pagenumber === null || pagenumber === undefined) { - pagenumber = 1 + pagenumber = 1; } if (Object.keys(filterDto).length != 0) { const limit = 20; @@ -134,8 +166,7 @@ export class DeviceService { //@ts-ignore if (filterDto.organizationId) { where = { ...where, organizationId }; - } - else { + } else { where = { ...where, api_user_id }; } } else { @@ -144,11 +175,12 @@ export class DeviceService { query.where = where; const [devices, totalCount] = await this.repository.findAndCount({ - ...query, skip: (pagenumber - 1) * limit, + ...query, + skip: (pagenumber - 1) * limit, take: limit, order: { createdAt: 'DESC', - } + }, }); if (totalCount == 0) { this.logger.error(`Page number out of range`); @@ -158,22 +190,25 @@ export class DeviceService { const totalPages = Math.ceil(totalCount / limit); if (pagenumber > totalPages) { this.logger.error(`Page number out of range`); - throw new HttpException('Page number out of range', HttpStatus.NOT_FOUND); + throw new HttpException( + 'Page number out of range', + HttpStatus.NOT_FOUND, + ); } const currentPage = pagenumber; const newDevices = []; await devices.map((device: Device) => { - device.externalId = device.developerExternalId - delete device["developerExternalId"]; - delete device["organization"]; + device.externalId = device.developerExternalId; + delete device['developerExternalId']; + delete device['organization']; newDevices.push(device); - }) + }); return { devices: newDevices, currentPage, totalPages, - totalCount + totalCount, }; } //devices.externalId = devices.developerExternalId @@ -187,16 +222,15 @@ export class DeviceService { //devices.externalId = devices.developerExternalId const newDevices = []; await devices.map((device: Device) => { - device.externalId = device.developerExternalId - delete device["developerExternalId"]; - delete device["organization"]; + device.externalId = device.developerExternalId; + delete device['developerExternalId']; + delete device['organization']; newDevices.push(device); - }) + }); return newDevices; } - public getatleastonedeviceinOrg(organizationId: number): Promise { this.logger.verbose(`With in getatleastonedeviceinOrg`); const result = this.repository.find({ @@ -204,13 +238,13 @@ export class DeviceService { order: { id: 'DESC', }, - take: 1 + take: 1, }); - delete result["organization"]; + delete result['organization']; return result; } // Cron pattern for running every 30 seconds - // @Cron('*/30 * * * * *') + // @Cron('*/30 * * * * *') // async fetchDataCronJob() { // try { // const data = await this.fetchDataFromApi(); @@ -233,8 +267,6 @@ export class DeviceService { // return response.data; // } - - //@Cron('*/30 * * * * *') async I_recPostData(deviceId): Promise { this.logger.verbose(`With in I_recPostData`); @@ -249,19 +281,20 @@ export class DeviceService { let jwtToken = await regenerateToken(this.httpService); const headers = { 'Content-Type': 'application/json', - 'Authorization': `Bearer ${jwtToken}` + Authorization: `Bearer ${jwtToken}`, }; if (device.fuelCode === null) { - this.logger.error(`Device Added Failure in I-REC,Item not found for fuel`); + this.logger.error( + `Device Added Failure in I-REC,Item not found for fuel`, + ); return { status: false, message: 'Device Added Failure in I-REC,Item not found for fuel', - }; } const requestBody = { name: `${device.externalId}`, - fuel: `/fuels/${device.fuelCode}` + fuel: `/fuels/${device.fuelCode}`, }; const config: AxiosRequestConfig = { headers, @@ -269,40 +302,40 @@ export class DeviceService { const url = `${process.env.IREC_EVIDENT_API_URL}/devices`; try { - const response = await this.httpService.post(url, requestBody, config).toPromise(); + const response = await this.httpService + .post(url, requestBody, config) + .toPromise(); const data = response.data; device.IREC_ID = data.code; device.IREC_Status = IRECDeviceStatus.DeviceNameCreated; await this.repository.save(device); let irecdeviceaddDto = new IrecDevicesInformationEntity(); - irecdeviceaddDto.IREC_id = data.code, - irecdeviceaddDto.event = 'register', - irecdeviceaddDto.request = requestBody, - irecdeviceaddDto.responses = data + (irecdeviceaddDto.IREC_id = data.code), + (irecdeviceaddDto.event = 'register'), + (irecdeviceaddDto.request = requestBody), + (irecdeviceaddDto.responses = data); await this.irecinforepository.save({ - ...irecdeviceaddDto - }) + ...irecdeviceaddDto, + }); this.logger.log(`Device Added Successfully in I-REC`); return { status: true, message: 'Device Added Successfully in I-REC', - IREC_ID: data.code + IREC_ID: data.code, }; - } catch (error) { let irecdeviceerrorlogDto = new IrecErrorLogInformationEntity(); - irecdeviceerrorlogDto.event = 'register', - irecdeviceerrorlogDto.request = requestBody, - irecdeviceerrorlogDto.error_log_responses = error + (irecdeviceerrorlogDto.event = 'register'), + (irecdeviceerrorlogDto.request = requestBody), + (irecdeviceerrorlogDto.error_log_responses = error); await this.irecerrorlogrepository.save({ - ...irecdeviceerrorlogDto - }) + ...irecdeviceerrorlogDto, + }); this.logger.error(`Device Added Failure in I-REC ${error}`); return { status: false, message: 'Device Added Failure in I-REC, ' + error, - }; } } @@ -310,7 +343,7 @@ export class DeviceService { //return { status: false, message: 'device not found' }; } - //this function for add device details into irec + //this function for add device details into irec async I_RECDeviceDetailsPostData(deviceId): Promise> { this.logger.verbose(`With in I_RECDeviceDetailsPostData`); const device = await this.repository.findOne({ @@ -324,57 +357,54 @@ export class DeviceService { let jwtToken = await regenerateToken(this.httpService); const headers = { 'Content-Type': 'application/json', // Set the Content-Type header for JSON data - 'Authorization': `Bearer ${jwtToken}` + Authorization: `Bearer ${jwtToken}`, // Add any other custom headers if needed }; let irec_capacity = device.capacity / 1000; //let deId=device.externalId const requestBody = { - "deviceType": "/device_types/" + device.deviceTypeCode, - "fuel": "/fuels/", - "device": "/devices/", - "registrant": "/registrants/", - "issuer": "/issuers/", - "name": device.externalId, - "capacity": irec_capacity, - "supported": true, - "latitude": device.latitude, - "longitude": device.longitude, - "registrationDate": device.createdAt, - "commissioningDate": device.commissioningDate, - "status": IRECDeviceStatus.Submitted, - "active": true, - "address1": device.address, - "country": "/countries/" + device.countryCode, - } + deviceType: '/device_types/' + device.deviceTypeCode, + fuel: '/fuels/', + device: '/devices/', + registrant: '/registrants/', + issuer: '/issuers/', + name: device.externalId, + capacity: irec_capacity, + supported: true, + latitude: device.latitude, + longitude: device.longitude, + registrationDate: device.createdAt, + commissioningDate: device.commissioningDate, + status: IRECDeviceStatus.Submitted, + active: true, + address1: device.address, + country: '/countries/' + device.countryCode, + }; // console.log("jwtToken", jwtToken); const config: AxiosRequestConfig = { headers, // Set the headers in the config object - }; - const url = `${process.env.IREC_EVIDENT_API_URL}/devices`;// Replace with your API endpoint + const url = `${process.env.IREC_EVIDENT_API_URL}/devices`; // Replace with your API endpoint let data: any; - let response = this.httpService.post(url, requestBody, config).subscribe(response => { - - data = response.data; - device.IREC_ID = data.code - device.IREC_Status = IRECDeviceStatus.DeviceNameCreated - - }, error => { - this.logger.error(error); - - }); + let response = this.httpService.post(url, requestBody, config).subscribe( + (response) => { + data = response.data; + device.IREC_ID = data.code; + device.IREC_Status = IRECDeviceStatus.DeviceNameCreated; + }, + (error) => { + this.logger.error(error); + }, + ); await this.repository.save(device); // console.log("response from irec", response._subscribe) - return data + return data; } - } - public async findForDevicesWithDeviceIdAndOrganizationId( deviceIds: Array, organizationId: number, @@ -384,7 +414,7 @@ export class DeviceService { where: { id: In(deviceIds), organizationId }, }); - delete result["organization"]; + delete result['organization']; return result; } @@ -395,12 +425,13 @@ export class DeviceService { order: { createdAt: 'DESC', }, - }); - delete result["organization"]; + delete result['organization']; return result; } - public async NewfindForGroup(groupId: number): Promise<{ [key: string]: Device[] }> { + public async NewfindForGroup( + groupId: number, + ): Promise<{ [key: string]: Device[] }> { this.logger.verbose(`With in NewfindForGroup`); let groupdevice: Array = await this.repository.find({ where: { groupId }, @@ -410,7 +441,11 @@ export class DeviceService { }); //console.log(groupdevice) - groupdevice = groupdevice.filter(ele => ele.meterReadtype == ReadType.Delta || ele.meterReadtype == ReadType.ReadMeter) + groupdevice = groupdevice.filter( + (ele) => + ele.meterReadtype == ReadType.Delta || + ele.meterReadtype == ReadType.ReadMeter, + ); const deviceGroupedByCountry = this.groupBy(groupdevice, 'countryCode'); //console.log(deviceGroupedByCountry); @@ -421,31 +456,34 @@ export class DeviceService { ////console.log(array) this.logger.verbose(`With in groupBy`); return array.reduce((result: any, currentValue: any) => { - (result[currentValue[key]] = result[currentValue[key]] || []).push( - currentValue + currentValue, ); return result; }, {}); - }; + } public async findByIds(ids: number[]): Promise { this.logger.verbose(`With in findByIds`); const result = await this.repository.findByIds(ids); - delete result["organization"]; + delete result['organization']; return result; } - public async findByIdsWithoutGroupIdsAssignedImpliesWithoutReservation(ids: number[]): Promise { - this.logger.verbose(`With in findByIdsWithoutGroupIdsAssignedImpliesWithoutReservation`); + public async findByIdsWithoutGroupIdsAssignedImpliesWithoutReservation( + ids: number[], + ): Promise { + this.logger.verbose( + `With in findByIdsWithoutGroupIdsAssignedImpliesWithoutReservation`, + ); const result = await this.repository.find({ where: { //id: In(ids), groupId: IsNull() - id: In(ids) + id: In(ids), //, groupId: IsNull() - } + }, }); - delete result["organization"]; + delete result['organization']; return result; } @@ -458,31 +496,36 @@ export class DeviceService { if (!device) { return null; } - device.timezone = await getLocalTimeZoneFromDevice(device.createdAt, device); + device.timezone = await getLocalTimeZoneFromDevice( + device.createdAt, + device, + ); - delete device["organization"]; + delete device['organization']; return device; } async findReads(meterId: string): Promise { this.logger.verbose(`With in findReads`); - const result = await this.repository.findOne({ where: { externalId: meterId } }) - delete result["organization"]; - - return ( - (result) ?? null - ); + const result = await this.repository.findOne({ + where: { externalId: meterId }, + }); + delete result['organization']; + return result ?? null; } - async findDeviceByDeveloperExternalId(meterId: string, organizationId: number): Promise { + async findDeviceByDeveloperExternalId( + meterId: string, + organizationId: number, + ): Promise { this.logger.verbose(`With in findDeviceByDeveloperExternalId`); //change whare condition filter by developerExternalId instead of externalId and organizationid const device: Device = await this.repository.findOne({ where: { developerExternalId: meterId, - organizationId: organizationId - } + organizationId: organizationId, + }, }); // delete device["organization"]; @@ -490,18 +533,24 @@ export class DeviceService { this.logger.warn(`Returning null`); return null; } - device.timezone = await getLocalTimeZoneFromDevice(device.createdAt, device); + device.timezone = await getLocalTimeZoneFromDevice( + device.createdAt, + device, + ); return device; } async findMultipleDevicesBasedExternalId( meterIdList: Array, - organizationId: number + organizationId: number, ): Promise> { //console.log("meterIdList", meterIdList); this.logger.verbose(`With in findMultipleDevicesBasedExternalId`); return ( (await this.repository.find({ - where: { developerExternalId: In(meterIdList), organizationId: organizationId }, + where: { + developerExternalId: In(meterIdList), + organizationId: organizationId, + }, })) ?? null ); } @@ -534,21 +583,21 @@ export class DeviceService { const checkexternalid = await this.repository.findOne({ where: { developerExternalId: newDevice.externalId, - organizationId: orgCode - - } + organizationId: orgCode, + }, }); //console.log(checkexternalid) if (checkexternalid != undefined) { - this.logger.debug("Line No: 236"); - this.logger.error(`ExternalId already exist in this organization, can't add entry with same external id ${newDevice.externalId}`); + this.logger.debug('Line No: 236'); + this.logger.error( + `ExternalId already exist in this organization, can't add entry with same external id ${newDevice.externalId}`, + ); return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: `ExternalId already exist in this organization, can't add entry with same external id ${newDevice.externalId}`, - - }) + }), ); }); // throw new ConflictException({ @@ -562,28 +611,30 @@ export class DeviceService { //console.log(newDevice.developerExternalId) //@ts-ignore if (newDevice.SDGBenefits === 0 || newDevice.SDGBenefits === 1) { - newDevice.SDGBenefits = [] + newDevice.SDGBenefits = []; } else if (Array.isArray(newDevice.SDGBenefits)) { - newDevice.SDGBenefits.forEach( - (sdgbname: string, index: number) => { - let foundEle = sdgbbenifitslist.find(ele => ele.name.toLowerCase() === sdgbname.toString().toLowerCase()); - if (foundEle) { - newDevice.SDGBenefits[index] = foundEle.value - } - else { - newDevice.SDGBenefits[index] = 'invalid'; - } - }); - newDevice.SDGBenefits = newDevice.SDGBenefits.filter(ele => ele !== 'invalid'); + newDevice.SDGBenefits.forEach((sdgbname: string, index: number) => { + let foundEle = sdgbbenifitslist.find( + (ele) => ele.name.toLowerCase() === sdgbname.toString().toLowerCase(), + ); + if (foundEle) { + newDevice.SDGBenefits[index] = foundEle.value; + } else { + newDevice.SDGBenefits[index] = 'invalid'; + } + }); + newDevice.SDGBenefits = newDevice.SDGBenefits.filter( + (ele) => ele !== 'invalid', + ); } else { - newDevice.SDGBenefits = [] + newDevice.SDGBenefits = []; } let result: any; if (role === Role.ApiUser) { const org = await this.organizationService.findOne(orgCode, { where: { - api_user_id: api_user_id - } + api_user_id: api_user_id, + }, }); const orguser = await this.userService.findByEmail(org.orgEmail); @@ -601,17 +652,16 @@ export class DeviceService { organizationId: orgCode, api_user_id: api_user_id, }); - } - else { + } else { result = await this.repository.save({ ...newDevice, organizationId: orgCode, }); } result.externalId = result.developerExternalId; - delete result["developerExternalId"]; - delete result["organization"]; - return result + delete result['developerExternalId']; + delete result['organization']; + return result; } async update( organizationId: number, @@ -623,12 +673,15 @@ export class DeviceService { const rule = role === Role.DeviceOwner ? { - where: { - organizationId, - }, - } + where: { + organizationId, + }, + } : undefined; - let currentDevice = await this.findDeviceByDeveloperExternalId(externalId.trim(), organizationId); + let currentDevice = await this.findDeviceByDeveloperExternalId( + externalId.trim(), + organizationId, + ); if (!currentDevice) { this.logger.error(`No device found with id ${externalId}`); throw new NotFoundException(`No device found with id ${externalId}`); @@ -640,29 +693,34 @@ export class DeviceService { let sdgbbenifitslist = SDGBenefits; //@ts-ignore - if (updateDeviceDTO.SDGBenefits === 0 || updateDeviceDTO.SDGBenefits === 1) { - updateDeviceDTO.SDGBenefits = [] + if ( + updateDeviceDTO.SDGBenefits === 0 || + updateDeviceDTO.SDGBenefits === 1 + ) { + updateDeviceDTO.SDGBenefits = []; } else if (Array.isArray(updateDeviceDTO.SDGBenefits)) { - updateDeviceDTO.SDGBenefits.forEach( - (sdgbname: string, index: number) => { - let foundEle = sdgbbenifitslist.find(ele => ele.name.toLowerCase() === sdgbname.toString().toLowerCase()); - if (foundEle) { - updateDeviceDTO.SDGBenefits[index] = foundEle.value - } - else { - updateDeviceDTO.SDGBenefits[index] = 'invalid'; - } - }); - updateDeviceDTO.SDGBenefits = updateDeviceDTO.SDGBenefits.filter(ele => ele !== 'invalid'); + updateDeviceDTO.SDGBenefits.forEach((sdgbname: string, index: number) => { + let foundEle = sdgbbenifitslist.find( + (ele) => ele.name.toLowerCase() === sdgbname.toString().toLowerCase(), + ); + if (foundEle) { + updateDeviceDTO.SDGBenefits[index] = foundEle.value; + } else { + updateDeviceDTO.SDGBenefits[index] = 'invalid'; + } + }); + updateDeviceDTO.SDGBenefits = updateDeviceDTO.SDGBenefits.filter( + (ele) => ele !== 'invalid', + ); } else { - updateDeviceDTO.SDGBenefits = [] + updateDeviceDTO.SDGBenefits = []; } currentDevice = defaults(updateDeviceDTO, currentDevice); // currentDevice.status = DeviceStatus.Submitted; const result = await this.repository.save(currentDevice); result.externalId = result.developerExternalId; - delete result["developerExternalId"]; - delete result["organization"]; + delete result['developerExternalId']; + delete result['organization']; //console.log(result); return result; } @@ -675,12 +733,12 @@ export class DeviceService { const devices = await this.repository.find({ where: { groupId: null, organizationId }, }); - delete devices["organization"]; + delete devices['organization']; return this.groupDevices(orderFilterDto, devices); } async findUngroupedById( id: number, - organizationId?: number + organizationId?: number, ): Promise { this.logger.verbose(`With in findUngroupedById`); const devices = await this.repository.find({ @@ -689,7 +747,6 @@ export class DeviceService { if (devices) { return true; } - } getDeviceTypes(): CodeNameDTO[] { @@ -783,7 +840,10 @@ export class DeviceService { return name; } - public getFilteredQuery(filter: FilterDTO, orgId?: number): FindManyOptions { + public getFilteredQuery( + filter: FilterDTO, + orgId?: number, + ): FindManyOptions { this.logger.verbose(`With in getFilteredQuery`); const limit = 20; const where: FindConditions = cleanDeep({ @@ -793,68 +853,73 @@ export class DeviceService { gridInterconnection: filter.gridInterconnection, // offTaker: filter.offTaker, countryCode: filter.country && getCodeFromCountry(filter.country), - }); if (orgId != null || orgId != undefined) { - where.organizationId = orgId + where.organizationId = orgId; } //@ts-ignore - else if (filter.organizationId != null && filter.organizationId != undefined) { + else if ( + filter.organizationId != null && + filter.organizationId != undefined + ) { //@ts-ignore - where.organizationId = filter.organizationId + where.organizationId = filter.organizationId; } if (filter.start_date != null && filter.end_date === undefined) { where.commissioningDate = MoreThanOrEqual(filter.start_date); - } if (filter.start_date === undefined && filter.end_date != null) { where.commissioningDate = LessThanOrEqual(filter.end_date); } if (filter.start_date != null && filter.end_date != null) { - where.commissioningDate = filter.start_date && + where.commissioningDate = + filter.start_date && filter.end_date && - Between(filter.start_date, filter.end_date) + Between(filter.start_date, filter.end_date); } if (filter.SDGBenefits) { - const newsdg = filter.SDGBenefits.toString() + const newsdg = filter.SDGBenefits.toString(); const sdgBenefitsArray = newsdg.split(','); - where.SDGBenefits = Raw(alias => `${alias} ILIKE ANY(ARRAY[${sdgBenefitsArray.map(term => `'%${term}%'`)}])`); + where.SDGBenefits = Raw( + (alias) => + `${alias} ILIKE ANY(ARRAY[${sdgBenefitsArray.map((term) => `'%${term}%'`)}])`, + ); // where.SDGBenefits = this.getRawFilter(filter.SDGBenefits.toString()); } if (filter.deviceTypeCode) { - const newdtype = filter.deviceTypeCode.toString() + const newdtype = filter.deviceTypeCode.toString(); const newdtypeArray = newdtype.split(','); - where.deviceTypeCode = Raw(alias => `${alias} ILIKE ANY(ARRAY[${newdtypeArray.map(term => `'%${term}%'`)}])`); - + where.deviceTypeCode = Raw( + (alias) => + `${alias} ILIKE ANY(ARRAY[${newdtypeArray.map((term) => `'%${term}%'`)}])`, + ); } if (filter.offTaker) { - const newoffTaker = filter.offTaker.toString() + const newoffTaker = filter.offTaker.toString(); const newoffTakerArray = newoffTaker.split(','); - where.offTaker = Raw(alias => `${alias} ILIKE ANY(ARRAY[${newoffTakerArray.map(term => `'%${term}%'`)}])`); - + where.offTaker = Raw( + (alias) => + `${alias} ILIKE ANY(ARRAY[${newoffTakerArray.map((term) => `'%${term}%'`)}])`, + ); } //console.log(where) const query: FindManyOptions = { where, order: { organizationId: 'DESC', - } + }, }; return query; } - private getRawFilter( - filter: - | String - , - ): FindOperator { + private getRawFilter(filter: String): FindOperator { this.logger.verbose(`With in getRawFilter`); return Raw((alias) => `${alias} = Any(SDGBenefits)`, { - SDGBenefits: [filter] + SDGBenefits: [filter], }); } public async addGroupIdToDeviceForReserving( currentDevice: Device, - groupId: number + groupId: number, ): Promise { this.logger.verbose(`With in addGroupIdToDeviceForReserving`); currentDevice.groupId = groupId; @@ -891,7 +956,9 @@ export class DeviceService { organizationOwnerCode && currentDevice.organizationId !== organizationOwnerCode ) { - this.logger.error(`Device with id: ${currentDevice.id} belongs to a different owner`); + this.logger.error( + `Device with id: ${currentDevice.id} belongs to a different owner`, + ); throw new NotAcceptableException( `Device with id: ${currentDevice.id} belongs to a different owner`, ); @@ -910,9 +977,11 @@ export class DeviceService { // throw new NotFoundException( // `No device found with id ${deviceId} and groupId: ${groupId}`, // ); - this.logger.error(`in removeFromGroup 373 No device found with id ${deviceId} and groupId: ${groupId}`); + this.logger.error( + `in removeFromGroup 373 No device found with id ${deviceId} and groupId: ${groupId}`, + ); } - currentDevice ? currentDevice.groupId = null : ''; + currentDevice ? (currentDevice.groupId = null) : ''; return await this.repository.save(currentDevice); } @@ -937,7 +1006,7 @@ export class DeviceService { const devicereadtype = await this.repository.findOne({ where: { externalId: deviceId, - } + }, }); if (!devicereadtype) { this.logger.error(`No device found with id ${deviceId}`); @@ -946,7 +1015,6 @@ export class DeviceService { devicereadtype.meterReadtype = meterReadtype; return await this.repository.save(devicereadtype); - } public async updatetimezone( deviceId: string, @@ -956,7 +1024,7 @@ export class DeviceService { const devicereadtype = await this.repository.findOne({ where: { externalId: deviceId, - } + }, }); if (!devicereadtype) { this.logger.error(`No device found with id ${deviceId}`); @@ -965,13 +1033,15 @@ export class DeviceService { devicereadtype.timezone = timeZone; return await this.repository.save(devicereadtype); - } // - private getBuyerFilteredQuery(filter: FilterDTO, pagenumber, limit): FindManyOptions { + private getBuyerFilteredQuery( + filter: FilterDTO, + pagenumber, + limit, + ): FindManyOptions { this.logger.verbose(`With in getBuyerFilteredQuery`); const where: FindConditions = cleanDeep({ - fuelCode: filter.fuelCode, deviceTypeCode: filter.deviceTypeCode, capacity: filter.capacity && LessThanOrEqual(filter.capacity), @@ -993,16 +1063,21 @@ export class DeviceService { }; return query; } - public async finddeviceForBuyer(filterDto: FilterDTO, pagenumber: number, api_user_id: string): Promise { + public async finddeviceForBuyer( + filterDto: FilterDTO, + pagenumber: number, + api_user_id: string, + ): Promise { const limit = 20; let query = this.getFilteredQuery(filterDto); if (pagenumber) { query = { - ...query, skip: (pagenumber - 1) * limit, - take: limit - } + ...query, + skip: (pagenumber - 1) * limit, + take: limit, + }; } - let where: any = query.where + let where: any = query.where; where = { ...where, groupId: null, api_user_id: api_user_id }; @@ -1015,39 +1090,42 @@ export class DeviceService { const newUnreservedDevices = devices.map((device: Device) => { device.externalId = device.developerExternalId; - delete device["developerExternalId"]; - delete device["organization"]; + delete device['developerExternalId']; + delete device['organization']; return device; }); return { devices: newUnreservedDevices, currentPage, totalPages, - totalCount + totalCount, }; } - - public async AddCertificateIssueDateLogForDevice(params: CheckCertificateIssueDateLogForDeviceEntity + public async AddCertificateIssueDateLogForDevice( + params: CheckCertificateIssueDateLogForDeviceEntity, ): Promise { this.logger.verbose(`With in AddCertificateIssueDateLogForDevice`); return await this.checkdevcielogcertificaterepository.save({ ...params, - }); } //add new fuction for add window cycle date for late certificate - public async AddLateCertificateIssueDateLogForDevice(params: DeviceLateongoingIssueCertificateEntity + public async AddLateCertificateIssueDateLogForDevice( + params: DeviceLateongoingIssueCertificateEntity, ): Promise { this.logger.verbose(`With in AddLateCertificateIssueDateForDevice`); return await this.latedevciecertificaterepository.save({ ...params, - }); } - public async findAllLateCycle(groupid, externalid,reservation_endDate:Date): Promise { + public async findAllLateCycle( + groupid, + externalid, + reservation_endDate: Date, + ): Promise { const reservation_end_UtcDate = new Date(reservation_endDate); - console.log(reservation_end_UtcDate) + console.log(reservation_end_UtcDate); return await this.latedevciecertificaterepository.find({ where: { groupId: groupid, @@ -1055,25 +1133,28 @@ export class DeviceService { //createdAt:LessThanOrEqual(reservation_end_UtcDate) }, order: { - id: 'ASC' - } - }) + id: 'ASC', + }, + }); } - public async finddeviceLateCycleOfdaterange(groupid, externalid, latestartDate, lateendDate): Promise { - + public async finddeviceLateCycleOfdaterange( + groupid, + externalid, + latestartDate, + lateendDate, + ): Promise { const isalreadyadded = await this.latedevciecertificaterepository.findOne({ where: { groupId: groupid, device_externalid: externalid, late_start_date: latestartDate.toString(), - late_end_date: lateendDate.toString() + late_end_date: lateendDate.toString(), }, - }) - + }); + if (isalreadyadded) { return true; } - } // public getCheckCertificateIssueDateLogForDevice(deviceid: string, @@ -1103,23 +1184,23 @@ export class DeviceService { // //console.log(groupId); // return groupId // } - public async getCheckCertificateIssueDateLogForDevice(deviceid: string, + public async getCheckCertificateIssueDateLogForDevice( + deviceid: string, startDate: Date, - endDate: Date): Promise { + endDate: Date, + ): Promise { this.logger.verbose(`With in getCheckCertificateIssueDateLogForDevice`); - const query = this.getdevcielogFilteredQuery(deviceid, - startDate, - endDate); + const query = this.getdevcielogFilteredQuery(deviceid, startDate, endDate); try { - const device = await query.getRawMany(); const devices = device.map((s: any) => { const item: any = { - certificate_issuance_startdate: s.device_certificate_issuance_startdate, + certificate_issuance_startdate: + s.device_certificate_issuance_startdate, certificate_issuance_enddate: s.device_certificate_issuance_enddate, readvalue_watthour: s.device_readvalue_watthour, status: s.device_status, - deviceid: s.device_externalId + deviceid: s.device_externalId, }; return item; }); @@ -1131,38 +1212,53 @@ export class DeviceService { } } - private getdevcielogFilteredQuery(deviceid: string, + private getdevcielogFilteredQuery( + deviceid: string, startDate: Date, - endDate: Date): SelectQueryBuilder { + endDate: Date, + ): SelectQueryBuilder { this.logger.verbose(`With in getdevcielogFilteredQuery`); // const { organizationName, status } = filterDto; const query = this.checkdevcielogcertificaterepository - .createQueryBuilder("device"). - where("device.externalId = :deviceid", { deviceid: deviceid }) + .createQueryBuilder('device') + .where('device.externalId = :deviceid', { deviceid: deviceid }) .andWhere( new Brackets((db) => { - db.where("device.status ='Requested' OR device.status ='Succeeded'") - })) + db.where("device.status ='Requested' OR device.status ='Succeeded'"); + }), + ) .andWhere( new Brackets((db) => { - db.where("device.certificate_issuance_startdate BETWEEN :startDateFirstWhere AND :endDateFirstWhere ", { startDateFirstWhere: startDate, endDateFirstWhere: endDate }) - .orWhere("device.certificate_issuance_enddate BETWEEN :startDateSecondtWhere AND :endDateSecondWhere", { startDateSecondtWhere: startDate, endDateSecondWhere: endDate }) - .orWhere(":startdateThirdWhere BETWEEN device.certificate_issuance_startdate AND device.certificate_issuance_enddate", { startdateThirdWhere: startDate }) - .orWhere(":enddateforthdWhere BETWEEN device.certificate_issuance_startdate AND device.certificate_issuance_enddate", { enddateforthdWhere: endDate }) - + db.where( + 'device.certificate_issuance_startdate BETWEEN :startDateFirstWhere AND :endDateFirstWhere ', + { startDateFirstWhere: startDate, endDateFirstWhere: endDate }, + ) + .orWhere( + 'device.certificate_issuance_enddate BETWEEN :startDateSecondtWhere AND :endDateSecondWhere', + { startDateSecondtWhere: startDate, endDateSecondWhere: endDate }, + ) + .orWhere( + ':startdateThirdWhere BETWEEN device.certificate_issuance_startdate AND device.certificate_issuance_enddate', + { startdateThirdWhere: startDate }, + ) + .orWhere( + ':enddateforthdWhere BETWEEN device.certificate_issuance_startdate AND device.certificate_issuance_enddate', + { enddateforthdWhere: endDate }, + ); }), - ) + ); // //console.log(query) // //console.log(query.getQuery()) return query; } - async getallread(meterId: string,): Promise> { + async getallread( + meterId: string, + ): Promise> { this.logger.verbose(`With in getallread`); - const fluxQuery = - `from(bucket: "${process.env.INFLUXDB_BUCKET}") + const fluxQuery = `from(bucket: "${process.env.INFLUXDB_BUCKET}") |> range(start: 0) - |> filter(fn: (r) => r.meter == "${meterId}" and r._field == "read")` + |> filter(fn: (r) => r.meter == "${meterId}" and r._field == "read")`; return await this.execute(fluxQuery); } async execute(query: any) { @@ -1186,7 +1282,7 @@ export class DeviceService { const org = process.env.INFLUXDB_ORG; //@ts-ignore - return new InfluxDB({ url, token }).getQueryApi(org) + return new InfluxDB({ url, token }).getQueryApi(org); } async getOrganizationDevicesTotal(organizationId: number): Promise { @@ -1198,14 +1294,13 @@ export class DeviceService { let totalamountofreads = []; await Promise.all( devices.map(async (device: Device) => { - - let certifiedamountofread = await this.checkdevcielogcertificaterepository.find( - { - where: { externalId: device.externalId } - } - ) + let certifiedamountofread = + await this.checkdevcielogcertificaterepository.find({ + where: { externalId: device.externalId }, + }); const totalcertifiedReadValue = certifiedamountofread.reduce( - (accumulator, currentValue) => accumulator + currentValue.readvalue_watthour, + (accumulator, currentValue) => + accumulator + currentValue.readvalue_watthour, 0, ); let totalamount = await this.getallread(device.externalId); @@ -1216,10 +1311,10 @@ export class DeviceService { totalamountofreads.push({ externalId: device.developerExternalId, totalcertifiedReadValue: totalcertifiedReadValue, - totalReadValue: totalReadValue - }) - - })) + totalReadValue: totalReadValue, + }); + }), + ); //console.log(totalamountofreads); return totalamountofreads; @@ -1240,40 +1335,41 @@ export class DeviceService { // ); // } - /* */ public async changeDeviceCreatedAt(externalId, onboardedDate, givenDate) { this.logger.verbose(`With in changeDeviceCreatedAt`); - const numberOfHistReads: number = await this.getNumberOfHistReads(externalId); - const numberOfOngReads: number = await this.getNumberOfOngReads(externalId, onboardedDate); + const numberOfHistReads: number = + await this.getNumberOfHistReads(externalId); + const numberOfOngReads: number = await this.getNumberOfOngReads( + externalId, + onboardedDate, + ); - if (numberOfHistReads <= 0 && numberOfOngReads <= 0) - //no reads exist for the given device - //So we can change the date - { + if (numberOfHistReads <= 0 && numberOfOngReads <= 0) { + //no reads exist for the given device + //So we can change the date return this.changecreatedAtDate(onboardedDate, givenDate, externalId); - } - - - else//If reads exist for the given device - { - this.logger.error(`The given device already had some meter reads;Thus you cannot change the createdAt`); - throw new HttpException('The given device already had some meter reads;Thus you cannot change the createdAt', 409); + } //If reads exist for the given device + else { + this.logger.error( + `The given device already had some meter reads;Thus you cannot change the createdAt`, + ); + throw new HttpException( + 'The given device already had some meter reads;Thus you cannot change the createdAt', + 409, + ); } } - - async getNumberOfHistReads(deviceId): Promise { this.logger.verbose(`With in getNumberOfHistReads`); - const query = this.historyrepository.createQueryBuilder("devicehistory") - .where("devicehistory.externalId = :deviceId", { deviceId }); + const query = this.historyrepository + .createQueryBuilder('devicehistory') + .where('devicehistory.externalId = :deviceId', { deviceId }); const count = await query.getCount(); return count; } - - async getNumberOfOngReads(externalId, onboardedDate): Promise { this.logger.verbose(`With in getNumberOfOngReads`); let fluxQuery = ``; @@ -1287,7 +1383,6 @@ export class DeviceService { return noOfReads; } - async ongExecute(query: any) { this.logger.verbose(`With in ongExecute`); const data: any = await this.dbReader.collectRows(query); @@ -1298,23 +1393,32 @@ export class DeviceService { return Number(data[0]._value); } - async changecreatedAtDate(onboardedDate, givenDate, externalId) { this.logger.verbose(`With in changecreatedAtDate`); - this.logger.debug("THE EXTERNALID IS::::::::::::::::::::::::" + externalId); + this.logger.debug('THE EXTERNALID IS::::::::::::::::::::::::' + externalId); const sixMonthsAgo = new Date(onboardedDate); sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6); - if (new Date(givenDate) < sixMonthsAgo || new Date(givenDate) >= new Date(onboardedDate)) { - this.logger.error(`Given date is more than 6 months before the onboarded date or after or equal to the onboarded date`); - throw new HttpException('Given date is more than 6 months before the onboarded date or after or equal to the onboarded date', 400); + if ( + new Date(givenDate) < sixMonthsAgo || + new Date(givenDate) >= new Date(onboardedDate) + ) { + this.logger.error( + `Given date is more than 6 months before the onboarded date or after or equal to the onboarded date`, + ); + throw new HttpException( + 'Given date is more than 6 months before the onboarded date or after or equal to the onboarded date', + 400, + ); } await this.repository.update( { createdAt: onboardedDate, externalId: externalId }, { createdAt: givenDate }, ); - this.logger.log(`Changed createdAt date from ${onboardedDate} to ${givenDate}`); + this.logger.log( + `Changed createdAt date from ${onboardedDate} to ${givenDate}`, + ); return `Changed createdAt date from ${onboardedDate} to ${givenDate}`; } /* */ @@ -1325,21 +1429,25 @@ export class DeviceService { this.logger.verbose(`With in atto`); const queryBuilder = this.repository.createQueryBuilder('Device'); const rows = await queryBuilder - .where("Device.organizationId = :organizationId", { organizationId }) + .where('Device.organizationId = :organizationId', { organizationId }) .andWhere( - new Brackets(qb => { - qb.where("Device.developerExternalId = :externalId", { externalId }) - .orWhere("Device.developerExternalId LIKE :pattern", { pattern: `${externalId}%` }); - })) + new Brackets((qb) => { + qb.where('Device.developerExternalId = :externalId', { + externalId, + }).orWhere('Device.developerExternalId LIKE :pattern', { + pattern: `${externalId}%`, + }); + }), + ) .orderBy('Device.externalId') .getMany(); this.logger.debug(rows); const newDevices = []; await rows.map((device: Device) => { - device.externalId = device.developerExternalId - delete device["developerExternalId"]; + device.externalId = device.developerExternalId; + delete device['developerExternalId']; newDevices.push(device); - }) + }); return newDevices; // rows.map(row => ({ // externalId: row.developerExternalId, @@ -1348,43 +1456,48 @@ export class DeviceService { // })); } async getLastCertifiedDevicelogBYgroupId( - groupId: number, deviceId: string + groupId: number, + deviceId: string, ): Promise { this.logger.verbose(`With in getLastCertifiedDevicelogBYgroupId`); - return await this.checkdevcielogcertificaterepository.find( - { - where: { - groupId: groupId, - externalId: deviceId, - - }, - order: { - certificate_issuance_enddate: 'DESC' - } - }) - + return await this.checkdevcielogcertificaterepository.find({ + where: { + groupId: groupId, + externalId: deviceId, + }, + order: { + certificate_issuance_enddate: 'DESC', + }, + }); } async getcertifieddevicedaterange(groupId, device?): Promise { this.logger.verbose(`With in getcertifieddevicedaterange`); let queryBuilder; - queryBuilder = this.checkdevcielogcertificaterepository.createQueryBuilder('deviceData') - .select('MIN(deviceData.certificate_issuance_startdate)', 'firstcertifiedstartdate') - .addSelect('MAX(deviceData.certificate_issuance_enddate)', 'lastcertifiedenddate') - .leftJoin(Device, "d", "deviceData.externalId = d.externalId") - .where('deviceData.externalId= :externalId', { externalId: device.externalId }) + queryBuilder = this.checkdevcielogcertificaterepository + .createQueryBuilder('deviceData') + .select( + 'MIN(deviceData.certificate_issuance_startdate)', + 'firstcertifiedstartdate', + ) + .addSelect( + 'MAX(deviceData.certificate_issuance_enddate)', + 'lastcertifiedenddate', + ) + .leftJoin(Device, 'd', 'deviceData.externalId = d.externalId') + .where('deviceData.externalId= :externalId', { + externalId: device.externalId, + }) .andWhere('deviceData.groupId= :groupId', { groupId }); const result = await queryBuilder.getRawOne(); - let finalresult = { ...result, extenalId: device.developerExternalId } + let finalresult = { ...result, extenalId: device.developerExternalId }; return finalresult; - - - - - } - async getcertifieddevicedaterangeBygroupid(groupId, pageNumber?: number): Promise { + async getcertifieddevicedaterangeBygroupid( + groupId, + pageNumber?: number, + ): Promise { this.logger.verbose(`With in getcertifieddevicedaterangeBygroupid`); let queryBuilder; if (pageNumber === undefined || pageNumber === null) { @@ -1403,25 +1516,24 @@ export class DeviceService { ]) .where('deviceData.groupId = :groupId', { groupId }) .groupBy('d.developerExternalId') - .offset(skip).limit(pageSize); + .offset(skip) + .limit(pageSize); const result = await queryBuilder.getRawMany(); const count = await queryBuilder.getCount(); const totalPages = Math.ceil(count / pageSize); - //let finalresult = + //let finalresult = return { certifieddevices_startToend: result, totalItems: count, currentPage: pageNumber, totalPages: totalPages, }; - } /////////////////// - async remove(id: number, filterop): Promise { this.logger.verbose(`With in remove`); - let checkdeviceunreserve = await this.findOne(id, filterop) + let checkdeviceunreserve = await this.findOne(id, filterop); if (!checkdeviceunreserve) { const message = `Device id: ${checkdeviceunreserve.developerExternalId} already part of the reservation , you cannot delete it`; this.logger.error(message); @@ -1429,13 +1541,11 @@ export class DeviceService { success: false, message, }; - } - let certifiedamountofread = await this.checkdevcielogcertificaterepository.findOne( - { - where: { externalId: checkdeviceunreserve.externalId } - } - ) + let certifiedamountofread = + await this.checkdevcielogcertificaterepository.findOne({ + where: { externalId: checkdeviceunreserve.externalId }, + }); if (certifiedamountofread) { const message = `Device id: ${checkdeviceunreserve.developerExternalId} already certified in reservation , you cannot delete it`; @@ -1444,14 +1554,12 @@ export class DeviceService { success: false, message, }; - } await this.repository.delete(id); this.logger.log(`device deleted Successfully`); return { success: true, - message: "device deleted Successfully", - - } + message: 'device deleted Successfully', + }; } -} \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/device/device_lateongoing_certificate.entity.ts b/apps/drec-api/src/pods/device/device_lateongoing_certificate.entity.ts index 8ee35ca6f..d7822c21c 100755 --- a/apps/drec-api/src/pods/device/device_lateongoing_certificate.entity.ts +++ b/apps/drec-api/src/pods/device/device_lateongoing_certificate.entity.ts @@ -1,49 +1,54 @@ -import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; -import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; -import { - IsString, - IsNotEmpty, - IsEnum, - IsBoolean, - IsNumber, - IsOptional, - IsDate -} from 'class-validator'; -import { IDeviceLateOngoingIssueCertificate, IFullOrganization } from '../../models'; -import { - CapacityRange, - CommissioningDateRange, - Installation, - OffTaker, - Sector, - StandardCompliance, -} from '../../utils/enums'; -import { Device } from '.'; - -@Entity('device_lateongoing_certificate_cycle') -export class DeviceLateongoingIssueCertificateEntity extends ExtendedBaseEntity implements IDeviceLateOngoingIssueCertificate { - @PrimaryGeneratedColumn() - id: number; - - @Column() - groupId: number; - - @Column() - @IsString() - device_externalid: string; - - @Column() - @IsDate() - late_start_date: string; - - @Column() - @IsDate() - late_end_date: string; - - @Column() - certificate_issued: boolean; - - - @Column() - createdAt: Date; -} +import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; +import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; +import { + IsString, + IsNotEmpty, + IsEnum, + IsBoolean, + IsNumber, + IsOptional, + IsDate, +} from 'class-validator'; +import { + IDeviceLateOngoingIssueCertificate, + IFullOrganization, +} from '../../models'; +import { + CapacityRange, + CommissioningDateRange, + Installation, + OffTaker, + Sector, + StandardCompliance, +} from '../../utils/enums'; +import { Device } from '.'; + +@Entity('device_lateongoing_certificate_cycle') +export class DeviceLateongoingIssueCertificateEntity + extends ExtendedBaseEntity + implements IDeviceLateOngoingIssueCertificate +{ + @PrimaryGeneratedColumn() + id: number; + + @Column() + groupId: number; + + @Column() + @IsString() + device_externalid: string; + + @Column() + @IsDate() + late_start_date: string; + + @Column() + @IsDate() + late_end_date: string; + + @Column() + certificate_issued: boolean; + + @Column() + createdAt: Date; +} diff --git a/apps/drec-api/src/pods/device/dto/device.dto.ts b/apps/drec-api/src/pods/device/dto/device.dto.ts index ba0b01902..103a923f4 100755 --- a/apps/drec-api/src/pods/device/dto/device.dto.ts +++ b/apps/drec-api/src/pods/device/dto/device.dto.ts @@ -5,7 +5,7 @@ import { IsBoolean, IsArray, IsOptional, - Matches + Matches, } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { @@ -15,7 +15,7 @@ import { Sector, StandardCompliance, FuelCode, - DevicetypeCode + DevicetypeCode, } from '../../../utils/enums'; import { DeviceStatus } from '@energyweb/origin-backend-core'; import { DeviceDescription, IDevice } from '../../../models'; @@ -29,7 +29,6 @@ export class DeviceDTO implements IDevice { @IsString() externalId: string; - @IsString() @Exclude() developerExternalId?: string; @@ -51,8 +50,7 @@ export class DeviceDTO implements IDevice { @ApiProperty() // @IsOptional() @IsString({ - message: - 'Address must be added', + message: 'Address must be added', }) address: string; @@ -64,7 +62,7 @@ export class DeviceDTO implements IDevice { 'Latitude should be number/The Latitude ranges from -90 to +90 degrees, with up to 9 decimal places. So, the maximum length could be 11 characters including the minus sign, digits, and decimal point ', }) latitude: string; - + @ApiProperty() @IsString() @Matches(/^-?\d{1,3}(\.\d{1,9})?$/, { @@ -84,23 +82,21 @@ export class DeviceDTO implements IDevice { // @IsNumber() // zipCode: string; - @ApiProperty({ default: "ES100"}) - @IsEnum(FuelCode,{ - message: - 'FuelCode must be added Or Valid FuelCode values are ES100', + @ApiProperty({ default: 'ES100' }) + @IsEnum(FuelCode, { + message: 'FuelCode must be added Or Valid FuelCode values are ES100', }) // @IsOptional() fuelCode: FuelCode; @ApiProperty() - @IsEnum(DevicetypeCode,{ + @IsEnum(DevicetypeCode, { message: 'DeviceCode must be added Or Valid DeviceCode values are TC110,TC120,TC130,TC140,TC150 ', }) // @IsOptional() deviceTypeCode: DevicetypeCode; - // @ApiProperty() // @IsEnum(Installation) // installationConfiguration: Installation; @@ -197,11 +193,11 @@ export class DeviceDTO implements IDevice { @ApiProperty() @IsOptional() SDGBenefits?: string[]; - + @IsString() @IsOptional() meterReadtype?: string; - + @IsString() @IsOptional() timezone: string; diff --git a/apps/drec-api/src/pods/device/dto/filter.dto.ts b/apps/drec-api/src/pods/device/dto/filter.dto.ts index 98362e598..4e13559a7 100755 --- a/apps/drec-api/src/pods/device/dto/filter.dto.ts +++ b/apps/drec-api/src/pods/device/dto/filter.dto.ts @@ -7,16 +7,25 @@ import { StandardCompliance, FuelCode, DevicetypeCode, - SDGBenefitsList + SDGBenefitsList, } from '../../../utils/enums'; export class FilterDTO { @IsOptional() - @ApiPropertyOptional({ type: FuelCode, description: 'Fuel Code',enum:FuelCode }) + @ApiPropertyOptional({ + type: FuelCode, + description: 'Fuel Code', + enum: FuelCode, + }) fuelCode: FuelCode; @IsOptional() - @ApiPropertyOptional({ type: DevicetypeCode, description: 'Device Type Code',enum:DevicetypeCode, isArray:true }) + @ApiPropertyOptional({ + type: DevicetypeCode, + description: 'Device Type Code', + enum: DevicetypeCode, + isArray: true, + }) deviceTypeCode: DevicetypeCode; // @IsOptional() @@ -35,11 +44,15 @@ export class FilterDTO { capacity: number; @IsOptional() - @ApiPropertyOptional({ description: 'Start date Commissioning Date filter 2020-01-01T00:00:00Z' }) + @ApiPropertyOptional({ + description: 'Start date Commissioning Date filter 2020-01-01T00:00:00Z', + }) start_date: string; @IsOptional() - @ApiPropertyOptional({ description: 'End date Commissioning Date filter 2020-01-01T00:00:00Z' }) + @ApiPropertyOptional({ + description: 'End date Commissioning Date filter 2020-01-01T00:00:00Z', + }) end_date: string; @IsOptional() @@ -51,7 +64,7 @@ export class FilterDTO { type: OffTaker, description: 'Off-taker', enum: OffTaker, - isArray:true + isArray: true, }) offTaker: OffTaker; @@ -83,9 +96,9 @@ export class FilterDTO { @ApiPropertyOptional({ description: 'SDG Benefit', enum: SDGBenefitsList, - isArray:true + isArray: true, }) - SDGBenefits?: string[]| undefined; + SDGBenefits?: string[] | undefined; } export class BuyerDeviceFilterDTO { @IsOptional() @@ -93,15 +106,21 @@ export class BuyerDeviceFilterDTO { country: string; @IsOptional() - @ApiPropertyOptional({ type: FuelCode, description: 'Fuel Code',enum:FuelCode }) + @ApiPropertyOptional({ + type: FuelCode, + description: 'Fuel Code', + enum: FuelCode, + }) fuelCode: FuelCode; @IsOptional() - @ApiPropertyOptional({ type: DevicetypeCode, description: 'Device Type Code',enum:DevicetypeCode }) + @ApiPropertyOptional({ + type: DevicetypeCode, + description: 'Device Type Code', + enum: DevicetypeCode, + }) deviceTypeCode: DevicetypeCode; - - @IsOptional() @ApiPropertyOptional({ type: Number, @@ -109,7 +128,6 @@ export class BuyerDeviceFilterDTO { }) capacity: number; - @IsOptional() @ApiPropertyOptional({ type: OffTaker, @@ -118,8 +136,7 @@ export class BuyerDeviceFilterDTO { }) offTaker: OffTaker; - - groupId?: number|null; + groupId?: number | null; - organizationId ?: number | null; + organizationId?: number | null; } diff --git a/apps/drec-api/src/pods/device/dto/grouped-devices.dto.ts b/apps/drec-api/src/pods/device/dto/grouped-devices.dto.ts index 0d4ea5917..7cd039569 100755 --- a/apps/drec-api/src/pods/device/dto/grouped-devices.dto.ts +++ b/apps/drec-api/src/pods/device/dto/grouped-devices.dto.ts @@ -36,26 +36,24 @@ export class GroupedDevicesDTO { @IsOptional() devices: UngroupedDeviceDTO[]; @ApiProperty({ type: Number }) - targetCapacityInMegaWattHour?:number; + targetCapacityInMegaWattHour?: number; - @ApiProperty({ type: Date }) - reservationStartDate?:Date; + reservationStartDate?: Date; - @ApiProperty({ type: Date }) - reservationEndDate?:Date; + reservationEndDate?: Date; @ApiProperty({ type: Boolean }) - continueWithReservationIfOneOrMoreDevicesUnavailableForReservation?:boolean; + continueWithReservationIfOneOrMoreDevicesUnavailableForReservation?: boolean; @ApiProperty({ type: Boolean }) - continueWithReservationIfTargetCapacityIsLessThanDeviceTotalCapacityBetweenDuration?:boolean; + continueWithReservationIfTargetCapacityIsLessThanDeviceTotalCapacityBetweenDuration?: boolean; @ApiProperty({ type: Boolean }) - authorityToExceed?:boolean; + authorityToExceed?: boolean; @ApiProperty() @IsEnum(BuyerReservationCertificateGenerationFrequency) - frequency?:BuyerReservationCertificateGenerationFrequency; + frequency?: BuyerReservationCertificateGenerationFrequency; } diff --git a/apps/drec-api/src/pods/device/dto/new-device.dto.ts b/apps/drec-api/src/pods/device/dto/new-device.dto.ts index c81539003..e3a523b05 100755 --- a/apps/drec-api/src/pods/device/dto/new-device.dto.ts +++ b/apps/drec-api/src/pods/device/dto/new-device.dto.ts @@ -6,7 +6,7 @@ import { IsNumber, IsOptional, IsNotEmpty, - Matches + Matches, } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { @@ -15,13 +15,17 @@ import { Sector, StandardCompliance, FuelCode, - DevicetypeCode + DevicetypeCode, } from '../../../utils/enums'; import { DeviceDescription, IDevice } from '../../../models'; -import { Exclude ,} from 'class-transformer'; +import { Exclude } from 'class-transformer'; export class NewDeviceDTO - implements Omit + implements + Omit< + IDevice, + 'id' | 'status' | 'organizationId' | 'yieldValue' | 'labels' | 'groupId' + > { @ApiProperty() @IsNotEmpty() @@ -32,7 +36,6 @@ export class NewDeviceDTO }) externalId: string; - @IsOptional() @IsString() @Exclude() @@ -46,8 +49,7 @@ export class NewDeviceDTO @ApiProperty() // @IsOptional() @IsString({ - message: - 'Address must be added', + message: 'Address must be added', }) address: string; @@ -59,7 +61,7 @@ export class NewDeviceDTO 'Latitude should be number/The Latitude ranges from -90 to +90 degrees, with up to 9 decimal places. So, the maximum length could be 11 characters including the minus sign, digits, and decimal point ', }) latitude: string; - + @ApiProperty() @IsString() @Matches(/^-?\d{1,3}(\.\d{1,9})?$/, { @@ -78,16 +80,15 @@ export class NewDeviceDTO // @IsString() // zipCode: string; - @ApiProperty({ default: "ES100"}) - @IsEnum(FuelCode,{ - message: - 'FuelCode must be added Or Valid FuelCode values are ES100', + @ApiProperty({ default: 'ES100' }) + @IsEnum(FuelCode, { + message: 'FuelCode must be added Or Valid FuelCode values are ES100', }) // @IsOptional() fuelCode: FuelCode; @ApiProperty() - @IsEnum(DevicetypeCode,{ + @IsEnum(DevicetypeCode, { message: 'DeviceCode must be added Or Valid DeviceCode values are TC110,TC120,TC130,TC140,TC150 ', }) @@ -103,7 +104,10 @@ export class NewDeviceDTO capacity: number; @ApiProperty() - @IsString({message:'Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z'}) + @IsString({ + message: + 'Invalid commissioning date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z', + }) commissioningDate: string; @ApiProperty() @@ -112,7 +116,7 @@ export class NewDeviceDTO gridInterconnection: boolean; @ApiProperty() - @IsEnum(OffTaker,{ + @IsEnum(OffTaker, { message: 'Valid OffTaker values are Education , Health Facility , Residential , Commercial , Industrial , Public Sector,Agriculture,Off-Grid Community,Utility', }) @@ -189,10 +193,8 @@ export class NewDeviceDTO @IsOptional() SDGBenefits?: string[]; - @ApiProperty({ default: "1.0"}) + @ApiProperty({ default: '1.0' }) @IsString() @IsOptional() - version: string="1.0"; - - + version: string = '1.0'; } diff --git a/apps/drec-api/src/pods/device/dto/update-device.dto.ts b/apps/drec-api/src/pods/device/dto/update-device.dto.ts index d980c574b..fc6c25c61 100755 --- a/apps/drec-api/src/pods/device/dto/update-device.dto.ts +++ b/apps/drec-api/src/pods/device/dto/update-device.dto.ts @@ -5,7 +5,7 @@ import { IsArray, IsNumber, IsOptional, - Matches + Matches, } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { @@ -14,12 +14,21 @@ import { Sector, StandardCompliance, FuelCode, - DevicetypeCode + DevicetypeCode, } from '../../../utils/enums'; import { IDevice } from '../../../models'; import { Exclude } from 'class-transformer'; export class UpdateDeviceDTO - implements Omit + implements + Omit< + IDevice, + | 'id' + | 'externalId' + | 'status' + | 'organizationId' + | 'yieldValue' + | 'labels' + > { @ApiProperty() @IsOptional() @@ -29,7 +38,7 @@ export class UpdateDeviceDTO 'external id can contain only alphabets( lower and upper case included), numeric(0 to 9), hyphen(-), underscore(_) and spaces in between', }) externalId?: string; - + @IsOptional() @IsString() @Exclude() @@ -43,8 +52,7 @@ export class UpdateDeviceDTO @ApiProperty() @IsOptional() @IsString({ - message: - 'Address must be added', + message: 'Address must be added', }) address: string; @@ -56,14 +64,14 @@ export class UpdateDeviceDTO 'Latitude should be number/The Latitude ranges from -90 to +90 degrees, with up to 9 decimal places. So, the maximum length could be 11 characters including the minus sign, digits, and decimal point ', }) latitude: string; - + @ApiProperty() @IsString() @Matches(/^-?\d{1,3}(\.\d{1,9})?$/, { message: 'Longitude should be number/The Longitude ranges from -180 to +180 degrees, with up to 9 decimal places. So, the maximum length could be 12 characters including the minus sign, digits, and decimal point', }) - @IsOptional() + @IsOptional() longitude: string; @ApiProperty() @@ -75,20 +83,19 @@ export class UpdateDeviceDTO // @IsOptional() // @IsNumber() // zipCode: string; - @ApiProperty({ default: "ES100"}) - @IsEnum(FuelCode,{ - message: - 'FuelCode must be added Or Valid FuelCode values are ES100', + @ApiProperty({ default: 'ES100' }) + @IsEnum(FuelCode, { + message: 'FuelCode must be added Or Valid FuelCode values are ES100', }) @IsOptional() fuelCode: FuelCode; @ApiProperty() - @IsEnum(DevicetypeCode,{ + @IsEnum(DevicetypeCode, { message: 'DeviceCode must be added Or Valid DeviceCode values are TC110,TC120,TC130,TC140,TC150 ', }) - @IsOptional() + @IsOptional() deviceTypeCode: DevicetypeCode; // @ApiProperty() @@ -112,9 +119,9 @@ export class UpdateDeviceDTO gridInterconnection: boolean; @ApiProperty() - @IsEnum(OffTaker,{ + @IsEnum(OffTaker, { message: - 'Valid OffTaker values are Education , Health Facility , Residential , Commercial , Industrial , Public Sector,Agriculture,Off-Grid Community,Utility', + 'Valid OffTaker values are Education , Health Facility , Residential , Commercial , Industrial , Public Sector,Agriculture,Off-Grid Community,Utility', }) @IsOptional() offTaker: OffTaker; @@ -163,7 +170,7 @@ export class UpdateDeviceDTO @IsArray() @IsOptional() SDGBenefits?: string[]; - + @IsString() @IsOptional() meterReadtype?: string; @@ -171,7 +178,6 @@ export class UpdateDeviceDTO @IsString() @IsOptional() IREC_Status?: string; - @IsString() @IsOptional() diff --git a/apps/drec-api/src/pods/device/irec_devices_information.entity.ts b/apps/drec-api/src/pods/device/irec_devices_information.entity.ts index 065e1a305..1e6c92729 100755 --- a/apps/drec-api/src/pods/device/irec_devices_information.entity.ts +++ b/apps/drec-api/src/pods/device/irec_devices_information.entity.ts @@ -1,34 +1,31 @@ -import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; -import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; -import { - IsString, - IsNotEmpty, - IsEnum, - IsBoolean, - IsNumber, - IsOptional, - IsDate -} from 'class-validator'; - - -@Entity('irec_devices_information') -export class IrecDevicesInformationEntity extends ExtendedBaseEntity { - @PrimaryGeneratedColumn() - id: number; - - @Column() - @IsString() - IREC_id: string; - - @Column() - @IsString() - event:string - - @Column('json') - request: any; - - @Column('json') - responses: any; - - -} \ No newline at end of file +import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; +import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; +import { + IsString, + IsNotEmpty, + IsEnum, + IsBoolean, + IsNumber, + IsOptional, + IsDate, +} from 'class-validator'; + +@Entity('irec_devices_information') +export class IrecDevicesInformationEntity extends ExtendedBaseEntity { + @PrimaryGeneratedColumn() + id: number; + + @Column() + @IsString() + IREC_id: string; + + @Column() + @IsString() + event: string; + + @Column('json') + request: any; + + @Column('json') + responses: any; +} diff --git a/apps/drec-api/src/pods/device/irec_error_log_information.entity.ts b/apps/drec-api/src/pods/device/irec_error_log_information.entity.ts index 9657f73e0..bec3bb0e4 100755 --- a/apps/drec-api/src/pods/device/irec_error_log_information.entity.ts +++ b/apps/drec-api/src/pods/device/irec_error_log_information.entity.ts @@ -1,31 +1,27 @@ -import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; -import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; -import { - IsString, - IsNotEmpty, - IsEnum, - IsBoolean, - IsNumber, - IsOptional, - IsDate -} from 'class-validator'; - - -@Entity('irec_error_log_information') -export class IrecErrorLogInformationEntity extends ExtendedBaseEntity { - - @PrimaryGeneratedColumn() - id: number; - - - - @Column() - @IsString() - event: string - - @Column('json') - request: any; - - @Column('json') - error_log_responses: any; -} \ No newline at end of file +import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; +import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; +import { + IsString, + IsNotEmpty, + IsEnum, + IsBoolean, + IsNumber, + IsOptional, + IsDate, +} from 'class-validator'; + +@Entity('irec_error_log_information') +export class IrecErrorLogInformationEntity extends ExtendedBaseEntity { + @PrimaryGeneratedColumn() + id: number; + + @Column() + @IsString() + event: string; + + @Column('json') + request: any; + + @Column('json') + error_log_responses: any; +} diff --git a/apps/drec-api/src/pods/email-confirmation/email-confirmation.module.ts b/apps/drec-api/src/pods/email-confirmation/email-confirmation.module.ts index f75d8eeef..e1a42b189 100755 --- a/apps/drec-api/src/pods/email-confirmation/email-confirmation.module.ts +++ b/apps/drec-api/src/pods/email-confirmation/email-confirmation.module.ts @@ -7,7 +7,11 @@ import { EmailConfirmationService } from './email-confirmation.service'; import { UserModule } from '../user/user.module'; @Module({ - imports: [TypeOrmModule.forFeature([EmailConfirmation]), MailModule, forwardRef(() => UserModule)], + imports: [ + TypeOrmModule.forFeature([EmailConfirmation]), + MailModule, + forwardRef(() => UserModule), + ], providers: [EmailConfirmationService], controllers: [], exports: [EmailConfirmationService], diff --git a/apps/drec-api/src/pods/email-confirmation/email-confirmation.service.spec.ts b/apps/drec-api/src/pods/email-confirmation/email-confirmation.service.spec.ts index 0e9b6d2b7..9ad228c98 100644 --- a/apps/drec-api/src/pods/email-confirmation/email-confirmation.service.spec.ts +++ b/apps/drec-api/src/pods/email-confirmation/email-confirmation.service.spec.ts @@ -1,47 +1,49 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { Repository } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { UserService } from '../user/user.service'; -import { MailService } from '../../mail'; -import { EmailConfirmationService } from './email-confirmation.service'; -import { EmailConfirmation } from './email-confirmation.entity'; -import { OauthClientCredentialsService } from '../user/oauth_client.service'; - - -describe('EmailConfirmationService', () => { - let service: EmailConfirmationService; - let repository: Repository; - let userService: UserService; - let mailService: MailService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [EmailConfirmationService, - { - provide: getRepositoryToken(EmailConfirmation), - useClass: Repository, - }, - { - provide: UserService, - useValue: {} as any, - }, - { - provide: MailService, - useValue: {} as any, - }, - { - provide: OauthClientCredentialsService, - useValue: {} as any, - } - ], - }).compile(); - - service = module.get(EmailConfirmationService); - repository = module.get>(getRepositoryToken(EmailConfirmation)); - userService = module.get(UserService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { Repository } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { UserService } from '../user/user.service'; +import { MailService } from '../../mail'; +import { EmailConfirmationService } from './email-confirmation.service'; +import { EmailConfirmation } from './email-confirmation.entity'; +import { OauthClientCredentialsService } from '../user/oauth_client.service'; + +describe('EmailConfirmationService', () => { + let service: EmailConfirmationService; + let repository: Repository; + let userService: UserService; + let mailService: MailService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + EmailConfirmationService, + { + provide: getRepositoryToken(EmailConfirmation), + useClass: Repository, + }, + { + provide: UserService, + useValue: {} as any, + }, + { + provide: MailService, + useValue: {} as any, + }, + { + provide: OauthClientCredentialsService, + useValue: {} as any, + }, + ], + }).compile(); + + service = module.get(EmailConfirmationService); + repository = module.get>( + getRepositoryToken(EmailConfirmation), + ); + userService = module.get(UserService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/email-confirmation/email-confirmation.service.ts b/apps/drec-api/src/pods/email-confirmation/email-confirmation.service.ts index e46c88548..abfafd09a 100755 --- a/apps/drec-api/src/pods/email-confirmation/email-confirmation.service.ts +++ b/apps/drec-api/src/pods/email-confirmation/email-confirmation.service.ts @@ -4,12 +4,12 @@ import { Injectable, Logger, forwardRef, - Inject + Inject, } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import crypto from 'crypto'; import { DateTime } from 'luxon'; -import { Repository, FindConditions, } from 'typeorm'; +import { Repository, FindConditions } from 'typeorm'; import { MailService } from '../../mail'; import { IEmailConfirmationToken, ISuccessResponse, IUser } from '../../models'; import { EmailConfirmationResponse, Role } from '../../utils/enums'; @@ -19,8 +19,8 @@ import { EmailConfirmation } from './email-confirmation.entity'; import { OauthClientCredentialsService } from '../user/oauth_client.service'; import { UserService } from '../user/user.service'; export interface SuccessResponse { - success: boolean, - message: string, + success: boolean; + message: string; } @Injectable() export class EmailConfirmationService { @@ -30,25 +30,34 @@ export class EmailConfirmationService { @InjectRepository(EmailConfirmation) private readonly repository: Repository, private mailService: MailService, - @Inject(forwardRef(() => UserService)) private readonly userService: UserService, + @Inject(forwardRef(() => UserService)) + private readonly userService: UserService, private readonly oauthClientCredentialsService: OauthClientCredentialsService, - ) { } + ) {} public async create(user: User): Promise { this.logger.verbose(`With in create`); //const client = await this.oauthClientCredentialsService.findOneByuserid(user.api_user_id); //console.log("Client with email create:",client,(client.client_id === process.env.client_id),user.role === 'ApiUser' ) //@ts-ignore - if (await this.userService.findOne({role: Role.Admin, api_user_id: user.api_user_id}) != undefined || user.role === 'ApiUser') { + if ( + (await this.userService.findOne({ + role: Role.Admin, + api_user_id: user.api_user_id, + })) != undefined || + user.role === 'ApiUser' + ) { const exists = await this.repository.findOne({ where: { - user: { email: user.email } + user: { email: user.email }, }, - relations: ['user'] + relations: ['user'], }); if (exists) { - this.logger.error(`Email confirmation for user with email ${user.email} already exists`); + this.logger.error( + `Email confirmation for user with email ${user.email} already exists`, + ); throw new ConflictException({ success: false, message: `Email confirmation for user with email ${user.email} already exists`, @@ -73,17 +82,22 @@ export class EmailConfirmationService { } // create function when orguseradmin direct added by super admin so confirm email true - public async admincreate(user: User, password: string): Promise { + public async admincreate( + user: User, + password: string, + ): Promise { this.logger.verbose(`With in admincreate`); const exists = await this.repository.findOne({ where: { - user: { email: user.email } + user: { email: user.email }, }, - relations: ['user'] + relations: ['user'], }); if (exists) { - this.logger.error(`Email confirmation for user with email ${user.email} already exists`); + this.logger.error( + `Email confirmation for user with email ${user.email} already exists`, + ); throw new ConflictException({ success: false, message: `Email confirmation for user with email ${user.email} already exists`, @@ -122,15 +136,14 @@ export class EmailConfirmationService { confirmation.user.email.toLowerCase() === email.toLowerCase(), ); } - async findOne(conditions: FindConditions): Promise { + async findOne( + conditions: FindConditions, + ): Promise { this.logger.verbose(`With in findOne`); const user = await (this.repository.findOne(conditions, { relations: ['user'], - }) as Promise as Promise); - - return user; } async confirmEmail( @@ -158,7 +171,7 @@ export class EmailConfirmationService { if ( emailConfirmation.expiryTimestamp < Math.floor(DateTime.now().toSeconds()) ) { - this.logger.warn(`EmailConfirmationResponse.Expired`) + this.logger.warn(`EmailConfirmationResponse.Expired`); return { success: false, message: EmailConfirmationResponse.Expired, @@ -172,8 +185,8 @@ export class EmailConfirmationService { this.logger.warn(EmailConfirmationResponse.Success); return { success: true, - message: EmailConfirmationResponse.Success - } + message: EmailConfirmationResponse.Success, + }; } public async sendConfirmationEmail( @@ -198,7 +211,7 @@ export class EmailConfirmationService { message: `Email already confirmed`, }); } - let { token, expiryTimestamp } = await this.generatetoken(currentToken, id) + let { token, expiryTimestamp } = await this.generatetoken(currentToken, id); await this.sendConfirmEmailRequest(email.toLowerCase(), token); @@ -215,26 +228,32 @@ export class EmailConfirmationService { if (!currentToken) { this.logger.error(`Email not found or Email not registered`); return { - message: "Email not found or Email not registered", + message: 'Email not found or Email not registered', success: false, }; } const { id, confirmed } = currentToken; let { token, expiryTimestamp } = await this.generatetoken(currentToken, id); - await this.sendResetPasswordRequest(email.toLowerCase(), token, currentToken.user.role); + await this.sendResetPasswordRequest( + email.toLowerCase(), + token, + currentToken.user.role, + ); - this.logger.log(`Password Reset Mail has been sent to your register authorized Email.`); + this.logger.log( + `Password Reset Mail has been sent to your register authorized Email.`, + ); return { success: true, - message: 'Password Reset Mail has been sent to your register authorized Email.', + message: + 'Password Reset Mail has been sent to your register authorized Email.', }; } public async generatetoken(currentToken, id) { this.logger.verbose(`With in generatetoken`); let { token, expiryTimestamp } = currentToken; - if (expiryTimestamp < Math.floor(DateTime.now().toSeconds())) { const newToken = this.generateEmailToken(); await this.repository.update(id, newToken); @@ -243,8 +262,6 @@ export class EmailConfirmationService { } else { return ({ token, expiryTimestamp } = currentToken); } - - } generateEmailToken(): IEmailConfirmationToken { this.logger.verbose(`With in generateEmailToken`); @@ -298,7 +315,7 @@ export class EmailConfirmationService { private async sendResetPasswordRequest( email: string, token: string, - role?: string + role?: string, ): Promise { this.logger.verbose(`With in sendResetPasswordRequest`); const url = `${process.env.UI_BASE_URL}/reset-password?token=${token}&email=${email}&role=${role}`; @@ -314,14 +331,12 @@ export class EmailConfirmationService { } } - async remove(userId: number): Promise { this.logger.verbose(`With in remove`); - const allemialconfirm = await this.get(userId) + const allemialconfirm = await this.get(userId); await this.repository.delete(allemialconfirm.id); } - // private async sendInvitation( // organization: string, // email: string, @@ -332,7 +347,7 @@ export class EmailConfirmationService { // const result = await this.mailService.send({ // to: email, // subject: `[Origin] Organization invitation`, - // html: `Organization ${organization} has invited you to join. To accept the invitation,
+ // html: `Organization ${organization} has invited you to join. To accept the invitation,
// Please click the button to confirm your email: Confirme.
// and Please change password: Add Password
// and then login and visit`, @@ -347,7 +362,7 @@ export class EmailConfirmationService { inviteuser: any, email: string, - invitationId: number + invitationId: number, ): Promise { this.logger.verbose(`With in sendInvitation`); const url = `${process.env.UI_BASE_URL}/login`; diff --git a/apps/drec-api/src/pods/file/file-upload.dto.ts b/apps/drec-api/src/pods/file/file-upload.dto.ts index 16439ad70..d42497b6d 100755 --- a/apps/drec-api/src/pods/file/file-upload.dto.ts +++ b/apps/drec-api/src/pods/file/file-upload.dto.ts @@ -3,5 +3,5 @@ import { ApiProperty } from '@nestjs/swagger'; export class FileUploadDto { @ApiProperty({ type: 'blob', format: 'binary', isArray: true }) files: Blob[]; - type?:string; + type?: string; } diff --git a/apps/drec-api/src/pods/file/file.controller.ts b/apps/drec-api/src/pods/file/file.controller.ts index c543e5acc..795dfd1dd 100755 --- a/apps/drec-api/src/pods/file/file.controller.ts +++ b/apps/drec-api/src/pods/file/file.controller.ts @@ -52,17 +52,16 @@ supportedFiles.push('image/png'); @ApiBearerAuth('access-token') @Controller('file') export class FileController { - private readonly logger = new Logger(FileController.name); //constructor(private deviceGroupService:DeviceGroupService,private readonly fileService: FileService) {} - constructor(private readonly fileService: FileService) { } + constructor(private readonly fileService: FileService) {} /** * It is POST api to upload multiple files into aws s3 bucket * @param user from request * @param param1 is getting organization id from request - * @param uploadedFiles array of files to be uploaded + * @param uploadedFiles array of files to be uploaded * @returns {} */ @Post() @@ -84,7 +83,7 @@ export class FileController { }, }), ) - @UseGuards(AuthGuard('jwt'),PermissionGuard) + @UseGuards(AuthGuard('jwt'), PermissionGuard) @Permission('Write') @ACLModules('FILE_MANAGEMENT_CRUDL') @ApiResponse({ @@ -117,10 +116,10 @@ export class FileController { // } return await Promise.all( uploadedFiles.files.map(async (file) => { - let response:any=await this.fileService.upload(file); - return response.key; - }) - ) + let response: any = await this.fileService.upload(file); + return response.key; + }), + ); // return await this.fileService.upload(uploadedFiles.files[0]); // return this.fileService.store(user, uploadedFiles.files); } @@ -129,10 +128,10 @@ export class FileController { * It is GET api to view or download an file from AWS S3 bucket * @param user from request * @param id is unique identifier of file entity - * @param res is Response type + * @param res is Response type */ @Get(':id') - @UseGuards(AuthGuard('jwt'),PermissionGuard) + @UseGuards(AuthGuard('jwt'), PermissionGuard) @Permission('Read') @ACLModules('FILE_MANAGEMENT_CRUDL') @ApiResponse({ @@ -161,9 +160,7 @@ export class FileController { .send(file.data); } - - - // + // // @Post('/upload') // @UseInterceptors(FileInterceptor('file')) // async uploads(@UploadedFile() file) { diff --git a/apps/drec-api/src/pods/file/file.module.ts b/apps/drec-api/src/pods/file/file.module.ts index 235f83ca9..1e6b181de 100755 --- a/apps/drec-api/src/pods/file/file.module.ts +++ b/apps/drec-api/src/pods/file/file.module.ts @@ -1,4 +1,4 @@ -import { Module,forwardRef } from '@nestjs/common'; +import { Module, forwardRef } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; //import { DeviceGroupModule } from '../device-group/device-group.module'; //import { DeviceCsvFileProcessingJobsEntity } from '../device-group/device_csv_processing_jobs.entity'; @@ -10,9 +10,7 @@ import { UserModule } from '../user/user.module'; @Module({ // imports: [TypeOrmModule.forFeature([File,DeviceCsvFileProcessingJobsEntity]), - imports: [TypeOrmModule.forFeature([File]), - UserModule -], + imports: [TypeOrmModule.forFeature([File]), UserModule], providers: [FileService], controllers: [FileController], exports: [FileService], diff --git a/apps/drec-api/src/pods/file/file.service.spec.ts b/apps/drec-api/src/pods/file/file.service.spec.ts index 06ee4f549..95ea66169 100644 --- a/apps/drec-api/src/pods/file/file.service.spec.ts +++ b/apps/drec-api/src/pods/file/file.service.spec.ts @@ -1,33 +1,34 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { Connection } from 'typeorm'; -import { FileService } from './file.service'; -import { Repository } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { File } from './file.entity'; - -describe('FileService', () => { - let service: FileService; - let repository: Repository - let connection: Connection; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [FileService, - { - provide: getRepositoryToken(File), - useClass: Repository, - }, - { - provide:Connection, - useValue: {} as any, - } - ], - }).compile(); - - service = module.get(FileService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { Connection } from 'typeorm'; +import { FileService } from './file.service'; +import { Repository } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { File } from './file.entity'; + +describe('FileService', () => { + let service: FileService; + let repository: Repository; + let connection: Connection; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + FileService, + { + provide: getRepositoryToken(File), + useClass: Repository, + }, + { + provide: Connection, + useValue: {} as any, + }, + ], + }).compile(); + + service = module.get(FileService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/file/file.service.ts b/apps/drec-api/src/pods/file/file.service.ts index b6d26af14..aae3ed97f 100755 --- a/apps/drec-api/src/pods/file/file.service.ts +++ b/apps/drec-api/src/pods/file/file.service.ts @@ -1,4 +1,8 @@ -import { Logger, NotAcceptableException, NotFoundException } from '@nestjs/common'; +import { + Logger, + NotAcceptableException, + NotFoundException, +} from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import path from 'path'; import { Connection, Repository } from 'typeorm'; @@ -25,7 +29,7 @@ export class FileService { // @InjectRepository(DeviceCsvFileProcessingJobsEntity) // private readonly repositoyCSVJobProcessing: Repository, private readonly connection: Connection, - ) { } + ) {} public async store( user: ILoggedInUser, @@ -38,7 +42,8 @@ export class FileService { throw new NotAcceptableException('No files added'); } this.logger.debug( - `User ${user ? JSON.stringify(user) : 'Anonymous'} requested store for ${files.length + `User ${user ? JSON.stringify(user) : 'Anonymous'} requested store for ${ + files.length } files`, ); @@ -59,7 +64,8 @@ export class FileService { } }); this.logger.debug( - `User ${user ? JSON.stringify(user) : 'Anonymous' + `User ${ + user ? JSON.stringify(user) : 'Anonymous' } has stored ${JSON.stringify(storedFile)}`, ); @@ -132,14 +138,14 @@ export class FileService { const where = hasOrganization ? { - id: documentId, - userId: user.id.toString(), - organizationId: user.organizationId.toString(), - } + id: documentId, + userId: user.id.toString(), + organizationId: user.organizationId.toString(), + } : { - id: documentId, - userId: user.id.toString(), - }; + id: documentId, + userId: user.id.toString(), + }; const count = await this.repository.count({ where }); @@ -181,28 +187,26 @@ export class FileService { // }); // } - - async upload(file) { this.logger.verbose(`With in upload`); this.logger.debug(file); const { originalname } = file; const bucketS3 = process.env.bucketname; const result = await this.uploadS3(file.buffer, bucketS3, originalname); - return result + return result; } async uploadS3(file, bucket, name) { this.logger.verbose(`With in uploadS3`); const s3 = this.getS3(); - this.logger.debug(`${uuid()}-${String(name)}`) - let a= name.substr(0,name.indexOf(".csv")) + this.logger.debug(`${uuid()}-${String(name)}`); + let a = name.substr(0, name.indexOf('.csv')); this.logger.debug(a); const params = { Bucket: bucket, Key: `${a}-${uuid()}.csv`, Body: file, - ACL: 'public-read' + ACL: 'public-read', }; return new Promise((resolve, reject) => { s3.upload(params, (err, data) => { @@ -210,8 +214,7 @@ export class FileService { this.logger.error(err); reject(err.message); } - resolve(data - ); + resolve(data); }); }); } @@ -223,8 +226,6 @@ export class FileService { }); } - - public async GetuploadS3(key: string) { this.logger.verbose(`With in GetuploadS3`); const s3 = this.getS3(); @@ -235,20 +236,19 @@ export class FileService { let response: any; return new Promise((resolve, reject) => { s3.getObject( - { Bucket: process.env.bucketname, Key: key }, (err, data) => { - + { Bucket: process.env.bucketname, Key: key }, + (err, data) => { if (err) { this.logger.error(err); reject(err.message); } resolve({ data, - filename: key - } - ); - }) + filename: key, + }); + }, + ); }); - } this.logger.error(`Object not found`); throw new NotFoundException(); diff --git a/apps/drec-api/src/pods/integrators/integrators.service.spec.ts b/apps/drec-api/src/pods/integrators/integrators.service.spec.ts index eb73bbe6e..7b2ce2363 100644 --- a/apps/drec-api/src/pods/integrators/integrators.service.spec.ts +++ b/apps/drec-api/src/pods/integrators/integrators.service.spec.ts @@ -1,49 +1,49 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { OrganizationService } from '../organization/organization.service'; -import { DeviceService } from '../device'; -import { HttpService } from '@nestjs/axios'; -import { BASE_READ_SERVICE } from '../reads/const'; -import { IntegratorsService } from './integrators.service'; -import { ConfigService } from '@nestjs/config'; -import { EventBus } from '@nestjs/cqrs'; - - -describe('IntegratorsService', () => { - let service: IntegratorsService; - let httpService: HttpService; - let deviceService: DeviceService; - let configService: ConfigService; - let eventBus: EventBus; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [IntegratorsService, - { - provide: HttpService, - useValue: {} as any, - }, - { - provide: DeviceService, - useValue: {} as any, - }, - { - provide: BASE_READ_SERVICE, - useValue: {} as any, - }, - ConfigService, - - { - provide: EventBus, - useValue: {} as any, - }, - ], - }).compile(); - - service = module.get(IntegratorsService); - httpService = module.get(HttpService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { OrganizationService } from '../organization/organization.service'; +import { DeviceService } from '../device'; +import { HttpService } from '@nestjs/axios'; +import { BASE_READ_SERVICE } from '../reads/const'; +import { IntegratorsService } from './integrators.service'; +import { ConfigService } from '@nestjs/config'; +import { EventBus } from '@nestjs/cqrs'; + +describe('IntegratorsService', () => { + let service: IntegratorsService; + let httpService: HttpService; + let deviceService: DeviceService; + let configService: ConfigService; + let eventBus: EventBus; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + IntegratorsService, + { + provide: HttpService, + useValue: {} as any, + }, + { + provide: DeviceService, + useValue: {} as any, + }, + { + provide: BASE_READ_SERVICE, + useValue: {} as any, + }, + ConfigService, + + { + provide: EventBus, + useValue: {} as any, + }, + ], + }).compile(); + + service = module.get(IntegratorsService); + httpService = module.get(HttpService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/invitation/dto/invitation.dto.ts b/apps/drec-api/src/pods/invitation/dto/invitation.dto.ts index 59e5d2817..574e62a67 100755 --- a/apps/drec-api/src/pods/invitation/dto/invitation.dto.ts +++ b/apps/drec-api/src/pods/invitation/dto/invitation.dto.ts @@ -14,7 +14,7 @@ import { IOrganizationInvitation, OrganizationRole } from '../../../models'; import { PublicOrganizationInfoDTO } from '../../organization/dto/public-organization-info.dto'; import { OrganizationInvitationStatus, Role } from '../../../utils/enums'; import { Invitation } from '../invitation.entity'; -import {NewPermissionDTO} from '../../permission/dto/modulepermission.dto' +import { NewPermissionDTO } from '../../permission/dto/modulepermission.dto'; export class InvitationDTO implements IOrganizationInvitation { @ApiProperty({ type: Number }) @IsNotEmpty() @@ -50,13 +50,12 @@ export class InvitationDTO implements IOrganizationInvitation { @IsNotEmpty() @IsDate() createdAt: Date; - + @ApiProperty({ type: [Number] }) @IsArray() @IsOptional() permissionId?: number[]; - - + public static fromInvitation(invitation: Invitation): InvitationDTO { return plainToClass(InvitationDTO, invitation); } diff --git a/apps/drec-api/src/pods/invitation/dto/invite.dto.ts b/apps/drec-api/src/pods/invitation/dto/invite.dto.ts index ad7775313..b83ef3469 100755 --- a/apps/drec-api/src/pods/invitation/dto/invite.dto.ts +++ b/apps/drec-api/src/pods/invitation/dto/invite.dto.ts @@ -1,13 +1,25 @@ import { ApiProperty } from '@nestjs/swagger'; -import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany } from 'typeorm'; -import { IsNotEmpty, IsEnum, IsEmail, IsArray, IsOptional, IsString } from 'class-validator'; +import { + Entity, + PrimaryGeneratedColumn, + Column, + ManyToOne, + OneToMany, +} from 'typeorm'; +import { + IsNotEmpty, + IsEnum, + IsEmail, + IsArray, + IsOptional, + IsString, +} from 'class-validator'; import { OrganizationRole } from '../../../models'; import { Role } from '../../../utils/enums'; import { Exclude } from 'class-transformer'; -import { NewPermissionDTO } from '../../permission/dto/modulepermission.dto' +import { NewPermissionDTO } from '../../permission/dto/modulepermission.dto'; import { OrganizationInvitationStatus } from '../../../utils/enums'; export class InviteDTO { - @ApiProperty({ type: String }) @IsOptional() @IsString() @@ -29,7 +41,6 @@ export class InviteDTO { @IsEnum(Role) role: OrganizationRole; - // @ApiProperty({ type: [NewPermissionDTO] }) // @IsArray() // @IsOptional() @@ -37,7 +48,6 @@ export class InviteDTO { @IsOptional() status?: string; - } export class updateInviteStatusDTO { @ApiProperty({ type: String }) @@ -45,7 +55,6 @@ export class updateInviteStatusDTO { @IsEmail() email: string; - @ApiProperty({ enum: OrganizationInvitationStatus, enumName: 'OrganizationInvitationStatus', diff --git a/apps/drec-api/src/pods/invitation/invitation.controller.ts b/apps/drec-api/src/pods/invitation/invitation.controller.ts index 8e7f3b597..167a15928 100755 --- a/apps/drec-api/src/pods/invitation/invitation.controller.ts +++ b/apps/drec-api/src/pods/invitation/invitation.controller.ts @@ -27,7 +27,7 @@ import { ApiBody, ApiResponse, ApiTags, - ApiQuery + ApiQuery, } from '@nestjs/swagger'; import { InvitationService } from './invitation.service'; import { AlreadyPartOfOrganizationError } from './errors/already-part-of-organization.error'; @@ -55,18 +55,24 @@ export class InvitationController { constructor( private readonly organizationInvitationService: InvitationService, - ) { } + ) {} /** - * - * @param loggedUser - * @returns + * + * @param loggedUser + * @returns */ @Get() - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) @Permission('Read') @ACLModules('INVITATION_MANAGEMENT_CRUDL') - @ApiQuery({ name: 'organizationId', type: Number, required: false, description: "This organizationId can be used to retrieve records of apiuser" }) + @ApiQuery({ + name: 'organizationId', + type: Number, + required: false, + description: + 'This organizationId can be used to retrieve records of apiuser', + }) @ApiQuery({ name: 'pageNumber', type: Number, required: false }) @ApiQuery({ name: 'limit', type: Number, required: false }) @ApiResponse({ @@ -77,23 +83,27 @@ export class InvitationController { async getInvitations( @UserDecorator() loggedUser: ILoggedInUser, @Query('organizationId') organizationId?: number | null, - @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) pageNumber?: number, + @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) + pageNumber?: number, @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit?: number, - )/*: Promise*/ { + ) /*: Promise*/ { this.logger.verbose(`With in getInvitations`); const invitations = await this.organizationInvitationService.getUsersInvitation( - loggedUser, organizationId, pageNumber, limit, + loggedUser, + organizationId, + pageNumber, + limit, ); return invitations; } /** - * - * @param invitationId - * @param useracceptinvitation - * @returns + * + * @param invitationId + * @param useracceptinvitation + * @returns */ @Put(':id') @UseGuards(AuthGuard('jwt'), PermissionGuard) @@ -112,7 +122,7 @@ export class InvitationController { async updateInvitation( @Param('id') invitationId: string, // @Param('status') status: IOrganizationInvitation['status'], - @Body() useracceptinvitation: updateInviteStatusDTO + @Body() useracceptinvitation: updateInviteStatusDTO, // @UserDecorator() loggedUser: ILoggedInUser, ): Promise { this.logger.verbose(`With in updateInvitation`); @@ -124,15 +134,26 @@ export class InvitationController { } /** - * - * @param param0 - * @param organizationId - * @param loggedUser - * @returns + * + * @param param0 + * @param organizationId + * @param loggedUser + * @returns */ @Post() - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), ActiveUserGuard, RolesGuard, PermissionGuard) - @Roles(Role.OrganizationAdmin, Role.Admin, Role.Buyer, Role.SubBuyer, Role.ApiUser) + @UseGuards( + AuthGuard(['jwt', 'oauth2-client-password']), + ActiveUserGuard, + RolesGuard, + PermissionGuard, + ) + @Roles( + Role.OrganizationAdmin, + Role.Admin, + Role.Buyer, + Role.SubBuyer, + Role.ApiUser, + ) @Permission('Write') @ACLModules('INVITATION_MANAGEMENT_CRUDL') @ApiBody({ type: InviteDTO }) @@ -146,7 +167,6 @@ export class InvitationController { required: false, type: Number, description: 'This query parameter is used to for admin...', - }) async invite( @Body() { email, role, firstName, lastName }: InviteDTO, @@ -174,21 +194,40 @@ export class InvitationController { if (loggedUser.role === Role.Admin || loggedUser.role === Role.ApiUser) { if (organizationId === null || organizationId === undefined) { throw new BadRequestException( - ResponseFailure(`Organization id is required,please add your Organization id`), + ResponseFailure( + `Organization id is required,please add your Organization id`, + ), ); } - await this.organizationInvitationService.invite(loggedUser, email, role, firstName, lastName, organizationId); - + await this.organizationInvitationService.invite( + loggedUser, + email, + role, + firstName, + lastName, + organizationId, + ); } else { - await this.organizationInvitationService.invite(loggedUser, email, role, firstName, lastName, organizationId); + await this.organizationInvitationService.invite( + loggedUser, + email, + role, + firstName, + lastName, + organizationId, + ); } - } catch (error) { this.logger.error(error.toString()); - this.logger.error(error.toString() instanceof AlreadyPartOfOrganizationError); + this.logger.error( + error.toString() instanceof AlreadyPartOfOrganizationError, + ); //// if (error instanceof AlreadyPartOfOrganizationError) { this.logger.error(error.message); - throw new ForbiddenException({ message: error.message, status: error.status }); + throw new ForbiddenException({ + message: error.message, + status: error.status, + }); ///// } // return error } @@ -197,15 +236,14 @@ export class InvitationController { } /** - * - * @param loggedUser - * @returns + * + * @param loggedUser + * @returns */ @Get('/By_email') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) @Permission('Read') @ACLModules('INVITATION_MANAGEMENT_CRUDL') - @ApiResponse({ status: HttpStatus.OK, type: [InvitationDTO], @@ -213,8 +251,7 @@ export class InvitationController { }) async getInvitationsByemail( @UserDecorator() loggedUser: ILoggedInUser, - - )/*: Promise*/ { + ) /*: Promise*/ { this.logger.verbose(`With in getInvitations`); const invitations = await this.organizationInvitationService.getinvite_info_byEmail( @@ -223,5 +260,4 @@ export class InvitationController { return invitations; } - } diff --git a/apps/drec-api/src/pods/invitation/invitation.entity.ts b/apps/drec-api/src/pods/invitation/invitation.entity.ts index 310048121..b78539951 100755 --- a/apps/drec-api/src/pods/invitation/invitation.entity.ts +++ b/apps/drec-api/src/pods/invitation/invitation.entity.ts @@ -44,10 +44,9 @@ export class Invitation onDelete: 'CASCADE', }) organization: Organization; - + @ApiProperty({ type: () => [Number] }) @Column('simple-array', { nullable: true }) @IsArray() permissionId: number[]; - } diff --git a/apps/drec-api/src/pods/invitation/invitation.module.ts b/apps/drec-api/src/pods/invitation/invitation.module.ts index a9665d2bf..18c4dab94 100644 --- a/apps/drec-api/src/pods/invitation/invitation.module.ts +++ b/apps/drec-api/src/pods/invitation/invitation.module.ts @@ -1,4 +1,4 @@ -import { Module,forwardRef } from '@nestjs/common'; +import { Module, forwardRef } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { MailModule } from '../../mail'; import { OrganizationModule } from '../organization/organization.module'; @@ -6,19 +6,18 @@ import { UserModule } from '../user/user.module'; import { InvitationController } from './invitation.controller'; import { Invitation } from './invitation.entity'; import { InvitationService } from './invitation.service'; -import {PermissionModule} from '../permission/permission.module' +import { PermissionModule } from '../permission/permission.module'; @Module({ imports: [ TypeOrmModule.forFeature([Invitation]), UserModule, - forwardRef(()=>OrganizationModule) , + forwardRef(() => OrganizationModule), MailModule, - PermissionModule + PermissionModule, ], providers: [InvitationService], controllers: [InvitationController], exports: [InvitationService], }) - export class InvitationModule {} diff --git a/apps/drec-api/src/pods/invitation/invitation.service.spec.ts b/apps/drec-api/src/pods/invitation/invitation.service.spec.ts index c683028a3..f9e12e388 100644 --- a/apps/drec-api/src/pods/invitation/invitation.service.spec.ts +++ b/apps/drec-api/src/pods/invitation/invitation.service.spec.ts @@ -1,467 +1,522 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { InvitationService } from './invitation.service'; -import { UserService } from '../user/user.service'; -import { MailService } from '../../mail/mail.service'; -import { OrganizationService } from '../organization/organization.service'; -import { Repository, DeepPartial } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { Invitation } from './invitation.entity'; -import { ILoggedInUser, IUser, OrganizationRole } from '../../models'; -import { PermissionService } from '../permission/permission.service'; -import { OrganizationInvitationStatus, OrganizationStatus, Role, UserStatus } from '../../utils/enums'; -import { Organization } from '../organization/organization.entity'; -import { User } from '../user/user.entity'; -import exp from 'constants'; -import { UserDTO } from '../user/dto/user.dto'; -import { CreateUserORGDTO } from '../user/dto/create-user.dto'; - -describe('InvitationService', () => { - let service: InvitationService; - let invitationRepository: Repository; - let userService: UserService; - let mailService: MailService; - let organizationService: OrganizationService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [ - InvitationService, - { - provide: getRepositoryToken(Invitation), - useClass: Repository, - }, - { - provide: OrganizationService, - useValue: { - findOne: jest.fn(), - } as any, - }, - { - provide: UserService, - useValue: { - findByEmail: jest.fn(), - newcreate: jest.fn(), - sentinvitiontoUser: jest.fn(), - } as any, - }, - { - provide: MailService, - useValue: {} as any, - }, { - provide: PermissionService, - useValue: {} as any, - }, - ], - }).compile(); - - service = module.get(InvitationService); - invitationRepository = module.get>( - getRepositoryToken(Invitation), - ); - userService = module.get(UserService); - mailService = module.get(MailService); - organizationService = module.get( - OrganizationService, - ); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); - - describe('invite', () => { - it('should invite a user By admin', async () => { - - const user = { - id: 1, - organizationId: 1, - email: 'aishuutech@gmail.com', - blockchainAccountAddress: null, - role: Role.Admin,//'Admin', - permissions: undefined, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - }; - - const email= 'cccplrtzifwzerosys@cazlp.com'; - const role= Role.User as OrganizationRole;//'DeviceOwner'; - const firstName= 'tst'; - const lastName= 'test'; - const orgId= 13; - - const mockAdminUserEntity : IUser = { - //createdAt: '2024-02-18T07:25:29.743Z', - // updatedAt: '2024-02-18T07:25:29.743Z', - id: 1, - firstName: 'admin', - lastName: 'drec', - email: 'aishuutech@gmail.com', - notifications: true, - status: UserStatus.Active,//'Active', - role: Role.Admin,//'Admin', - roleId: 1, - //api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - organization :{ - //createdAt: '2024-02-18T07:25:29.669Z', - //updatedAt: '2024-02-18T07:25:29.669Z', - id: 1, - name: 'Admin_DREC', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'ApiUser', - //orgEmail: 'aishuutech@gmail.com', - status: OrganizationStatus.Active,//'Active', - documentIds: null, - //api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - //users: [ [User] ], - //invitations: [] - } as Organization, - emailConfirmed: false, - }; - - let inviteeOrganization = { - createdAt: '2024-03-01T07:59:03.122Z', - updatedAt: '2024-03-01T07:59:03.122Z', - id: 13, - name: 'Dev____ORG', - address: 'BLR', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'Developer', - orgEmail: 'mgi36509@zslsz.com', - status: OrganizationStatus.Active,//'Active', - documentIds: null, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - users: [], - invitations: [ - { - //createdAt: '2024-03-02T16:45:15.459Z', - //updatedAt: '2024-03-02T16:45:15.459Z', - id: 2, - email: 'uyhujjlswzfkdvoaot@cazlv.com', - role: Role.User as OrganizationRole,//'User', - status: OrganizationInvitationStatus.Pending,//'Pending', - sender: 'admin drec', - permissionId: null - } as Invitation, - ] - }; - - - let savedinvitedUser = { - email: 'cccplrtzifwzerosys@cazlp.com', - organization: { - createdAt: '2024-03-01T07:59:03.122Z', - updatedAt: '2024-03-01T07:59:03.122Z', - id: 13, - name: 'Dev____ORG', - address: 'BLR', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'Developer', - orgEmail: 'mgi36509@zslsz.com', - status: 'Active', - documentIds: null, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - users: [ [User], [User], [User] ], - invitations: [ [Invitation], [Invitation] ] - }, - role: 'User', - status: 'Pending', - sender: 'admin drec', - permissionId: null, - createdAt: '2024-03-03T06:30:23.875Z', - updatedAt: '2024-03-03T06:30:23.875Z', - password: 'Drec@1234', - id: 4 - }; - - let mockinvitedUser = { - firstName: 'test', - lastName: 'test', - email: 'cccplrtzifwzerosys@cazlp.com', - password: '$2a$08$d8IsG9Oqw5U3TVXWtEyN6.wktWKZ1ZhxHweaQ6oWqJhEL4k2SUk.S', - notifications: true, - status: 'Pending', - role: 'OrganizationAdmin', - roleId: 2, - organization: { id: 13 }, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - createdAt: '2024-03-03T06:30:23.936Z', - updatedAt: '2024-03-03T06:30:23.936Z', - id: 4, - }; - - const findByEmailSpy = jest.spyOn(userService, 'findByEmail').mockResolvedValueOnce(mockAdminUserEntity as IUser).mockResolvedValueOnce(null); - const orgfindOneSpy = jest.spyOn(organizationService, 'findOne').mockResolvedValue(inviteeOrganization as unknown as Organization); - const inviteefindOneSpy = jest.spyOn(invitationRepository, 'findOne').mockResolvedValue(undefined); - const ensureIsNotMemberSpy = jest.spyOn(service, 'ensureIsNotMember').mockImplementation(() => {}); - const saveSpy = jest.spyOn(invitationRepository, 'save').mockResolvedValue(savedinvitedUser as any); - const newcreatespy = jest.spyOn(userService, 'newcreate').mockResolvedValue(mockinvitedUser as any); - const sendInvitationSpy = jest.spyOn(userService, 'sentinvitiontoUser').mockResolvedValue({ - message: 'Invitation sent successfully', - success: true - }); - - await expect( - service.invite( - user as ILoggedInUser, - email, - role, - firstName, - lastName, - orgId, // Assuming organization ID - ), - ).resolves.not.toThrow();//.toEqual({});//resolves.not.toThrow(); - - await expect(findByEmailSpy).toHaveBeenCalledWith(user.email); - await expect(orgfindOneSpy).toHaveBeenCalledWith(orgId); - await expect(findByEmailSpy).toHaveBeenCalledWith(email.toLowerCase()); - await expect(inviteefindOneSpy).toHaveBeenCalledWith({where: { email: email, organization: orgId }, relations: ['organization'],}); - await expect(ensureIsNotMemberSpy).toHaveBeenCalledWith(email,inviteeOrganization); - await expect(saveSpy).toHaveBeenCalledWith({ - email: email, - organization: inviteeOrganization, - role, - status: OrganizationInvitationStatus.Pending, - sender: mockAdminUserEntity ? `${mockAdminUserEntity.firstName} ${mockAdminUserEntity.lastName}` : '', - }); - await expect(newcreatespy).toHaveBeenCalledWith({ - firstName: firstName, - lastName: lastName, - email: email, - password: service.randPassword, - orgName: inviteeOrganization.name, - organizationType: inviteeOrganization.organizationType, - orgid: orgId, - api_user_id: inviteeOrganization.api_user_id, - } as CreateUserORGDTO, - UserStatus.Pending, true, - ); - await expect(sendInvitationSpy).toHaveBeenCalledWith({ - firstName: firstName, - lastName: lastName, - email: email, - password: service.randPassword, - orgName: inviteeOrganization.name, - organizationType: inviteeOrganization.organizationType, - orgid: orgId, - api_user_id: inviteeOrganization.api_user_id, - } as CreateUserORGDTO, - email, mockinvitedUser.id, - ); - //Math.random = originalRandom; - }); - - it('should invite a user By ApiUser', async () => { - - const user = { - id: 2, - organizationId: 2, - email: 'iceratan@gmail.com', - blockchainAccountAddress: null, - role: Role.ApiUser,//'Admin', - permissions: [ 'Read', 'Write', 'Update' ], - api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', - }; - - const email= 'diuqtdpnqttfuvauha@cazlq.com'; - const role= Role.User as OrganizationRole;//'DeviceOwner'; - const firstName= 'test'; - const lastName= 'test'; - const orgId= 18; - - const mockApiUserEntity : IUser = { - //createdAt: '2024-02-18T07:25:29.743Z', - // updatedAt: '2024-02-18T07:25:29.743Z', - id: 2, - firstName: 'test', - lastName: 'apiuser', - email: 'iceratan@gmail.com', - notifications: true, - status: UserStatus.Active,//'Active', - role: Role.ApiUser,//'Admin', - roleId: 6, - //api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - organization :{ - //createdAt: '2024-02-18T07:25:29.669Z', - //updatedAt: '2024-02-18T07:25:29.669Z', - id: 2, - name: 'ORG_APIUSER1', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'ApiUser', - orgEmail: 'iceratan@gmail.com', - status: OrganizationStatus.Active,//'Active', - documentIds: null, - api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', - users: [], - invitations: [] - } as Organization, - emailConfirmed: false, - }; - - let inviteeOrganization = { - createdAt: '2024-03-01T07:59:03.122Z', - updatedAt: '2024-03-01T07:59:03.122Z', - id: 18, - name: 'ORG_DEV1_APIUSER', - address: 'BLR', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'Developer', - orgEmail: 'eqicgglmwppkbkugh@cazlg.com', - status: OrganizationStatus.Active,//'Active', - documentIds: null, - api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', - users: [{ - createdAt: '2024-03-03T17:18:55.416Z', - updatedAt: '2024-03-03T17:18:55.416Z', - id: 23, - firstName: 'string', - lastName: 'string', - email: 'eqicgglmwppkbkugh@cazlg.com', - notifications: true, - status: 'Active', - role: 'OrganizationAdmin', - roleId: 2, - api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d' - }], - invitations: [ - ] - }; - - - let savedinvitedUser = { - email: 'diuqtdpnqttfuvauha@cazlq.com', - organization: { - createdAt: '2024-03-03T17:18:55.388Z', - updatedAt: '2024-03-03T17:18:55.388Z', - id: 18, - name: 'ORG_DEV1_APIUSER', - address: 'BLR', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'Developer', - orgEmail: 'eqicgglmwppkbkugh@cazlg.com', - status: 'Active', - documentIds: null, - api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', - users: [ [User] ], - invitations: [] - }, - role: 'User', - status: 'Pending', - sender: 'test apiuser', - permissionId: null, - createdAt: '2024-03-03T18:13:43.629Z', - updatedAt: '2024-03-03T18:13:43.629Z', - id: 6 - }; - - let mockinvitedUser = { - firstName: 'test', - lastName: 'test', - email: 'diuqtdpnqttfuvauha@cazlq.com', - password: '$2a$08$d8IsG9Oqw5U3TVXWtEyN6.wktWKZ1ZhxHweaQ6oWqJhEL4k2SUk.S', - notifications: true, - status: 'Pending', - role: 'OrganizationAdmin', - roleId: 2, - organization: { id: 18 }, - api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', - createdAt: '2024-03-03T06:30:23.936Z', - updatedAt: '2024-03-03T06:30:23.936Z', - id: 6, - }; - - const findByEmailSpy = jest.spyOn(userService, 'findByEmail').mockResolvedValueOnce(mockApiUserEntity as IUser).mockResolvedValueOnce(null); - const orgfindOneSpy = jest.spyOn(organizationService, 'findOne').mockResolvedValue(inviteeOrganization as unknown as Organization); - const inviteefindOneSpy = jest.spyOn(invitationRepository, 'findOne').mockResolvedValue(undefined); - const ensureIsNotMemberSpy = jest.spyOn(service, 'ensureIsNotMember').mockImplementation(() => {}); - const saveSpy = jest.spyOn(invitationRepository, 'save').mockResolvedValue(savedinvitedUser as any); - const newcreatespy = jest.spyOn(userService, 'newcreate').mockResolvedValue(mockinvitedUser as any); - const sendInvitationSpy = jest.spyOn(userService, 'sentinvitiontoUser').mockResolvedValue({ - message: 'Invitation sent successfully', - success: true - }); - - await expect( - service.invite( - user as unknown as ILoggedInUser, - email, - role, - firstName, - lastName, - orgId, // Assuming organization ID - ), - ).resolves.not.toThrow();//.toEqual({});//resolves.not.toThrow(); - - await expect(findByEmailSpy).toHaveBeenCalledWith(user.email); - await expect(orgfindOneSpy).toHaveBeenCalledWith(orgId); - await expect(findByEmailSpy).toHaveBeenCalledWith(email.toLowerCase()); - await expect(inviteefindOneSpy).toHaveBeenCalledWith({where: { email: email, organization: orgId }, relations: ['organization'],}); - await expect(ensureIsNotMemberSpy).toHaveBeenCalledWith(email,inviteeOrganization); - await expect(saveSpy).toHaveBeenCalledWith({ - email: email, - organization: inviteeOrganization, - role, - status: OrganizationInvitationStatus.Pending, - sender: mockApiUserEntity ? `${mockApiUserEntity.firstName} ${mockApiUserEntity.lastName}` : '', - }); - await expect(newcreatespy).toHaveBeenCalledWith({ - firstName: firstName, - lastName: lastName, - email: email, - password: service.randPassword, - orgName: inviteeOrganization.name, - organizationType: inviteeOrganization.organizationType, - orgid: orgId, - api_user_id: inviteeOrganization.api_user_id, - } as CreateUserORGDTO, - UserStatus.Pending, true, - ); - }); - }); -/* - describe('update', () => { - it('should update invitation status', async () => { - // Mock necessary dependencies and implement your test case - jest.spyOn(userService, 'findByEmail').mockResolvedValue({}); - jest.spyOn(invitationRepository, 'findOne').mockResolvedValue({ - status: 'Pending', - organization: { id: 1 }, - }); - jest.spyOn(userService, 'addToOrganization').mockResolvedValue({}); - jest.spyOn(userService, 'changeRole').mockResolvedValue({}); - jest.spyOn(invitationRepository, 'save').mockResolvedValue({}); - - await expect( - service.update( - { email: 'test@example.com', status: 'Accepted' }, - 'invitationId', - ), - ).resolves.toEqual(ResponseSuccess()); - }); - }); */ - // Add more test cases for other methods as needed -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { InvitationService } from './invitation.service'; +import { UserService } from '../user/user.service'; +import { MailService } from '../../mail/mail.service'; +import { OrganizationService } from '../organization/organization.service'; +import { Repository, DeepPartial } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { Invitation } from './invitation.entity'; +import { ILoggedInUser, IUser, OrganizationRole } from '../../models'; +import { PermissionService } from '../permission/permission.service'; +import { + OrganizationInvitationStatus, + OrganizationStatus, + Role, + UserStatus, +} from '../../utils/enums'; +import { Organization } from '../organization/organization.entity'; +import { User } from '../user/user.entity'; +import exp from 'constants'; +import { UserDTO } from '../user/dto/user.dto'; +import { CreateUserORGDTO } from '../user/dto/create-user.dto'; + +describe('InvitationService', () => { + let service: InvitationService; + let invitationRepository: Repository; + let userService: UserService; + let mailService: MailService; + let organizationService: OrganizationService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + InvitationService, + { + provide: getRepositoryToken(Invitation), + useClass: Repository, + }, + { + provide: OrganizationService, + useValue: { + findOne: jest.fn(), + } as any, + }, + { + provide: UserService, + useValue: { + findByEmail: jest.fn(), + newcreate: jest.fn(), + sentinvitiontoUser: jest.fn(), + } as any, + }, + { + provide: MailService, + useValue: {} as any, + }, + { + provide: PermissionService, + useValue: {} as any, + }, + ], + }).compile(); + + service = module.get(InvitationService); + invitationRepository = module.get>( + getRepositoryToken(Invitation), + ); + userService = module.get(UserService); + mailService = module.get(MailService); + organizationService = module.get(OrganizationService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); + + describe('invite', () => { + it('should invite a user By admin', async () => { + const user = { + id: 1, + organizationId: 1, + email: 'aishuutech@gmail.com', + blockchainAccountAddress: null, + role: Role.Admin, //'Admin', + permissions: undefined, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + }; + + const email = 'cccplrtzifwzerosys@cazlp.com'; + const role = Role.User as OrganizationRole; //'DeviceOwner'; + const firstName = 'tst'; + const lastName = 'test'; + const orgId = 13; + + const mockAdminUserEntity: IUser = { + //createdAt: '2024-02-18T07:25:29.743Z', + // updatedAt: '2024-02-18T07:25:29.743Z', + id: 1, + firstName: 'admin', + lastName: 'drec', + email: 'aishuutech@gmail.com', + notifications: true, + status: UserStatus.Active, //'Active', + role: Role.Admin, //'Admin', + roleId: 1, + //api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + organization: { + //createdAt: '2024-02-18T07:25:29.669Z', + //updatedAt: '2024-02-18T07:25:29.669Z', + id: 1, + name: 'Admin_DREC', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'ApiUser', + //orgEmail: 'aishuutech@gmail.com', + status: OrganizationStatus.Active, //'Active', + documentIds: null, + //api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + //users: [ [User] ], + //invitations: [] + } as Organization, + emailConfirmed: false, + }; + + let inviteeOrganization = { + createdAt: '2024-03-01T07:59:03.122Z', + updatedAt: '2024-03-01T07:59:03.122Z', + id: 13, + name: 'Dev____ORG', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'mgi36509@zslsz.com', + status: OrganizationStatus.Active, //'Active', + documentIds: null, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + users: [], + invitations: [ + { + //createdAt: '2024-03-02T16:45:15.459Z', + //updatedAt: '2024-03-02T16:45:15.459Z', + id: 2, + email: 'uyhujjlswzfkdvoaot@cazlv.com', + role: Role.User as OrganizationRole, //'User', + status: OrganizationInvitationStatus.Pending, //'Pending', + sender: 'admin drec', + permissionId: null, + } as Invitation, + ], + }; + + let savedinvitedUser = { + email: 'cccplrtzifwzerosys@cazlp.com', + organization: { + createdAt: '2024-03-01T07:59:03.122Z', + updatedAt: '2024-03-01T07:59:03.122Z', + id: 13, + name: 'Dev____ORG', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'mgi36509@zslsz.com', + status: 'Active', + documentIds: null, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + users: [[User], [User], [User]], + invitations: [[Invitation], [Invitation]], + }, + role: 'User', + status: 'Pending', + sender: 'admin drec', + permissionId: null, + createdAt: '2024-03-03T06:30:23.875Z', + updatedAt: '2024-03-03T06:30:23.875Z', + password: 'Drec@1234', + id: 4, + }; + + let mockinvitedUser = { + firstName: 'test', + lastName: 'test', + email: 'cccplrtzifwzerosys@cazlp.com', + password: + '$2a$08$d8IsG9Oqw5U3TVXWtEyN6.wktWKZ1ZhxHweaQ6oWqJhEL4k2SUk.S', + notifications: true, + status: 'Pending', + role: 'OrganizationAdmin', + roleId: 2, + organization: { id: 13 }, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + createdAt: '2024-03-03T06:30:23.936Z', + updatedAt: '2024-03-03T06:30:23.936Z', + id: 4, + }; + + const findByEmailSpy = jest + .spyOn(userService, 'findByEmail') + .mockResolvedValueOnce(mockAdminUserEntity as IUser) + .mockResolvedValueOnce(null); + const orgfindOneSpy = jest + .spyOn(organizationService, 'findOne') + .mockResolvedValue(inviteeOrganization as unknown as Organization); + const inviteefindOneSpy = jest + .spyOn(invitationRepository, 'findOne') + .mockResolvedValue(undefined); + const ensureIsNotMemberSpy = jest + .spyOn(service, 'ensureIsNotMember') + .mockImplementation(() => {}); + const saveSpy = jest + .spyOn(invitationRepository, 'save') + .mockResolvedValue(savedinvitedUser as any); + const newcreatespy = jest + .spyOn(userService, 'newcreate') + .mockResolvedValue(mockinvitedUser as any); + const sendInvitationSpy = jest + .spyOn(userService, 'sentinvitiontoUser') + .mockResolvedValue({ + message: 'Invitation sent successfully', + success: true, + }); + + await expect( + service.invite( + user as ILoggedInUser, + email, + role, + firstName, + lastName, + orgId, // Assuming organization ID + ), + ).resolves.not.toThrow(); //.toEqual({});//resolves.not.toThrow(); + + await expect(findByEmailSpy).toHaveBeenCalledWith(user.email); + await expect(orgfindOneSpy).toHaveBeenCalledWith(orgId); + await expect(findByEmailSpy).toHaveBeenCalledWith(email.toLowerCase()); + await expect(inviteefindOneSpy).toHaveBeenCalledWith({ + where: { email: email, organization: orgId }, + relations: ['organization'], + }); + await expect(ensureIsNotMemberSpy).toHaveBeenCalledWith( + email, + inviteeOrganization, + ); + await expect(saveSpy).toHaveBeenCalledWith({ + email: email, + organization: inviteeOrganization, + role, + status: OrganizationInvitationStatus.Pending, + sender: mockAdminUserEntity + ? `${mockAdminUserEntity.firstName} ${mockAdminUserEntity.lastName}` + : '', + }); + await expect(newcreatespy).toHaveBeenCalledWith( + { + firstName: firstName, + lastName: lastName, + email: email, + password: service.randPassword, + orgName: inviteeOrganization.name, + organizationType: inviteeOrganization.organizationType, + orgid: orgId, + api_user_id: inviteeOrganization.api_user_id, + } as CreateUserORGDTO, + UserStatus.Pending, + true, + ); + await expect(sendInvitationSpy).toHaveBeenCalledWith( + { + firstName: firstName, + lastName: lastName, + email: email, + password: service.randPassword, + orgName: inviteeOrganization.name, + organizationType: inviteeOrganization.organizationType, + orgid: orgId, + api_user_id: inviteeOrganization.api_user_id, + } as CreateUserORGDTO, + email, + mockinvitedUser.id, + ); + //Math.random = originalRandom; + }); + + it('should invite a user By ApiUser', async () => { + const user = { + id: 2, + organizationId: 2, + email: 'iceratan@gmail.com', + blockchainAccountAddress: null, + role: Role.ApiUser, //'Admin', + permissions: ['Read', 'Write', 'Update'], + api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', + }; + + const email = 'diuqtdpnqttfuvauha@cazlq.com'; + const role = Role.User as OrganizationRole; //'DeviceOwner'; + const firstName = 'test'; + const lastName = 'test'; + const orgId = 18; + + const mockApiUserEntity: IUser = { + //createdAt: '2024-02-18T07:25:29.743Z', + // updatedAt: '2024-02-18T07:25:29.743Z', + id: 2, + firstName: 'test', + lastName: 'apiuser', + email: 'iceratan@gmail.com', + notifications: true, + status: UserStatus.Active, //'Active', + role: Role.ApiUser, //'Admin', + roleId: 6, + //api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + organization: { + //createdAt: '2024-02-18T07:25:29.669Z', + //updatedAt: '2024-02-18T07:25:29.669Z', + id: 2, + name: 'ORG_APIUSER1', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'ApiUser', + orgEmail: 'iceratan@gmail.com', + status: OrganizationStatus.Active, //'Active', + documentIds: null, + api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', + users: [], + invitations: [], + } as Organization, + emailConfirmed: false, + }; + + let inviteeOrganization = { + createdAt: '2024-03-01T07:59:03.122Z', + updatedAt: '2024-03-01T07:59:03.122Z', + id: 18, + name: 'ORG_DEV1_APIUSER', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'eqicgglmwppkbkugh@cazlg.com', + status: OrganizationStatus.Active, //'Active', + documentIds: null, + api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', + users: [ + { + createdAt: '2024-03-03T17:18:55.416Z', + updatedAt: '2024-03-03T17:18:55.416Z', + id: 23, + firstName: 'string', + lastName: 'string', + email: 'eqicgglmwppkbkugh@cazlg.com', + notifications: true, + status: 'Active', + role: 'OrganizationAdmin', + roleId: 2, + api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', + }, + ], + invitations: [], + }; + + let savedinvitedUser = { + email: 'diuqtdpnqttfuvauha@cazlq.com', + organization: { + createdAt: '2024-03-03T17:18:55.388Z', + updatedAt: '2024-03-03T17:18:55.388Z', + id: 18, + name: 'ORG_DEV1_APIUSER', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'eqicgglmwppkbkugh@cazlg.com', + status: 'Active', + documentIds: null, + api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', + users: [[User]], + invitations: [], + }, + role: 'User', + status: 'Pending', + sender: 'test apiuser', + permissionId: null, + createdAt: '2024-03-03T18:13:43.629Z', + updatedAt: '2024-03-03T18:13:43.629Z', + id: 6, + }; + + let mockinvitedUser = { + firstName: 'test', + lastName: 'test', + email: 'diuqtdpnqttfuvauha@cazlq.com', + password: + '$2a$08$d8IsG9Oqw5U3TVXWtEyN6.wktWKZ1ZhxHweaQ6oWqJhEL4k2SUk.S', + notifications: true, + status: 'Pending', + role: 'OrganizationAdmin', + roleId: 2, + organization: { id: 18 }, + api_user_id: 'ebf1a4ee-ec55-4ed6-b6bd-4c836a56ad9d', + createdAt: '2024-03-03T06:30:23.936Z', + updatedAt: '2024-03-03T06:30:23.936Z', + id: 6, + }; + + const findByEmailSpy = jest + .spyOn(userService, 'findByEmail') + .mockResolvedValueOnce(mockApiUserEntity as IUser) + .mockResolvedValueOnce(null); + const orgfindOneSpy = jest + .spyOn(organizationService, 'findOne') + .mockResolvedValue(inviteeOrganization as unknown as Organization); + const inviteefindOneSpy = jest + .spyOn(invitationRepository, 'findOne') + .mockResolvedValue(undefined); + const ensureIsNotMemberSpy = jest + .spyOn(service, 'ensureIsNotMember') + .mockImplementation(() => {}); + const saveSpy = jest + .spyOn(invitationRepository, 'save') + .mockResolvedValue(savedinvitedUser as any); + const newcreatespy = jest + .spyOn(userService, 'newcreate') + .mockResolvedValue(mockinvitedUser as any); + const sendInvitationSpy = jest + .spyOn(userService, 'sentinvitiontoUser') + .mockResolvedValue({ + message: 'Invitation sent successfully', + success: true, + }); + + await expect( + service.invite( + user as unknown as ILoggedInUser, + email, + role, + firstName, + lastName, + orgId, // Assuming organization ID + ), + ).resolves.not.toThrow(); //.toEqual({});//resolves.not.toThrow(); + + await expect(findByEmailSpy).toHaveBeenCalledWith(user.email); + await expect(orgfindOneSpy).toHaveBeenCalledWith(orgId); + await expect(findByEmailSpy).toHaveBeenCalledWith(email.toLowerCase()); + await expect(inviteefindOneSpy).toHaveBeenCalledWith({ + where: { email: email, organization: orgId }, + relations: ['organization'], + }); + await expect(ensureIsNotMemberSpy).toHaveBeenCalledWith( + email, + inviteeOrganization, + ); + await expect(saveSpy).toHaveBeenCalledWith({ + email: email, + organization: inviteeOrganization, + role, + status: OrganizationInvitationStatus.Pending, + sender: mockApiUserEntity + ? `${mockApiUserEntity.firstName} ${mockApiUserEntity.lastName}` + : '', + }); + await expect(newcreatespy).toHaveBeenCalledWith( + { + firstName: firstName, + lastName: lastName, + email: email, + password: service.randPassword, + orgName: inviteeOrganization.name, + organizationType: inviteeOrganization.organizationType, + orgid: orgId, + api_user_id: inviteeOrganization.api_user_id, + } as CreateUserORGDTO, + UserStatus.Pending, + true, + ); + }); + }); + /* + describe('update', () => { + it('should update invitation status', async () => { + // Mock necessary dependencies and implement your test case + jest.spyOn(userService, 'findByEmail').mockResolvedValue({}); + jest.spyOn(invitationRepository, 'findOne').mockResolvedValue({ + status: 'Pending', + organization: { id: 1 }, + }); + jest.spyOn(userService, 'addToOrganization').mockResolvedValue({}); + jest.spyOn(userService, 'changeRole').mockResolvedValue({}); + jest.spyOn(invitationRepository, 'save').mockResolvedValue({}); + + await expect( + service.update( + { email: 'test@example.com', status: 'Accepted' }, + 'invitationId', + ), + ).resolves.toEqual(ResponseSuccess()); + }); + }); */ + // Add more test cases for other methods as needed +}); diff --git a/apps/drec-api/src/pods/invitation/invitation.service.ts b/apps/drec-api/src/pods/invitation/invitation.service.ts index d25e38de9..2d08e3000 100644 --- a/apps/drec-api/src/pods/invitation/invitation.service.ts +++ b/apps/drec-api/src/pods/invitation/invitation.service.ts @@ -1,4 +1,11 @@ -import { BadRequestException, Injectable, Logger, ConflictException, forwardRef, Inject,} from '@nestjs/common'; +import { + BadRequestException, + Injectable, + Logger, + ConflictException, + forwardRef, + Inject, +} from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository, SelectQueryBuilder } from 'typeorm'; import { @@ -18,7 +25,7 @@ import { OrganizationDTO } from '../organization/dto'; import { MailService } from '../../mail/mail.service'; import { updateInviteStatusDTO } from './dto/invite.dto'; import { CreateUserORGDTO } from '../user/dto/create-user.dto'; -import { PermissionService } from '../permission/permission.service' +import { PermissionService } from '../permission/permission.service'; import { UserStatus } from '@energyweb/origin-backend-core'; @Injectable() export class InvitationService { @@ -28,11 +35,12 @@ export class InvitationService { constructor( @InjectRepository(Invitation) private readonly invitationRepository: Repository, - @Inject(forwardRef(() => OrganizationService)) private readonly organizationService: OrganizationService, + @Inject(forwardRef(() => OrganizationService)) + private readonly organizationService: OrganizationService, private readonly userService: UserService, private readonly mailService: MailService, private readonly PermissionService: PermissionService, - ) { } + ) {} public async invite( user: ILoggedInUser, @@ -40,7 +48,7 @@ export class InvitationService { role: OrganizationRole, firstName: string, lastName: string, - orgId?: number + orgId?: number, // permission: NewPermissionDTO[], ): Promise { this.logger.verbose(`With in invite`); @@ -49,24 +57,21 @@ export class InvitationService { if (orgId) { if (user.role === Role.Admin || user.role === Role.ApiUser) { inviteorg = orgId; - } - else { + } else { if (user.organizationId != orgId) { - this.logger.error(`Requested organization is part of other organization`); + this.logger.error( + `Requested organization is part of other organization`, + ); throw new ConflictException({ success: false, message: `Requested organization is part of other organization`, }); } - } - } - else { + } else { inviteorg = user.organizationId; } - const organization = await this.organizationService.findOne( - inviteorg, - ); + const organization = await this.organizationService.findOne(inviteorg); if (!organization) { this.logger.error(`Organization information not found`); throw new ConflictException({ @@ -76,7 +81,9 @@ export class InvitationService { } if (user.role === Role.ApiUser) { if (user.api_user_id !== organization.api_user_id) { - this.logger.error(`Organization ${organization.name} is part of other apiuser or developer`); + this.logger.error( + `Organization ${organization.name} is part of other apiuser or developer`, + ); throw new ConflictException({ success: false, message: `Organization ${organization.name} is part of other apiuser or developer`, @@ -89,33 +96,39 @@ export class InvitationService { if (invitee && invitee.organization) { if (invitee.organization.id === inviteorg) { - this.logger.error(`User ${lowerCaseEmail} is already part of this organization`); + this.logger.error( + `User ${lowerCaseEmail} is already part of this organization`, + ); throw new ConflictException({ success: false, message: `User ${lowerCaseEmail} is already part of this organization`, }); } else { - this.logger.error(`User ${lowerCaseEmail} is already part of the other organization`); + this.logger.error( + `User ${lowerCaseEmail} is already part of the other organization`, + ); throw new ConflictException({ success: false, message: `User ${lowerCaseEmail} is already part of the other organization`, }); } - - } const orginvitee = await this.invitationRepository.findOne({ where: { email: lowerCaseEmail, - organization: inviteorg + organization: inviteorg, }, relations: ['organization'], }); //console.log(invitation) if (orginvitee) { - this.logger.error(`Requested invitation User ${lowerCaseEmail} is already exist`); - throw new BadRequestException(`Requested invitation User ${lowerCaseEmail} is already exist`); + this.logger.error( + `Requested invitation User ${lowerCaseEmail} is already exist`, + ); + throw new BadRequestException( + `Requested invitation User ${lowerCaseEmail} is already exist`, + ); } this.ensureIsNotMember(lowerCaseEmail, organization); var saveinviteuser: any = {}; @@ -128,7 +141,12 @@ export class InvitationService { sender: sender ? `${sender.firstName} ${sender.lastName}` : '', }); } - this.randPassword = Array(10).fill("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").map(function (x) { return x[Math.floor(Math.random() * x.length)] }).join(''); + this.randPassword = Array(10) + .fill('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz') + .map(function (x) { + return x[Math.floor(Math.random() * x.length)]; + }) + .join(''); var inviteuser: CreateUserORGDTO = { firstName: firstName, lastName: lastName, @@ -137,13 +155,12 @@ export class InvitationService { orgName: organization.name, organizationType: organization.organizationType, //@ts-ignore - orgid?: organization.id + orgid: organization.id, // orgAddress:'' - - } + }; var userid: any; - this.logger.debug("invitee") - //to add for if one user invite by multiple organization + this.logger.debug('invitee'); + //to add for if one user invite by multiple organization // if (invitee) { // userid = invitee @@ -151,17 +168,25 @@ export class InvitationService { //let client; //inviteuser['client'] = { api_user_id: organization.api_user_id } inviteuser.api_user_id = organization.api_user_id; - userid = await this.userService.newcreate(inviteuser, UserStatus.Pending, true); + userid = await this.userService.newcreate( + inviteuser, + UserStatus.Pending, + true, + ); //} var updateinviteuser: updateInviteStatusDTO = { email: lowerCaseEmail, - status: OrganizationInvitationStatus.Accepted - } + status: OrganizationInvitationStatus.Accepted, + }; //await this.update(updateinviteuser, saveinviteuser.id) if (sender.role !== Role.ApiUser) { - await this.userService.sentinvitiontoUser(inviteuser, lowerCaseEmail, saveinviteuser.id); + await this.userService.sentinvitiontoUser( + inviteuser, + lowerCaseEmail, + saveinviteuser.id, + ); } //to add permission for user role in invitaion // const newpermission: any = []; @@ -199,7 +224,7 @@ export class InvitationService { ): Promise { this.logger.verbose(`With in update`); const lowerCaseEmail = user.email.toLowerCase(); - const userinvite = await this.userService.findByEmail(lowerCaseEmail) + const userinvite = await this.userService.findByEmail(lowerCaseEmail); this.logger.debug(userinvite); const invitation = await this.invitationRepository.findOne(invitationId, { where: { @@ -217,7 +242,9 @@ export class InvitationService { invitation.status === OrganizationInvitationStatus.Accepted || invitation.status === OrganizationInvitationStatus.Rejected ) { - this.logger.error(`Requested invitation has already been accepted or rejected`); + this.logger.error( + `Requested invitation has already been accepted or rejected`, + ); throw new BadRequestException( 'Requested invitation has already been accepted or rejected', ); @@ -245,22 +272,37 @@ export class InvitationService { return ResponseSuccess(); } - public async getUsersInvitation(user: ILoggedInUser, organizationId?: number, pageNumber?: number, limit?: number): Promise<{ invitations: Invitation[], currentPage: number, totalPages: number, totalCount: number }> { + public async getUsersInvitation( + user: ILoggedInUser, + organizationId?: number, + pageNumber?: number, + limit?: number, + ): Promise<{ + invitations: Invitation[]; + currentPage: number; + totalPages: number; + totalCount: number; + }> { this.logger.verbose(`With in getUsersInvitation`); - let query: SelectQueryBuilder = await this.invitationRepository.createQueryBuilder('invitation') + let query: SelectQueryBuilder = await this.invitationRepository + .createQueryBuilder('invitation') .leftJoinAndSelect('invitation.organization', 'organization'); if (user.role != Role.Admin) { - query = await query - .andWhere('organization.api_user_id = :apiUserId', { apiUserId: user.api_user_id }); + query = await query.andWhere('organization.api_user_id = :apiUserId', { + apiUserId: user.api_user_id, + }); } if (organizationId) { - const organization = await this.organizationService.findOne(organizationId); + const organization = + await this.organizationService.findOne(organizationId); if (user.role != Role.Admin && user.role != Role.ApiUser) { if (user.organizationId != organizationId) { - this.logger.error(`${user.role} can't view the invitation list of other organizations`); + this.logger.error( + `${user.role} can't view the invitation list of other organizations`, + ); throw new BadRequestException({ success: false, message: `${user.role} can't view the invitation list of other organizations`, @@ -270,7 +312,9 @@ export class InvitationService { if (user.role === Role.ApiUser) { if (user.api_user_id != organization.api_user_id) { - this.logger.error(`Organization ${organization.name} is part of other apiuser`); + this.logger.error( + `Organization ${organization.name} is part of other apiuser`, + ); throw new BadRequestException({ success: false, message: `Organization ${organization.name} is part of other apiuser`, @@ -278,8 +322,9 @@ export class InvitationService { } } - query = query - .andWhere('organization.id = :organizationId', { organizationId: organizationId }); + query = query.andWhere('organization.id = :organizationId', { + organizationId: organizationId, + }); } const [invitations, totalCount] = await query @@ -300,7 +345,7 @@ export class InvitationService { invitations: invitations, currentPage: pageNumber, totalPages, - totalCount + totalCount, }; } @@ -320,7 +365,6 @@ export class InvitationService { private async sendInvitation( organization: OrganizationDTO, email: string, - ): Promise { this.logger.verbose(`With in sendInvitation`); const url = `${process.env.UI_BASE_URL}/organization/invitations`; @@ -337,33 +381,29 @@ export class InvitationService { } } - async remove(email, orgId): Promise { - const lowerCaseEmail = email.toLowerCase(); const orginvitee = await this.invitationRepository.findOne({ where: { email: lowerCaseEmail, - organization: orgId + organization: orgId, }, relations: ['organization'], }); - console.log('orginvitee', orginvitee) + console.log('orginvitee', orginvitee); if (orginvitee) { await this.invitationRepository.delete(orginvitee.id); } - } - async getinvite_info_byEmail(user:LoggedInUser){ + async getinvite_info_byEmail(user: LoggedInUser) { const lowerCaseEmail = user.email.toLowerCase(); const orginvitee = await this.invitationRepository.findOne({ where: { email: lowerCaseEmail, - organization: user.organizationId + organization: user.organizationId, }, relations: ['organization'], }); return orginvitee; } - } diff --git a/apps/drec-api/src/pods/issuer/drec-issuer.controller.ts b/apps/drec-api/src/pods/issuer/drec-issuer.controller.ts index 1a15bd0e4..454e1568f 100755 --- a/apps/drec-api/src/pods/issuer/drec-issuer.controller.ts +++ b/apps/drec-api/src/pods/issuer/drec-issuer.controller.ts @@ -1,11 +1,4 @@ -import { - Controller, - Get, - Post, - Body, - UseGuards, - Logger, -} from '@nestjs/common'; +import { Controller, Get, Post, Body, UseGuards, Logger } from '@nestjs/common'; import { ApiBearerAuth, ApiOkResponse, @@ -24,16 +17,13 @@ import { ACLModules } from '../access-control-layer-module-service/decorator/acl @ApiSecurity('drec') @Controller('drec-issuer') export class DrecIssuerController { - private readonly logger = new Logger(DrecIssuerController.name); - constructor(private readonly issuerService: IssuerService) { - - } -/** - * - * @returns - */ + constructor(private readonly issuerService: IssuerService) {} + /** + * + * @returns + */ @Get('/ongoing') @UseGuards(PermissionGuard) @Permission('Read') @@ -42,32 +32,30 @@ export class DrecIssuerController { description: 'Simple Get For Issuer API', }) async simpleGetCallForOngoing() { - - this.logger.verbose(`With in simpleGetCallForOngoing`,`got hit from cloudwatch ongoing`); - + this.logger.verbose( + `With in simpleGetCallForOngoing`, + `got hit from cloudwatch ongoing`, + ); return new Promise((resolve, reject) => { - this.invokeIssuerCronOngoing(); this.logger.log(`successfully Hitddd the ongoing API`); - resolve("successfully Hitddd the ongoing API"); - }) - + resolve('successfully Hitddd the ongoing API'); + }); } async invokeIssuerCronOngoing() { this.logger.verbose(`With in invokeIssuerCronOngoing`); try { await this.issuerService.handleCron(); - } - catch (e) { - this.logger.error("caught exception in cron ongoing", e); + } catch (e) { + this.logger.error('caught exception in cron ongoing', e); } } -/** - * - * @returns - */ + /** + * + * @returns + */ @Get('/history') @UseGuards(PermissionGuard) @Permission('Read') @@ -76,23 +64,22 @@ export class DrecIssuerController { description: 'Simple Get For Issuer API', }) async simpleGetCallForHistory() { - - this.logger.verbose(`With in simpleGetCallForHistory`, `got hit from cloudwatch history`); - + this.logger.verbose( + `With in simpleGetCallForHistory`, + `got hit from cloudwatch history`, + ); return new Promise((resolve, reject) => { - this.invokeIssuerCronForHistory(); this.logger.log(`successfully Hitthe history API`); - resolve("successfully Hitthe history API"); - }) - + resolve('successfully Hitthe history API'); + }); } -/** - * - * @param certificateData - * @returns - */ + /** + * + * @param certificateData + * @returns + */ @Post() @UseGuards(PermissionGuard) @Permission('Write') @@ -103,63 +90,56 @@ export class DrecIssuerController { }) @ApiBody({ type: ReIssueCertificateDTO }) async reIssueCertificates(@Body() certificateData) { - this.logger.verbose(`With in reIssueCertificates`); return new Promise((resolve, reject) => { - //@ts-ignore this.issuerService.issueCertificateFromAPI(certificateData); this.logger.log(`hit the issueance data`); - resolve("hit the issueance data"); - }) - + resolve('hit the issueance data'); + }); } async invokeIssuerCronForHistory() { this.logger.verbose(`With in invokeIssuerCronForHistory`); try { await this.issuerService.handleCronForHistoricalIssuance(); - } - catch (e) { - this.logger.error("caught exception in cron history", e); + } catch (e) { + this.logger.error('caught exception in cron history', e); } } -/** - * - * @returns - */ + /** + * + * @returns + */ @Get('/lateongoing') - // @UseGuards(PermissionGuard) - // @Permission('Read') - // @ACLModules('DREC_ISSUER_MANAGEMENT_CRUDL') + // @UseGuards(PermissionGuard) + // @Permission('Read') + // @ACLModules('DREC_ISSUER_MANAGEMENT_CRUDL') @ApiOkResponse({ description: 'Simple Get For Issuer API', }) async simpleGetCallForlateOngoing() { - - this.logger.verbose(`With in simpleGetCallForlateOngoing`, `got hit from cloudwatch ongoing`); - + this.logger.verbose( + `With in simpleGetCallForlateOngoing`, + `got hit from cloudwatch ongoing`, + ); return new Promise((resolve, reject) => { - this.invokeIssuerCronlateOngoing(); this.logger.log(`successfully Hitddd the late ongoing API`); - resolve("successfully Hitddd the late ongoing API"); - }) - + resolve('successfully Hitddd the late ongoing API'); + }); } async invokeIssuerCronlateOngoing() { this.logger.verbose(`With in invokeIssuerCronlateOngoing`); try { await this.issuerService.handleCronForOngoingLateIssuance(); - } - catch (e) { - this.logger.error("caught exception in cron ongoing", e); + } catch (e) { + this.logger.error('caught exception in cron ongoing', e); } } - } diff --git a/apps/drec-api/src/pods/issuer/dto/re-issue-certificate.dto.ts b/apps/drec-api/src/pods/issuer/dto/re-issue-certificate.dto.ts index 438c2dcfd..7ed837c6b 100755 --- a/apps/drec-api/src/pods/issuer/dto/re-issue-certificate.dto.ts +++ b/apps/drec-api/src/pods/issuer/dto/re-issue-certificate.dto.ts @@ -1,5 +1,12 @@ -import { ApiProperty ,ApiPropertyOptional} from '@nestjs/swagger'; -import { IsInt, IsString,IsOptional, Min,IsBoolean,IsEnum } from 'class-validator'; +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { + IsInt, + IsString, + IsOptional, + Min, + IsBoolean, + IsEnum, +} from 'class-validator'; // {"deviceId":"10","energyValue":"2463000","fromTime":"2022-07-31T18:30:01.000Z","toTime":"2022-08-31T18:29:59.000Z", // "toAddress":"0x320Bbee0D0CE23302eDDb2707B2DdED3e49E4437", @@ -31,5 +38,4 @@ export class ReIssueCertificateDTO { @ApiProperty() metadata: any; - } diff --git a/apps/drec-api/src/pods/issuer/issuer.module.ts b/apps/drec-api/src/pods/issuer/issuer.module.ts index 10d5eb77a..c6619c070 100755 --- a/apps/drec-api/src/pods/issuer/issuer.module.ts +++ b/apps/drec-api/src/pods/issuer/issuer.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; -import {HttpModule} from '@nestjs/axios'; +import { HttpModule } from '@nestjs/axios'; import { DeviceModule } from '../device/device.module'; // import { CertificateModule } from '@energyweb/origin-247-certificate'; @@ -9,12 +9,11 @@ import { ReadsModule } from '../reads/reads.module'; import { OrganizationModule } from '../organization/organization.module'; import { DeviceGroupModule } from '../device-group/device-group.module'; import { IssuerService } from './issuer.service'; -import {DrecIssuerController} from './drec-issuer.controller'; +import { DrecIssuerController } from './drec-issuer.controller'; import { SynchronizeBlockchainTaskService } from './synchronize-blockchain-task.service'; -import {CertificateLogModule} from '../certificate-log/certificate-log.module' +import { CertificateLogModule } from '../certificate-log/certificate-log.module'; import { UserModule } from '../user/user.module'; - @Module({ imports: [ DeviceModule, @@ -25,10 +24,10 @@ import { UserModule } from '../user/user.module'; ReadsModule, OrganizationModule, HttpModule, - UserModule + UserModule, ], - providers: [IssuerService,SynchronizeBlockchainTaskService], + providers: [IssuerService, SynchronizeBlockchainTaskService], exports: [IssuerService], - controllers:[DrecIssuerController] + controllers: [DrecIssuerController], }) export class IssuerModule {} diff --git a/apps/drec-api/src/pods/issuer/issuer.service.spec.ts b/apps/drec-api/src/pods/issuer/issuer.service.spec.ts index 73f8936ee..089f797ed 100644 --- a/apps/drec-api/src/pods/issuer/issuer.service.spec.ts +++ b/apps/drec-api/src/pods/issuer/issuer.service.spec.ts @@ -1,62 +1,63 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { OrganizationService } from '../organization/organization.service'; -import { IssuerService } from './issuer.service'; -import { DeviceGroupService } from '../device-group/device-group.service'; -import { ReadsService } from '../reads/reads.service'; -import { DeviceService } from '../device'; -import { ReadsService as BaseReadsService, } from '@energyweb/energy-api-influxdb'; -import { HttpService } from '@nestjs/axios'; -import { OffChainCertificateService } from '@energyweb/origin-247-certificate'; -import { BASE_READ_SERVICE } from '../reads/const'; - -describe('IssuerService', () => { - let service: IssuerService; - let groupService: DeviceGroupService; - let deviceService: DeviceService; - let organizationService: OrganizationService; - let readservice: ReadsService; - let httpService: HttpService; - let offChainCertificateService: OffChainCertificateService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [IssuerService, - { - provide: DeviceGroupService, - useValue: {} as any, - }, - { - provide: DeviceService, - useValue: {} as any, - }, - { - provide: OrganizationService, - useValue: {} as any, - }, - { - provide: ReadsService, - useValue: {} as any, - }, - { - provide: BASE_READ_SERVICE, - useValue: {} as any, - }, - { - provide: HttpService, - useValue: {} as any, - }, - { - provide: OffChainCertificateService, - useValue: {} as any, - }, - ], - }).compile(); - - service = module.get(IssuerService); - groupService = module.get(DeviceGroupService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { OrganizationService } from '../organization/organization.service'; +import { IssuerService } from './issuer.service'; +import { DeviceGroupService } from '../device-group/device-group.service'; +import { ReadsService } from '../reads/reads.service'; +import { DeviceService } from '../device'; +import { ReadsService as BaseReadsService } from '@energyweb/energy-api-influxdb'; +import { HttpService } from '@nestjs/axios'; +import { OffChainCertificateService } from '@energyweb/origin-247-certificate'; +import { BASE_READ_SERVICE } from '../reads/const'; + +describe('IssuerService', () => { + let service: IssuerService; + let groupService: DeviceGroupService; + let deviceService: DeviceService; + let organizationService: OrganizationService; + let readservice: ReadsService; + let httpService: HttpService; + let offChainCertificateService: OffChainCertificateService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + IssuerService, + { + provide: DeviceGroupService, + useValue: {} as any, + }, + { + provide: DeviceService, + useValue: {} as any, + }, + { + provide: OrganizationService, + useValue: {} as any, + }, + { + provide: ReadsService, + useValue: {} as any, + }, + { + provide: BASE_READ_SERVICE, + useValue: {} as any, + }, + { + provide: HttpService, + useValue: {} as any, + }, + { + provide: OffChainCertificateService, + useValue: {} as any, + }, + ], + }).compile(); + + service = module.get(IssuerService); + groupService = module.get(DeviceGroupService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/issuer/issuer.service.ts b/apps/drec-api/src/pods/issuer/issuer.service.ts index c2433c11a..21373108e 100755 --- a/apps/drec-api/src/pods/issuer/issuer.service.ts +++ b/apps/drec-api/src/pods/issuer/issuer.service.ts @@ -1,1267 +1,1602 @@ -import { Injectable, NotFoundException, Logger, Inject } from '@nestjs/common'; -import { Cron, CronExpression } from '@nestjs/schedule'; -// import { -// CertificateService, -// CERTIFICATE_SERVICE_TOKEN, -// IIssueCommandParams, -// IIssuedCertificate, -// ITransferCommand, -// } from '@energyweb/origin-247-certificate'; -import { - IGetAllCertificatesOptions, - IIssueCommandParams, -} from '@energyweb/origin-247-certificate'; -import { ICertificateMetadata } from '../../utils/types'; -import { DateTime } from 'luxon'; -import { - FilterDTO, - ReadsService as BaseReadsService, -} from '@energyweb/energy-api-influxdb'; -import { v4 as uuid } from 'uuid'; - -import { HttpService } from '@nestjs/axios'; - -import { DeviceService } from '../device/device.service'; -import { BASE_READ_SERVICE } from '../reads/const'; -import { OrganizationService } from '../organization/organization.service'; -import { DeviceGroupService } from '../device-group/device-group.service'; -import { IDevice, BuyerReservationCertificateGenerationFrequency } from '../../models'; -import { DeviceGroup } from '../device-group/device-group.entity'; -import { DeviceGroupNextIssueCertificate } from '../device-group/device_group_issuecertificate.entity' -import { AnyARecord } from 'dns'; -import { EndReservationdateDTO } from '../device-group/dto'; -import { CertificateType, ReadType, SingleDeviceIssuanceStatus, StandardCompliance } from '../../utils/enums' -import { CheckCertificateIssueDateLogForDeviceEntity } from '../device/check_certificate_issue_date_log_for_device.entity' -import { CheckCertificateIssueDateLogForDeviceGroupEntity } from '../device-group/check_certificate_issue_date_log_for_device_group.entity' -import { HistoryDeviceGroupNextIssueCertificate } from '../device-group/history_next_issuance_date_log.entity' -import { ReadsService } from '../reads/reads.service' -import { HistoryIntermediate_MeterRead } from '../reads/history_intermideate_meterread.entity'; -import { Device } from '../device'; -import { OffChainCertificateService } from '@energyweb/origin-247-certificate'; -import { HistoryNextInssuanceStatus } from '../../utils/enums/history_next_issuance.enum'; -import { DeviceLateongoingIssueCertificateEntity } from '../device/device_lateongoing_certificate.entity'; -@Injectable() -export class IssuerService { - private readonly logger = new Logger(IssuerService.name); - - constructor( - private groupService: DeviceGroupService, - private deviceService: DeviceService, - private organizationService: OrganizationService, - private readservice: ReadsService, - // @Inject(CERTIFICATE_SERVICE_TOKEN) - // private readonly certificateService: CertificateService, - @Inject(BASE_READ_SERVICE) - private baseReadsService: BaseReadsService, - private httpService: HttpService, - private readonly offChainCertificateService: OffChainCertificateService, - - ) { } - - // @Cron(CronExpression.EVERY_30_SECONDS) - // @Cron('0 00 21 * * *') // Every day at 23:30 - Server Time - // async handleCron(): Promise { - // this.logger.debug('Called every day at 23:30 Server time'); - - // const startDate = DateTime.now().minus({ days: 1 }).toUTC(); - // const endDate = DateTime.now().minus({ minute: 1 }).toUTC(); - - // this.logger.debug(`Start date ${startDate} - End date ${endDate}`); - - // const groups = await this.groupService.getAll(); - // await Promise.all( - // groups.map(async (group: DeviceGroup) => { - - - // group.devices = await this.deviceService.findForGroup(group.id); - // const organization = await this.organizationService.findOne( - // group.organizationId, - // ); - // group.organization = { - // name: organization.name, - // blockchainAccountAddress: organization.blockchainAccountAddress, - // }; - // return await this.issueCertificateForGroup(group, startDate, endDate); - // }), - // ); - // } - //@Cron('0 00 21 * * *') - - //@Cron(CronExpression.EVERY_30_SECONDS) - //@Cron('0 59 * * * *') - //@Cron('0 */10 * * * *') - // @Cron(CronExpression.EVERY_30_SECONDS) - hitTheCronFromIssuerAPIOngoing() { - this.logger.verbose(`With in hitTheCronFromIssuerAPIOngoing`); - // //console.log("hitting issuer api"); - this.httpService.get(`${process.env.REACT_APP_BACKEND_URL}/api/drec-issuer/ongoing`).subscribe(response => { - // //console.log("came here",response) - }); - } - - - //@Cron('0 59 * * * *') - //@Cron('0 */10 * * * *') - // @Cron(CronExpression.EVERY_30_SECONDS) - hitTheCronFromIssuerAPIHistory() { - this.logger.verbose(`With in hitTheCronFromIssuerAPIHistory`); - // //console.log("hitting issuer api"); - this.httpService.get(`${process.env.REACT_APP_BACKEND_URL}/api/drec-issuer/history`).subscribe(response => { - // //console.log("came here",response) - }); - } - - @Cron(CronExpression.EVERY_30_SECONDS) - async handleCron(): Promise { - this.logger.debug('Ongoing Cycle'); - this.logger.debug('Called every 10 minutes to check for isssuance of certificates'); - - const groupsrequestall = await this.groupService.getAllNextrequestCertificate(); - await Promise.all( - groupsrequestall.map(async (grouprequest: DeviceGroupNextIssueCertificate) => { - - const group = await this.groupService.findOne( - { id: grouprequest.groupId } - ); - - if (!group) { - this.logger.error("ongoing group is missing"); - return;//if group is missing - } - if (group.leftoverReadsByCountryCode === null || group.leftoverReadsByCountryCode === undefined || group.leftoverReadsByCountryCode === '') { - group.leftoverReadsByCountryCode = {}; - } - if (typeof group.leftoverReadsByCountryCode === 'string') { - group.leftoverReadsByCountryCode = JSON.parse(group.leftoverReadsByCountryCode); - } - - var countryDevicegroup = await this.deviceService.NewfindForGroup(group.id); - - const organization = await this.organizationService.findOne( - group.organizationId, - ); - group.organization = { - name: organization.name, - blockchainAccountAddress: organization.blockchainAccountAddress, - }; - - const startDate = DateTime.fromISO(grouprequest.start_date).toUTC(); - const endDate = DateTime.fromISO(grouprequest.end_date).toUTC(); - //console.log("151", startDate); - // console.log("152", endDate); - let start_date = endDate.toString(); - - let hours = 1; - const frequency = group.frequency.toLowerCase(); - if (frequency === BuyerReservationCertificateGenerationFrequency.daily) { - hours = 1 * 24; - } else if (frequency === BuyerReservationCertificateGenerationFrequency.monthly) { - hours = 30 * 24; - } else if (frequency === BuyerReservationCertificateGenerationFrequency.weekly) { - hours = 7 * 24; - } else if (frequency === BuyerReservationCertificateGenerationFrequency.quarterly) { - hours = 91 * 24; - } - let end_date = new Date((new Date(new Date(endDate.toString())).getTime() + (hours * 3.6e+6))).toISOString() - - let newEndDate: string = ''; - let skipUpdatingNextIssuanceLogTable: boolean = false; - if (new Date(endDate.toString()).getTime() === group.reservationEndDate.getTime()) { - skipUpdatingNextIssuanceLogTable = true; - // console.log("end time reached for buyer reservation", group); - let endDto = new EndReservationdateDTO(); - endDto.endresavationdate = new Date(group.reservationEndDate); - await this.groupService.EndReservationGroup(group.id, group.organizationId, endDto, group, grouprequest); - } - if (!skipUpdatingNextIssuanceLogTable) { - if (new Date(end_date).getTime() < group.reservationEndDate.getTime()) { - newEndDate = end_date; - } - else { - newEndDate = group.reservationEndDate.toISOString(); - } - let allDevicesOfGroup: Device[] = await this.deviceService.findForGroup(group.id); - - try { - //https://stackoverflow.com/a/10124053 - allDevicesOfGroup.sort(function (a, b) { - // Turn your strings into dates, and then subtract them - // to get a value that is either negative, positive, or zero. - //@ts-ignore - return new Date(b.createdAt) - new Date(a.createdAt); - }) - // console.log("192", allDevicesOfGroup); - let deviceOnBoardedWhichIsInBetweenNextIssuance: Device = allDevicesOfGroup.find(ele => { - //returns first find which is minimum and between next frequency - if (new Date(ele.createdAt).getTime() > new Date(start_date).getTime() && new Date(ele.createdAt).getTime() < new Date(newEndDate).getTime()) { - return true; - } - }) - if (deviceOnBoardedWhichIsInBetweenNextIssuance) { - newEndDate = new Date(deviceOnBoardedWhichIsInBetweenNextIssuance.createdAt).toISOString(); - } - } - catch (e) { - this.logger.error("exception caught in inbetween device onboarding checking for createdAt"); - this.logger.error(e); - } - await this.groupService.updatecertificateissuedate(grouprequest.id, start_date, newEndDate); - } - - this.logger.debug(`Start date ${startDate} - End date ${endDate}`); - this.logger.error("ongoing countryDevicegroup is missing"); - // if (Object.keys(countryDevicegroup).length === 0) { - const groupdevices = await this.deviceService.findForGroup(group.id); - - await Promise.all( - groupdevices.map(async (device: IDevice) => { - if (device.meterReadtype === null) { - await this.addlateongoing_devicecertificatecycle(group.id, device.externalId, startDate, endDate); - - } - })); - // } else { - for (let key in countryDevicegroup) { - //deep clone to avoid duplicates - let newGroup: DeviceGroup = JSON.parse(JSON.stringify(group)); - newGroup.devices = countryDevicegroup[key]; - //console.log("217", newGroup); - await this.newissueCertificateForGroup(newGroup, grouprequest, startDate, endDate, key); - } - // } - - /* if (endDate.diff(startDate, ['days']).days <= 1) { - for (let key in countryDevicegroup) { - //deep clone to avoid duplicates - let newGroup: DeviceGroup = JSON.parse(JSON.stringify(group)); - newGroup.devices = countryDevicegroup[key]; - // console.log("218line", startDate) - // console.log("20619line", endDate) - this.newissueCertificateForGroup(newGroup, grouprequest, startDate, endDate, key); - } - - } - else { - console.log("224line,monthlytestr") - let startDateCopy = DateTime.fromMillis(startDate.toMillis()); - let endDateCopy = DateTime.fromMillis(endDate.toMillis()); - const arrayofStartAndEndTimeDividedDifferenceBetweenAsOneDay: Array<{ startDate: DateTime, endDate: DateTime }> = []; - let currentDate = startDateCopy; - while (currentDate < endDateCopy) { - const nextDay = currentDate.plus({ days: 1 }); - const nextEndDate = (endDateCopy < nextDay) ? endDateCopy : nextDay; - arrayofStartAndEndTimeDividedDifferenceBetweenAsOneDay.push({ - startDate: currentDate, - endDate: nextEndDate - }); - currentDate = nextDay; - } - for (let key in countryDevicegroup) { - //deep clone to avoid duplicates - let newGroup: DeviceGroup = JSON.parse(JSON.stringify(group)); - newGroup.devices = countryDevicegroup[key]; - arrayofStartAndEndTimeDividedDifferenceBetweenAsOneDay.forEach((ele, index) => { - this.newissueCertificateForGroup(JSON.parse(JSON.stringify(newGroup)), JSON.parse(JSON.stringify(grouprequest)), ele.startDate, ele.endDate, key, index); - }) - } - }*/ - }), - ); - } - - - @Cron(CronExpression.EVERY_30_SECONDS) - async handleCronForHistoricalIssuance(): Promise { - this.logger.debug('History Cycle'); - this.logger.verbose(`With in handleCronForHistoricalIssuance`); - const historydevicerequestall = await this.groupService.getNextHistoryissuanceDevicelog(); - // console.log(historydevicerequestall); - await Promise.all( - historydevicerequestall.map(async (historydevice: HistoryDeviceGroupNextIssueCertificate, historydevicerequestindex: number) => { - - const group = await this.groupService.findOne( - { id: historydevice.groupId } - ); - if (!group) { - this.logger.error(`history group is missing`); - return;//if group is missing - } - const organization = await this.organizationService.findOne( - group.organizationId, - ); - group.organization = { - name: organization.name, - blockchainAccountAddress: organization.blockchainAccountAddress, - }; - const device = await this.deviceService.findReads( - historydevice.device_externalid - ); - const Histroryread = await this.readservice.getCheckHistoryCertificateIssueDateLogForDevice( - historydevice.device_externalid, - historydevice.reservationStartDate, - historydevice.reservationEndDate - ); - - if (Histroryread?.length > 0) { - await Promise.all( - Histroryread.map(async (historydeviceread: HistoryIntermediate_MeterRead) => { - this.newHistoryissueCertificateForDevice(group, historydeviceread, device); - }), - ); - let totalhistoryreadforsingledevices = 0; - Histroryread.forEach((historydeviceread: HistoryIntermediate_MeterRead) => { - if ( - !group.buyerAddress || - !group.buyerId - ) { - return; - } - // minimum value of certificate should be 1 Kw =1000W. - if (historydeviceread.readsvalue < 1000) { - return; - } - totalhistoryreadforsingledevices = totalhistoryreadforsingledevices + historydeviceread.readsvalue; - }); - let totalReadValueMegaWattHour = totalhistoryreadforsingledevices / 10 ** 6; - - if (totalReadValueMegaWattHour != 0) { - setTimeout(() => { - this.groupService.updateTotalReadingRequestedForCertificateIssuance(group.id, group.organizationId, totalReadValueMegaWattHour); - }, 1000 * (historydevicerequestindex + 1)); - - } - await this.groupService.HistoryUpdatecertificateissuedate(historydevice.id, HistoryNextInssuanceStatus.Completed); - if (group.reservationExpiryDate !== null) { - if (group.reservationExpiryDate.getTime() <= group.reservationEndDate.getTime() || group.reservationExpiryDate.getTime() <= new Date().getTime() - ) { - await this.deviceService.removeFromGroup(device.id, group.id); - } - } else { - if (group.reservationEndDate.getTime() <= new Date(device.createdAt).getTime()) { - await this.deviceService.removeFromGroup(device.id, group.id); - } - } - - } - await this.groupService.HistoryUpdatecertificateissuedate(historydevice.id, HistoryNextInssuanceStatus.Completed); - if (group.reservationExpiryDate !== null) { - if (group.reservationExpiryDate.getTime() <= group.reservationEndDate.getTime() || group.reservationExpiryDate.getTime() <= new Date().getTime() - ) { - await this.deviceService.removeFromGroup(device.id, group.id); - } - } else { - if (group.reservationEndDate.getTime() <= new Date(device.createdAt).getTime()) { - await this.deviceService.removeFromGroup(device.id, group.id); - } - } - - const count = await this.groupService.countgroupIdHistoryissuanceDevicelog(historydevice.groupId) - const checknextongoingissueance = await this.groupService.getGroupiCertificateIssueDate({ groupId: group.id }) - - if (count === 0 && !checknextongoingissueance) { - if (group.reservationExpiryDate !== null) { - if (group.reservationExpiryDate.getTime() <= group.reservationEndDate.getTime() || group.reservationExpiryDate.getTime() <= new Date().getTime() - ) { - await this.groupService.deactiveReaservation(group) - } - } - } - }), - ) - } - //old certificate generate process before 2022-may - // private async issueCertificateForGroup( - // group: DeviceGroup, - // startDate: DateTime, - // endDate: DateTime, - // ): Promise { - // this.logger.verbose(`With in issueCertificateForGroup`); - // const readsFilter: FilterDTO = { - // offset: 0, - // limit: 1000, - // start: startDate.toString(), - // end: endDate.toString(), - // }; - - // if (!group?.devices?.length) { - // return; - // } - // const org = await this.organizationService.findOne(group.organizationId); - // if (!org) { - // this.logger.error(`No organization found with code ${group.organizationId}`); - // throw new NotFoundException( - // `No organization found with code ${group.organizationId}`, - // ); - // } - // const groupReads: number[] = []; - // await Promise.all( - // group.devices.map(async (device: IDevice) => - // groupReads.push( - // await this.getDeviceFullReads(device.externalId, readsFilter), - // ), - // ), - // ); - // const totalReadValue = groupReads.reduce( - // (accumulator, currentValue) => accumulator + currentValue, - // 0, - // ); - - // if (!totalReadValue) { - // return; - // } - - // const totalReadValueKw = await this.handleLeftoverReads( - // group, - // totalReadValue, - // ); - - // if (!totalReadValueKw) { - // return; - // } - - // const issueTotalReadValue = totalReadValueKw * 10 ** 3; // Issue certificate in watts - - // const deviceGroup = { - // ...group, - // devices: [], - // }; - // const issuance: IIssueCommandParams = { - // deviceId: group.id?.toString(), // This is the device group id not a device id - // energyValue: issueTotalReadValue.toString(), - // fromTime: new Date(startDate.toString()), - // toTime: new Date(endDate.toString()), - // toAddress: org.blockchainAccountAddress, - // userId: org.blockchainAccountAddress, - // metadata: { - // version: "v1.0", - // buyerReservationId: group.devicegroup_uid, - // deviceIds: group.devices.map((device: IDevice) => device.id), - // //deviceGroup, - // groupId: group.id?.toString() || null, - // }, - // }; - // this.logger.log( - // `Issuance: ${JSON.stringify(issuance)}, Group name: ${group.name}`, - // ); - // //const issuedCertificate = await - // this.issueCertificate(issuance); - // //await this.transferCertificateToBuyer(group, issuedCertificate); - // return; - // } - - private async addlateongoing_devicecertificatecycle(groupId: number, device_externalid: string, late_start_date, late_end_date) { - - - let latedevicecertificatelogDto = new DeviceLateongoingIssueCertificateEntity(); - latedevicecertificatelogDto.device_externalid = device_externalid, - latedevicecertificatelogDto.groupId = groupId, - latedevicecertificatelogDto.late_start_date = late_start_date.toString(), - latedevicecertificatelogDto.late_end_date = late_end_date.toString() - // console.log("devicecertificatelogDto", devicecertificatelogDto); - return await this.deviceService.AddLateCertificateIssueDateLogForDevice(latedevicecertificatelogDto); - } - - private async newissueCertificateForGroup( - group: DeviceGroup, - grouprequest: DeviceGroupNextIssueCertificate, - startDate: DateTime, - endDate: DateTime, - countryCodeKey: string, - dateindex?: number - ): Promise { - console.log("newissueCertificateForGroup") - this.logger.verbose(`With in newissueCertificateForGroup`); - // console.log(`With in newissueCertificateForGroup`, group, grouprequest, startDate, endDate, countryCodeKey); - - if (!group?.devices?.length) { - this.logger.debug("Line No: 463"); - return; - } - const org = await this.organizationService.findOne(group.organizationId); - if (!org) { - this.logger.error(`No organization found with code ${group.organizationId}`); - throw new NotFoundException( - `No organization found with code ${group.organizationId}`, - ); - } - const groupReads: number[] = []; - let allDevicesCompleteReadsBetweenTimeRange: Array> = []; - let filteredDevicesIndexesListIfMeterReadsNotAvailable: Array = []; - /*Get all devices meter reads between time range */ - /*https://stackoverflow.com/questions/37576685/using-async-await-with-a-foreach-loop refer to answer why map and async works */ - await Promise.all( - group.devices.map(async (device: IDevice, index: number) => { - - /* - day: 24 hours entries if hourly data is sent , implies max entries 24 for one device - 30 days issuance : max entrries 30*24 = 720 - quarterly: issuance : max entrries 3 months: 31*3*24 = 2232 - so limit 5000 is kept to be on safer side - */ - - const readsFilter: FilterDTO = { - offset: 0, - limit: 5000, - start: startDate.toString(), - end: endDate.toString(), - }; - // console.log(readsFilter) - let allReadsForDeviceBetweenTimeRange: Array<{ timestamp: Date, value: number }> = await this.getDeviceFullReadsWithTimestampAndValueAsArray(device.externalId, readsFilter); - //console.log("482readdata", index, allReadsForDeviceBetweenTimeRange); - if (allReadsForDeviceBetweenTimeRange != undefined) { - if (device.meterReadtype === 'Delta' || allReadsForDeviceBetweenTimeRange.length > 0) { - const FirstDeltaRead = await this.readservice.getDeltaMeterReadsFirstEntryOfDevice(device.externalId) - allReadsForDeviceBetweenTimeRange = allReadsForDeviceBetweenTimeRange.filter(v => !( - FirstDeltaRead.some(e => e.readsEndDate.getTime() === v.timestamp.getTime()))) - } - - const certifieddevices = await this.deviceService.getCheckCertificateIssueDateLogForDevice(device.externalId, new Date(startDate.toString()), new Date(endDate.toString())); - // console.log("502certifieddevices", certifieddevices); - if (certifieddevices.length > 0 && allReadsForDeviceBetweenTimeRange.length > 0) { - - allReadsForDeviceBetweenTimeRange = allReadsForDeviceBetweenTimeRange.filter(ele => { - - let readingInBetween: boolean = false; - certifieddevices.forEach(certifieddevicesEle => { - if (ele.timestamp.getTime() >= new Date(certifieddevicesEle.certificate_issuance_startdate).getTime() && ele.timestamp.getTime() <= new Date(certifieddevicesEle.certificate_issuance_enddate).getTime()) { - readingInBetween = true; - } - }); - if (readingInBetween) { - return false; - } - else { - return true; - } - }); - } - // console.log("521afterallReadsForDeviceBetweenTimeRange", allReadsForDeviceBetweenTimeRange); - - allDevicesCompleteReadsBetweenTimeRange[index] = allReadsForDeviceBetweenTimeRange; - let devciereadvalue = allReadsForDeviceBetweenTimeRange.reduce( - (accumulator, currentValue) => accumulator + currentValue.value, - 0, - ); - if (devciereadvalue === 0) { - filteredDevicesIndexesListIfMeterReadsNotAvailable.push(index); - const Islateongoingcycle = await this.deviceService.finddeviceLateCycleOfdaterange(group.id, device.externalId, startDate, endDate); - - if (!Islateongoingcycle) { - await this.addlateongoing_devicecertificatecycle(group.id, device.externalId, startDate, endDate); - } - } - groupReads[index] = devciereadvalue; - } - }), - ); - - if (filteredDevicesIndexesListIfMeterReadsNotAvailable.length > 0) { - filteredDevicesIndexesListIfMeterReadsNotAvailable.forEach(index => { - - group.devices.splice(index, 1); - allDevicesCompleteReadsBetweenTimeRange.splice(index, 1); - groupReads.splice(index, 1); - }) - } - - if (group.devices.length === 0) { - //after filtering if devices are not there then do not continue further - return; - } - const totalReadValue = groupReads.reduce( - (accumulator, currentValue) => accumulator + currentValue, - 0, - ); - - if (!totalReadValue) { - return; - } - const totalReadValueKw = await this.handleLeftoverReadsByCountryCode( - group, - totalReadValue, - countryCodeKey - ); - // console.log("560Kw", totalReadValueKw); - if (!totalReadValueKw) { - return; - } - const issueTotalReadValue = totalReadValueKw * 10 ** 3; // Issue certificate in watts - // console.log("565", issueTotalReadValue); - // const deviceGroup = { - // ...group, - // devices: [], - // }; - if ( - !group.buyerAddress || - !group.buyerId - ) { - return; - } - let allPreviousReadingsOfDevices: Array<{ timestamp: Date, value: number }> = []; - let certificateTransactionUID = uuid(); - await Promise.all( - group.devices.map(async (device: IDevice, index) => { - // console.log("came inside previous readings check", allDevicesCompleteReadsBetweenTimeRange[index]); - let previousReading: Array<{ timestamp: Date, value: number }> = []; - if (allDevicesCompleteReadsBetweenTimeRange[index].length > 0) { - let endTimestampToCheck = new Date(allDevicesCompleteReadsBetweenTimeRange[index][0].timestamp.getTime() - 1000); - let startTimeToCheck = device.createdAt; - - try { - previousReading = await this.readservice.findLastReadForMeterWithinRange(device.externalId, new Date(startTimeToCheck), endTimestampToCheck); - - if (previousReading.length == 0) { - - if (device.meterReadtype === ReadType.Delta) { - previousReading = [{ timestamp: new Date(device.createdAt), value: 0 }]; - } - else if (device.meterReadtype === ReadType.ReadMeter) { - try { - let aggregateReadings = await this.readservice.getAggregateMeterReadsFirstEntryOfDevice(device.externalId); - if (aggregateReadings.length > 0) { - //console.log("aggregateReadings[0].datetime", aggregateReadings[0].datetime); - - previousReading = [{ timestamp: new Date(aggregateReadings[0].datetime), value: 0 }]; - } - //console.log("aggregateReadings", aggregateReadings); - } - catch (e) { - this.logger.error(`error in getting aggregate read ${e}`); - } - - } - //console.log("device previous reading", device.externalId, previousReading); - } - - //change this to when was initial reading came for aggregate or else if delta then its the createdAt - if (previousReading.length > 0) { - allPreviousReadingsOfDevices[index] = previousReading[0]; - } - } catch (e) { - this.logger.error(`error in getting aggregate read ${e}`); - } - - } - let devciereadvalue = allDevicesCompleteReadsBetweenTimeRange[index].reduce( - (accumulator, currentValue) => accumulator + currentValue.value, - 0, - ); - - let devicecertificatelogDto = new CheckCertificateIssueDateLogForDeviceEntity(); - devicecertificatelogDto.externalId = device.externalId, - devicecertificatelogDto.certificate_issuance_startdate = previousReading.length > 0 ? previousReading[0].timestamp : new Date(startDate.toString()), - devicecertificatelogDto.certificate_issuance_enddate = allDevicesCompleteReadsBetweenTimeRange[index][allDevicesCompleteReadsBetweenTimeRange[index].length - 1].timestamp,// new Date(endDate.toString()), - devicecertificatelogDto.status = SingleDeviceIssuanceStatus.Requested, - devicecertificatelogDto.readvalue_watthour = devciereadvalue; - devicecertificatelogDto.groupId = group.id, - devicecertificatelogDto.certificateTransactionUID = certificateTransactionUID.toString(); - devicecertificatelogDto.ongoing_start_date = grouprequest.start_date, - devicecertificatelogDto.ongoing_end_date = grouprequest.end_date - // console.log("devicecertificatelogDto", devicecertificatelogDto); - await this.deviceService.AddCertificateIssueDateLogForDevice(devicecertificatelogDto); - }), - ); - //find the minimum of all previous reading dates of devices and use it as start date - let minimumStartDate: Date = new Date('1970-04-01T12:51:51.112Z'); - let checkMinimumStartDate: Date = new Date('1970-04-01T12:51:51.112Z'); - if (allPreviousReadingsOfDevices.length == 1) { - minimumStartDate = allPreviousReadingsOfDevices[0].timestamp; - } - if (allPreviousReadingsOfDevices.length > 1) { - allPreviousReadingsOfDevices.sort(function (a, b) { - //@ts-ignore - return a.timestamp - b.timestamp; - }); - minimumStartDate = allPreviousReadingsOfDevices[0].timestamp; - } - let maximumEndDate: Date = new Date('1990-04-01T12:51:51.112Z'); - let checkMaximumEndDate: Date = new Date('1990-04-01T12:51:51.112Z'); - - if (allDevicesCompleteReadsBetweenTimeRange.length == 1) { - maximumEndDate = allDevicesCompleteReadsBetweenTimeRange[0][allDevicesCompleteReadsBetweenTimeRange[0].length - 1].timestamp; - } - else if (allDevicesCompleteReadsBetweenTimeRange.length > 1) { - allDevicesCompleteReadsBetweenTimeRange.forEach(ele => { - if (ele.length > 0)//if there are readings take last index reading as its the earliest date - { - if (ele[ele.length - 1].timestamp.getTime() > maximumEndDate.getTime()) { - maximumEndDate = ele[ele.length - 1].timestamp; - } - } - }) - } - - const issuance: IIssueCommandParams = { - deviceId: group.id?.toString(), // This is the device group id not a device id - energyValue: issueTotalReadValue.toString(), - fromTime: minimumStartDate,//new Date(startDate.toString()), - toTime: maximumEndDate,//new Date(endDate.toString()), - toAddress: group.buyerAddress, - userId: group.buyerAddress, - metadata: { - version: "v1.0", - buyerReservationId: group.devicegroup_uid, - isStandardIssuanceRequested: StandardCompliance.IREC, - type: CertificateType.REC, - deviceIds: group.devices.map((device: IDevice) => device.id), - //deviceGroup, - groupId: group.id?.toString() || null, - certificateTransactionUID: certificateTransactionUID.toString(), - }, - }; - this.logger.log( - `Issuance: ${JSON.stringify(issuance)}, Group name: ${group.name}`, - ); - let totalReadValueMegaWattHour = totalReadValueKw / 10 ** 3; - this.groupService.updateTotalReadingRequestedForCertificateIssuance(group.id, group.organizationId, totalReadValueMegaWattHour); - if (group.authorityToExceed === false && (group.targetVolumeCertificateGenerationRequestedInMegaWattHour + totalReadValueMegaWattHour) >= group.targetVolumeInMegaWattHour) { - this.groupService.endReservation(group.id, group, grouprequest); - } - let devicegroupcertificatelogDto = new CheckCertificateIssueDateLogForDeviceGroupEntity(); - devicegroupcertificatelogDto.groupid = group.id?.toString(), - devicegroupcertificatelogDto.certificate_issuance_startdate = minimumStartDate,//new Date(startDate.toString()), - devicegroupcertificatelogDto.certificate_issuance_enddate = maximumEndDate,//new Date(endDate.toString()), - devicegroupcertificatelogDto.status = SingleDeviceIssuanceStatus.Requested, - devicegroupcertificatelogDto.readvalue_watthour = issueTotalReadValue, - devicegroupcertificatelogDto.certificate_payload = issuance, - devicegroupcertificatelogDto.countryCode = countryCodeKey, - devicegroupcertificatelogDto.certificateTransactionUID = certificateTransactionUID.toString(); - await this.groupService.AddCertificateIssueDateLogForDeviceGroup(devicegroupcertificatelogDto); - //const issuedCertificate = await - // console.log("700", issuance); - this.issueCertificate(issuance); - ////console.log(issuedCertificate); - //console.log("generate Succesfull"); - return; - } - timerForHistoyIssuanceCounter: number = 0; - - private async newHistoryissueCertificateForDevice( - group: DeviceGroup, - devicehistoryrequest: HistoryIntermediate_MeterRead, - device: IDevice - ): Promise { - //console.log("HistoryIntermediate_MeterRead"); - //console.log(devicehistoryrequest); - if ( - !group.buyerAddress || - !group.buyerId - ) { - return; - } - // minimum value of certificate should be 1 Kw =1000W. - if (devicehistoryrequest.readsvalue < 1000) { - return; - } - let certificateTransactionUID = uuid(); - let devicecertificatelogDto = new CheckCertificateIssueDateLogForDeviceEntity(); - devicecertificatelogDto.externalId = device.externalId, - devicecertificatelogDto.certificate_issuance_startdate = new Date(devicehistoryrequest.readsStartDate.toString()), - devicecertificatelogDto.certificate_issuance_enddate = new Date(devicehistoryrequest.readsEndDate.toString()), - devicecertificatelogDto.status = SingleDeviceIssuanceStatus.Requested, - devicecertificatelogDto.readvalue_watthour = devicehistoryrequest.readsvalue; - devicecertificatelogDto.groupId = group.id; - devicecertificatelogDto.certificateTransactionUID = certificateTransactionUID.toString(); - await this.deviceService.AddCertificateIssueDateLogForDevice(devicecertificatelogDto); - const issuance: IIssueCommandParams = { - deviceId: group.id?.toString(), // This is the device group id not a device id - energyValue: devicehistoryrequest.readsvalue.toString(), - fromTime: new Date(devicehistoryrequest.readsStartDate.toString()), - toTime: new Date(devicehistoryrequest.readsEndDate.toString()), - toAddress: group.buyerAddress, - userId: group.buyerAddress, - - metadata: { - version: "v1.0", - buyerReservationId: group.devicegroup_uid, - isStandardIssuanceRequested: StandardCompliance.IREC, - type: CertificateType.REC, - deviceIds: [device.id], - //deviceGroup, - certificateTransactionUID: certificateTransactionUID.toString(), - groupId: group.id?.toString() || null, - }, - }; - this.logger.log( - `Issuance: ${JSON.stringify(issuance)}, Group name: ${group.name}`, - ); - // let totalReadValueMegaWattHour = devicehistoryrequest.readsvalue / 10 ** 6; - // //console.log("totalReadValueMegaWattHour"); - // //console.log(totalReadValueMegaWattHour); - // await this.groupService.updateTotalReadingRequestedForCertificateIssuance(group.id, group.organizationId, totalReadValueMegaWattHour); - - let devicegroupcertificatelogDto = new CheckCertificateIssueDateLogForDeviceGroupEntity(); - devicegroupcertificatelogDto.groupid = group.id?.toString(), - devicegroupcertificatelogDto.certificate_issuance_startdate = new Date(devicehistoryrequest.readsStartDate.toString()),//new Date(startDate.toString()), - devicegroupcertificatelogDto.certificate_issuance_enddate = new Date(devicehistoryrequest.readsEndDate.toString()),//new Date(endDate.toString()), - devicegroupcertificatelogDto.status = SingleDeviceIssuanceStatus.Requested, - devicegroupcertificatelogDto.readvalue_watthour = devicehistoryrequest.readsvalue, - devicegroupcertificatelogDto.certificate_payload = issuance, - devicegroupcertificatelogDto.countryCode = device.countryCode, - devicegroupcertificatelogDto.certificateTransactionUID = certificateTransactionUID.toString(); - await this.groupService.AddCertificateIssueDateLogForDeviceGroup(devicegroupcertificatelogDto); - //const issuedCertificate = await - this.issueCertificate(issuance); - - //console.log("generate Succesfull"); - await this.readservice.updatehistorycertificateissuedate(devicehistoryrequest.id, devicehistoryrequest.readsStartDate, devicehistoryrequest.readsEndDate); - return; - } - /* - private async transferCertificateToBuyer( - group: DeviceGroup, - certificate: IIssuedCertificate, - ) { - if ( - !certificate || - !group.buyerAddress || - !group.buyerId || - !group.organization?.blockchainAccountAddress - ) { - return; - } - this.logger.log(`Transfering a certificate`); - const transferCommand: ITransferCommand = { - certificateId: certificate.id, - fromAddress: group.organization.blockchainAccountAddress, - toAddress: group.buyerAddress, - energyValue: certificate.energy.publicVolume, - }; - await this.certificateService.transfer(transferCommand); - } - - */ - - - private async handleLeftoverReadsByCountryCode( - group: DeviceGroup, - totalReadValueW: number, - countryCodeKey: string - ): Promise { - // Logic - // 1. Get the accummulated read values from devices - // 2. Transform current value from watts to kw - // 3. Add any leftover value from group to the current total value - // 4. Separate all decimal values from the curent kw value and store it as leftover value to the device group - // 5. Return all the integer value from the current kw value (if any) and continue issuing the certificate - this.logger.verbose(`With in handleLeftoverReadsByCountryCode`); - const totalReadValueKw = group.leftoverReadsByCountryCode[countryCodeKey] - ? totalReadValueW / 10 ** 3 + group.leftoverReadsByCountryCode[countryCodeKey] - : totalReadValueW / 10 ** 3; - const { integralVal, decimalVal } = - this.separateIntegerAndDecimalByCountryCode(totalReadValueKw); - await this.groupService.updateLeftOverReadByCountryCode(group.id, decimalVal, countryCodeKey); - - return integralVal; - } - - private separateIntegerAndDecimalByCountryCode(num: number): { - integralVal: number; - decimalVal: number; - } { - this.logger.verbose(`With in separateIntegerAndDecimalByCountryCode`); - if (!num) { - return { integralVal: 0, decimalVal: 0 }; - } - const integralVal = Math.floor(num); - const decimalVal = this.roundDecimalNumberByCountryCode(num - integralVal); - return { integralVal, decimalVal }; - } - - private roundDecimalNumberByCountryCode(num: number): number { - this.logger.verbose(`With in roundDecimalNumberByCountryCode`); - if (num === 0) { - return num; - } - const precision = 2; - return Math.round(num * 10 ** precision) / 10 ** precision; - } - - private async handleLeftoverReads( - group: DeviceGroup, - totalReadValueW: number, - ): Promise { - this.logger.verbose(`With in handleLeftoverReads`); - // Logic - // 1. Get the accummulated read values from devices - // 2. Transform current value from watts to kw - // 3. Add any leftover value from group to the current total value - // 4. Separate all decimal values from the curent kw value and store it as leftover value to the device group - // 5. Return all the integer value from the current kw value (if any) and continue issuing the certificate - - const totalReadValueKw = group.leftoverReads - ? totalReadValueW / 10 ** 3 + group.leftoverReads - : totalReadValueW / 10 ** 3; - const { integralVal, decimalVal } = - this.separateIntegerAndDecimal(totalReadValueKw); - await this.groupService.updateLeftOverRead(group.id, decimalVal); - - return integralVal; - } - - private separateIntegerAndDecimal(num: number): { - integralVal: number; - decimalVal: number; - } { - this.logger.verbose(`With in separateIntegerAndDecimal`); - if (!num) { - return { integralVal: 0, decimalVal: 0 }; - } - const integralVal = Math.floor(num); - const decimalVal = this.roundDecimalNumber(num - integralVal); - return { integralVal, decimalVal }; - } - - private roundDecimalNumber(num: number): number { - this.logger.verbose(`With in roundDecimalNumber`); - if (num === 0) { - return num; - } - const precision = 2; - return Math.round(num * 10 ** precision) / 10 ** precision; - } - - private async getDeviceFullReadsWithTimestampAndValueAsArray( - meterId: string, - filter: FilterDTO, - ): Promise> { - this.logger.verbose(`With in getDeviceFullReadsWithTimestampAndValueAsArray`); - - try { - const allReads: Array<{ timestamp: Date, value: number }> = await this.baseReadsService.find(meterId, filter); - // console.log(`allReads externalId:${meterId}`, allReads); - return allReads; - } - catch (e) { - this.logger.error("exception caught in inbetween device onboarding checking for createdAt"); - this.logger.error(e); - - } - - } - - private async getDeviceFullReads( - meterId: string, - filter: FilterDTO, - ): Promise { - this.logger.verbose(`With in getDeviceFullReads`); - //console.log("381") - const allReads = await this.baseReadsService.find(meterId, filter); - //console.log(`allReads externalId:${meterId}`, allReads); - return allReads.reduce( - (accumulator, currentValue) => accumulator + currentValue.value, - 0, - ); - } - - // private async issueCertificate( - // reading: IIssueCommandParams, - // ): Promise> { - // this.logger.log(`Issuing a certificate for reading`); - // const issuedCertificate = await this.certificateService.issue(reading); - // this.logger.log(`Issued a certificate with ID ${issuedCertificate.id}`); - // return issuedCertificate; - // } - - //actual definition is up removing async - - issueCertificateFromAPI(reading: IIssueCommandParams) { - this.logger.verbose(`With in issueCertificateFromAPI`); - reading.fromTime = new Date(reading.fromTime); - reading.toTime = new Date(reading.toTime); - this.issueCertificate(reading); - - } - - private issueCertificate( - reading: IIssueCommandParams, - ) { - this.logger.log(`Issuing a certificate for reading`); - this.offChainCertificateService.issue(reading); - } - - - getCertificateData(deviceId?: string) { - let request: IGetAllCertificatesOptions = { - // generationEndFrom: new Date(1677671426*1000), - // generationEndTo: new Date(1677671426*1000), - // generationStartFrom :new Date(1646622684*1000), - // generationStartTo: new Date(1648159894*1000), - // creationTimeFrom: Date; - // creationTimeTo: Date; - deviceId: "51" - } - - this.offChainCertificateService.getAll(request).then(result => { - this.logger.debug("certificates"); - }); - } - - @Cron('0 */1 * * *') - async handleCronForOngoingLateIssuance(): Promise { - this.logger.debug('late ongoing issuance'); - this.logger.debug('Called every 4hr to check for isssuance of certificates'); - const devicegroups = await this.groupService.getallReservationactive(); - //this.logger.debug("groupsrequestall",groupsrequestall); - await Promise.all( - devicegroups.map(async (grouprequest: DeviceGroup) => { - const group = grouprequest; - if (!group) { - this.logger.error("late ongoing group is missing"); - return;//if group is missing - } - if (group.leftoverReadsByCountryCode === null || group.leftoverReadsByCountryCode === undefined || group.leftoverReadsByCountryCode === '') { - group.leftoverReadsByCountryCode = {}; - } - if (typeof group.leftoverReadsByCountryCode === 'string') { - group.leftoverReadsByCountryCode = JSON.parse(group.leftoverReadsByCountryCode); - } - var countryDevicegroup = await this.deviceService.NewfindForGroup(group.id); - const organization = await this.organizationService.findOne( - group.organizationId, - ); - group.organization = { - name: organization.name, - blockchainAccountAddress: organization.blockchainAccountAddress, - }; - const nextissuance = await this.groupService.getGroupiCertificateIssueDate({ groupId: group.id }) - this.logger.debug(nextissuance); - for (let key in countryDevicegroup) { - //deep clone to avoid duplicates - let newGroup: DeviceGroup = JSON.parse(JSON.stringify(group)); - - newGroup.devices = countryDevicegroup[key]; - await Promise.all( - newGroup.devices.map(async (element) => { - const lateongoing = await this.deviceService.findAllLateCycle(group.id, element.externalId,group.reservationEndDate) - - if (lateongoing) { - let newGroupwithsingledevice: DeviceGroup = JSON.parse(JSON.stringify(newGroup)); - newGroupwithsingledevice.devices = [element]; - - // if (lastcertifieddeviceend_date === undefined) { - - // if ((element.createdAt).getTime() <= (group.reservationStartDate).getTime()) { - // startDate = DateTime.fromISO(group.reservationStartDate.toISOString()).toUTC(); - // } - // else { - // startDate = DateTime.fromISO(new Date(element.createdAt).toISOString()).toUTC(); - // } - // } - // else { - // // const total_certified = - - // startDate = DateTime.fromISO(lastcertifieddeviceend_date.certificate_issuance_enddate.toISOString()).toUTC(); - // } - // if (new Date(lastread[0].timestamp).getTime() < new Date(nextissuance.start_date).getTime()) { - - // endDate = DateTime.fromISO(new Date(lastread[0].timestamp).toISOString()).toUTC(); - // } - - // if (new Date(lastread[0].timestamp).getTime() > new Date(nextissuance.start_date).getTime()) { - // endDate = DateTime.fromISO(new Date(nextissuance.start_date).toISOString()).toUTC(); - // } - await Promise.all( - lateongoing.map(async (element1) => { - - let startDate = DateTime.fromISO(element1.late_start_date).toUTC(); - let endDate = DateTime.fromISO(element1.late_end_date).toUTC(); - nextissuance.start_date = element1.late_start_date; - nextissuance.end_date = element1.late_end_date; - const certifieddevices = await this.deviceService.getCheckCertificateIssueDateLogForDevice(element1.device_externalid, new Date(startDate.toString()), new Date(endDate.toString())); - - if (certifieddevices.length === 0) { - await this.LateOngoingissueCertificateForGroup(newGroupwithsingledevice, nextissuance, startDate, endDate, key); - - } - - })) - } else { - this.logger.error("late ongoing read is missing"); - return; - } - - }) - ) - } - - }), - ); - } - private async LateOngoingissueCertificateForGroup( - group: DeviceGroup, - grouprequest: DeviceGroupNextIssueCertificate, - startDate: DateTime, - endDate: DateTime, - countryCodeKey: string, - dateindex?: number - ): Promise { - console.log("newissueCertificateForGroup") - this.logger.verbose(`With in newissueCertificateForGroup`); - if (!group?.devices?.length) { - this.logger.debug("Line No: 463"); - return; - } - const org = await this.organizationService.findOne(group.organizationId); - if (!org) { - this.logger.error(`No organization found with code ${group.organizationId}`); - throw new NotFoundException( - `No organization found with code ${group.organizationId}`, - ); - } - const readsFilter: FilterDTO = { - offset: 0, - limit: 5000, - start: startDate.toString(), - end: endDate.toString(), - }; - // console.log(readsFilter) - let allReadsForDeviceBetweenTimeRange: Array<{ timestamp: Date, value: number }> = await this.getDeviceFullReadsWithTimestampAndValueAsArray(group.devices[0].externalId, readsFilter); - //console.log("482readdata", index, allReadsForDeviceBetweenTimeRange); - let devciereadvalue: number; - if (allReadsForDeviceBetweenTimeRange != undefined) { - if (group?.devices[0].meterReadtype === 'Delta' || allReadsForDeviceBetweenTimeRange.length > 0) { - const FirstDeltaRead = await this.readservice.getDeltaMeterReadsFirstEntryOfDevice(group?.devices[0].externalId) - allReadsForDeviceBetweenTimeRange = allReadsForDeviceBetweenTimeRange.filter(v => !( - FirstDeltaRead.some(e => e.readsEndDate.getTime() === v.timestamp.getTime()))) - } - const certifieddevices = await this.deviceService.getCheckCertificateIssueDateLogForDevice(group.devices[0].externalId, new Date(startDate.toString()), new Date(endDate.toString())); - - if (certifieddevices.length > 0 && allReadsForDeviceBetweenTimeRange.length > 0) { - - allReadsForDeviceBetweenTimeRange = allReadsForDeviceBetweenTimeRange.filter(ele => { - - let readingInBetween: boolean = false; - certifieddevices.forEach(certifieddevicesEle => { - if (ele.timestamp.getTime() >= new Date(certifieddevicesEle.certificate_issuance_startdate).getTime() && ele.timestamp.getTime() <= new Date(certifieddevicesEle.certificate_issuance_enddate).getTime()) { - readingInBetween = true; - } - }); - if (readingInBetween) { - return false; - } - else { - return true; - } - }); - } - devciereadvalue = allReadsForDeviceBetweenTimeRange.reduce( - (accumulator, currentValue) => accumulator + currentValue.value, - 0, - ); - if (devciereadvalue === 0) { - return; - } - } - if ( - !group.buyerAddress || - !group.buyerId - ) { - return; - } - let certificateTransactionUID = uuid(); - - let previousReading: Array<{ timestamp: Date, value: number }> = []; - if (allReadsForDeviceBetweenTimeRange.length > 0) { - let endTimestampToCheck = new Date(allReadsForDeviceBetweenTimeRange[0].timestamp.getTime() - 1); - let startTimeToCheck = group.devices[0].createdAt; - - try { - previousReading = await this.readservice.findLastReadForMeterWithinRange(group.devices[0].externalId, new Date(startTimeToCheck), endTimestampToCheck); - - if (previousReading.length == 0) { - - if (group.devices[0].meterReadtype === ReadType.Delta) { - previousReading = [{ timestamp: new Date(group.devices[0].createdAt), value: 0 }]; - } - else if (group.devices[0].meterReadtype === ReadType.ReadMeter) { - try { - let aggregateReadings = await this.readservice.getAggregateMeterReadsFirstEntryOfDevice(group.devices[0].externalId); - if (aggregateReadings.length > 0) { - - previousReading = [{ timestamp: new Date(aggregateReadings[0].datetime), value: 0 }]; - } - - } - catch (e) { - this.logger.error(`error in getting aggregate read ${e}`); - } - - } - } - - } catch (e) { - this.logger.error(`error in getting aggregate read ${e}`); - } - - } - const totalReadValueKw = await this.handleLeftoverReadsByCountryCode( - group, - devciereadvalue, - countryCodeKey - ); - if (!totalReadValueKw) { - return; - } - const issueTotalReadValue = totalReadValueKw * 10 ** 3; // Issue certificate in watts - let devicecertificatelogDto = new CheckCertificateIssueDateLogForDeviceEntity(); - devicecertificatelogDto.externalId = group.devices[0].externalId, - devicecertificatelogDto.certificate_issuance_startdate = previousReading.length > 0 ? previousReading[0].timestamp : new Date(startDate.toString()), - devicecertificatelogDto.certificate_issuance_enddate = allReadsForDeviceBetweenTimeRange[allReadsForDeviceBetweenTimeRange.length - 1].timestamp,// new Date(endDate.toString()), - devicecertificatelogDto.status = SingleDeviceIssuanceStatus.Requested, - devicecertificatelogDto.readvalue_watthour = devciereadvalue; - devicecertificatelogDto.groupId = group.id, - devicecertificatelogDto.certificateTransactionUID = certificateTransactionUID.toString(); - devicecertificatelogDto.ongoing_start_date = grouprequest.start_date, - devicecertificatelogDto.ongoing_end_date = grouprequest.end_date - await this.deviceService.AddCertificateIssueDateLogForDevice(devicecertificatelogDto); - - let minimumStartDate: Date = new Date('1970-04-01T12:51:51.112Z'); - let checkMinimumStartDate: Date = new Date('1970-04-01T12:51:51.112Z'); - minimumStartDate = previousReading.length > 0 ? previousReading[0].timestamp : new Date(startDate.toString()); - let maximumEndDate: Date = new Date('1990-04-01T12:51:51.112Z'); - let checkMaximumEndDate: Date = new Date('1990-04-01T12:51:51.112Z'); - maximumEndDate = allReadsForDeviceBetweenTimeRange[allReadsForDeviceBetweenTimeRange.length - 1].timestamp; - - const issuance: IIssueCommandParams = { - deviceId: group.id?.toString(), // This is the device group id not a device id - energyValue: issueTotalReadValue.toString(), - fromTime: minimumStartDate,//new Date(startDate.toString()), - toTime: maximumEndDate,//new Date(endDate.toString()), - toAddress: group.buyerAddress, - userId: group.buyerAddress, - metadata: { - version: "v1.0", - buyerReservationId: group.devicegroup_uid, - isStandardIssuanceRequested: StandardCompliance.IREC, - type: CertificateType.REC, - deviceIds: group.devices.map((device: IDevice) => device.id), - //deviceGroup, - groupId: group.id?.toString() || null, - certificateTransactionUID: certificateTransactionUID.toString(), - }, - }; - let totalReadValueMegaWattHour = totalReadValueKw / 10 ** 3; - this.groupService.updateTotalReadingRequestedForCertificateIssuance(group.id, group.organizationId, totalReadValueMegaWattHour); - if (group.authorityToExceed === false && (group.targetVolumeCertificateGenerationRequestedInMegaWattHour + totalReadValueMegaWattHour) >= group.targetVolumeInMegaWattHour) { - this.groupService.endReservation(group.id, group, grouprequest); - } - let devicegroupcertificatelogDto = new CheckCertificateIssueDateLogForDeviceGroupEntity(); - devicegroupcertificatelogDto.groupid = group.id?.toString(), - devicegroupcertificatelogDto.certificate_issuance_startdate = minimumStartDate,//new Date(startDate.toString()), - devicegroupcertificatelogDto.certificate_issuance_enddate = maximumEndDate,//new Date(endDate.toString()), - devicegroupcertificatelogDto.status = SingleDeviceIssuanceStatus.Requested, - devicegroupcertificatelogDto.readvalue_watthour = issueTotalReadValue, - devicegroupcertificatelogDto.certificate_payload = issuance, - devicegroupcertificatelogDto.countryCode = countryCodeKey, - devicegroupcertificatelogDto.certificateTransactionUID = certificateTransactionUID.toString(); - await this.groupService.AddCertificateIssueDateLogForDeviceGroup(devicegroupcertificatelogDto); - //const issuedCertificate = await - // console.log("700", issuance); - this.issueCertificate(issuance); - ////console.log(issuedCertificate); - //console.log("generate Succesfull"); - return; - } - -} +import { Injectable, NotFoundException, Logger, Inject } from '@nestjs/common'; +import { Cron, CronExpression } from '@nestjs/schedule'; +// import { +// CertificateService, +// CERTIFICATE_SERVICE_TOKEN, +// IIssueCommandParams, +// IIssuedCertificate, +// ITransferCommand, +// } from '@energyweb/origin-247-certificate'; +import { + IGetAllCertificatesOptions, + IIssueCommandParams, +} from '@energyweb/origin-247-certificate'; +import { ICertificateMetadata } from '../../utils/types'; +import { DateTime } from 'luxon'; +import { + FilterDTO, + ReadsService as BaseReadsService, +} from '@energyweb/energy-api-influxdb'; +import { v4 as uuid } from 'uuid'; + +import { HttpService } from '@nestjs/axios'; + +import { DeviceService } from '../device/device.service'; +import { BASE_READ_SERVICE } from '../reads/const'; +import { OrganizationService } from '../organization/organization.service'; +import { DeviceGroupService } from '../device-group/device-group.service'; +import { + IDevice, + BuyerReservationCertificateGenerationFrequency, +} from '../../models'; +import { DeviceGroup } from '../device-group/device-group.entity'; +import { DeviceGroupNextIssueCertificate } from '../device-group/device_group_issuecertificate.entity'; +import { AnyARecord } from 'dns'; +import { EndReservationdateDTO } from '../device-group/dto'; +import { + CertificateType, + ReadType, + SingleDeviceIssuanceStatus, + StandardCompliance, +} from '../../utils/enums'; +import { CheckCertificateIssueDateLogForDeviceEntity } from '../device/check_certificate_issue_date_log_for_device.entity'; +import { CheckCertificateIssueDateLogForDeviceGroupEntity } from '../device-group/check_certificate_issue_date_log_for_device_group.entity'; +import { HistoryDeviceGroupNextIssueCertificate } from '../device-group/history_next_issuance_date_log.entity'; +import { ReadsService } from '../reads/reads.service'; +import { HistoryIntermediate_MeterRead } from '../reads/history_intermideate_meterread.entity'; +import { Device } from '../device'; +import { OffChainCertificateService } from '@energyweb/origin-247-certificate'; +import { HistoryNextInssuanceStatus } from '../../utils/enums/history_next_issuance.enum'; +import { DeviceLateongoingIssueCertificateEntity } from '../device/device_lateongoing_certificate.entity'; +@Injectable() +export class IssuerService { + private readonly logger = new Logger(IssuerService.name); + + constructor( + private groupService: DeviceGroupService, + private deviceService: DeviceService, + private organizationService: OrganizationService, + private readservice: ReadsService, + // @Inject(CERTIFICATE_SERVICE_TOKEN) + // private readonly certificateService: CertificateService, + @Inject(BASE_READ_SERVICE) + private baseReadsService: BaseReadsService, + private httpService: HttpService, + private readonly offChainCertificateService: OffChainCertificateService, + ) {} + + // @Cron(CronExpression.EVERY_30_SECONDS) + // @Cron('0 00 21 * * *') // Every day at 23:30 - Server Time + // async handleCron(): Promise { + // this.logger.debug('Called every day at 23:30 Server time'); + + // const startDate = DateTime.now().minus({ days: 1 }).toUTC(); + // const endDate = DateTime.now().minus({ minute: 1 }).toUTC(); + + // this.logger.debug(`Start date ${startDate} - End date ${endDate}`); + + // const groups = await this.groupService.getAll(); + // await Promise.all( + // groups.map(async (group: DeviceGroup) => { + + // group.devices = await this.deviceService.findForGroup(group.id); + // const organization = await this.organizationService.findOne( + // group.organizationId, + // ); + // group.organization = { + // name: organization.name, + // blockchainAccountAddress: organization.blockchainAccountAddress, + // }; + // return await this.issueCertificateForGroup(group, startDate, endDate); + // }), + // ); + // } + //@Cron('0 00 21 * * *') + + //@Cron(CronExpression.EVERY_30_SECONDS) + //@Cron('0 59 * * * *') + //@Cron('0 */10 * * * *') + // @Cron(CronExpression.EVERY_30_SECONDS) + hitTheCronFromIssuerAPIOngoing() { + this.logger.verbose(`With in hitTheCronFromIssuerAPIOngoing`); + // //console.log("hitting issuer api"); + this.httpService + .get(`${process.env.REACT_APP_BACKEND_URL}/api/drec-issuer/ongoing`) + .subscribe((response) => { + // //console.log("came here",response) + }); + } + + //@Cron('0 59 * * * *') + //@Cron('0 */10 * * * *') + // @Cron(CronExpression.EVERY_30_SECONDS) + hitTheCronFromIssuerAPIHistory() { + this.logger.verbose(`With in hitTheCronFromIssuerAPIHistory`); + // //console.log("hitting issuer api"); + this.httpService + .get(`${process.env.REACT_APP_BACKEND_URL}/api/drec-issuer/history`) + .subscribe((response) => { + // //console.log("came here",response) + }); + } + + @Cron(CronExpression.EVERY_30_SECONDS) + async handleCron(): Promise { + this.logger.debug('Ongoing Cycle'); + this.logger.debug( + 'Called every 10 minutes to check for isssuance of certificates', + ); + + const groupsrequestall = + await this.groupService.getAllNextrequestCertificate(); + await Promise.all( + groupsrequestall.map( + async (grouprequest: DeviceGroupNextIssueCertificate) => { + const group = await this.groupService.findOne({ + id: grouprequest.groupId, + }); + + if (!group) { + this.logger.error('ongoing group is missing'); + return; //if group is missing + } + if ( + group.leftoverReadsByCountryCode === null || + group.leftoverReadsByCountryCode === undefined || + group.leftoverReadsByCountryCode === '' + ) { + group.leftoverReadsByCountryCode = {}; + } + if (typeof group.leftoverReadsByCountryCode === 'string') { + group.leftoverReadsByCountryCode = JSON.parse( + group.leftoverReadsByCountryCode, + ); + } + + var countryDevicegroup = await this.deviceService.NewfindForGroup( + group.id, + ); + + const organization = await this.organizationService.findOne( + group.organizationId, + ); + group.organization = { + name: organization.name, + blockchainAccountAddress: organization.blockchainAccountAddress, + }; + + const startDate = DateTime.fromISO(grouprequest.start_date).toUTC(); + const endDate = DateTime.fromISO(grouprequest.end_date).toUTC(); + //console.log("151", startDate); + // console.log("152", endDate); + let start_date = endDate.toString(); + + let hours = 1; + const frequency = group.frequency.toLowerCase(); + if ( + frequency === BuyerReservationCertificateGenerationFrequency.daily + ) { + hours = 1 * 24; + } else if ( + frequency === BuyerReservationCertificateGenerationFrequency.monthly + ) { + hours = 30 * 24; + } else if ( + frequency === BuyerReservationCertificateGenerationFrequency.weekly + ) { + hours = 7 * 24; + } else if ( + frequency === + BuyerReservationCertificateGenerationFrequency.quarterly + ) { + hours = 91 * 24; + } + let end_date = new Date( + new Date(new Date(endDate.toString())).getTime() + hours * 3.6e6, + ).toISOString(); + + let newEndDate: string = ''; + let skipUpdatingNextIssuanceLogTable: boolean = false; + if ( + new Date(endDate.toString()).getTime() === + group.reservationEndDate.getTime() + ) { + skipUpdatingNextIssuanceLogTable = true; + // console.log("end time reached for buyer reservation", group); + let endDto = new EndReservationdateDTO(); + endDto.endresavationdate = new Date(group.reservationEndDate); + await this.groupService.EndReservationGroup( + group.id, + group.organizationId, + endDto, + group, + grouprequest, + ); + } + if (!skipUpdatingNextIssuanceLogTable) { + if ( + new Date(end_date).getTime() < group.reservationEndDate.getTime() + ) { + newEndDate = end_date; + } else { + newEndDate = group.reservationEndDate.toISOString(); + } + let allDevicesOfGroup: Device[] = + await this.deviceService.findForGroup(group.id); + + try { + //https://stackoverflow.com/a/10124053 + allDevicesOfGroup.sort(function (a, b) { + // Turn your strings into dates, and then subtract them + // to get a value that is either negative, positive, or zero. + //@ts-ignore + return new Date(b.createdAt) - new Date(a.createdAt); + }); + // console.log("192", allDevicesOfGroup); + let deviceOnBoardedWhichIsInBetweenNextIssuance: Device = + allDevicesOfGroup.find((ele) => { + //returns first find which is minimum and between next frequency + if ( + new Date(ele.createdAt).getTime() > + new Date(start_date).getTime() && + new Date(ele.createdAt).getTime() < + new Date(newEndDate).getTime() + ) { + return true; + } + }); + if (deviceOnBoardedWhichIsInBetweenNextIssuance) { + newEndDate = new Date( + deviceOnBoardedWhichIsInBetweenNextIssuance.createdAt, + ).toISOString(); + } + } catch (e) { + this.logger.error( + 'exception caught in inbetween device onboarding checking for createdAt', + ); + this.logger.error(e); + } + await this.groupService.updatecertificateissuedate( + grouprequest.id, + start_date, + newEndDate, + ); + } + + this.logger.debug(`Start date ${startDate} - End date ${endDate}`); + this.logger.error('ongoing countryDevicegroup is missing'); + // if (Object.keys(countryDevicegroup).length === 0) { + const groupdevices = await this.deviceService.findForGroup(group.id); + + await Promise.all( + groupdevices.map(async (device: IDevice) => { + if (device.meterReadtype === null) { + await this.addlateongoing_devicecertificatecycle( + group.id, + device.externalId, + startDate, + endDate, + ); + } + }), + ); + // } else { + for (let key in countryDevicegroup) { + //deep clone to avoid duplicates + let newGroup: DeviceGroup = JSON.parse(JSON.stringify(group)); + newGroup.devices = countryDevicegroup[key]; + //console.log("217", newGroup); + await this.newissueCertificateForGroup( + newGroup, + grouprequest, + startDate, + endDate, + key, + ); + } + // } + + /* if (endDate.diff(startDate, ['days']).days <= 1) { + for (let key in countryDevicegroup) { + //deep clone to avoid duplicates + let newGroup: DeviceGroup = JSON.parse(JSON.stringify(group)); + newGroup.devices = countryDevicegroup[key]; + // console.log("218line", startDate) + // console.log("20619line", endDate) + this.newissueCertificateForGroup(newGroup, grouprequest, startDate, endDate, key); + } + + } + else { + console.log("224line,monthlytestr") + let startDateCopy = DateTime.fromMillis(startDate.toMillis()); + let endDateCopy = DateTime.fromMillis(endDate.toMillis()); + const arrayofStartAndEndTimeDividedDifferenceBetweenAsOneDay: Array<{ startDate: DateTime, endDate: DateTime }> = []; + let currentDate = startDateCopy; + while (currentDate < endDateCopy) { + const nextDay = currentDate.plus({ days: 1 }); + const nextEndDate = (endDateCopy < nextDay) ? endDateCopy : nextDay; + arrayofStartAndEndTimeDividedDifferenceBetweenAsOneDay.push({ + startDate: currentDate, + endDate: nextEndDate + }); + currentDate = nextDay; + } + for (let key in countryDevicegroup) { + //deep clone to avoid duplicates + let newGroup: DeviceGroup = JSON.parse(JSON.stringify(group)); + newGroup.devices = countryDevicegroup[key]; + arrayofStartAndEndTimeDividedDifferenceBetweenAsOneDay.forEach((ele, index) => { + this.newissueCertificateForGroup(JSON.parse(JSON.stringify(newGroup)), JSON.parse(JSON.stringify(grouprequest)), ele.startDate, ele.endDate, key, index); + }) + } + }*/ + }, + ), + ); + } + + @Cron(CronExpression.EVERY_30_SECONDS) + async handleCronForHistoricalIssuance(): Promise { + this.logger.debug('History Cycle'); + this.logger.verbose(`With in handleCronForHistoricalIssuance`); + const historydevicerequestall = + await this.groupService.getNextHistoryissuanceDevicelog(); + // console.log(historydevicerequestall); + await Promise.all( + historydevicerequestall.map( + async ( + historydevice: HistoryDeviceGroupNextIssueCertificate, + historydevicerequestindex: number, + ) => { + const group = await this.groupService.findOne({ + id: historydevice.groupId, + }); + if (!group) { + this.logger.error(`history group is missing`); + return; //if group is missing + } + const organization = await this.organizationService.findOne( + group.organizationId, + ); + group.organization = { + name: organization.name, + blockchainAccountAddress: organization.blockchainAccountAddress, + }; + const device = await this.deviceService.findReads( + historydevice.device_externalid, + ); + const Histroryread = + await this.readservice.getCheckHistoryCertificateIssueDateLogForDevice( + historydevice.device_externalid, + historydevice.reservationStartDate, + historydevice.reservationEndDate, + ); + + if (Histroryread?.length > 0) { + await Promise.all( + Histroryread.map( + async (historydeviceread: HistoryIntermediate_MeterRead) => { + this.newHistoryissueCertificateForDevice( + group, + historydeviceread, + device, + ); + }, + ), + ); + let totalhistoryreadforsingledevices = 0; + Histroryread.forEach( + (historydeviceread: HistoryIntermediate_MeterRead) => { + if (!group.buyerAddress || !group.buyerId) { + return; + } + // minimum value of certificate should be 1 Kw =1000W. + if (historydeviceread.readsvalue < 1000) { + return; + } + totalhistoryreadforsingledevices = + totalhistoryreadforsingledevices + + historydeviceread.readsvalue; + }, + ); + let totalReadValueMegaWattHour = + totalhistoryreadforsingledevices / 10 ** 6; + + if (totalReadValueMegaWattHour != 0) { + setTimeout( + () => { + this.groupService.updateTotalReadingRequestedForCertificateIssuance( + group.id, + group.organizationId, + totalReadValueMegaWattHour, + ); + }, + 1000 * (historydevicerequestindex + 1), + ); + } + await this.groupService.HistoryUpdatecertificateissuedate( + historydevice.id, + HistoryNextInssuanceStatus.Completed, + ); + if (group.reservationExpiryDate !== null) { + if ( + group.reservationExpiryDate.getTime() <= + group.reservationEndDate.getTime() || + group.reservationExpiryDate.getTime() <= new Date().getTime() + ) { + await this.deviceService.removeFromGroup(device.id, group.id); + } + } else { + if ( + group.reservationEndDate.getTime() <= + new Date(device.createdAt).getTime() + ) { + await this.deviceService.removeFromGroup(device.id, group.id); + } + } + } + await this.groupService.HistoryUpdatecertificateissuedate( + historydevice.id, + HistoryNextInssuanceStatus.Completed, + ); + if (group.reservationExpiryDate !== null) { + if ( + group.reservationExpiryDate.getTime() <= + group.reservationEndDate.getTime() || + group.reservationExpiryDate.getTime() <= new Date().getTime() + ) { + await this.deviceService.removeFromGroup(device.id, group.id); + } + } else { + if ( + group.reservationEndDate.getTime() <= + new Date(device.createdAt).getTime() + ) { + await this.deviceService.removeFromGroup(device.id, group.id); + } + } + + const count = + await this.groupService.countgroupIdHistoryissuanceDevicelog( + historydevice.groupId, + ); + const checknextongoingissueance = + await this.groupService.getGroupiCertificateIssueDate({ + groupId: group.id, + }); + + if (count === 0 && !checknextongoingissueance) { + if (group.reservationExpiryDate !== null) { + if ( + group.reservationExpiryDate.getTime() <= + group.reservationEndDate.getTime() || + group.reservationExpiryDate.getTime() <= new Date().getTime() + ) { + await this.groupService.deactiveReaservation(group); + } + } + } + }, + ), + ); + } + //old certificate generate process before 2022-may + // private async issueCertificateForGroup( + // group: DeviceGroup, + // startDate: DateTime, + // endDate: DateTime, + // ): Promise { + // this.logger.verbose(`With in issueCertificateForGroup`); + // const readsFilter: FilterDTO = { + // offset: 0, + // limit: 1000, + // start: startDate.toString(), + // end: endDate.toString(), + // }; + + // if (!group?.devices?.length) { + // return; + // } + // const org = await this.organizationService.findOne(group.organizationId); + // if (!org) { + // this.logger.error(`No organization found with code ${group.organizationId}`); + // throw new NotFoundException( + // `No organization found with code ${group.organizationId}`, + // ); + // } + // const groupReads: number[] = []; + // await Promise.all( + // group.devices.map(async (device: IDevice) => + // groupReads.push( + // await this.getDeviceFullReads(device.externalId, readsFilter), + // ), + // ), + // ); + // const totalReadValue = groupReads.reduce( + // (accumulator, currentValue) => accumulator + currentValue, + // 0, + // ); + + // if (!totalReadValue) { + // return; + // } + + // const totalReadValueKw = await this.handleLeftoverReads( + // group, + // totalReadValue, + // ); + + // if (!totalReadValueKw) { + // return; + // } + + // const issueTotalReadValue = totalReadValueKw * 10 ** 3; // Issue certificate in watts + + // const deviceGroup = { + // ...group, + // devices: [], + // }; + // const issuance: IIssueCommandParams = { + // deviceId: group.id?.toString(), // This is the device group id not a device id + // energyValue: issueTotalReadValue.toString(), + // fromTime: new Date(startDate.toString()), + // toTime: new Date(endDate.toString()), + // toAddress: org.blockchainAccountAddress, + // userId: org.blockchainAccountAddress, + // metadata: { + // version: "v1.0", + // buyerReservationId: group.devicegroup_uid, + // deviceIds: group.devices.map((device: IDevice) => device.id), + // //deviceGroup, + // groupId: group.id?.toString() || null, + // }, + // }; + // this.logger.log( + // `Issuance: ${JSON.stringify(issuance)}, Group name: ${group.name}`, + // ); + // //const issuedCertificate = await + // this.issueCertificate(issuance); + // //await this.transferCertificateToBuyer(group, issuedCertificate); + // return; + // } + + private async addlateongoing_devicecertificatecycle( + groupId: number, + device_externalid: string, + late_start_date, + late_end_date, + ) { + let latedevicecertificatelogDto = + new DeviceLateongoingIssueCertificateEntity(); + (latedevicecertificatelogDto.device_externalid = device_externalid), + (latedevicecertificatelogDto.groupId = groupId), + (latedevicecertificatelogDto.late_start_date = + late_start_date.toString()), + (latedevicecertificatelogDto.late_end_date = late_end_date.toString()); + // console.log("devicecertificatelogDto", devicecertificatelogDto); + return await this.deviceService.AddLateCertificateIssueDateLogForDevice( + latedevicecertificatelogDto, + ); + } + + private async newissueCertificateForGroup( + group: DeviceGroup, + grouprequest: DeviceGroupNextIssueCertificate, + startDate: DateTime, + endDate: DateTime, + countryCodeKey: string, + dateindex?: number, + ): Promise { + console.log('newissueCertificateForGroup'); + this.logger.verbose(`With in newissueCertificateForGroup`); + // console.log(`With in newissueCertificateForGroup`, group, grouprequest, startDate, endDate, countryCodeKey); + + if (!group?.devices?.length) { + this.logger.debug('Line No: 463'); + return; + } + const org = await this.organizationService.findOne(group.organizationId); + if (!org) { + this.logger.error( + `No organization found with code ${group.organizationId}`, + ); + throw new NotFoundException( + `No organization found with code ${group.organizationId}`, + ); + } + const groupReads: number[] = []; + let allDevicesCompleteReadsBetweenTimeRange: Array< + Array<{ timestamp: Date; value: number }> + > = []; + let filteredDevicesIndexesListIfMeterReadsNotAvailable: Array = []; + /*Get all devices meter reads between time range */ + /*https://stackoverflow.com/questions/37576685/using-async-await-with-a-foreach-loop refer to answer why map and async works */ + await Promise.all( + group.devices.map(async (device: IDevice, index: number) => { + /* + day: 24 hours entries if hourly data is sent , implies max entries 24 for one device + 30 days issuance : max entrries 30*24 = 720 + quarterly: issuance : max entrries 3 months: 31*3*24 = 2232 + so limit 5000 is kept to be on safer side + */ + + const readsFilter: FilterDTO = { + offset: 0, + limit: 5000, + start: startDate.toString(), + end: endDate.toString(), + }; + // console.log(readsFilter) + let allReadsForDeviceBetweenTimeRange: Array<{ + timestamp: Date; + value: number; + }> = await this.getDeviceFullReadsWithTimestampAndValueAsArray( + device.externalId, + readsFilter, + ); + //console.log("482readdata", index, allReadsForDeviceBetweenTimeRange); + if (allReadsForDeviceBetweenTimeRange != undefined) { + if ( + device.meterReadtype === 'Delta' || + allReadsForDeviceBetweenTimeRange.length > 0 + ) { + const FirstDeltaRead = + await this.readservice.getDeltaMeterReadsFirstEntryOfDevice( + device.externalId, + ); + allReadsForDeviceBetweenTimeRange = + allReadsForDeviceBetweenTimeRange.filter( + (v) => + !FirstDeltaRead.some( + (e) => e.readsEndDate.getTime() === v.timestamp.getTime(), + ), + ); + } + + const certifieddevices = + await this.deviceService.getCheckCertificateIssueDateLogForDevice( + device.externalId, + new Date(startDate.toString()), + new Date(endDate.toString()), + ); + // console.log("502certifieddevices", certifieddevices); + if ( + certifieddevices.length > 0 && + allReadsForDeviceBetweenTimeRange.length > 0 + ) { + allReadsForDeviceBetweenTimeRange = + allReadsForDeviceBetweenTimeRange.filter((ele) => { + let readingInBetween: boolean = false; + certifieddevices.forEach((certifieddevicesEle) => { + if ( + ele.timestamp.getTime() >= + new Date( + certifieddevicesEle.certificate_issuance_startdate, + ).getTime() && + ele.timestamp.getTime() <= + new Date( + certifieddevicesEle.certificate_issuance_enddate, + ).getTime() + ) { + readingInBetween = true; + } + }); + if (readingInBetween) { + return false; + } else { + return true; + } + }); + } + // console.log("521afterallReadsForDeviceBetweenTimeRange", allReadsForDeviceBetweenTimeRange); + + allDevicesCompleteReadsBetweenTimeRange[index] = + allReadsForDeviceBetweenTimeRange; + let devciereadvalue = allReadsForDeviceBetweenTimeRange.reduce( + (accumulator, currentValue) => accumulator + currentValue.value, + 0, + ); + if (devciereadvalue === 0) { + filteredDevicesIndexesListIfMeterReadsNotAvailable.push(index); + const Islateongoingcycle = + await this.deviceService.finddeviceLateCycleOfdaterange( + group.id, + device.externalId, + startDate, + endDate, + ); + + if (!Islateongoingcycle) { + await this.addlateongoing_devicecertificatecycle( + group.id, + device.externalId, + startDate, + endDate, + ); + } + } + groupReads[index] = devciereadvalue; + } + }), + ); + + if (filteredDevicesIndexesListIfMeterReadsNotAvailable.length > 0) { + filteredDevicesIndexesListIfMeterReadsNotAvailable.forEach((index) => { + group.devices.splice(index, 1); + allDevicesCompleteReadsBetweenTimeRange.splice(index, 1); + groupReads.splice(index, 1); + }); + } + + if (group.devices.length === 0) { + //after filtering if devices are not there then do not continue further + return; + } + const totalReadValue = groupReads.reduce( + (accumulator, currentValue) => accumulator + currentValue, + 0, + ); + + if (!totalReadValue) { + return; + } + const totalReadValueKw = await this.handleLeftoverReadsByCountryCode( + group, + totalReadValue, + countryCodeKey, + ); + // console.log("560Kw", totalReadValueKw); + if (!totalReadValueKw) { + return; + } + const issueTotalReadValue = totalReadValueKw * 10 ** 3; // Issue certificate in watts + // console.log("565", issueTotalReadValue); + // const deviceGroup = { + // ...group, + // devices: [], + // }; + if (!group.buyerAddress || !group.buyerId) { + return; + } + let allPreviousReadingsOfDevices: Array<{ + timestamp: Date; + value: number; + }> = []; + let certificateTransactionUID = uuid(); + await Promise.all( + group.devices.map(async (device: IDevice, index) => { + // console.log("came inside previous readings check", allDevicesCompleteReadsBetweenTimeRange[index]); + let previousReading: Array<{ timestamp: Date; value: number }> = []; + if (allDevicesCompleteReadsBetweenTimeRange[index].length > 0) { + let endTimestampToCheck = new Date( + allDevicesCompleteReadsBetweenTimeRange[ + index + ][0].timestamp.getTime() - 1000, + ); + let startTimeToCheck = device.createdAt; + + try { + previousReading = + await this.readservice.findLastReadForMeterWithinRange( + device.externalId, + new Date(startTimeToCheck), + endTimestampToCheck, + ); + + if (previousReading.length == 0) { + if (device.meterReadtype === ReadType.Delta) { + previousReading = [ + { timestamp: new Date(device.createdAt), value: 0 }, + ]; + } else if (device.meterReadtype === ReadType.ReadMeter) { + try { + let aggregateReadings = + await this.readservice.getAggregateMeterReadsFirstEntryOfDevice( + device.externalId, + ); + if (aggregateReadings.length > 0) { + //console.log("aggregateReadings[0].datetime", aggregateReadings[0].datetime); + + previousReading = [ + { + timestamp: new Date(aggregateReadings[0].datetime), + value: 0, + }, + ]; + } + //console.log("aggregateReadings", aggregateReadings); + } catch (e) { + this.logger.error(`error in getting aggregate read ${e}`); + } + } + //console.log("device previous reading", device.externalId, previousReading); + } + + //change this to when was initial reading came for aggregate or else if delta then its the createdAt + if (previousReading.length > 0) { + allPreviousReadingsOfDevices[index] = previousReading[0]; + } + } catch (e) { + this.logger.error(`error in getting aggregate read ${e}`); + } + } + let devciereadvalue = allDevicesCompleteReadsBetweenTimeRange[ + index + ].reduce( + (accumulator, currentValue) => accumulator + currentValue.value, + 0, + ); + + let devicecertificatelogDto = + new CheckCertificateIssueDateLogForDeviceEntity(); + (devicecertificatelogDto.externalId = device.externalId), + (devicecertificatelogDto.certificate_issuance_startdate = + previousReading.length > 0 + ? previousReading[0].timestamp + : new Date(startDate.toString())), + (devicecertificatelogDto.certificate_issuance_enddate = + allDevicesCompleteReadsBetweenTimeRange[index][ + allDevicesCompleteReadsBetweenTimeRange[index].length - 1 + ].timestamp), // new Date(endDate.toString()), + (devicecertificatelogDto.status = + SingleDeviceIssuanceStatus.Requested), + (devicecertificatelogDto.readvalue_watthour = devciereadvalue); + (devicecertificatelogDto.groupId = group.id), + (devicecertificatelogDto.certificateTransactionUID = + certificateTransactionUID.toString()); + (devicecertificatelogDto.ongoing_start_date = grouprequest.start_date), + (devicecertificatelogDto.ongoing_end_date = grouprequest.end_date); + // console.log("devicecertificatelogDto", devicecertificatelogDto); + await this.deviceService.AddCertificateIssueDateLogForDevice( + devicecertificatelogDto, + ); + }), + ); + //find the minimum of all previous reading dates of devices and use it as start date + let minimumStartDate: Date = new Date('1970-04-01T12:51:51.112Z'); + let checkMinimumStartDate: Date = new Date('1970-04-01T12:51:51.112Z'); + if (allPreviousReadingsOfDevices.length == 1) { + minimumStartDate = allPreviousReadingsOfDevices[0].timestamp; + } + if (allPreviousReadingsOfDevices.length > 1) { + allPreviousReadingsOfDevices.sort(function (a, b) { + //@ts-ignore + return a.timestamp - b.timestamp; + }); + minimumStartDate = allPreviousReadingsOfDevices[0].timestamp; + } + let maximumEndDate: Date = new Date('1990-04-01T12:51:51.112Z'); + let checkMaximumEndDate: Date = new Date('1990-04-01T12:51:51.112Z'); + + if (allDevicesCompleteReadsBetweenTimeRange.length == 1) { + maximumEndDate = + allDevicesCompleteReadsBetweenTimeRange[0][ + allDevicesCompleteReadsBetweenTimeRange[0].length - 1 + ].timestamp; + } else if (allDevicesCompleteReadsBetweenTimeRange.length > 1) { + allDevicesCompleteReadsBetweenTimeRange.forEach((ele) => { + if (ele.length > 0) { + //if there are readings take last index reading as its the earliest date + if ( + ele[ele.length - 1].timestamp.getTime() > maximumEndDate.getTime() + ) { + maximumEndDate = ele[ele.length - 1].timestamp; + } + } + }); + } + + const issuance: IIssueCommandParams = { + deviceId: group.id?.toString(), // This is the device group id not a device id + energyValue: issueTotalReadValue.toString(), + fromTime: minimumStartDate, //new Date(startDate.toString()), + toTime: maximumEndDate, //new Date(endDate.toString()), + toAddress: group.buyerAddress, + userId: group.buyerAddress, + metadata: { + version: 'v1.0', + buyerReservationId: group.devicegroup_uid, + isStandardIssuanceRequested: StandardCompliance.IREC, + type: CertificateType.REC, + deviceIds: group.devices.map((device: IDevice) => device.id), + //deviceGroup, + groupId: group.id?.toString() || null, + certificateTransactionUID: certificateTransactionUID.toString(), + }, + }; + this.logger.log( + `Issuance: ${JSON.stringify(issuance)}, Group name: ${group.name}`, + ); + let totalReadValueMegaWattHour = totalReadValueKw / 10 ** 3; + this.groupService.updateTotalReadingRequestedForCertificateIssuance( + group.id, + group.organizationId, + totalReadValueMegaWattHour, + ); + if ( + group.authorityToExceed === false && + group.targetVolumeCertificateGenerationRequestedInMegaWattHour + + totalReadValueMegaWattHour >= + group.targetVolumeInMegaWattHour + ) { + this.groupService.endReservation(group.id, group, grouprequest); + } + let devicegroupcertificatelogDto = + new CheckCertificateIssueDateLogForDeviceGroupEntity(); + (devicegroupcertificatelogDto.groupid = group.id?.toString()), + (devicegroupcertificatelogDto.certificate_issuance_startdate = + minimumStartDate), //new Date(startDate.toString()), + (devicegroupcertificatelogDto.certificate_issuance_enddate = + maximumEndDate), //new Date(endDate.toString()), + (devicegroupcertificatelogDto.status = + SingleDeviceIssuanceStatus.Requested), + (devicegroupcertificatelogDto.readvalue_watthour = issueTotalReadValue), + (devicegroupcertificatelogDto.certificate_payload = issuance), + (devicegroupcertificatelogDto.countryCode = countryCodeKey), + (devicegroupcertificatelogDto.certificateTransactionUID = + certificateTransactionUID.toString()); + await this.groupService.AddCertificateIssueDateLogForDeviceGroup( + devicegroupcertificatelogDto, + ); + //const issuedCertificate = await + // console.log("700", issuance); + this.issueCertificate(issuance); + ////console.log(issuedCertificate); + //console.log("generate Succesfull"); + return; + } + timerForHistoyIssuanceCounter: number = 0; + + private async newHistoryissueCertificateForDevice( + group: DeviceGroup, + devicehistoryrequest: HistoryIntermediate_MeterRead, + device: IDevice, + ): Promise { + //console.log("HistoryIntermediate_MeterRead"); + //console.log(devicehistoryrequest); + if (!group.buyerAddress || !group.buyerId) { + return; + } + // minimum value of certificate should be 1 Kw =1000W. + if (devicehistoryrequest.readsvalue < 1000) { + return; + } + let certificateTransactionUID = uuid(); + let devicecertificatelogDto = + new CheckCertificateIssueDateLogForDeviceEntity(); + (devicecertificatelogDto.externalId = device.externalId), + (devicecertificatelogDto.certificate_issuance_startdate = new Date( + devicehistoryrequest.readsStartDate.toString(), + )), + (devicecertificatelogDto.certificate_issuance_enddate = new Date( + devicehistoryrequest.readsEndDate.toString(), + )), + (devicecertificatelogDto.status = SingleDeviceIssuanceStatus.Requested), + (devicecertificatelogDto.readvalue_watthour = + devicehistoryrequest.readsvalue); + devicecertificatelogDto.groupId = group.id; + devicecertificatelogDto.certificateTransactionUID = + certificateTransactionUID.toString(); + await this.deviceService.AddCertificateIssueDateLogForDevice( + devicecertificatelogDto, + ); + const issuance: IIssueCommandParams = { + deviceId: group.id?.toString(), // This is the device group id not a device id + energyValue: devicehistoryrequest.readsvalue.toString(), + fromTime: new Date(devicehistoryrequest.readsStartDate.toString()), + toTime: new Date(devicehistoryrequest.readsEndDate.toString()), + toAddress: group.buyerAddress, + userId: group.buyerAddress, + + metadata: { + version: 'v1.0', + buyerReservationId: group.devicegroup_uid, + isStandardIssuanceRequested: StandardCompliance.IREC, + type: CertificateType.REC, + deviceIds: [device.id], + //deviceGroup, + certificateTransactionUID: certificateTransactionUID.toString(), + groupId: group.id?.toString() || null, + }, + }; + this.logger.log( + `Issuance: ${JSON.stringify(issuance)}, Group name: ${group.name}`, + ); + // let totalReadValueMegaWattHour = devicehistoryrequest.readsvalue / 10 ** 6; + // //console.log("totalReadValueMegaWattHour"); + // //console.log(totalReadValueMegaWattHour); + // await this.groupService.updateTotalReadingRequestedForCertificateIssuance(group.id, group.organizationId, totalReadValueMegaWattHour); + + let devicegroupcertificatelogDto = + new CheckCertificateIssueDateLogForDeviceGroupEntity(); + (devicegroupcertificatelogDto.groupid = group.id?.toString()), + (devicegroupcertificatelogDto.certificate_issuance_startdate = new Date( + devicehistoryrequest.readsStartDate.toString(), + )), //new Date(startDate.toString()), + (devicegroupcertificatelogDto.certificate_issuance_enddate = new Date( + devicehistoryrequest.readsEndDate.toString(), + )), //new Date(endDate.toString()), + (devicegroupcertificatelogDto.status = + SingleDeviceIssuanceStatus.Requested), + (devicegroupcertificatelogDto.readvalue_watthour = + devicehistoryrequest.readsvalue), + (devicegroupcertificatelogDto.certificate_payload = issuance), + (devicegroupcertificatelogDto.countryCode = device.countryCode), + (devicegroupcertificatelogDto.certificateTransactionUID = + certificateTransactionUID.toString()); + await this.groupService.AddCertificateIssueDateLogForDeviceGroup( + devicegroupcertificatelogDto, + ); + //const issuedCertificate = await + this.issueCertificate(issuance); + + //console.log("generate Succesfull"); + await this.readservice.updatehistorycertificateissuedate( + devicehistoryrequest.id, + devicehistoryrequest.readsStartDate, + devicehistoryrequest.readsEndDate, + ); + return; + } + /* + private async transferCertificateToBuyer( + group: DeviceGroup, + certificate: IIssuedCertificate, + ) { + if ( + !certificate || + !group.buyerAddress || + !group.buyerId || + !group.organization?.blockchainAccountAddress + ) { + return; + } + this.logger.log(`Transfering a certificate`); + const transferCommand: ITransferCommand = { + certificateId: certificate.id, + fromAddress: group.organization.blockchainAccountAddress, + toAddress: group.buyerAddress, + energyValue: certificate.energy.publicVolume, + }; + await this.certificateService.transfer(transferCommand); + } + + */ + + private async handleLeftoverReadsByCountryCode( + group: DeviceGroup, + totalReadValueW: number, + countryCodeKey: string, + ): Promise { + // Logic + // 1. Get the accummulated read values from devices + // 2. Transform current value from watts to kw + // 3. Add any leftover value from group to the current total value + // 4. Separate all decimal values from the curent kw value and store it as leftover value to the device group + // 5. Return all the integer value from the current kw value (if any) and continue issuing the certificate + this.logger.verbose(`With in handleLeftoverReadsByCountryCode`); + const totalReadValueKw = group.leftoverReadsByCountryCode[countryCodeKey] + ? totalReadValueW / 10 ** 3 + + group.leftoverReadsByCountryCode[countryCodeKey] + : totalReadValueW / 10 ** 3; + const { integralVal, decimalVal } = + this.separateIntegerAndDecimalByCountryCode(totalReadValueKw); + await this.groupService.updateLeftOverReadByCountryCode( + group.id, + decimalVal, + countryCodeKey, + ); + + return integralVal; + } + + private separateIntegerAndDecimalByCountryCode(num: number): { + integralVal: number; + decimalVal: number; + } { + this.logger.verbose(`With in separateIntegerAndDecimalByCountryCode`); + if (!num) { + return { integralVal: 0, decimalVal: 0 }; + } + const integralVal = Math.floor(num); + const decimalVal = this.roundDecimalNumberByCountryCode(num - integralVal); + return { integralVal, decimalVal }; + } + + private roundDecimalNumberByCountryCode(num: number): number { + this.logger.verbose(`With in roundDecimalNumberByCountryCode`); + if (num === 0) { + return num; + } + const precision = 2; + return Math.round(num * 10 ** precision) / 10 ** precision; + } + + private async handleLeftoverReads( + group: DeviceGroup, + totalReadValueW: number, + ): Promise { + this.logger.verbose(`With in handleLeftoverReads`); + // Logic + // 1. Get the accummulated read values from devices + // 2. Transform current value from watts to kw + // 3. Add any leftover value from group to the current total value + // 4. Separate all decimal values from the curent kw value and store it as leftover value to the device group + // 5. Return all the integer value from the current kw value (if any) and continue issuing the certificate + + const totalReadValueKw = group.leftoverReads + ? totalReadValueW / 10 ** 3 + group.leftoverReads + : totalReadValueW / 10 ** 3; + const { integralVal, decimalVal } = + this.separateIntegerAndDecimal(totalReadValueKw); + await this.groupService.updateLeftOverRead(group.id, decimalVal); + + return integralVal; + } + + private separateIntegerAndDecimal(num: number): { + integralVal: number; + decimalVal: number; + } { + this.logger.verbose(`With in separateIntegerAndDecimal`); + if (!num) { + return { integralVal: 0, decimalVal: 0 }; + } + const integralVal = Math.floor(num); + const decimalVal = this.roundDecimalNumber(num - integralVal); + return { integralVal, decimalVal }; + } + + private roundDecimalNumber(num: number): number { + this.logger.verbose(`With in roundDecimalNumber`); + if (num === 0) { + return num; + } + const precision = 2; + return Math.round(num * 10 ** precision) / 10 ** precision; + } + + private async getDeviceFullReadsWithTimestampAndValueAsArray( + meterId: string, + filter: FilterDTO, + ): Promise> { + this.logger.verbose( + `With in getDeviceFullReadsWithTimestampAndValueAsArray`, + ); + + try { + const allReads: Array<{ timestamp: Date; value: number }> = + await this.baseReadsService.find(meterId, filter); + // console.log(`allReads externalId:${meterId}`, allReads); + return allReads; + } catch (e) { + this.logger.error( + 'exception caught in inbetween device onboarding checking for createdAt', + ); + this.logger.error(e); + } + } + + private async getDeviceFullReads( + meterId: string, + filter: FilterDTO, + ): Promise { + this.logger.verbose(`With in getDeviceFullReads`); + //console.log("381") + const allReads = await this.baseReadsService.find(meterId, filter); + //console.log(`allReads externalId:${meterId}`, allReads); + return allReads.reduce( + (accumulator, currentValue) => accumulator + currentValue.value, + 0, + ); + } + + // private async issueCertificate( + // reading: IIssueCommandParams, + // ): Promise> { + // this.logger.log(`Issuing a certificate for reading`); + // const issuedCertificate = await this.certificateService.issue(reading); + // this.logger.log(`Issued a certificate with ID ${issuedCertificate.id}`); + // return issuedCertificate; + // } + + //actual definition is up removing async + + issueCertificateFromAPI(reading: IIssueCommandParams) { + this.logger.verbose(`With in issueCertificateFromAPI`); + reading.fromTime = new Date(reading.fromTime); + reading.toTime = new Date(reading.toTime); + this.issueCertificate(reading); + } + + private issueCertificate(reading: IIssueCommandParams) { + this.logger.log(`Issuing a certificate for reading`); + this.offChainCertificateService.issue(reading); + } + + getCertificateData(deviceId?: string) { + let request: IGetAllCertificatesOptions = { + // generationEndFrom: new Date(1677671426*1000), + // generationEndTo: new Date(1677671426*1000), + // generationStartFrom :new Date(1646622684*1000), + // generationStartTo: new Date(1648159894*1000), + // creationTimeFrom: Date; + // creationTimeTo: Date; + deviceId: '51', + }; + + this.offChainCertificateService.getAll(request).then((result) => { + this.logger.debug('certificates'); + }); + } + + @Cron('0 */1 * * *') + async handleCronForOngoingLateIssuance(): Promise { + this.logger.debug('late ongoing issuance'); + this.logger.debug( + 'Called every 4hr to check for isssuance of certificates', + ); + const devicegroups = await this.groupService.getallReservationactive(); + //this.logger.debug("groupsrequestall",groupsrequestall); + await Promise.all( + devicegroups.map(async (grouprequest: DeviceGroup) => { + const group = grouprequest; + if (!group) { + this.logger.error('late ongoing group is missing'); + return; //if group is missing + } + if ( + group.leftoverReadsByCountryCode === null || + group.leftoverReadsByCountryCode === undefined || + group.leftoverReadsByCountryCode === '' + ) { + group.leftoverReadsByCountryCode = {}; + } + if (typeof group.leftoverReadsByCountryCode === 'string') { + group.leftoverReadsByCountryCode = JSON.parse( + group.leftoverReadsByCountryCode, + ); + } + var countryDevicegroup = await this.deviceService.NewfindForGroup( + group.id, + ); + const organization = await this.organizationService.findOne( + group.organizationId, + ); + group.organization = { + name: organization.name, + blockchainAccountAddress: organization.blockchainAccountAddress, + }; + const nextissuance = + await this.groupService.getGroupiCertificateIssueDate({ + groupId: group.id, + }); + this.logger.debug(nextissuance); + for (let key in countryDevicegroup) { + //deep clone to avoid duplicates + let newGroup: DeviceGroup = JSON.parse(JSON.stringify(group)); + + newGroup.devices = countryDevicegroup[key]; + await Promise.all( + newGroup.devices.map(async (element) => { + const lateongoing = await this.deviceService.findAllLateCycle( + group.id, + element.externalId, + group.reservationEndDate, + ); + + if (lateongoing) { + let newGroupwithsingledevice: DeviceGroup = JSON.parse( + JSON.stringify(newGroup), + ); + newGroupwithsingledevice.devices = [element]; + + // if (lastcertifieddeviceend_date === undefined) { + + // if ((element.createdAt).getTime() <= (group.reservationStartDate).getTime()) { + // startDate = DateTime.fromISO(group.reservationStartDate.toISOString()).toUTC(); + // } + // else { + // startDate = DateTime.fromISO(new Date(element.createdAt).toISOString()).toUTC(); + // } + // } + // else { + // // const total_certified = + + // startDate = DateTime.fromISO(lastcertifieddeviceend_date.certificate_issuance_enddate.toISOString()).toUTC(); + // } + // if (new Date(lastread[0].timestamp).getTime() < new Date(nextissuance.start_date).getTime()) { + + // endDate = DateTime.fromISO(new Date(lastread[0].timestamp).toISOString()).toUTC(); + // } + + // if (new Date(lastread[0].timestamp).getTime() > new Date(nextissuance.start_date).getTime()) { + // endDate = DateTime.fromISO(new Date(nextissuance.start_date).toISOString()).toUTC(); + // } + await Promise.all( + lateongoing.map(async (element1) => { + let startDate = DateTime.fromISO( + element1.late_start_date, + ).toUTC(); + let endDate = DateTime.fromISO( + element1.late_end_date, + ).toUTC(); + nextissuance.start_date = element1.late_start_date; + nextissuance.end_date = element1.late_end_date; + const certifieddevices = + await this.deviceService.getCheckCertificateIssueDateLogForDevice( + element1.device_externalid, + new Date(startDate.toString()), + new Date(endDate.toString()), + ); + + if (certifieddevices.length === 0) { + await this.LateOngoingissueCertificateForGroup( + newGroupwithsingledevice, + nextissuance, + startDate, + endDate, + key, + ); + } + }), + ); + } else { + this.logger.error('late ongoing read is missing'); + return; + } + }), + ); + } + }), + ); + } + private async LateOngoingissueCertificateForGroup( + group: DeviceGroup, + grouprequest: DeviceGroupNextIssueCertificate, + startDate: DateTime, + endDate: DateTime, + countryCodeKey: string, + dateindex?: number, + ): Promise { + console.log('newissueCertificateForGroup'); + this.logger.verbose(`With in newissueCertificateForGroup`); + if (!group?.devices?.length) { + this.logger.debug('Line No: 463'); + return; + } + const org = await this.organizationService.findOne(group.organizationId); + if (!org) { + this.logger.error( + `No organization found with code ${group.organizationId}`, + ); + throw new NotFoundException( + `No organization found with code ${group.organizationId}`, + ); + } + const readsFilter: FilterDTO = { + offset: 0, + limit: 5000, + start: startDate.toString(), + end: endDate.toString(), + }; + // console.log(readsFilter) + let allReadsForDeviceBetweenTimeRange: Array<{ + timestamp: Date; + value: number; + }> = await this.getDeviceFullReadsWithTimestampAndValueAsArray( + group.devices[0].externalId, + readsFilter, + ); + //console.log("482readdata", index, allReadsForDeviceBetweenTimeRange); + let devciereadvalue: number; + if (allReadsForDeviceBetweenTimeRange != undefined) { + if ( + group?.devices[0].meterReadtype === 'Delta' || + allReadsForDeviceBetweenTimeRange.length > 0 + ) { + const FirstDeltaRead = + await this.readservice.getDeltaMeterReadsFirstEntryOfDevice( + group?.devices[0].externalId, + ); + allReadsForDeviceBetweenTimeRange = + allReadsForDeviceBetweenTimeRange.filter( + (v) => + !FirstDeltaRead.some( + (e) => e.readsEndDate.getTime() === v.timestamp.getTime(), + ), + ); + } + const certifieddevices = + await this.deviceService.getCheckCertificateIssueDateLogForDevice( + group.devices[0].externalId, + new Date(startDate.toString()), + new Date(endDate.toString()), + ); + + if ( + certifieddevices.length > 0 && + allReadsForDeviceBetweenTimeRange.length > 0 + ) { + allReadsForDeviceBetweenTimeRange = + allReadsForDeviceBetweenTimeRange.filter((ele) => { + let readingInBetween: boolean = false; + certifieddevices.forEach((certifieddevicesEle) => { + if ( + ele.timestamp.getTime() >= + new Date( + certifieddevicesEle.certificate_issuance_startdate, + ).getTime() && + ele.timestamp.getTime() <= + new Date( + certifieddevicesEle.certificate_issuance_enddate, + ).getTime() + ) { + readingInBetween = true; + } + }); + if (readingInBetween) { + return false; + } else { + return true; + } + }); + } + devciereadvalue = allReadsForDeviceBetweenTimeRange.reduce( + (accumulator, currentValue) => accumulator + currentValue.value, + 0, + ); + if (devciereadvalue === 0) { + return; + } + } + if (!group.buyerAddress || !group.buyerId) { + return; + } + let certificateTransactionUID = uuid(); + + let previousReading: Array<{ timestamp: Date; value: number }> = []; + if (allReadsForDeviceBetweenTimeRange.length > 0) { + let endTimestampToCheck = new Date( + allReadsForDeviceBetweenTimeRange[0].timestamp.getTime() - 1, + ); + let startTimeToCheck = group.devices[0].createdAt; + + try { + previousReading = + await this.readservice.findLastReadForMeterWithinRange( + group.devices[0].externalId, + new Date(startTimeToCheck), + endTimestampToCheck, + ); + + if (previousReading.length == 0) { + if (group.devices[0].meterReadtype === ReadType.Delta) { + previousReading = [ + { timestamp: new Date(group.devices[0].createdAt), value: 0 }, + ]; + } else if (group.devices[0].meterReadtype === ReadType.ReadMeter) { + try { + let aggregateReadings = + await this.readservice.getAggregateMeterReadsFirstEntryOfDevice( + group.devices[0].externalId, + ); + if (aggregateReadings.length > 0) { + previousReading = [ + { + timestamp: new Date(aggregateReadings[0].datetime), + value: 0, + }, + ]; + } + } catch (e) { + this.logger.error(`error in getting aggregate read ${e}`); + } + } + } + } catch (e) { + this.logger.error(`error in getting aggregate read ${e}`); + } + } + const totalReadValueKw = await this.handleLeftoverReadsByCountryCode( + group, + devciereadvalue, + countryCodeKey, + ); + if (!totalReadValueKw) { + return; + } + const issueTotalReadValue = totalReadValueKw * 10 ** 3; // Issue certificate in watts + let devicecertificatelogDto = + new CheckCertificateIssueDateLogForDeviceEntity(); + (devicecertificatelogDto.externalId = group.devices[0].externalId), + (devicecertificatelogDto.certificate_issuance_startdate = + previousReading.length > 0 + ? previousReading[0].timestamp + : new Date(startDate.toString())), + (devicecertificatelogDto.certificate_issuance_enddate = + allReadsForDeviceBetweenTimeRange[ + allReadsForDeviceBetweenTimeRange.length - 1 + ].timestamp), // new Date(endDate.toString()), + (devicecertificatelogDto.status = SingleDeviceIssuanceStatus.Requested), + (devicecertificatelogDto.readvalue_watthour = devciereadvalue); + (devicecertificatelogDto.groupId = group.id), + (devicecertificatelogDto.certificateTransactionUID = + certificateTransactionUID.toString()); + (devicecertificatelogDto.ongoing_start_date = grouprequest.start_date), + (devicecertificatelogDto.ongoing_end_date = grouprequest.end_date); + await this.deviceService.AddCertificateIssueDateLogForDevice( + devicecertificatelogDto, + ); + + let minimumStartDate: Date = new Date('1970-04-01T12:51:51.112Z'); + let checkMinimumStartDate: Date = new Date('1970-04-01T12:51:51.112Z'); + minimumStartDate = + previousReading.length > 0 + ? previousReading[0].timestamp + : new Date(startDate.toString()); + let maximumEndDate: Date = new Date('1990-04-01T12:51:51.112Z'); + let checkMaximumEndDate: Date = new Date('1990-04-01T12:51:51.112Z'); + maximumEndDate = + allReadsForDeviceBetweenTimeRange[ + allReadsForDeviceBetweenTimeRange.length - 1 + ].timestamp; + + const issuance: IIssueCommandParams = { + deviceId: group.id?.toString(), // This is the device group id not a device id + energyValue: issueTotalReadValue.toString(), + fromTime: minimumStartDate, //new Date(startDate.toString()), + toTime: maximumEndDate, //new Date(endDate.toString()), + toAddress: group.buyerAddress, + userId: group.buyerAddress, + metadata: { + version: 'v1.0', + buyerReservationId: group.devicegroup_uid, + isStandardIssuanceRequested: StandardCompliance.IREC, + type: CertificateType.REC, + deviceIds: group.devices.map((device: IDevice) => device.id), + //deviceGroup, + groupId: group.id?.toString() || null, + certificateTransactionUID: certificateTransactionUID.toString(), + }, + }; + let totalReadValueMegaWattHour = totalReadValueKw / 10 ** 3; + this.groupService.updateTotalReadingRequestedForCertificateIssuance( + group.id, + group.organizationId, + totalReadValueMegaWattHour, + ); + if ( + group.authorityToExceed === false && + group.targetVolumeCertificateGenerationRequestedInMegaWattHour + + totalReadValueMegaWattHour >= + group.targetVolumeInMegaWattHour + ) { + this.groupService.endReservation(group.id, group, grouprequest); + } + let devicegroupcertificatelogDto = + new CheckCertificateIssueDateLogForDeviceGroupEntity(); + (devicegroupcertificatelogDto.groupid = group.id?.toString()), + (devicegroupcertificatelogDto.certificate_issuance_startdate = + minimumStartDate), //new Date(startDate.toString()), + (devicegroupcertificatelogDto.certificate_issuance_enddate = + maximumEndDate), //new Date(endDate.toString()), + (devicegroupcertificatelogDto.status = + SingleDeviceIssuanceStatus.Requested), + (devicegroupcertificatelogDto.readvalue_watthour = issueTotalReadValue), + (devicegroupcertificatelogDto.certificate_payload = issuance), + (devicegroupcertificatelogDto.countryCode = countryCodeKey), + (devicegroupcertificatelogDto.certificateTransactionUID = + certificateTransactionUID.toString()); + await this.groupService.AddCertificateIssueDateLogForDeviceGroup( + devicegroupcertificatelogDto, + ); + //const issuedCertificate = await + // console.log("700", issuance); + this.issueCertificate(issuance); + ////console.log(issuedCertificate); + //console.log("generate Succesfull"); + return; + } +} diff --git a/apps/drec-api/src/pods/issuer/synchronize-blockchain-task.service.ts b/apps/drec-api/src/pods/issuer/synchronize-blockchain-task.service.ts index c205ffb97..a92d5f84c 100755 --- a/apps/drec-api/src/pods/issuer/synchronize-blockchain-task.service.ts +++ b/apps/drec-api/src/pods/issuer/synchronize-blockchain-task.service.ts @@ -1,18 +1,14 @@ import { Injectable, Logger } from '@nestjs/common'; import { Cron, CronExpression } from '@nestjs/schedule'; import { BlockchainSynchronizeService } from '@energyweb/origin-247-certificate'; -​ @Injectable() export class SynchronizeBlockchainTaskService { - private logger = new Logger(SynchronizeBlockchainTaskService.name); -​ - constructor(private synchronizationService: BlockchainSynchronizeService) {} -​ - @Cron(CronExpression.EVERY_MINUTE) - public async synchronizeblockchain() { - this.logger.log(`Synchronizing blockchain started`); -​ - await this.synchronizationService.synchronize(); - this.logger.log(`Synchronizing blockchain Ended`); - } + private logger = new Logger(SynchronizeBlockchainTaskService.name); + constructor(private synchronizationService: BlockchainSynchronizeService) {} + @Cron(CronExpression.EVERY_MINUTE) + public async synchronizeblockchain() { + this.logger.log(`Synchronizing blockchain started`); + await this.synchronizationService.synchronize(); + this.logger.log(`Synchronizing blockchain Ended`); + } } diff --git a/apps/drec-api/src/pods/organization/dto/new-organization.dto.ts b/apps/drec-api/src/pods/organization/dto/new-organization.dto.ts index f0c4cface..361c1d5cd 100755 --- a/apps/drec-api/src/pods/organization/dto/new-organization.dto.ts +++ b/apps/drec-api/src/pods/organization/dto/new-organization.dto.ts @@ -4,10 +4,16 @@ import { IsEmail, IsOptional, IsArray, - Matches, MaxLength,IsNotEmpty + Matches, + MaxLength, + IsNotEmpty, } from 'class-validator'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; -import { IFullOrganization,IPublicOrganization,IPublicAddOrganization } from '../../../models'; +import { + IFullOrganization, + IPublicOrganization, + IPublicAddOrganization, +} from '../../../models'; export class NewOrganizationDTO implements @@ -92,17 +98,14 @@ export class NewOrganizationDTO signatoryDocumentIds?: string[]; } - - export class NewAddOrganizationDTO - implements - Omit + implements Omit { @ApiProperty({ type: String }) @IsString() @IsNotEmpty() name: string; - + // @ApiProperty({ type: String }) // @MaxLength(6) // @Matches(/((?=.*[0-9])(?=.*[A-Z]).{6,})/, { @@ -117,10 +120,9 @@ export class NewAddOrganizationDTO @IsString() @IsNotEmpty() organizationType: string; - + @ApiProperty({ type: String }) @IsString() @IsNotEmpty() orgEmail: string; - -} \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/organization/dto/organization.dto.ts b/apps/drec-api/src/pods/organization/dto/organization.dto.ts index 1c048bb62..c022bf45e 100755 --- a/apps/drec-api/src/pods/organization/dto/organization.dto.ts +++ b/apps/drec-api/src/pods/organization/dto/organization.dto.ts @@ -4,7 +4,7 @@ import { IsEmail, IsArray, IsOptional, - IsNotEmpty + IsNotEmpty, } from 'class-validator'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IFullOrganization } from '../../../models'; diff --git a/apps/drec-api/src/pods/organization/dto/public-organization-info.dto.ts b/apps/drec-api/src/pods/organization/dto/public-organization-info.dto.ts index 632fb3d0c..05bb9a388 100755 --- a/apps/drec-api/src/pods/organization/dto/public-organization-info.dto.ts +++ b/apps/drec-api/src/pods/organization/dto/public-organization-info.dto.ts @@ -6,7 +6,8 @@ import { IsISO31661Alpha2, IsString, Min, - IsNotEmpty, IsOptional + IsNotEmpty, + IsOptional, } from 'class-validator'; import { IPublicOrganization } from '../../../models'; import { OrganizationStatus } from '../../../utils/enums'; @@ -23,7 +24,7 @@ export class PublicOrganizationInfoDTO implements IPublicOrganization { @IsString() @IsOptional() name: string; - + // @ApiProperty({ type: String }) // @IsString() // @IsOptional() diff --git a/apps/drec-api/src/pods/organization/organization.controller.ts b/apps/drec-api/src/pods/organization/organization.controller.ts index 3e857f741..a291312a4 100644 --- a/apps/drec-api/src/pods/organization/organization.controller.ts +++ b/apps/drec-api/src/pods/organization/organization.controller.ts @@ -26,7 +26,7 @@ import { ApiNotFoundResponse, ApiTags, ApiBody, - ApiQuery + ApiQuery, } from '@nestjs/swagger'; import { AuthGuard } from '@nestjs/passport'; @@ -36,8 +36,8 @@ import { BindBlockchainAccountDTO, } from './dto'; import { OrganizationService } from './organization.service'; -import {UserService} from '../user/user.service' -import {InvitationService} from '../invitation/invitation.service' +import { UserService } from '../user/user.service'; +import { InvitationService } from '../invitation/invitation.service'; import { UserDTO } from '../user/dto/user.dto'; import { UserDecorator } from '../user/decorators/user.decorator'; import { Role } from '../../utils/enums/role.enum'; @@ -54,8 +54,7 @@ import { InvitationDTO } from '../invitation/dto/invitation.dto'; import { UpdateMemberDTO } from './dto/organization-update-member.dto'; import { Permission } from '../permission/decorators/permission.decorator'; import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator'; -import { OrganizationFilterDTO } from '../admin/dto/organization-filter.dto' - +import { OrganizationFilterDTO } from '../admin/dto/organization-filter.dto'; @ApiTags('organization') @ApiBearerAuth('access-token') @@ -64,17 +63,18 @@ import { OrganizationFilterDTO } from '../admin/dto/organization-filter.dto' @UseGuards(AuthGuard('jwt'), PermissionGuard) @UseInterceptors(NullOrUndefinedResultInterceptor) export class OrganizationController { - private readonly logger = new Logger(OrganizationController.name); - constructor(private readonly organizationService: OrganizationService, - private userService:UserService, - private invitationservice:InvitationService) { } + constructor( + private readonly organizationService: OrganizationService, + private userService: UserService, + private invitationservice: InvitationService, + ) {} /** - * - * @param param0 - * @returns + * + * @param param0 + * @returns */ @Get('/me') @Permission('Read') @@ -87,16 +87,16 @@ export class OrganizationController { async getMyOrganization( @UserDecorator() { organizationId }: ILoggedInUser, ): Promise { - this.logger.verbose("With in getOrg at org controller"); + this.logger.verbose('With in getOrg at org controller'); return await this.organizationService.findOne(organizationId); } /** - * This Api route to get all organization of apiuser - * @param param0 - * @returns - */ + * This Api route to get all organization of apiuser + * @param param0 + * @returns + */ @Get('/apiuser/all_organization') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) @Roles(Role.ApiUser) @Permission('Read') @ACLModules('ORGANIZATION_MANAGEMENT_CRUDL') @@ -109,22 +109,28 @@ export class OrganizationController { async getAllOrganizations( @UserDecorator() loggedUser: ILoggedInUser, @Query(ValidationPipe) filterDto: OrganizationFilterDTO, - @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) pageNumber: number, + @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) + pageNumber: number, @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit: number, - )/*: Promise*/ { + ) /*: Promise*/ { this.logger.verbose(`With in getAllOrganizations`); - return await this.organizationService.getAll(filterDto, pageNumber, limit, loggedUser); + return await this.organizationService.getAll( + filterDto, + pageNumber, + limit, + loggedUser, + ); } /** - * - * @param param0 - * @param pageNumber - * @param limit - * @returns + * + * @param param0 + * @param pageNumber + * @param limit + * @returns */ @Get('/users') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) @Permission('Read') @ACLModules('ORGANIZATION_MANAGEMENT_CRUDL') @ApiQuery({ name: 'pageNumber', type: Number, required: false }) @@ -139,30 +145,38 @@ export class OrganizationController { }) async getOrganizationUsers( @UserDecorator() loggedUser: ILoggedInUser, - @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) pageNumber: number, + @Query('pageNumber', new DefaultValuePipe(1), ParseIntPipe) + pageNumber: number, @Query('limit', new DefaultValuePipe(0), ParseIntPipe) limit: number, - )/*: Promise*/ { + ) /*: Promise*/ { this.logger.verbose(`With in getOrganizationUsers`); if (loggedUser.role === Role.ApiUser) { - return this.organizationService.findApiuserOrganizationUsers(loggedUser.api_user_id, pageNumber, limit); - + return this.organizationService.findApiuserOrganizationUsers( + loggedUser.api_user_id, + pageNumber, + limit, + ); } else { - return this.organizationService.findOrganizationUsers(loggedUser.organizationId, pageNumber, limit, loggedUser.role); + return this.organizationService.findOrganizationUsers( + loggedUser.organizationId, + pageNumber, + limit, + loggedUser.role, + ); } - } /** - * It is GET api to fetch an organization renord. - * @param {orhanizationId} is type of number which is the identifier of an organization - * @return { OrganizationDTO | undefined } OrganizationDto is for success response - * and undefined when there is no particular record not available. - */ + * It is GET api to fetch an organization renord. + * @param {orhanizationId} is type of number which is the identifier of an organization + * @return { OrganizationDTO | undefined } OrganizationDto is for success response + * and undefined when there is no particular record not available. + */ @Get('/:id') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) // @Roles(Role.Admin) @Permission('Read') - @ACLModules("ORGANIZATION_MANAGEMENT_CRUDL") + @ACLModules('ORGANIZATION_MANAGEMENT_CRUDL') @ApiResponse({ status: HttpStatus.OK, type: OrganizationDTO, @@ -178,10 +192,10 @@ export class OrganizationController { return this.organizationService.findOne(organizationId); } /** - * - * @param organizationId - * @param loggedUser - * @returns + * + * @param organizationId + * @param loggedUser + * @returns */ @Get('/:id/invitations') @UseGuards(AuthGuard('jwt'), RolesGuard) @@ -207,8 +221,8 @@ export class OrganizationController { } /** * This api route use for add organization afte user login (but now it directly added at register time) - * @param organizationToRegister - * @param loggedUser + * @param organizationToRegister + * @param loggedUser * @returns {OrganizationDTO} */ @Post() @@ -227,7 +241,9 @@ export class OrganizationController { ): Promise { this.logger.verbose(`With in register`); if (loggedUser.organizationId) { - this.logger.error(`There is already an organization assigned to this account`); + this.logger.error( + `There is already an organization assigned to this account`, + ); throw new BadRequestException({ success: false, message: `There is already an organization assigned to this account`, @@ -239,11 +255,11 @@ export class OrganizationController { ); } /** - * This Api route use for change the user role + * This Api route use for change the user role * @param organizationId ;number "in api param is id" * @param memberId :number "in api param is userId" - * @body {role} - * @param loggedUser + * @body {role} + * @param loggedUser * @returns {SuccessResponseDTO} */ @Put(':id/change-role/:userId') @@ -284,8 +300,8 @@ export class OrganizationController { /** * This api route for Set blockchain address and singh for organization(for now we using static default value) - * @param param0 - * @param param1 + * @param param0 + * @param param1 * @returns {BindBlockchainAccountDTO} */ @Post('chain-address') @@ -331,7 +347,11 @@ export class OrganizationController { } } @Delete('/user/:id') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), ActiveUserGuard, PermissionGuard) + @UseGuards( + AuthGuard(['jwt', 'oauth2-client-password']), + ActiveUserGuard, + PermissionGuard, + ) @Permission('Delete') @ACLModules('ORGANIZATION_MANAGEMENT_CRUDL') @ApiResponse({ @@ -345,21 +365,23 @@ export class OrganizationController { ): Promise { const user = await this.userService.findById(userid); //@ts-ignore - if((loggedUser.role===Role.ApiUser&&(loggedUser.api_user_id!=user.api_user_id))){ + if ( + loggedUser.role === Role.ApiUser && + loggedUser.api_user_id != user.api_user_id + ) { throw new NotFoundException('User does not exist in this organization'); - }else{ + } else { if (!user && user.organization.id != loggedUser.organizationId) { throw new NotFoundException('User does not exist in this organization'); } } - + //const manyotheruserinorg = await this.userService.getatleastoneotheruserinOrg(user.organization.id, user.id) - if ((user.role === loggedUser.role && user.status === 'Active')) { + if (user.role === loggedUser.role && user.status === 'Active') { throw new NotFoundException('Unauthorized'); - } - else { - await this.invitationservice.remove(user.email, user.organization.id) + } else { + await this.invitationservice.remove(user.email, user.organization.id); await this.userService.remove(user.id); } return ResponseSuccess(); diff --git a/apps/drec-api/src/pods/organization/organization.entity.ts b/apps/drec-api/src/pods/organization/organization.entity.ts index 8a908c30d..6d2e82926 100755 --- a/apps/drec-api/src/pods/organization/organization.entity.ts +++ b/apps/drec-api/src/pods/organization/organization.entity.ts @@ -25,7 +25,7 @@ export class Organization @Column() @IsString() name: string; - + // @ApiProperty({ type: String }) // @Column() // @IsString() @@ -135,7 +135,6 @@ export class Organization @IsArray() documentIds: string[]; - @Column() api_user_id: string; } diff --git a/apps/drec-api/src/pods/organization/organization.module.ts b/apps/drec-api/src/pods/organization/organization.module.ts index 598a8bac3..375bddab3 100644 --- a/apps/drec-api/src/pods/organization/organization.module.ts +++ b/apps/drec-api/src/pods/organization/organization.module.ts @@ -8,17 +8,17 @@ import { BlockchainPropertiesModule } from '@energyweb/issuer-api'; import { UserModule } from '../user/user.module'; import { MailModule } from '../../mail'; import { FileModule } from '../file'; -import {InvitationModule} from '../invitation/invitation.module'; +import { InvitationModule } from '../invitation/invitation.module'; @Module({ imports: [ TypeOrmModule.forFeature([Organization]), - + BlockchainPropertiesModule, MailModule, forwardRef(() => UserModule), FileModule, - forwardRef(()=> InvitationModule), + forwardRef(() => InvitationModule), ], providers: [OrganizationService], controllers: [OrganizationController], diff --git a/apps/drec-api/src/pods/organization/organization.service.spec.ts b/apps/drec-api/src/pods/organization/organization.service.spec.ts index 076b1a9c4..af0032477 100644 --- a/apps/drec-api/src/pods/organization/organization.service.spec.ts +++ b/apps/drec-api/src/pods/organization/organization.service.spec.ts @@ -1,519 +1,570 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { Repository, SelectQueryBuilder } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { OrganizationService } from '../organization/organization.service'; -import { Organization } from './organization.entity'; -import { ConfigService } from '@nestjs/config'; -import { BlockchainPropertiesService } from '@energyweb/issuer-api'; -import { UserService } from '../user/user.service'; -import { MailService } from '../../mail/mail.service'; -import { FileService } from '../file'; -import { OrganizationFilterDTO } from '../admin/dto/organization-filter.dto'; -import { LoggedInUser } from 'src/models'; -import { OrganizationStatus, Role, UserStatus } from 'src/utils/enums'; -import { InternalServerErrorException, NotFoundException } from '@nestjs/common'; -import exp from 'constants'; -import { User } from '../user/user.entity'; - - -describe('OrganizationService', () => { - let service: OrganizationService; - let repository: Repository; - let configService: ConfigService; - let blockchainPropertiesService: BlockchainPropertiesService; - let userService: UserService; - let mailService: MailService; - let fileService: FileService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [OrganizationService, - { - provide: getRepositoryToken(Organization), - useClass: Repository, - }, - { - provide: UserService, - useValue: { - findUserByOrganization: jest.fn(), - } as any, - }, - ConfigService, - { - provide: BlockchainPropertiesService, - useValue: {} as any, - }, - { - provide: MailService, - useValue: {} as any, - }, - { - provide: FileService, - useValue: {} as any, - }, - ], - }).compile(); - - service = module.get(OrganizationService); - repository = module.get>(getRepositoryToken(Organization)); - userService = module.get(UserService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); - - describe('getAll', ()=> { - it('should return organizations without filtering when user is not provided', async () => { - - const filterDto: OrganizationFilterDTO = { - organizationName: undefined - }; - const pageNumber = 1; - const limit = 0; - const user = undefined; - - const queryMock: Partial> = { - andWhere: jest.fn().mockReturnThis(), - skip: jest.fn().mockReturnThis(), - take: jest.fn().mockReturnThis(), - getManyAndCount: jest.fn().mockResolvedValue([[], 0]), - }; - - jest.spyOn(service, 'getFilteredQuery').mockResolvedValue(queryMock as any); - const result = await service.getAll(filterDto, pageNumber, limit, user); - - expect(result.organizations).toBeDefined(); - expect(result.currentPage).toBe(pageNumber); - expect(result.totalPages).toEqual(NaN); - expect(result.totalCount).toEqual(result.organizations.length); - }); - - it('should return organizations filtered by API user ID when user is an API user', async () => { - const filterDto: OrganizationFilterDTO = { - organizationName:undefined, - }; - const pageNumber = 1; - const limit = 10; - const user = { - role: Role.ApiUser,//'ApiUser', - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944' - }; - const queryMock: Partial> = { - andWhere: jest.fn().mockReturnThis(), - skip: jest.fn().mockReturnThis(), - take: jest.fn().mockReturnThis(), - getManyAndCount: jest.fn().mockResolvedValue([[], 0]), - }; - - jest.spyOn(service, 'getFilteredQuery').mockResolvedValue(queryMock as any); - - const result = await service.getAll(filterDto, pageNumber, limit, user as LoggedInUser); - - expect(queryMock.andWhere).toHaveBeenCalledWith(`organization.api_user_id = :apiuserid`, { apiuserid: user.api_user_id }); - }); - - it('should throw InternalServerErrorException when an error occurs during retrieval', async () => { - - const filterDto: OrganizationFilterDTO = { - organizationName: undefined, - }; - const pageNumber = 1; - const limit = 10; - const user = { - role: 'Admin', - }; - const queryMock: Partial> = { - andWhere: jest.fn().mockReturnThis(), - skip: jest.fn().mockReturnThis(), - take: jest.fn().mockReturnThis(), - getManyAndCount: jest.fn().mockRejectedValue(new Error('Database error')), - }; - - jest.spyOn(service, 'getFilteredQuery').mockResolvedValue(queryMock as any); - - await expect(service.getAll(filterDto, pageNumber, limit, user as LoggedInUser)).rejects.toThrowError(InternalServerErrorException); - }); - - it('should return the list of organizations with filteration with pagination', async ()=> { - - const response = { - "organizations": [ - { - "createdAt": "2024-03-01T07:59:03.122Z", - "updatedAt": "2024-03-01T07:59:03.122Z", - "id": 13, - "name": "Dev____ORG", - "address": "BLR", - "zipCode": null, - "city": null, - "country": null, - "blockchainAccountAddress": null, - "blockchainAccountSignedMessage": null, - "organizationType": "Developer", - "orgEmail": "mgi36509@zslsz.com", - "status": "Active", - "documentIds": null, - "api_user_id": "dfd2f57d-f2b8-4057-bf48-c19f1a5aa944", - "users": [ - { - "createdAt": "2024-03-01T07:59:03.148Z", - "updatedAt": "2024-03-01T07:59:03.148Z", - "id": 14, - "firstName": "test", - "lastName": "test", - "email": "mgi36509@zslsz.com", - "notifications": true, - "status": "Active", - "role": "OrganizationAdmin", - "roleId": 2, - "api_user_id": "dfd2f57d-f2b8-4057-bf48-c19f1a5aa944" - }, - { - "createdAt": "2024-03-02T16:45:15.601Z", - "updatedAt": "2024-03-02T16:45:15.601Z", - "id": 18, - "firstName": "test", - "lastName": "test", - "email": "uyhujjlswzfkdvoaot@cazlv.com", - "notifications": true, - "status": "Pending", - "role": "OrganizationAdmin", - "roleId": 2, - "api_user_id": "dfd2f57d-f2b8-4057-bf48-c19f1a5aa944" - }, - { - "createdAt": "2024-03-02T17:12:01.027Z", - "updatedAt": "2024-03-02T17:12:01.027Z", - "id": 19, - "firstName": "tst", - "lastName": "test", - "email": "scjiujrqomsqcgwqkb@cazlp.com", - "notifications": true, - "status": "Pending", - "role": "OrganizationAdmin", - "roleId": 2, - "api_user_id": "dfd2f57d-f2b8-4057-bf48-c19f1a5aa944" - }, - { - "createdAt": "2024-03-03T06:30:23.936Z", - "updatedAt": "2024-03-03T06:30:23.936Z", - "id": 20, - "firstName": "test", - "lastName": "test", - "email": "zqiscghgjyvfusuypl@cazlv.com", - "notifications": true, - "status": "Pending", - "role": "OrganizationAdmin", - "roleId": 2, - "api_user_id": "dfd2f57d-f2b8-4057-bf48-c19f1a5aa944" - }, - { - "createdAt": "2024-03-03T15:23:29.222Z", - "updatedAt": "2024-03-04T07:03:46.336Z", - "id": 21, - "firstName": "abc", - "lastName": "abctss", - "email": "test@gmail.com", - "notifications": true, - "status": "Pending", - "role": "OrganizationAdmin", - "roleId": 2, - "api_user_id": "dfd2f57d-f2b8-4057-bf48-c19f1a5aa944" - } - ] - } - ], - "currentPage": 1, - "totalPages": 1, - "totalCount": 1 - }; - - const filterDto = { - organizationName: 'DEV__ORG', - }; - const pageNumber = 1; - const limit = 10; - const user = { - role: 'Admin', - }; - - const queryMock: Partial> = { - andWhere: jest.fn().mockReturnThis(), - skip: jest.fn().mockReturnThis(), - take: jest.fn().mockReturnThis(), - getManyAndCount: jest.fn().mockResolvedValue([[], 0]), - }; - - const getFilteredQuerySpy = jest.spyOn(service, 'getFilteredQuery').mockImplementation(async (filterDto) => { - return queryMock as any; - }); - - const result = await service.getAll(filterDto, pageNumber, limit, user as LoggedInUser); - - expect(getFilteredQuerySpy).toHaveBeenCalledWith(filterDto); - console.log(result); - await expect(result).toEqual({ - organizations: [], - currentPage: 1, - totalPages: 0, - totalCount: 0, - }); - await expect(result.organizations).toBeDefined(); - }); - }); - - describe('findOne', ()=> { - it('should find an organization with id and conditions', async()=> { - const id = 13; - - const organization= { - //"createdAt": "2024-03-01T07:59:03.122Z", - //"updatedAt": "2024-03-01T07:59:03.122Z", - "id": 13, - "name": "Dev____ORG", - "address": "BLR", - "zipCode": null, - "city": null, - "country": null, - "blockchainAccountAddress": null, - "blockchainAccountSignedMessage": null, - "organizationType": "Developer", - "orgEmail": "mgi36509@zslsz.com", - "status": OrganizationStatus.Active,//"Active", - "documentIds": null, - "api_user_id": "dfd2f57d-f2b8-4057-bf48-c19f1a5aa944", - "users": [ - ], - invitations:[], - } as Organization; - - const options = { - where: { - api_user_id: "dfd2f57d-f2b8-4057-bf48-c19f1a5aa944", - }, - }; - - jest.spyOn(repository, 'findOne').mockImplementation(async () => organization as any); - const result = await service.findOne(id, options); - - expect(result).toEqual(organization); - expect(repository.findOne).toHaveBeenCalledWith(id, options); - }); - - it('should throw NotFoundException when organization is not found', async () => { - jest.spyOn(repository, 'findOne').mockResolvedValue(undefined); - await expect(service.findOne(999)).rejects.toThrowError(NotFoundException); - }); - }); - - describe('findOrganizationUsers', () => { - let orgId = 13; - let pageNumber = 1; - let limit = 20; - let role = undefined; - - let users = [{ - //createdAt: '2024-03-03T15:23:29.222Z', - updatedAt: new Date('2024-03-04T07:03:46.336Z'), - id: 21, - firstName: 'abc', - lastName: 'abctss', - email: 'test@gmail.com', - notifications: true, - status: UserStatus.Pending,//'Pending', - role: Role.OrganizationAdmin,//'OrganizationAdmin', - roleId: 2, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - organization:{ - //createdAt: '2024-03-01T07:59:03.122Z', - //updatedAt: '2024-03-01T07:59:03.122Z', - id: 13, - name: 'Dev____ORG', - address: 'BLR', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'Developer', - orgEmail: 'mgi36509@zslsz.com', - status: OrganizationStatus.Active,//'Active', - documentIds: null, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - users: [], - invitations: [], - } as Organization, - password: 'Drec@1234', - moduleName: 'any ModuleName', - } as User, - { - //createdAt: '2024-03-03T06:30:23.936Z', - updatedAt: new Date('2024-03-03T06:30:23.936Z'), - id: 20, - firstName: 'test', - lastName: 'test', - email: 'zqiscghgjyvfusuypl@cazlv.com', - notifications: true, - status: UserStatus.Pending,//'Pending', - role: Role.OrganizationAdmin,//'OrganizationAdmin', - roleId: 2, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - organization: { - //createdAt: '2024-03-01T07:59:03.122Z', - //updatedAt: '2024-03-01T07:59:03.122Z', - id: 13, - name: 'Dev____ORG', - address: 'BLR', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'Developer', - orgEmail: 'mgi36509@zslsz.com', - status: OrganizationStatus.Active,//'Active', - documentIds: null, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944' - } as Organization, - password: 'Drec@1234', - moduleName: 'any Module', - } as User, - { - //createdAt: '2024-03-02T17:12:01.027Z', - updatedAt: new Date('2024-03-02T17:12:01.027Z'), - id: 19, - firstName: 'tst', - lastName: 'test', - email: 'scjiujrqomsqcgwqkb@cazlp.com', - notifications: true, - status: UserStatus.Pending,//'Pending', - role: Role.OrganizationAdmin,//'OrganizationAdmin', - roleId: 2, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - organization: { - //createdAt: '2024-03-01T07:59:03.122Z', - //updatedAt: '2024-03-01T07:59:03.122Z', - id: 13, - name: 'Dev____ORG', - address: 'BLR', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'Developer', - orgEmail: 'mgi36509@zslsz.com', - status: OrganizationStatus.Active,//'Active', - documentIds: null, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944' - } as Organization, - password: 'Drec@1234', - moduleName: 'anyModule', - } as User, - { - //createdAt: '2024-03-02T16:45:15.601Z', - updatedAt: new Date('2024-03-02T16:45:15.601Z'), - id: 18, - firstName: 'test', - lastName: 'test', - email: 'uyhujjlswzfkdvoaot@cazlv.com', - notifications: true, - status: UserStatus.Pending,//'Pending', - role: Role.OrganizationAdmin,//'OrganizationAdmin', - roleId: 2, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - organization: { - //createdAt: '2024-03-01T07:59:03.122Z', - //updatedAt: '2024-03-01T07:59:03.122Z', - id: 13, - name: 'Dev____ORG', - address: 'BLR', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'Developer', - orgEmail: 'mgi36509@zslsz.com', - status: OrganizationStatus.Active,//'Active', - documentIds: null, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944' - } as Organization, - password: 'Drec@1234', - moduleName: 'any Module', - } as User, - { - //createdAt: '2024-03-01T07:59:03.148Z', - updatedAt: new Date('2024-03-01T07:59:03.148Z'), - id: 14, - firstName: 'test', - lastName: 'test', - email: 'mgi36509@zslsz.com', - notifications: true, - status: UserStatus.Active,//'Active', - role: Role.OrganizationAdmin,//'OrganizationAdmin', - roleId: 2, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', - organization: { - //createdAt: '2024-03-01T07:59:03.122Z', - //updatedAt: '2024-03-01T07:59:03.122Z', - id: 13, - name: 'Dev____ORG', - address: 'BLR', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - organizationType: 'Developer', - orgEmail: 'mgi36509@zslsz.com', - status: OrganizationStatus.Active,//'Active', - documentIds: null, - api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944' - } as Organization, - password: 'Drec@1234', - moduleName: 'any Module', - } as User, - ]; - let totalCount = 5; - it('should return the list of users for a valid organization ID', async () => { - - jest.spyOn(userService, 'findUserByOrganization').mockResolvedValue([users,totalCount] as any); - - const result = await service.findOrganizationUsers(orgId, pageNumber, limit); - - expect(result.users).toEqual(users); - expect(result.totalCount).toBe(totalCount); - }); - - it('should filter users based on the provided role parameter', async () => { - jest.spyOn(userService, 'findUserByOrganization').mockResolvedValue([users, totalCount] as any); - - const result = await service.findOrganizationUsers(orgId, pageNumber, limit, Role.OrganizationAdmin); - - expect(result.users).toEqual(users); - }); - - it('should return empty array when the organization is not found', async () => { - jest.spyOn(userService, 'findUserByOrganization').mockResolvedValue([[],0] as any); - - const result = await service.findOrganizationUsers(999, pageNumber, limit); - - expect(result.users).toEqual([]); - expect(result.currentPage).toBe(1); - expect(result.totalPages).toBe(0); - expect(result.totalCount).toBe(0); - }); - - it('should handle edge cases when page number is out of bounds', async () => { - jest.spyOn(userService, 'findUserByOrganization').mockResolvedValue([[],0] as any); - - // Assuming there are only 2 users in total and page size is 10 - const result = await service.findOrganizationUsers(orgId, 100, 10); - - expect(result.users).toEqual([]); - expect(result.currentPage).toBe(100); // Current page should still be 100 - }); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { Repository, SelectQueryBuilder } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { OrganizationService } from '../organization/organization.service'; +import { Organization } from './organization.entity'; +import { ConfigService } from '@nestjs/config'; +import { BlockchainPropertiesService } from '@energyweb/issuer-api'; +import { UserService } from '../user/user.service'; +import { MailService } from '../../mail/mail.service'; +import { FileService } from '../file'; +import { OrganizationFilterDTO } from '../admin/dto/organization-filter.dto'; +import { LoggedInUser } from 'src/models'; +import { OrganizationStatus, Role, UserStatus } from 'src/utils/enums'; +import { + InternalServerErrorException, + NotFoundException, +} from '@nestjs/common'; +import exp from 'constants'; +import { User } from '../user/user.entity'; + +describe('OrganizationService', () => { + let service: OrganizationService; + let repository: Repository; + let configService: ConfigService; + let blockchainPropertiesService: BlockchainPropertiesService; + let userService: UserService; + let mailService: MailService; + let fileService: FileService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + OrganizationService, + { + provide: getRepositoryToken(Organization), + useClass: Repository, + }, + { + provide: UserService, + useValue: { + findUserByOrganization: jest.fn(), + } as any, + }, + ConfigService, + { + provide: BlockchainPropertiesService, + useValue: {} as any, + }, + { + provide: MailService, + useValue: {} as any, + }, + { + provide: FileService, + useValue: {} as any, + }, + ], + }).compile(); + + service = module.get(OrganizationService); + repository = module.get>( + getRepositoryToken(Organization), + ); + userService = module.get(UserService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); + + describe('getAll', () => { + it('should return organizations without filtering when user is not provided', async () => { + const filterDto: OrganizationFilterDTO = { + organizationName: undefined, + }; + const pageNumber = 1; + const limit = 0; + const user = undefined; + + const queryMock: Partial> = { + andWhere: jest.fn().mockReturnThis(), + skip: jest.fn().mockReturnThis(), + take: jest.fn().mockReturnThis(), + getManyAndCount: jest.fn().mockResolvedValue([[], 0]), + }; + + jest + .spyOn(service, 'getFilteredQuery') + .mockResolvedValue(queryMock as any); + const result = await service.getAll(filterDto, pageNumber, limit, user); + + expect(result.organizations).toBeDefined(); + expect(result.currentPage).toBe(pageNumber); + expect(result.totalPages).toEqual(NaN); + expect(result.totalCount).toEqual(result.organizations.length); + }); + + it('should return organizations filtered by API user ID when user is an API user', async () => { + const filterDto: OrganizationFilterDTO = { + organizationName: undefined, + }; + const pageNumber = 1; + const limit = 10; + const user = { + role: Role.ApiUser, //'ApiUser', + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + }; + const queryMock: Partial> = { + andWhere: jest.fn().mockReturnThis(), + skip: jest.fn().mockReturnThis(), + take: jest.fn().mockReturnThis(), + getManyAndCount: jest.fn().mockResolvedValue([[], 0]), + }; + + jest + .spyOn(service, 'getFilteredQuery') + .mockResolvedValue(queryMock as any); + + const result = await service.getAll( + filterDto, + pageNumber, + limit, + user as LoggedInUser, + ); + + expect(queryMock.andWhere).toHaveBeenCalledWith( + `organization.api_user_id = :apiuserid`, + { apiuserid: user.api_user_id }, + ); + }); + + it('should throw InternalServerErrorException when an error occurs during retrieval', async () => { + const filterDto: OrganizationFilterDTO = { + organizationName: undefined, + }; + const pageNumber = 1; + const limit = 10; + const user = { + role: 'Admin', + }; + const queryMock: Partial> = { + andWhere: jest.fn().mockReturnThis(), + skip: jest.fn().mockReturnThis(), + take: jest.fn().mockReturnThis(), + getManyAndCount: jest + .fn() + .mockRejectedValue(new Error('Database error')), + }; + + jest + .spyOn(service, 'getFilteredQuery') + .mockResolvedValue(queryMock as any); + + await expect( + service.getAll(filterDto, pageNumber, limit, user as LoggedInUser), + ).rejects.toThrowError(InternalServerErrorException); + }); + + it('should return the list of organizations with filteration with pagination', async () => { + const response = { + organizations: [ + { + createdAt: '2024-03-01T07:59:03.122Z', + updatedAt: '2024-03-01T07:59:03.122Z', + id: 13, + name: 'Dev____ORG', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'mgi36509@zslsz.com', + status: 'Active', + documentIds: null, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + users: [ + { + createdAt: '2024-03-01T07:59:03.148Z', + updatedAt: '2024-03-01T07:59:03.148Z', + id: 14, + firstName: 'test', + lastName: 'test', + email: 'mgi36509@zslsz.com', + notifications: true, + status: 'Active', + role: 'OrganizationAdmin', + roleId: 2, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + }, + { + createdAt: '2024-03-02T16:45:15.601Z', + updatedAt: '2024-03-02T16:45:15.601Z', + id: 18, + firstName: 'test', + lastName: 'test', + email: 'uyhujjlswzfkdvoaot@cazlv.com', + notifications: true, + status: 'Pending', + role: 'OrganizationAdmin', + roleId: 2, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + }, + { + createdAt: '2024-03-02T17:12:01.027Z', + updatedAt: '2024-03-02T17:12:01.027Z', + id: 19, + firstName: 'tst', + lastName: 'test', + email: 'scjiujrqomsqcgwqkb@cazlp.com', + notifications: true, + status: 'Pending', + role: 'OrganizationAdmin', + roleId: 2, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + }, + { + createdAt: '2024-03-03T06:30:23.936Z', + updatedAt: '2024-03-03T06:30:23.936Z', + id: 20, + firstName: 'test', + lastName: 'test', + email: 'zqiscghgjyvfusuypl@cazlv.com', + notifications: true, + status: 'Pending', + role: 'OrganizationAdmin', + roleId: 2, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + }, + { + createdAt: '2024-03-03T15:23:29.222Z', + updatedAt: '2024-03-04T07:03:46.336Z', + id: 21, + firstName: 'abc', + lastName: 'abctss', + email: 'test@gmail.com', + notifications: true, + status: 'Pending', + role: 'OrganizationAdmin', + roleId: 2, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + }, + ], + }, + ], + currentPage: 1, + totalPages: 1, + totalCount: 1, + }; + + const filterDto = { + organizationName: 'DEV__ORG', + }; + const pageNumber = 1; + const limit = 10; + const user = { + role: 'Admin', + }; + + const queryMock: Partial> = { + andWhere: jest.fn().mockReturnThis(), + skip: jest.fn().mockReturnThis(), + take: jest.fn().mockReturnThis(), + getManyAndCount: jest.fn().mockResolvedValue([[], 0]), + }; + + const getFilteredQuerySpy = jest + .spyOn(service, 'getFilteredQuery') + .mockImplementation(async (filterDto) => { + return queryMock as any; + }); + + const result = await service.getAll( + filterDto, + pageNumber, + limit, + user as LoggedInUser, + ); + + expect(getFilteredQuerySpy).toHaveBeenCalledWith(filterDto); + console.log(result); + await expect(result).toEqual({ + organizations: [], + currentPage: 1, + totalPages: 0, + totalCount: 0, + }); + await expect(result.organizations).toBeDefined(); + }); + }); + + describe('findOne', () => { + it('should find an organization with id and conditions', async () => { + const id = 13; + + const organization = { + //"createdAt": "2024-03-01T07:59:03.122Z", + //"updatedAt": "2024-03-01T07:59:03.122Z", + id: 13, + name: 'Dev____ORG', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'mgi36509@zslsz.com', + status: OrganizationStatus.Active, //"Active", + documentIds: null, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + users: [], + invitations: [], + } as Organization; + + const options = { + where: { + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + }, + }; + + jest + .spyOn(repository, 'findOne') + .mockImplementation(async () => organization as any); + const result = await service.findOne(id, options); + + expect(result).toEqual(organization); + expect(repository.findOne).toHaveBeenCalledWith(id, options); + }); + + it('should throw NotFoundException when organization is not found', async () => { + jest.spyOn(repository, 'findOne').mockResolvedValue(undefined); + await expect(service.findOne(999)).rejects.toThrowError( + NotFoundException, + ); + }); + }); + + describe('findOrganizationUsers', () => { + let orgId = 13; + let pageNumber = 1; + let limit = 20; + let role = undefined; + + let users = [ + { + //createdAt: '2024-03-03T15:23:29.222Z', + updatedAt: new Date('2024-03-04T07:03:46.336Z'), + id: 21, + firstName: 'abc', + lastName: 'abctss', + email: 'test@gmail.com', + notifications: true, + status: UserStatus.Pending, //'Pending', + role: Role.OrganizationAdmin, //'OrganizationAdmin', + roleId: 2, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + organization: { + //createdAt: '2024-03-01T07:59:03.122Z', + //updatedAt: '2024-03-01T07:59:03.122Z', + id: 13, + name: 'Dev____ORG', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'mgi36509@zslsz.com', + status: OrganizationStatus.Active, //'Active', + documentIds: null, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + users: [], + invitations: [], + } as Organization, + password: 'Drec@1234', + moduleName: 'any ModuleName', + } as User, + { + //createdAt: '2024-03-03T06:30:23.936Z', + updatedAt: new Date('2024-03-03T06:30:23.936Z'), + id: 20, + firstName: 'test', + lastName: 'test', + email: 'zqiscghgjyvfusuypl@cazlv.com', + notifications: true, + status: UserStatus.Pending, //'Pending', + role: Role.OrganizationAdmin, //'OrganizationAdmin', + roleId: 2, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + organization: { + //createdAt: '2024-03-01T07:59:03.122Z', + //updatedAt: '2024-03-01T07:59:03.122Z', + id: 13, + name: 'Dev____ORG', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'mgi36509@zslsz.com', + status: OrganizationStatus.Active, //'Active', + documentIds: null, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + } as Organization, + password: 'Drec@1234', + moduleName: 'any Module', + } as User, + { + //createdAt: '2024-03-02T17:12:01.027Z', + updatedAt: new Date('2024-03-02T17:12:01.027Z'), + id: 19, + firstName: 'tst', + lastName: 'test', + email: 'scjiujrqomsqcgwqkb@cazlp.com', + notifications: true, + status: UserStatus.Pending, //'Pending', + role: Role.OrganizationAdmin, //'OrganizationAdmin', + roleId: 2, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + organization: { + //createdAt: '2024-03-01T07:59:03.122Z', + //updatedAt: '2024-03-01T07:59:03.122Z', + id: 13, + name: 'Dev____ORG', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'mgi36509@zslsz.com', + status: OrganizationStatus.Active, //'Active', + documentIds: null, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + } as Organization, + password: 'Drec@1234', + moduleName: 'anyModule', + } as User, + { + //createdAt: '2024-03-02T16:45:15.601Z', + updatedAt: new Date('2024-03-02T16:45:15.601Z'), + id: 18, + firstName: 'test', + lastName: 'test', + email: 'uyhujjlswzfkdvoaot@cazlv.com', + notifications: true, + status: UserStatus.Pending, //'Pending', + role: Role.OrganizationAdmin, //'OrganizationAdmin', + roleId: 2, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + organization: { + //createdAt: '2024-03-01T07:59:03.122Z', + //updatedAt: '2024-03-01T07:59:03.122Z', + id: 13, + name: 'Dev____ORG', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'mgi36509@zslsz.com', + status: OrganizationStatus.Active, //'Active', + documentIds: null, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + } as Organization, + password: 'Drec@1234', + moduleName: 'any Module', + } as User, + { + //createdAt: '2024-03-01T07:59:03.148Z', + updatedAt: new Date('2024-03-01T07:59:03.148Z'), + id: 14, + firstName: 'test', + lastName: 'test', + email: 'mgi36509@zslsz.com', + notifications: true, + status: UserStatus.Active, //'Active', + role: Role.OrganizationAdmin, //'OrganizationAdmin', + roleId: 2, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + organization: { + //createdAt: '2024-03-01T07:59:03.122Z', + //updatedAt: '2024-03-01T07:59:03.122Z', + id: 13, + name: 'Dev____ORG', + address: 'BLR', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + organizationType: 'Developer', + orgEmail: 'mgi36509@zslsz.com', + status: OrganizationStatus.Active, //'Active', + documentIds: null, + api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa944', + } as Organization, + password: 'Drec@1234', + moduleName: 'any Module', + } as User, + ]; + let totalCount = 5; + it('should return the list of users for a valid organization ID', async () => { + jest + .spyOn(userService, 'findUserByOrganization') + .mockResolvedValue([users, totalCount] as any); + + const result = await service.findOrganizationUsers( + orgId, + pageNumber, + limit, + ); + + expect(result.users).toEqual(users); + expect(result.totalCount).toBe(totalCount); + }); + + it('should filter users based on the provided role parameter', async () => { + jest + .spyOn(userService, 'findUserByOrganization') + .mockResolvedValue([users, totalCount] as any); + + const result = await service.findOrganizationUsers( + orgId, + pageNumber, + limit, + Role.OrganizationAdmin, + ); + + expect(result.users).toEqual(users); + }); + + it('should return empty array when the organization is not found', async () => { + jest + .spyOn(userService, 'findUserByOrganization') + .mockResolvedValue([[], 0] as any); + + const result = await service.findOrganizationUsers( + 999, + pageNumber, + limit, + ); + + expect(result.users).toEqual([]); + expect(result.currentPage).toBe(1); + expect(result.totalPages).toBe(0); + expect(result.totalCount).toBe(0); + }); + + it('should handle edge cases when page number is out of bounds', async () => { + jest + .spyOn(userService, 'findUserByOrganization') + .mockResolvedValue([[], 0] as any); + + // Assuming there are only 2 users in total and page size is 10 + const result = await service.findOrganizationUsers(orgId, 100, 10); + + expect(result.users).toEqual([]); + expect(result.currentPage).toBe(100); // Current page should still be 100 + }); + }); +}); diff --git a/apps/drec-api/src/pods/organization/organization.service.ts b/apps/drec-api/src/pods/organization/organization.service.ts index b2a5d6ccb..737de5760 100755 --- a/apps/drec-api/src/pods/organization/organization.service.ts +++ b/apps/drec-api/src/pods/organization/organization.service.ts @@ -5,10 +5,15 @@ import { Injectable, Logger, NotFoundException, - InternalServerErrorException + InternalServerErrorException, } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { FindOneOptions, Repository, FindConditions, SelectQueryBuilder, } from 'typeorm'; +import { + FindOneOptions, + Repository, + FindConditions, + SelectQueryBuilder, +} from 'typeorm'; import { getProviderWithFallback, recoverTypedSignatureAddress, @@ -54,7 +59,7 @@ export class OrganizationService { private readonly userService: UserService, private readonly mailService: MailService, private readonly fileService: FileService, - ) { } + ) {} async findOne( id: number, @@ -83,26 +88,44 @@ export class OrganizationService { return this.repository.findByIds(ids); } - async getAll(filterDto: OrganizationFilterDTO, pageNumber: number, limit: number, user?: LoggedInUser,): Promise<{ organizations: Organization[], currentPage: number, totalPages: number, totalCount: number }> { + async getAll( + filterDto: OrganizationFilterDTO, + pageNumber: number, + limit: number, + user?: LoggedInUser, + ): Promise<{ + organizations: Organization[]; + currentPage: number; + totalPages: number; + totalCount: number; + }> { this.logger.verbose(`With in getAll`); let query = await this.getFilteredQuery(filterDto); try { if (user != undefined && user?.role === 'ApiUser') { - query = query.andWhere(`organization.api_user_id = :apiuserid`, { apiuserid: user.api_user_id }) + query = query.andWhere(`organization.api_user_id = :apiuserid`, { + apiuserid: user.api_user_id, + }); } - query.andWhere(`organization.organizationType != :organizationType`, { organizationType: Role.ApiUser }) - let [organizations, count] = await query.skip((pageNumber - 1) * limit).take(limit).getManyAndCount(); + query.andWhere(`organization.organizationType != :organizationType`, { + organizationType: Role.ApiUser, + }); + let [organizations, count] = await query + .skip((pageNumber - 1) * limit) + .take(limit) + .getManyAndCount(); const totalPages = Math.ceil(count / limit); return { organizations, currentPage: pageNumber, totalPages, - totalCount: count + totalCount: count, }; - } - catch (error) { + } catch (error) { this.logger.error(`Failed to retrieve organizations`, error.stack); - throw new InternalServerErrorException('Failed to retrieve organizations'); + throw new InternalServerErrorException( + 'Failed to retrieve organizations', + ); } } @@ -125,36 +148,63 @@ export class OrganizationService { return organization.users; } - public async findOrganizationUsers(id: number, pageNumber: number, limit: number, role?: string): Promise<{ users: IUser[], currentPage: number, totalPages: number, totalCount: number }> { + public async findOrganizationUsers( + id: number, + pageNumber: number, + limit: number, + role?: string, + ): Promise<{ + users: IUser[]; + currentPage: number; + totalPages: number; + totalCount: number; + }> { this.logger.verbose(`With in findOrganizationUsers`); /* const organization = await this.findOne(id); return organization ? organization.users : []; */ - const [users, totalCount] = await this.userService.findUserByOrganization(id, pageNumber, limit); + const [users, totalCount] = await this.userService.findUserByOrganization( + id, + pageNumber, + limit, + ); const totalPages = Math.ceil(totalCount / limit); - let newuser= users + let newuser = users; if (role != undefined && role != Role.OrganizationAdmin) { - newuser = users.filter(user => user.role != "OrganizationAdmin"); + newuser = users.filter((user) => user.role != 'OrganizationAdmin'); } return { users: newuser, currentPage: pageNumber, totalPages, - totalCount - } + totalCount, + }; } - public async findApiuserOrganizationUsers(apiuser_id: string, pageNumber: number, limit: number): Promise<{ users: IUser[], currentPage: number, totalPages: number, totalCount: number }> { + public async findApiuserOrganizationUsers( + apiuser_id: string, + pageNumber: number, + limit: number, + ): Promise<{ + users: IUser[]; + currentPage: number; + totalPages: number; + totalCount: number; + }> { this.logger.verbose(`With in findApiuserOrganizationUsers`); /* const organization = await this.findOne(id); return organization ? organization.users : []; */ - const [users, totalCount] = await this.userService.findUserByApiUserId(apiuser_id, pageNumber, limit); + const [users, totalCount] = await this.userService.findUserByApiUserId( + apiuser_id, + pageNumber, + limit, + ); const totalPages = Math.ceil(totalCount / limit); return { users: users, currentPage: pageNumber, totalPages, - totalCount - } + totalCount, + }; } async seed(organizationToRegister: IFullOrganization): Promise { this.logger.debug( @@ -188,7 +238,9 @@ export class OrganizationService { ); if (await this.isNameAlreadyTaken(organizationToRegister.name)) { - this.logger.error(new OrganizationNameAlreadyTakenError(organizationToRegister.name)); + this.logger.error( + new OrganizationNameAlreadyTakenError(organizationToRegister.name), + ); throw new OrganizationNameAlreadyTakenError(organizationToRegister.name); } const documents = [ @@ -264,7 +316,6 @@ export class OrganizationService { ...organizationToRegister, status: OrganizationStatus.Active, - }); try { @@ -283,10 +334,8 @@ export class OrganizationService { // else{ // return organization; // } - } - private async generateBlockchainAddress(index: number): Promise { this.logger.verbose(`With in generateBlockchainAddress`); const issuerAccount = Wallet.fromMnemonic( @@ -350,7 +399,9 @@ export class OrganizationService { isRole(userToBeChanged.role, Role.OrganizationAdmin) && admins.length < 2 ) { - this.logger.error(`Can't change role of admin user from organization. There always has to be at least one admin in the organization.`); + this.logger.error( + `Can't change role of admin user from organization. There always has to be at least one admin in the organization.`, + ); throw new BadRequestException({ success: false, message: `Can't change role of admin user from organization. There always has to be at least one admin in the organization.`, @@ -414,7 +465,9 @@ export class OrganizationService { }); if (alreadyExistingOrganizationWithAddress > 0) { - this.logger.error(`This blockchain address has already been linked to a different organization.`); + this.logger.error( + `This blockchain address has already been linked to a different organization.`, + ); throw new ConflictException( `This blockchain address has already been linked to a different organization.`, ); @@ -481,7 +534,9 @@ export class OrganizationService { // return Boolean(await this.findOne(conditions)); // } - public async getFilteredQuery(filterDto: OrganizationFilterDTO): Promise> { + public async getFilteredQuery( + filterDto: OrganizationFilterDTO, + ): Promise> { this.logger.verbose(`With in getFilteredQuery`); const { organizationName } = filterDto; const query = this.repository diff --git a/apps/drec-api/src/pods/permission/dto/modulepermission.dto.ts b/apps/drec-api/src/pods/permission/dto/modulepermission.dto.ts index 35fa29cd0..c1dde76b3 100755 --- a/apps/drec-api/src/pods/permission/dto/modulepermission.dto.ts +++ b/apps/drec-api/src/pods/permission/dto/modulepermission.dto.ts @@ -1,5 +1,9 @@ import { ApiProperty } from '@nestjs/swagger'; -import { IModulePermissionsConfig, IACLModuleConfig, IaddModulePermission } from '../../../models'; +import { + IModulePermissionsConfig, + IACLModuleConfig, + IaddModulePermission, +} from '../../../models'; import { Role, EntityType, UserPermissionStatus } from '../../../utils/enums'; import { Expose } from 'class-transformer'; import { @@ -16,7 +20,6 @@ import { import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm'; import { ACLModuleDTO } from '../../access-control-layer-module-service/dto/aclmodule.dto'; export class PermissionDTO implements Omit { - @ApiProperty({ type: Number }) @PrimaryGeneratedColumn() id: number; @@ -39,7 +42,6 @@ export class PermissionDTO implements Omit { @IsArray() permissions: string[]; - @Column() permissionValue: number; @ApiProperty({ type: Number }) @@ -48,12 +50,8 @@ export class PermissionDTO implements Omit { // @ApiProperty({ type: ACLModuleDTO }) // @ValidateNested() // aclmodules: IACLModuleConfig; - } export class NewPermissionDTO { - - - @ApiProperty({ type: Number }) @Column() aclmodulesId: number; @@ -79,7 +77,6 @@ export class NewPermissionDTO { status: number; } export class UpdatePermissionDTO implements Omit { - // @ApiProperty({ type: Number }) @Column() aclmodulesId: number; @@ -106,7 +103,6 @@ export class UpdatePermissionDTO implements Omit { } export class NewApiUserPermissionDTO { - @ApiProperty({ type: Number }) @Column() aclmodulesId: number; @@ -133,9 +129,8 @@ export class NewApiUserPermissionDTO { } export class ApiUserPermissionUpdateDTO { - @ApiProperty({ enum: UserPermissionStatus, enumName: 'UserPermissionStatus' }) @IsEnum(UserPermissionStatus) @Column({ default: UserPermissionStatus.Request }) status: UserPermissionStatus; -} \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/permission/dto/role.dto.ts b/apps/drec-api/src/pods/permission/dto/role.dto.ts index dd428023a..8fa97b2c0 100755 --- a/apps/drec-api/src/pods/permission/dto/role.dto.ts +++ b/apps/drec-api/src/pods/permission/dto/role.dto.ts @@ -13,12 +13,8 @@ import { ValidateNested, } from 'class-validator'; import { OrganizationDTO } from '../../organization/dto'; -import { - RoleStatus, - -} from '../../../utils/enums'; +import { RoleStatus } from '../../../utils/enums'; export class RoleConfigDTO implements IRoleConfig { - @ApiProperty({ type: Number }) @IsNumber() @Expose() @@ -38,6 +34,4 @@ export class RoleConfigDTO implements IRoleConfig { @IsNotEmpty() @IsEnum(RoleStatus) status: RoleStatus; - - } diff --git a/apps/drec-api/src/pods/permission/permission.controller.ts b/apps/drec-api/src/pods/permission/permission.controller.ts index cad4e17f0..0e3957145 100755 --- a/apps/drec-api/src/pods/permission/permission.controller.ts +++ b/apps/drec-api/src/pods/permission/permission.controller.ts @@ -1,196 +1,204 @@ import { - Controller, - Get, - Post, - Body, - Put, - Param, - ParseIntPipe, - HttpStatus, - UseGuards, - Logger, + Controller, + Get, + Post, + Body, + Put, + Param, + ParseIntPipe, + HttpStatus, + UseGuards, + Logger, } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; import { - ApiBearerAuth, - ApiResponse, - ApiBody, - ApiTags, - ApiSecurity, - ApiOkResponse + ApiBearerAuth, + ApiResponse, + ApiBody, + ApiTags, + ApiSecurity, + ApiOkResponse, } from '@nestjs/swagger'; import { UserDecorator } from '../user/decorators/user.decorator'; -import { PermissionService } from './permission.service' -import { NewPermissionDTO, PermissionDTO, UpdatePermissionDTO, NewApiUserPermissionDTO, ApiUserPermissionUpdateDTO } from '../permission/dto/modulepermission.dto' +import { PermissionService } from './permission.service'; +import { + NewPermissionDTO, + PermissionDTO, + UpdatePermissionDTO, + NewApiUserPermissionDTO, + ApiUserPermissionUpdateDTO, +} from '../permission/dto/modulepermission.dto'; import { Roles } from '../user/decorators/roles.decorator'; import { RolesGuard } from '../../guards/RolesGuard'; import { Role } from '../../utils/enums'; import { ILoggedInUser } from '../../models'; -import { ACLModulePermissions } from './permission.entity' +import { ACLModulePermissions } from './permission.entity'; import { Permission } from './decorators/permission.decorator'; -import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator' +import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator'; import { PermissionGuard } from '../../guards'; @ApiTags('permission') @ApiBearerAuth('access-token') @ApiSecurity('drec') @Controller('permission') export class PermissionController { + private readonly logger = new Logger(PermissionController.name); - private readonly logger = new Logger(PermissionController.name); - - constructor( - private readonly PermissionService: PermissionService, - - ) { } - - /** - * This api use for get the all list of User and Role base permission - * @returns {ACLModulePermissions[]} - */ - @Get() - @UseGuards(AuthGuard('jwt'), PermissionGuard) - @Permission('Read') - @ACLModules('PERMISSION_MANAGEMENT_CRUDL') - @ApiOkResponse({ type: [ACLModulePermissions], description: 'Returns all Permission' }) - async getAll(): Promise { - this.logger.verbose(`With in getAll`); - return this.PermissionService.getAll(); - } - /** - * This api route use for get list permission of user role - * @param id :number "id means role id" - * @returns {ACLModulePermissions[]} - */ - @Get('/role/:id') - @UseGuards(AuthGuard('jwt'), RolesGuard, PermissionGuard) - @Roles(Role.Admin, Role.OrganizationAdmin) - @Permission('Read') - @ACLModules('PERMISSION_MANAGEMENT_CRUDL') - @ApiResponse({ - status: HttpStatus.OK, - type: PermissionDTO, - description: 'Get list of user role permission', - }) - - async rolepermission(@Param('id', new ParseIntPipe()) id: number): Promise { - this.logger.verbose(`With in rolepermission`); - return this.PermissionService.FindbyRole(id); - } + constructor(private readonly PermissionService: PermissionService) {} - /** - * This api rout use for get permission of Role not related what the role of user - * @param id :number "id means user id" - * @returns {ACLModulePermissions[]} - */ - @Get('/user/:id') - @UseGuards(AuthGuard('jwt')) - @Permission('Read') - @ACLModules('PERMISSION_MANAGEMENT_CRUDL') - @ApiResponse({ - status: HttpStatus.OK, - type: PermissionDTO, - description: 'Get list of user permission', - }) - //user( { id }: PermissionDTO): Promise { - user(@Param('id', new ParseIntPipe()) id: number): Promise { - this.logger.verbose(`With in user`); - return this.PermissionService.FindbyUser(id); - } - /** - * This api route use to add permission for all role by admin - * @param moduleData {NewPermissionDTO} - * @param loggedUser {ILoggedInUser} "login details" - * @returns {PermissionDTO} - */ - @Post('/module') - @UseGuards(AuthGuard('jwt'), RolesGuard, PermissionGuard) - @Roles(Role.Admin, Role.OrganizationAdmin) - @ApiBody({ type: NewPermissionDTO }) - @Permission('Write') - @ACLModules('PERMISSION_MANAGEMENT_CRUDL') - @ApiResponse({ - status: HttpStatus.CREATED, - type: PermissionDTO, - description: 'Permission added sucessfull', - }) - public async register( - @Body() moduleData: NewPermissionDTO, - @UserDecorator() loggedUser: ILoggedInUser, - ): Promise { - this.logger.verbose(`With in register`); - return this.PermissionService.create(moduleData, loggedUser); - } - /** - * This api route use for update the permission of user and role - * @param id - * @param body - * @returns - */ - @Put('/update/:id') - @UseGuards(AuthGuard(['jwt','oauth2-client-password'])) - @ApiBody({ type: UpdatePermissionDTO }) - @Permission('Write') - @ACLModules('PERMISSION_MANAGEMENT_CRUDL') - @ApiResponse({ - status: HttpStatus.OK, - type: PermissionDTO, - description: 'Updates a permission (Read,Write,Delete,Update) or status by admin', - }) - public async updateyield( - @Param('id', new ParseIntPipe()) id: number, - @Body() body: UpdatePermissionDTO, - @UserDecorator() loggedUser: ILoggedInUser, - ): Promise { - this.logger.verbose(`With in updateyield`); - return this.PermissionService.update(id, body, loggedUser); + /** + * This api use for get the all list of User and Role base permission + * @returns {ACLModulePermissions[]} + */ + @Get() + @UseGuards(AuthGuard('jwt'), PermissionGuard) + @Permission('Read') + @ACLModules('PERMISSION_MANAGEMENT_CRUDL') + @ApiOkResponse({ + type: [ACLModulePermissions], + description: 'Returns all Permission', + }) + async getAll(): Promise { + this.logger.verbose(`With in getAll`); + return this.PermissionService.getAll(); + } + /** + * This api route use for get list permission of user role + * @param id :number "id means role id" + * @returns {ACLModulePermissions[]} + */ + @Get('/role/:id') + @UseGuards(AuthGuard('jwt'), RolesGuard, PermissionGuard) + @Roles(Role.Admin, Role.OrganizationAdmin) + @Permission('Read') + @ACLModules('PERMISSION_MANAGEMENT_CRUDL') + @ApiResponse({ + status: HttpStatus.OK, + type: PermissionDTO, + description: 'Get list of user role permission', + }) + async rolepermission( + @Param('id', new ParseIntPipe()) id: number, + ): Promise { + this.logger.verbose(`With in rolepermission`); + return this.PermissionService.FindbyRole(id); + } - } - /** - * This api route use for make a request of permission to use api with module select by apiuser - * @param moduleData - * @param loggedUser - * @returns {PermissionDTO} - */ - @Post('/module/apiuser/request') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), RolesGuard) - @Roles(Role.ApiUser) - @ApiBody({ type: [NewApiUserPermissionDTO] }) - @ApiResponse({ - status: HttpStatus.CREATED, - type: PermissionDTO, - description: 'Request of permission from ApiUser', - }) - public async apiuser_modulerequest( - // @Param('apiuserId') api_user_id: string, - @Body() moduleData: [NewApiUserPermissionDTO], - @UserDecorator() loggedUser: ILoggedInUser, - ): Promise<{ statsu: string, message: string }> { - this.logger.verbose(`With in apiuser_modulerequest`); - return this.PermissionService.permisssion_request(moduleData, loggedUser); - } + /** + * This api rout use for get permission of Role not related what the role of user + * @param id :number "id means user id" + * @returns {ACLModulePermissions[]} + */ + @Get('/user/:id') + @UseGuards(AuthGuard('jwt')) + @Permission('Read') + @ACLModules('PERMISSION_MANAGEMENT_CRUDL') + @ApiResponse({ + status: HttpStatus.OK, + type: PermissionDTO, + description: 'Get list of user permission', + }) + //user( { id }: PermissionDTO): Promise { + user( + @Param('id', new ParseIntPipe()) id: number, + ): Promise { + this.logger.verbose(`With in user`); + return this.PermissionService.FindbyUser(id); + } + /** + * This api route use to add permission for all role by admin + * @param moduleData {NewPermissionDTO} + * @param loggedUser {ILoggedInUser} "login details" + * @returns {PermissionDTO} + */ + @Post('/module') + @UseGuards(AuthGuard('jwt'), RolesGuard, PermissionGuard) + @Roles(Role.Admin, Role.OrganizationAdmin) + @ApiBody({ type: NewPermissionDTO }) + @Permission('Write') + @ACLModules('PERMISSION_MANAGEMENT_CRUDL') + @ApiResponse({ + status: HttpStatus.CREATED, + type: PermissionDTO, + description: 'Permission added sucessfull', + }) + public async register( + @Body() moduleData: NewPermissionDTO, + @UserDecorator() loggedUser: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in register`); + return this.PermissionService.create(moduleData, loggedUser); + } + /** + * This api route use for update the permission of user and role + * @param id + * @param body + * @returns + */ + @Put('/update/:id') + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password'])) + @ApiBody({ type: UpdatePermissionDTO }) + @Permission('Write') + @ACLModules('PERMISSION_MANAGEMENT_CRUDL') + @ApiResponse({ + status: HttpStatus.OK, + type: PermissionDTO, + description: + 'Updates a permission (Read,Write,Delete,Update) or status by admin', + }) + public async updateyield( + @Param('id', new ParseIntPipe()) id: number, + @Body() body: UpdatePermissionDTO, + @UserDecorator() loggedUser: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in updateyield`); + return this.PermissionService.update(id, body, loggedUser); + } + /** + * This api route use for make a request of permission to use api with module select by apiuser + * @param moduleData + * @param loggedUser + * @returns {PermissionDTO} + */ + @Post('/module/apiuser/request') + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), RolesGuard) + @Roles(Role.ApiUser) + @ApiBody({ type: [NewApiUserPermissionDTO] }) + @ApiResponse({ + status: HttpStatus.CREATED, + type: PermissionDTO, + description: 'Request of permission from ApiUser', + }) + public async apiuser_modulerequest( + // @Param('apiuserId') api_user_id: string, + @Body() moduleData: [NewApiUserPermissionDTO], + @UserDecorator() loggedUser: ILoggedInUser, + ): Promise<{ statsu: string; message: string }> { + this.logger.verbose(`With in apiuser_modulerequest`); + return this.PermissionService.permisssion_request(moduleData, loggedUser); + } - /** - * This api route use for aprrove the apiuser permission request by admin - * @param api_user_id:string - * @param moduleData {ApiUserPermissionUpdateDTO} - * @param loggedUser - * @returns {statsu:string,message:string} - */ - @Put('/module/verify/ByAdmin/:apiuserId') - @UseGuards(AuthGuard('jwt'), RolesGuard) - @Roles(Role.Admin) - @ApiBody({ type: ApiUserPermissionUpdateDTO }) - @ApiResponse({ - status: HttpStatus.CREATED, - type: PermissionDTO, - description: 'Request for api user', - }) - public async apiuser_moduleapprove( - @Param('apiuserId') api_user_id: string, - @Body() moduleData: ApiUserPermissionUpdateDTO, - @UserDecorator() loggedUser: ILoggedInUser, - ): Promise<{ statsu: string, message: string }> { - this.logger.verbose(`With in apiuser_moduleapprove`); - return this.PermissionService.permission_veify(api_user_id, moduleData); - } + /** + * This api route use for aprrove the apiuser permission request by admin + * @param api_user_id:string + * @param moduleData {ApiUserPermissionUpdateDTO} + * @param loggedUser + * @returns {statsu:string,message:string} + */ + @Put('/module/verify/ByAdmin/:apiuserId') + @UseGuards(AuthGuard('jwt'), RolesGuard) + @Roles(Role.Admin) + @ApiBody({ type: ApiUserPermissionUpdateDTO }) + @ApiResponse({ + status: HttpStatus.CREATED, + type: PermissionDTO, + description: 'Request for api user', + }) + public async apiuser_moduleapprove( + @Param('apiuserId') api_user_id: string, + @Body() moduleData: ApiUserPermissionUpdateDTO, + @UserDecorator() loggedUser: ILoggedInUser, + ): Promise<{ statsu: string; message: string }> { + this.logger.verbose(`With in apiuser_moduleapprove`); + return this.PermissionService.permission_veify(api_user_id, moduleData); + } } diff --git a/apps/drec-api/src/pods/permission/permission.entity.ts b/apps/drec-api/src/pods/permission/permission.entity.ts index b45b34304..a47bc5429 100755 --- a/apps/drec-api/src/pods/permission/permission.entity.ts +++ b/apps/drec-api/src/pods/permission/permission.entity.ts @@ -4,53 +4,56 @@ import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; import { ApiProperty } from '@nestjs/swagger'; import { Role, EntityType } from '../../utils/enums'; import { IsEnum, IsString, IsArray } from 'class-validator'; -import { IModulePermissionsConfig,IaddModulePermission } from '../../models'; +import { IModulePermissionsConfig, IaddModulePermission } from '../../models'; import { User } from '../user/user.entity'; -import { AClModules } from '../access-control-layer-module-service/aclmodule.entity' +import { AClModules } from '../access-control-layer-module-service/aclmodule.entity'; @Entity({ name: 'aclmodulepermissions' }) -export class ACLModulePermissions extends ExtendedBaseEntity implements IaddModulePermission { - constructor(aclmodulespermission: Partial) { - super(); - - Object.assign(this, aclmodulespermission); - } - - @ApiProperty({ type: Number }) - @PrimaryGeneratedColumn() - id: number; - - @ApiProperty({ type: Number }) - @Column() - aclmodulesId: number; - - @ApiProperty({ enum: EntityType, enumName: 'EntityType' }) - @Column() - @IsEnum(EntityType) - entityType: EntityType; - - @ApiProperty({ type: Number }) - @Column({ nullable: true }) - entityId: number; - - @ApiProperty({ type: () => [String] }) - @Column('simple-array', { nullable: true }) - @IsArray() - permissions: string[]; - - @ApiProperty({ type: Number }) - @Column() - permissionValue: number; - - @ApiProperty({ type:Number }) - @Column({ default: 1}) - status: number; - - @ManyToOne(() => AClModules, (aclmodule) => aclmodule.aclpermission, { - onDelete: 'CASCADE', - }) - aclmodules: AClModules; - // @ManyToOne(() => User, (user) => user.permissions, { - // onDelete: 'CASCADE', - // }) - // user: User; +export class ACLModulePermissions + extends ExtendedBaseEntity + implements IaddModulePermission +{ + constructor(aclmodulespermission: Partial) { + super(); + + Object.assign(this, aclmodulespermission); + } + + @ApiProperty({ type: Number }) + @PrimaryGeneratedColumn() + id: number; + + @ApiProperty({ type: Number }) + @Column() + aclmodulesId: number; + + @ApiProperty({ enum: EntityType, enumName: 'EntityType' }) + @Column() + @IsEnum(EntityType) + entityType: EntityType; + + @ApiProperty({ type: Number }) + @Column({ nullable: true }) + entityId: number; + + @ApiProperty({ type: () => [String] }) + @Column('simple-array', { nullable: true }) + @IsArray() + permissions: string[]; + + @ApiProperty({ type: Number }) + @Column() + permissionValue: number; + + @ApiProperty({ type: Number }) + @Column({ default: 1 }) + status: number; + + @ManyToOne(() => AClModules, (aclmodule) => aclmodule.aclpermission, { + onDelete: 'CASCADE', + }) + aclmodules: AClModules; + // @ManyToOne(() => User, (user) => user.permissions, { + // onDelete: 'CASCADE', + // }) + // user: User; } diff --git a/apps/drec-api/src/pods/permission/permission.module.ts b/apps/drec-api/src/pods/permission/permission.module.ts index 5cbf27171..18213aa7a 100755 --- a/apps/drec-api/src/pods/permission/permission.module.ts +++ b/apps/drec-api/src/pods/permission/permission.module.ts @@ -1,16 +1,20 @@ -import { Module,Global } from '@nestjs/common'; +import { Module, Global } from '@nestjs/common'; import { PermissionController } from './permission.controller'; import { PermissionService } from './permission.service'; -import {ACLModulePermissions} from './permission.entity' +import { ACLModulePermissions } from './permission.entity'; import { TypeOrmModule } from '@nestjs/typeorm'; import { DecimalPermissionValue } from '../access-control-layer-module-service/common/permissionBitposition'; -import {AccessControlLayerModuleServiceModule} from '../access-control-layer-module-service/access-control-layer-module-service.module' -import {UserModule} from '../user/user.module' +import { AccessControlLayerModuleServiceModule } from '../access-control-layer-module-service/access-control-layer-module-service.module'; +import { UserModule } from '../user/user.module'; @Global() @Module({ - imports: [TypeOrmModule.forFeature([ACLModulePermissions]),AccessControlLayerModuleServiceModule,UserModule], + imports: [ + TypeOrmModule.forFeature([ACLModulePermissions]), + AccessControlLayerModuleServiceModule, + UserModule, + ], controllers: [PermissionController], - providers: [PermissionService,DecimalPermissionValue], - exports: [PermissionService] + providers: [PermissionService, DecimalPermissionValue], + exports: [PermissionService], }) export class PermissionModule {} diff --git a/apps/drec-api/src/pods/permission/permission.service.spec.ts b/apps/drec-api/src/pods/permission/permission.service.spec.ts index b8ad1a786..2cae8eb28 100644 --- a/apps/drec-api/src/pods/permission/permission.service.spec.ts +++ b/apps/drec-api/src/pods/permission/permission.service.spec.ts @@ -1,46 +1,49 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { Repository } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { PermissionService } from './permission.service'; -import { ACLModulePermissions } from './permission.entity'; -import { AccessControlLayerModuleServiceService } from '../access-control-layer-module-service/access-control-layer-module-service.service'; -import { UserService } from '../user/user.service'; -import { DecimalPermissionValue } from '../access-control-layer-module-service/common/permissionBitposition'; - -describe('PermissionService', () => { - let service: PermissionService; - let repository: Repository; - let ACLpermissionService: AccessControlLayerModuleServiceService; - let userService: UserService; - let permissionValue: DecimalPermissionValue; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [PermissionService, - { - provide: getRepositoryToken(ACLModulePermissions), - useClass: Repository, - }, - { - provide: AccessControlLayerModuleServiceService, - useValue: {} as any, - }, - { - provide: UserService, - useValue: {} as any, - }, - { - provide: DecimalPermissionValue, - useValue: {} as any, - }, - ], - }).compile(); - - service = module.get(PermissionService); - repository = module.get>(getRepositoryToken(ACLModulePermissions)); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { Repository } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { PermissionService } from './permission.service'; +import { ACLModulePermissions } from './permission.entity'; +import { AccessControlLayerModuleServiceService } from '../access-control-layer-module-service/access-control-layer-module-service.service'; +import { UserService } from '../user/user.service'; +import { DecimalPermissionValue } from '../access-control-layer-module-service/common/permissionBitposition'; + +describe('PermissionService', () => { + let service: PermissionService; + let repository: Repository; + let ACLpermissionService: AccessControlLayerModuleServiceService; + let userService: UserService; + let permissionValue: DecimalPermissionValue; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + PermissionService, + { + provide: getRepositoryToken(ACLModulePermissions), + useClass: Repository, + }, + { + provide: AccessControlLayerModuleServiceService, + useValue: {} as any, + }, + { + provide: UserService, + useValue: {} as any, + }, + { + provide: DecimalPermissionValue, + useValue: {} as any, + }, + ], + }).compile(); + + service = module.get(PermissionService); + repository = module.get>( + getRepositoryToken(ACLModulePermissions), + ); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/permission/permission.service.ts b/apps/drec-api/src/pods/permission/permission.service.ts index aacf02736..58f490f1b 100755 --- a/apps/drec-api/src/pods/permission/permission.service.ts +++ b/apps/drec-api/src/pods/permission/permission.service.ts @@ -1,296 +1,353 @@ - import { - ConflictException, - Injectable, - Logger, - NotFoundException, + ConflictException, + Injectable, + Logger, + NotFoundException, } from '@nestjs/common'; -import { - FindConditions, - Repository, -} from 'typeorm'; +import { FindConditions, Repository } from 'typeorm'; import { ACLModulePermissions } from './permission.entity'; import { InjectRepository } from '@nestjs/typeorm'; import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; -import { PermissionDTO, NewPermissionDTO, UpdatePermissionDTO } from './dto/modulepermission.dto'; -import { IModulePermissionsConfig, LoggedInUser, IACLmodulsPermissions, IaddModulePermission } from '../../models'; +import { + PermissionDTO, + NewPermissionDTO, + UpdatePermissionDTO, +} from './dto/modulepermission.dto'; +import { + IModulePermissionsConfig, + LoggedInUser, + IACLmodulsPermissions, + IaddModulePermission, +} from '../../models'; export type TModuleBaseEntity = ExtendedBaseEntity & IModulePermissionsConfig; import { EntityType, Role, UserPermissionStatus } from '../../utils/enums'; import { DecimalPermissionValue } from '../access-control-layer-module-service/common/permissionBitposition'; -import { AccessControlLayerModuleServiceService } from '../access-control-layer-module-service/access-control-layer-module-service.service' -import { UserService } from '../user/user.service' +import { AccessControlLayerModuleServiceService } from '../access-control-layer-module-service/access-control-layer-module-service.service'; +import { UserService } from '../user/user.service'; @Injectable() export class PermissionService { - - addedPermissionList: any = { - Read: false, - Write: false, - Delete: false, - Update: false, + addedPermissionList: any = { + Read: false, + Write: false, + Delete: false, + Update: false, + }; + private readonly logger = new Logger(PermissionService.name); + constructor( + @InjectRepository(ACLModulePermissions) + private readonly repository: Repository, + private readonly ACLpermissionService: AccessControlLayerModuleServiceService, + private readonly userService: UserService, + + private readonly Permissionvalue: DecimalPermissionValue, + ) {} + + public async create( + data: NewPermissionDTO, + loginuser: LoggedInUser, + ): Promise { + this.logger.verbose(`With in create`); + //console.log(data) + const addedPermissionList: any = { + Read: false, + Write: false, + Delete: false, + Update: false, }; - private readonly logger = new Logger(PermissionService.name); - constructor( - @InjectRepository(ACLModulePermissions) private readonly repository: Repository, - private readonly ACLpermissionService: AccessControlLayerModuleServiceService, - private readonly userService: UserService, - - private readonly Permissionvalue: DecimalPermissionValue, - ) { } - - - public async create(data: NewPermissionDTO, loginuser: LoggedInUser): - Promise { - this.logger.verbose(`With in create`); - //console.log(data) - const addedPermissionList: any = { - Read: false, - Write: false, - Delete: false, - Update: false, - }; - for (var key in addedPermissionList) { - - data.permissions.map((myArr, index) => { - if (myArr === key) { - addedPermissionList[key] = true; - } - }) - + for (var key in addedPermissionList) { + data.permissions.map((myArr, index) => { + if (myArr === key) { + addedPermissionList[key] = true; } - //console.log(addedPermissionList) - var permissionValue = (this.Permissionvalue.computePermissions(addedPermissionList)); - const userpermission = await (this.findOne({ aclmodulesId: data.aclmodulesId, entityType: data.entityType, entityId: data.entityId })); - //console.log("permission69"); - //console.log(userpermission); - if (!userpermission) { - const permissionboolean = await this.checkForExistingmodulepermission(data, permissionValue); - //console.log(permissionboolean) - if (permissionboolean) { - const aclpermission = new ACLModulePermissions({ - ...data, - permissionValue: permissionValue, - - - }); - if (loginuser.role === Role.OrganizationAdmin && data.entityType != 'Role' || loginuser.role === Role.Admin || loginuser.role === Role.ApiUser) { - const modulepermission = await this.repository.save(aclpermission); - return modulepermission; - } else { - this.logger.error(`You are not authorized to add module for any Role`); - throw new ConflictException({ - success: false, - message: `You are not authorized to add module for any Role`, - }); - - } - } else { - this.logger.error(`This Permission not available in this module Name`); - throw new ConflictException({ - success: false, - message: `This Permission not available in this module Name`, - }); - - } + }); + } + //console.log(addedPermissionList) + var permissionValue = + this.Permissionvalue.computePermissions(addedPermissionList); + const userpermission = await this.findOne({ + aclmodulesId: data.aclmodulesId, + entityType: data.entityType, + entityId: data.entityId, + }); + //console.log("permission69"); + //console.log(userpermission); + if (!userpermission) { + const permissionboolean = await this.checkForExistingmodulepermission( + data, + permissionValue, + ); + //console.log(permissionboolean) + if (permissionboolean) { + const aclpermission = new ACLModulePermissions({ + ...data, + permissionValue: permissionValue, + }); + if ( + (loginuser.role === Role.OrganizationAdmin && + data.entityType != 'Role') || + loginuser.role === Role.Admin || + loginuser.role === Role.ApiUser + ) { + const modulepermission = await this.repository.save(aclpermission); + return modulepermission; } else { - this.logger.error(`Permission For ModuleId and Role already exist`); - throw new ConflictException({ - success: false, - message: `Permission For ModuleId and Role already exist`, - }); - // return userpermission; - //throw new NotFoundException(`Permission For ModuleId and Role already exist`); + this.logger.error( + `You are not authorized to add module for any Role`, + ); + throw new ConflictException({ + success: false, + message: `You are not authorized to add module for any Role`, + }); } - + } else { + this.logger.error(`This Permission not available in this module Name`); + throw new ConflictException({ + success: false, + message: `This Permission not available in this module Name`, + }); + } + } else { + this.logger.error(`Permission For ModuleId and Role already exist`); + throw new ConflictException({ + success: false, + message: `Permission For ModuleId and Role already exist`, + }); + // return userpermission; + //throw new NotFoundException(`Permission For ModuleId and Role already exist`); } - private async checkForExistingmodulepermission(data: any, newpermissionvalue: number): Promise { - //console.log(data) - this.logger.verbose(`With in checkForExistingmodulepermission`); - const moduleId = await (this.ACLpermissionService.findOne({ id: data.aclmodulesId })); - - const Ispermission = await (this.Permissionvalue.checkModulePermissionAgainstUserPermission(moduleId.permissionsValue, newpermissionvalue)) - if (data.permissions.length === Ispermission.length) { - return true; - } - return false; + } + private async checkForExistingmodulepermission( + data: any, + newpermissionvalue: number, + ): Promise { + //console.log(data) + this.logger.verbose(`With in checkForExistingmodulepermission`); + const moduleId = await this.ACLpermissionService.findOne({ + id: data.aclmodulesId, + }); + + const Ispermission = + await this.Permissionvalue.checkModulePermissionAgainstUserPermission( + moduleId.permissionsValue, + newpermissionvalue, + ); + if (data.permissions.length === Ispermission.length) { + return true; } - async findById(roleId: any, userId: any, modulename: any): Promise { - this.logger.verbose(`With in findById`); - const moduleId = await (this.ACLpermissionService.findOne({ name: modulename[0] })); - const userpermission = await (this.repository.find({ - relations: ['aclmodules'], - where: [ - { - entityId: roleId, - aclmodulesId: moduleId.id, - status: 1 - }, - { entityType: 'User', entityId: userId, aclmodulesId: moduleId.id, status: 1 } - ], - - })); - - if (!userpermission) { - this.logger.error(`No module found`); - throw new NotFoundException(`No module found `); - } - return userpermission; - } - async findOne(conditions: FindConditions): Promise { - this.logger.verbose(`With in findOne`); - const module = await (this.repository.findOne(conditions) as Promise as Promise); - return module; + return false; + } + async findById( + roleId: any, + userId: any, + modulename: any, + ): Promise { + this.logger.verbose(`With in findById`); + const moduleId = await this.ACLpermissionService.findOne({ + name: modulename[0], + }); + const userpermission = await this.repository.find({ + relations: ['aclmodules'], + where: [ + { + entityId: roleId, + aclmodulesId: moduleId.id, + status: 1, + }, + { + entityType: 'User', + entityId: userId, + aclmodulesId: moduleId.id, + status: 1, + }, + ], + }); + + if (!userpermission) { + this.logger.error(`No module found`); + throw new NotFoundException(`No module found `); } - async getAll(): Promise { - this.logger.verbose(`With in getAll`); - const permission = await this.repository.find({ - order: { - createdAt: 'DESC', - }, - relations: ['aclmodules'], - }); - return permission; + return userpermission; + } + async findOne( + conditions: FindConditions, + ): Promise { + this.logger.verbose(`With in findOne`); + const module = await (this.repository.findOne( + conditions, + ) as Promise as Promise); + return module; + } + async getAll(): Promise { + this.logger.verbose(`With in getAll`); + const permission = await this.repository.find({ + order: { + createdAt: 'DESC', + }, + relations: ['aclmodules'], + }); + return permission; + } + async FindbyRole(id: number): Promise { + this.logger.verbose(`With in FindbyRole`); + const aclpermission = await this.repository.find({ + relations: ['aclmodules'], + where: { + entityType: 'Role', + entityId: id, + }, + order: { + createdAt: 'DESC', + }, + }); + + return aclpermission; + } + async FindbyUser(id: number): Promise { + this.logger.verbose(`With in FindbyUser`); + const useraclpermission = await this.repository.find({ + relations: ['aclmodules'], + where: { + entityType: 'User', + entityId: id, + }, + order: { + createdAt: 'DESC', + }, + }); + + return useraclpermission; + } + async update( + id: number, + data: UpdatePermissionDTO, + loginuser: LoggedInUser, + ): Promise { + this.logger.verbose(`With in update`); + const addedPermissionList: any = { + Read: false, + Write: false, + Delete: false, + Update: false, + }; + for (var key in addedPermissionList) { + data.permissions.map((myArr, index) => { + if (myArr === key) { + addedPermissionList[key] = true; + } + }); } - async FindbyRole(id: number): Promise { - this.logger.verbose(`With in FindbyRole`); - const aclpermission = await this.repository.find({ - relations: ['aclmodules'], - where: { - entityType: 'Role', - entityId: id, - }, - order: { - createdAt: 'DESC', - }, - }); + const userpermission = await this.findOne({ id }); - return aclpermission; - } - async FindbyUser(id: number): Promise { - this.logger.verbose(`With in FindbyUser`); - const useraclpermission = await this.repository.find({ - relations: ['aclmodules'], - where: { - entityType: 'User', - entityId: id, - }, - order: { - createdAt: 'DESC', - }, + var permissionValue = + await this.Permissionvalue.computePermissions(addedPermissionList); + const checkdata = { + aclmodulesId: userpermission.aclmodulesId, + permissions: data.permissions, + }; + const permissionboolean = await this.checkForExistingmodulepermission( + checkdata, + permissionValue, + ); + if (permissionboolean) { + if (loginuser.role === Role.ApiUser) { + await this.repository.update(id, { + permissions: data.permissions, + permissionValue: permissionValue, + status: 0, }); - - return useraclpermission; + } else { + await this.repository.update(id, { + permissions: data.permissions, + permissionValue: permissionValue, + }); + } + + return this.findOne({ id }); + } else { + this.logger.verbose(`This Permission not available in this module Name`); + throw new NotFoundException( + `This Permission not available in this module Name`, + ); } - async update( - id: number, - data: UpdatePermissionDTO, - loginuser: LoggedInUser - ): Promise { - this.logger.verbose(`With in update`); - const addedPermissionList: any = { - Read: false, - Write: false, - Delete: false, - Update: false, - }; - for (var key in addedPermissionList) { - data.permissions.map((myArr, index) => { - if (myArr === key) { - addedPermissionList[key] = true; - } - }) - } - const userpermission = await (this.findOne({ id })); - - var permissionValue = await this.Permissionvalue.computePermissions(addedPermissionList); - const checkdata = { - aclmodulesId: userpermission.aclmodulesId, - permissions: data.permissions - }; - const permissionboolean = await this.checkForExistingmodulepermission(checkdata, permissionValue); - if (permissionboolean) { - if (loginuser.role === Role.ApiUser) { - await this.repository.update(id, { - permissions: data.permissions, - permissionValue: permissionValue, - status: 0 - }); - } else { - await this.repository.update(id, { - permissions: data.permissions, - permissionValue: permissionValue, - - }); - } - - return this.findOne({ id }); - } else { - this.logger.verbose(`This Permission not available in this module Name`); - throw new NotFoundException(`This Permission not available in this module Name`); - } - + } + public async updatepermissionstatus( + id: number, + apipermission_status?: UserPermissionStatus, + ): Promise { + this.logger.verbose(`With in updatepermissionstatus`); + if ( + apipermission_status != undefined && + apipermission_status === UserPermissionStatus.Active + ) { + await this.repository.update(id, { status: 1 }); + } else if ( + apipermission_status != undefined && + apipermission_status === UserPermissionStatus.Deactive + ) { + this.logger.log('Line No: 232'); + await this.repository.update(id, { status: 0 }); + } else { + await this.repository.update(id, { status: 1 }); } - public async updatepermissionstatus( - id: number, - apipermission_status?: UserPermissionStatus - ): Promise { - this.logger.verbose(`With in updatepermissionstatus`); - if (apipermission_status != undefined && apipermission_status === UserPermissionStatus.Active) { - await this.repository.update(id, { status: 1 }); - } else if ((apipermission_status != undefined && apipermission_status === UserPermissionStatus.Deactive)) { - this.logger.log("Line No: 232") - await this.repository.update(id, { status: 0 }); - } else { - await this.repository.update(id, { status: 1 }); - } - return this.findOne({ id: id }); + return this.findOne({ id: id }); + } + + async permisssion_request(data, loginuser): Promise { + this.logger.verbose(`With in permisssion_request`); + if (!data.length) { + this.logger.error(`No module permission available in requeste`); + throw new NotFoundException(`No module permission available in requeste`); } - async permisssion_request(data, loginuser): Promise { - this.logger.verbose(`With in permisssion_request`); - if (!data.length) { - this.logger.error(`No module permission available in requeste`); - throw new NotFoundException(`No module permission available in requeste`); - - } - - const api_user = await this.userService.findById(loginuser.id) - - var permissionIds: any = []; - //@ts-ignore - const api_userpermission = await this.userService.getApiuser(api_user.api_user_id); - - if (api_userpermission.permissionIds != null && api_userpermission.permissionIds.length > 0) { - permissionIds = api_userpermission.permissionIds; - } - await Promise.all( - data.map( - async (newpermission: NewPermissionDTO) => { - newpermission.entityType = EntityType.User - newpermission.entityId = loginuser.id - const perId = await this.create(newpermission, loginuser) - //console.log(perId); - permissionIds.push(perId.id); - }), - ); - //@ts-ignore - await this.userService.apiuser_permission_request(api_user.api_user_id, permissionIds) + const api_user = await this.userService.findById(loginuser.id); - return { statsu: 'success', message: "Your permission request send successfully" } + var permissionIds: any = []; + //@ts-ignore + const api_userpermission = await this.userService.getApiuser( + api_user.api_user_id, + ); - - } - - async permission_veify(api_user_id, data: any): Promise { - this.logger.verbose(`With in permission_veify`); - const verify_apiuser = await this.userService.apiuser_permission_accepted_byadmin(api_user_id, data.status) - const pre = verify_apiuser.permissionIds; - await Promise.all( - pre.map( - async (pre: number) => - await this.updatepermissionstatus(pre, data.status)), - ); - return { statsu: 'success' } + if ( + api_userpermission.permissionIds != null && + api_userpermission.permissionIds.length > 0 + ) { + permissionIds = api_userpermission.permissionIds; } - - + await Promise.all( + data.map(async (newpermission: NewPermissionDTO) => { + newpermission.entityType = EntityType.User; + newpermission.entityId = loginuser.id; + const perId = await this.create(newpermission, loginuser); + //console.log(perId); + permissionIds.push(perId.id); + }), + ); + //@ts-ignore + await this.userService.apiuser_permission_request( + api_user.api_user_id, + permissionIds, + ); + + return { + statsu: 'success', + message: 'Your permission request send successfully', + }; + } + + async permission_veify(api_user_id, data: any): Promise { + this.logger.verbose(`With in permission_veify`); + const verify_apiuser = + await this.userService.apiuser_permission_accepted_byadmin( + api_user_id, + data.status, + ); + const pre = verify_apiuser.permissionIds; + await Promise.all( + pre.map( + async (pre: number) => + await this.updatepermissionstatus(pre, data.status), + ), + ); + return { statsu: 'success' }; + } } diff --git a/apps/drec-api/src/pods/reads/aggregate_readvalue.entity.ts b/apps/drec-api/src/pods/reads/aggregate_readvalue.entity.ts index e6de2287a..b4763fd94 100755 --- a/apps/drec-api/src/pods/reads/aggregate_readvalue.entity.ts +++ b/apps/drec-api/src/pods/reads/aggregate_readvalue.entity.ts @@ -1,17 +1,24 @@ import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; -import { IsEmail, IsEnum, IsNumber, IsString ,IsDate,IsOptional} from 'class-validator'; +import { + IsEmail, + IsEnum, + IsNumber, + IsString, + IsDate, + IsOptional, +} from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; import { ReadType } from '../../utils/enums'; import { IAggregateintermediate } from '../../models'; import { Organization } from '../organization/organization.entity'; -import { - Unit, -} from '@energyweb/energy-api-influxdb'; +import { Unit } from '@energyweb/energy-api-influxdb'; @Entity({ name: 'aggregate_meterread' }) -export class AggregateMeterRead extends ExtendedBaseEntity implements IAggregateintermediate { - +export class AggregateMeterRead + extends ExtendedBaseEntity + implements IAggregateintermediate +{ constructor(aggrgatevalue?: Partial) { super(); Object.assign(this, aggrgatevalue); @@ -20,16 +27,16 @@ export class AggregateMeterRead extends ExtendedBaseEntity implements IAggregate @PrimaryGeneratedColumn() id: number; -// @ApiProperty({ enum: ReadType, enumName: 'type'}) -// @Column() -// @IsEnum(ReadType) -// type: ReadType; + // @ApiProperty({ enum: ReadType, enumName: 'type'}) + // @Column() + // @IsEnum(ReadType) + // type: ReadType; - @ApiProperty({ enum: Unit}) + @ApiProperty({ enum: Unit }) @Column() @IsEnum(Unit) unit: Unit; - + @ApiProperty({ type: String }) @Column() @IsString() @@ -40,24 +47,22 @@ export class AggregateMeterRead extends ExtendedBaseEntity implements IAggregate @IsOptional() updatedAt: Date; - @ApiProperty({ type: Date }) @IsDate() createdAt: Date; - + @ApiProperty({ type: Number }) @Column() @IsNumber() value: number; - + @ApiProperty({ type: Number }) @Column() @IsNumber() deltaValue: number; - + @ApiProperty({ type: String }) @Column() @IsString() externalId: string; - } diff --git a/apps/drec-api/src/pods/reads/delta_firstread.entity.ts b/apps/drec-api/src/pods/reads/delta_firstread.entity.ts index c3c2b9eaa..7d97898dc 100755 --- a/apps/drec-api/src/pods/reads/delta_firstread.entity.ts +++ b/apps/drec-api/src/pods/reads/delta_firstread.entity.ts @@ -1,50 +1,56 @@ -import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; -import { IsEmail, IsEnum, IsNumber, IsString, IsDate, IsOptional } from 'class-validator'; -import { ApiProperty } from '@nestjs/swagger'; - -import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; -import { IDeltaintermediate } from '../../models/Delta_firstread'; -import { - Unit, -} from '@energyweb/energy-api-influxdb'; -@Entity({ name: 'delta_firstread' }) -export class DeltaFirstRead extends ExtendedBaseEntity implements IDeltaintermediate { - - constructor(deltafirstreadvalue?: Partial) { - super(); - Object.assign(this, deltafirstreadvalue); - } - @ApiProperty({ type: Number }) - @PrimaryGeneratedColumn() - id: number; - - @ApiProperty({ enum: Unit }) - @Column() - @IsEnum(Unit) - unit: Unit; - - @ApiProperty({ type: Date }) - @Column() - @IsString() - readsEndDate: Date; - - @ApiProperty({ type: Number }) - @Column() - @IsNumber() - readsvalue: number; - - - @ApiProperty({ type: String }) - @Column() - @IsString() - externalId: string; - - @ApiProperty({ type: Date }) - @IsDate() - createdAt: Date; - - @ApiProperty({ type: Date }) - @IsDate() - @IsOptional() - updatedAt: Date; -} \ No newline at end of file +import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; +import { + IsEmail, + IsEnum, + IsNumber, + IsString, + IsDate, + IsOptional, +} from 'class-validator'; +import { ApiProperty } from '@nestjs/swagger'; + +import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; +import { IDeltaintermediate } from '../../models/Delta_firstread'; +import { Unit } from '@energyweb/energy-api-influxdb'; +@Entity({ name: 'delta_firstread' }) +export class DeltaFirstRead + extends ExtendedBaseEntity + implements IDeltaintermediate +{ + constructor(deltafirstreadvalue?: Partial) { + super(); + Object.assign(this, deltafirstreadvalue); + } + @ApiProperty({ type: Number }) + @PrimaryGeneratedColumn() + id: number; + + @ApiProperty({ enum: Unit }) + @Column() + @IsEnum(Unit) + unit: Unit; + + @ApiProperty({ type: Date }) + @Column() + @IsString() + readsEndDate: Date; + + @ApiProperty({ type: Number }) + @Column() + @IsNumber() + readsvalue: number; + + @ApiProperty({ type: String }) + @Column() + @IsString() + externalId: string; + + @ApiProperty({ type: Date }) + @IsDate() + createdAt: Date; + + @ApiProperty({ type: Date }) + @IsDate() + @IsOptional() + updatedAt: Date; +} diff --git a/apps/drec-api/src/pods/reads/dto/filter-no-off-limit.dto.ts b/apps/drec-api/src/pods/reads/dto/filter-no-off-limit.dto.ts index 21d09b1a1..564d52036 100755 --- a/apps/drec-api/src/pods/reads/dto/filter-no-off-limit.dto.ts +++ b/apps/drec-api/src/pods/reads/dto/filter-no-off-limit.dto.ts @@ -1,45 +1,52 @@ /* */ -import { - IsDate, - IsOptional, - IsPositive - -} from 'class-validator'; +import { IsDate, IsOptional, IsPositive } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; export enum accumulationType { monthly = 'Monthly', yearly = 'Yearly', - } -export enum readType{ - accumulated='accumulated', - meterReads='meterReads' +export enum readType { + accumulated = 'accumulated', + meterReads = 'meterReads', } export class filterNoOffLimit { - - @ApiProperty({enum:readType, description:'Specify the type of reads'}) - readType:readType; + @ApiProperty({ enum: readType, description: 'Specify the type of reads' }) + readType: readType; @IsOptional() - @ApiProperty({description:'Example : 2020-01-01T00:00:00Z',required:false}) + @ApiProperty({ + description: 'Example : 2020-01-01T00:00:00Z', + required: false, + }) start: Date; - @ApiProperty({description:'Example : 2020-01-01T00:00:00Z',required:false}) + @ApiProperty({ + description: 'Example : 2020-01-01T00:00:00Z', + required: false, + }) end: Date; - @ApiProperty({ enum: accumulationType, enumName: 'accumulationType',required:false }) - accumulationType:accumulationType; + @ApiProperty({ + enum: accumulationType, + enumName: 'accumulationType', + required: false, + }) + accumulationType: accumulationType; limit: number; - offset: number; + offset: number; - @IsOptional() - @ApiProperty({type : Number, required : false, description : "Mention when it's requested from Apiuser"}) - organizationId?:number; + @IsOptional() + @ApiProperty({ + type: Number, + required: false, + description: "Mention when it's requested from Apiuser", + }) + organizationId?: number; } -/* */ \ No newline at end of file +/* */ diff --git a/apps/drec-api/src/pods/reads/dto/filter.dto.ts b/apps/drec-api/src/pods/reads/dto/filter.dto.ts index b5e15e0d0..a52e2ee80 100755 --- a/apps/drec-api/src/pods/reads/dto/filter.dto.ts +++ b/apps/drec-api/src/pods/reads/dto/filter.dto.ts @@ -1,31 +1,21 @@ -import { - Unit, -} from '@energyweb/energy-api-influxdb'; -import { - IsDate, - IsOptional, - IsPositive - -} from 'class-validator'; - -import { ApiPropertyOptional } from '@nestjs/swagger'; -import { ApiProperty } from '@nestjs/swagger'; - -export class ReadFilterDTO { - - @ApiProperty({description:'Example : 2020-01-01T00:00:00Z'}) - start: Date; - - @ApiProperty({description:'Example : 2020-01-01T00:00:00Z'}) - end: Date; - - @IsOptional() - @ApiPropertyOptional({ default: 10000 , description: 'Default value : 10000' }) - limit: number; - - @IsOptional() - @ApiPropertyOptional({ default: 0, description: 'Default value : 0' }) - offset: number; - - -} \ No newline at end of file +import { Unit } from '@energyweb/energy-api-influxdb'; +import { IsDate, IsOptional, IsPositive } from 'class-validator'; + +import { ApiPropertyOptional } from '@nestjs/swagger'; +import { ApiProperty } from '@nestjs/swagger'; + +export class ReadFilterDTO { + @ApiProperty({ description: 'Example : 2020-01-01T00:00:00Z' }) + start: Date; + + @ApiProperty({ description: 'Example : 2020-01-01T00:00:00Z' }) + end: Date; + + @IsOptional() + @ApiPropertyOptional({ default: 10000, description: 'Default value : 10000' }) + limit: number; + + @IsOptional() + @ApiPropertyOptional({ default: 0, description: 'Default value : 0' }) + offset: number; +} diff --git a/apps/drec-api/src/pods/reads/dto/intermediate_meter_read.dto.ts b/apps/drec-api/src/pods/reads/dto/intermediate_meter_read.dto.ts index 731e2f07b..cd5867890 100755 --- a/apps/drec-api/src/pods/reads/dto/intermediate_meter_read.dto.ts +++ b/apps/drec-api/src/pods/reads/dto/intermediate_meter_read.dto.ts @@ -6,23 +6,16 @@ import { IsNumber, IsOptional, IsDate, - ValidateNested + ValidateNested, } from 'class-validator'; -import { - Unit, -} from '@energyweb/energy-api-influxdb'; +import { Unit } from '@energyweb/energy-api-influxdb'; import { ApiProperty } from '@nestjs/swagger'; -import {ReadType } from '../../../utils/enums' +import { ReadType } from '../../../utils/enums'; import { Iintermediate, NewReadDTO } from '../../../models'; -import { - YieldStatus, - -} from '../../../utils/enums'; +import { YieldStatus } from '../../../utils/enums'; import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm'; -export class IntmediateMeterReadDTO - implements Omit -{ +export class IntmediateMeterReadDTO implements Omit { @ApiProperty({ type: Number }) @PrimaryGeneratedColumn() id: number; @@ -32,7 +25,7 @@ export class IntmediateMeterReadDTO @IsEnum(ReadType) type: ReadType; - @ApiProperty({ enum: Unit}) + @ApiProperty({ enum: Unit }) @Column() @IsEnum(Unit) unit: Unit; @@ -45,18 +38,17 @@ export class IntmediateMeterReadDTO @Column() @IsString() externalId: string; - } export class NewIntmediateMeterReadDTO - implements Omit + implements + Omit { - @ApiProperty() @IsString() @IsOptional() - timezone?:string; - + timezone?: string; + @ApiProperty({ enum: ReadType, enumName: 'type' }) @IsEnum(ReadType) type: ReadType; @@ -64,7 +56,7 @@ export class NewIntmediateMeterReadDTO @ApiProperty({ enum: Unit }) @IsEnum(Unit) unit: Unit; - + @ApiProperty({ type: () => [NewReadDTO] }) @IsArray() @ValidateNested() @@ -73,6 +65,4 @@ export class NewIntmediateMeterReadDTO @ApiProperty({ type: () => Number }) @IsOptional() organizationId?: number; - - } diff --git a/apps/drec-api/src/pods/reads/history_intermideate_meterread.entity.ts b/apps/drec-api/src/pods/reads/history_intermideate_meterread.entity.ts index fe8d82e40..4fd2059a1 100755 --- a/apps/drec-api/src/pods/reads/history_intermideate_meterread.entity.ts +++ b/apps/drec-api/src/pods/reads/history_intermideate_meterread.entity.ts @@ -1,27 +1,33 @@ import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; -import { IsEmail, IsEnum, IsNumber, IsString ,IsDate,IsOptional} from 'class-validator'; +import { + IsEmail, + IsEnum, + IsNumber, + IsString, + IsDate, + IsOptional, +} from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; import { ReadType } from '../../utils/enums'; import { Iintermediate } from '../../models'; import { Organization } from '../organization/organization.entity'; -import { - Unit, -} from '@energyweb/energy-api-influxdb'; +import { Unit } from '@energyweb/energy-api-influxdb'; @Entity({ name: 'history_intermediate_meteread' }) -export class HistoryIntermediate_MeterRead extends ExtendedBaseEntity implements Iintermediate { - +export class HistoryIntermediate_MeterRead + extends ExtendedBaseEntity + implements Iintermediate +{ constructor(intermideatevalue?: Partial) { super(); Object.assign(this, intermideatevalue); } @ApiProperty({ type: Number }) - @PrimaryGeneratedColumn('uuid') id: number; - @ApiProperty({ enum: ReadType, enumName: 'type'}) + @ApiProperty({ enum: ReadType, enumName: 'type' }) @Column() @IsEnum(ReadType) type: ReadType; @@ -30,29 +36,26 @@ export class HistoryIntermediate_MeterRead extends ExtendedBaseEntity implements @Column() @IsEnum(Unit) unit: Unit; - - + @IsDate() createdAt: Date; @Column() externalId: string; - @Column() @IsNumber() readsvalue: number; - - @Column({ - type: 'timestamp', - precision: 3 + @Column({ + type: 'timestamp', + precision: 3, }) readsStartDate: Date; - - @Column({ - type: 'timestamp', - precision: 3 + + @Column({ + type: 'timestamp', + precision: 3, }) readsEndDate: Date; @@ -67,19 +70,15 @@ export class HistoryIntermediate_MeterRead extends ExtendedBaseEntity implements @IsNumber() issuer_certificate_id: number; - @Column({ - type: 'timestamp', - precision: 3 + @Column({ + type: 'timestamp', + precision: 3, }) - certificate_issuance_startdate:Date; + certificate_issuance_startdate: Date; - @Column({ - type: 'timestamp', - precision: 3 + @Column({ + type: 'timestamp', + precision: 3, }) - certificate_issuance_enddate:Date; - - - - + certificate_issuance_enddate: Date; } diff --git a/apps/drec-api/src/pods/reads/reads.controller.ts b/apps/drec-api/src/pods/reads/reads.controller.ts index 690f3d823..5fb8de64b 100644 --- a/apps/drec-api/src/pods/reads/reads.controller.ts +++ b/apps/drec-api/src/pods/reads/reads.controller.ts @@ -1,1352 +1,1657 @@ -import { - BaseReadsController, - FilterDTO, - ReadDTO, - ReadsService as BaseReadsService, -} from '@energyweb/energy-api-influxdb'; -import { - Body, - Controller, - Get, - HttpStatus, - Inject, - Param, - Post, - Query, - UseGuards, - ConflictException, - HttpException, - BadRequestException, - Logger, - UnauthorizedException, -} from '@nestjs/common'; -import { ApiBearerAuth, ApiResponse, ApiTags, ApiQuery } from '@nestjs/swagger'; -import { BASE_READ_SERVICE } from './const'; -import { ReadsService } from './reads.service'; -import { AuthGuard } from '@nestjs/passport'; -import { Roles } from '../user/decorators/roles.decorator'; -import { RolesGuard } from '../../guards/RolesGuard'; -import { Role } from '../../utils/enums'; -import { NewIntmediateMeterReadDTO } from '../reads/dto/intermediate_meter_read.dto' -import { DeviceService } from '../device'; -import { UserDecorator } from '../user/decorators/user.decorator'; -import { ILoggedInUser, IUser } from '../../models'; -import { DeviceDTO } from '../device/dto'; -import { ReadType } from '../../utils/enums'; -import { isValidUTCDateFormat } from '../../utils/checkForISOStringFormat'; -import * as momentTimeZone from 'moment-timezone'; -import { filterNoOffLimit } from './dto/filter-no-off-limit.dto'; -import { getLocalTimeZoneFromDevice } from '../../utils/localTimeDetailsForDevice'; -import { PermissionGuard } from '../../guards'; -import { Permission } from '../permission/decorators/permission.decorator'; -import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator'; -import { OrganizationService } from '../organization/organization.service'; -import { UserService } from '../user/user.service'; - -@Controller('meter-reads') -@ApiBearerAuth('access-token') -@ApiTags('meter-reads') -export class ReadsController extends BaseReadsController { - - private readonly logger = new Logger(ReadsController.name); - - constructor( - private internalReadsService: ReadsService, - private deviceService: DeviceService, - @Inject(BASE_READ_SERVICE) - baseReadsService: BaseReadsService, - private readonly organizationService: OrganizationService, - private readonly userService: UserService, - ) { - super(baseReadsService); - } -/** - * This api user for get all the timezone list and also from serach key - * @param searchKeyword :string - * @returns {string[]} - */ - @Get('/time-zones') - @UseGuards(PermissionGuard) - @Permission('Read') - @ACLModules('READS_MANAGEMENT_CRUDL') - @ApiResponse({ - status: HttpStatus.OK, - description: 'Returns valid time-zones list', - }) - getTimezones( - @Query('timezoneSearchKeyword') searchKeyword?: string): string[] { - this.logger.verbose(`With in getTimezones`); - if (searchKeyword) { - return momentTimeZone.tz.names().filter(timezone => timezone.toLowerCase().includes(searchKeyword.toLowerCase())); - } else { - return momentTimeZone.tz.names(); - } - } - -/** - * This api route use for to get all read of devcie - * @param meterId :string - * @param filter:{FilterDTO} - * @returns {ReadDTO[]} - */ - @Get('/:externalId') - @ApiResponse({ - status: HttpStatus.OK, - type: [ReadDTO], - description: 'Returns time-series of meter reads', - }) - @UseGuards(AuthGuard('jwt'),PermissionGuard) - @Permission('Read') - @ACLModules('READS_MANAGEMENT_CRUDL') - public async getReads( - @Param('externalId') meterId: string, - @Query() filter: FilterDTO, - // @UserDecorator() user: ILoggedInUser, - ): Promise { - this.logger.verbose(`With in getReads`); - let device: DeviceDTO | null = await this.deviceService.findReads(meterId); - - if (device === null) { - this.logger.error(`Invalid device id`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Invalid device id`, - }) - ); - }); - } - return super.getReads(device.externalId, filter); - } - - -/** - * this api route use for all meter read by externalId - * @param meterId :string - * @param filter {filterNoOffLimit} - * @param pagenumber :number - * @param month :number - * @param year :number - * @param user {ILoggedInUser} - * @returns {ReadDTO} - */ - @Get('new/:externalId') - @ApiQuery({ name: 'Month', type: Number, required: false }) - @ApiQuery({ name: 'Year', type: Number, required: false }) - @ApiQuery({ name: 'pagenumber', type: Number, required: false }) - @ApiResponse({ - status: HttpStatus.OK, - type: [ReadDTO], - description: 'Returns time-series of meter reads', - }) - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) - @Permission('Read') - @ACLModules('READS_MANAGEMENT_CRUDL') - public async newgetReads( - @Param('externalId') meterId: string, - @Query() filter: filterNoOffLimit, - @Query('pagenumber') pagenumber: number | null, - @Query('Month') month: number | null, - @Query('Year') year: number | null, - @UserDecorator() user: ILoggedInUser, - ) - /*: Promise*/ { - this.logger.verbose(`With in newgetReads`); - //finding the device details throught the device service - let orguser : IUser | null; - if(filter.organizationId) { - const organization = await this.organizationService.findOne(filter.organizationId); - orguser = await this.userService.findByEmail(organization.orgEmail); - if(user.role === Role.ApiUser) { - if(user.api_user_id != organization.api_user_id) { - this.logger.error(`An apiuser cannot view the reads of other apiuser's`); - throw new BadRequestException({ - success: false, - message: `An apiuser cannot view the reads of other apiuser's`, - }); - } - else { - user.organizationId = filter.organizationId; - } - } - else { - if(user.role === Role.OrganizationAdmin && (user.organizationId != filter.organizationId)) { - this.logger.error(`An developer can't view the reads of other organization`); - throw new BadRequestException({ - success: false, - message: `An developer can't view the reads of other organization`, - }); - } - - if(user.role != Role.Admin && user.api_user_id != organization.api_user_id) { - this.logger.error(`An developer cannot view the reads of other ApiUsers's`); - throw new BadRequestException({ - success: false, - message: `An developer cannot view the reads of other ApiUsers's`, - }); - } - user.organizationId = filter.organizationId; - - } - } - - filter.offset = 0; - filter.limit = 5; - let device: DeviceDTO | null; - if (month && !year) { - this.logger.error(`Year is required when month is given`); - throw new HttpException('Year is required when month is given', 400) - } - - if (user.role === 'Buyer' || user.role === 'Admin' || (filter.organizationId != undefined && orguser.role === 'Buyer') || (user.role === 'ApiUser' && filter.organizationId == undefined)) { - if(isNaN(parseInt(meterId))) { - this.logger.error(`The URL param externalId should be number.. please provide the device id of which you want to query`); - throw new BadRequestException({ - success: false, - message: `The URL param externalId should be number.. please provide the device id of which you want to query`, - }); - } - device = await this.deviceService.findOne(parseInt(meterId)); - //@ts-ignore - if (orguser != undefined && device.api_user_id === null && orguser.role === enums_1.Role.Buyer) { - this.logger.error(`An buyer of apiuser can't view the reads of direct organization`); - throw new BadRequestException({ - success: false, - message: `An buyer of apiuser can't view the reads of direct organization`, - }); - } - if (user.role === Role.Buyer) { - //@ts-ignore - if (device.api_user_id != null) { - this.logger.error(`An buyer can't view the reads of apiuser's organization`); - throw new BadRequestException({ - success: false, - message: `An buyer can't view the reads of apiuser's organization`, - }); - } - - if (orguser != undefined && device.organizationId === orguser.organization.id) { - this.logger.error(`The organizationId given not same as the device's organization`); - throw new BadRequestException({ - success: false, - message: `The organizationId given not same as the device's organization `, - }); - } - } - } - else { - device = await this.deviceService.findDeviceByDeveloperExternalId(meterId, user.organizationId); - } - - if (device === null) { - this.logger.error(`Invalid device id`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Invalid device id`, - }) - ); - }); - } - - if (filter.readType === 'accumulated' && filter.accumulationType) { - return this.internalReadsService.getAccumulatedReads(device.externalId, user.organizationId, device.developerExternalId, filter.accumulationType, month, year); - } - - else if (filter.readType === 'meterReads') { - let timezone = getLocalTimeZoneFromDevice(filter.start, device); - this.logger.log("the timezone we got from all reads is:::" + timezone); - const returnedObject = await this.internalReadsService.getAllRead(device.externalId, filter, device.createdAt, pagenumber); - this.logger.log("THE RETURNED OBJECT KEYS:::" + Object.keys(returnedObject)); - Object.assign(returnedObject, { "timezone": timezone }); - this.logger.log("THE CHANGED OBJECT KEYS::::::" + Object.keys(returnedObject)); - return returnedObject; - } - else { - this.logger.error(`Invalid readType parameter`); - throw new HttpException('Invalid readType parameter', 400); - } - } - /* */ - - - // @Get('/:meter/difference') - // @ApiResponse({ - // status: HttpStatus.OK, - // type: [ReadDTO], - // description: - // 'Returns time-series of difference between subsequent meter reads', - // }) - // @)UseGuards(AuthGuard('jwt')) - // public async getReadsDifference( - // @Param('meter') meterId: string, - // @Query() filter: FilterDTO, - // ): Promise { - // let device: DeviceDTO | null = await this.deviceService.findReads(meterId); - - // if (device === null) { - - // return new Promise((resolve, reject) => { - // reject( - // new ConflictException({ - // success: false, - // message: `Invalid device id`, - // }) - // ); - // }); - // } - // return super.getReadsDifference(device.externalId, filter); - // } - - // @Get('group/:groupId/aggregate') - // @ApiResponse({ - // status: HttpStatus.OK, - // type: [AggregatedReadDTO], - // description: - // 'Returns aggregated time-series of difference between subsequent meter reads', - // }) - // public async getGroupAggregatedReads( - // @Param('groupId') groupId: number, - // @Query() filter: AggregateFilterDTO, - // ): Promise { - // return this.internalReadsService.getGroupAggregatedReads(groupId, filter); - // } - - // @Get('/:meter/aggregate') - // @ApiResponse({ - // status: HttpStatus.OK, - // type: [AggregatedReadDTO], - // description: - // 'Returns aggregated time-series of difference between subsequent meter reads', - // }) - // public async getReadsAggregates( - // @Param('meter') meterId: string, - // @Query() filter: AggregateFilterDTO, - // ): Promise { - // let device: DeviceDTO | null = await this.deviceService.findReads(meterId); - - // if (device === null) { - - // return new Promise((resolve, reject) => { - // reject( - // new ConflictException({ - // success: false, - // message: `Invalid device id`, - // }) - // ); - // }); - // } - // return super.getReadsAggregates(device.externalId, filter); - // } - - // @Post('/:id') - // @UseGuards(AuthGuard('jwt'), RolesGuard) - // @Roles(Role.Admin, Role.DeviceOwner, Role.OrganizationAdmin) - // public async storeReads( - // @Param('id') id: string, - // @Body() measurements: MeasurementDTO, - // ): Promise { - // return await this.internalReadsService.storeRead(id, measurements); - // } - - /** - * This api route use for add meter read of devices - * @param id - * @param measurements - * @param user - * @returns {NewIntmediateMeterReadDTO} - */ - @Post('new/:id') - @ApiResponse({ - status: HttpStatus.OK, - description: 'New meter reads for historical data, Delta readings and Aggregate Readings', - type: [NewIntmediateMeterReadDTO], - }) - - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), RolesGuard,PermissionGuard) - @Roles(Role.Admin, Role.DeviceOwner, Role.OrganizationAdmin, Role.ApiUser) - @Permission('Write') - @ACLModules('READS_MANAGEMENT_CRUDL') - public async newstoreRead( - @Param('id') id: string, - @Body() measurements: NewIntmediateMeterReadDTO, - @UserDecorator() user: ILoggedInUser, - ): Promise { - this.logger.verbose(`With in newstoreRead`); - if(measurements.organizationId) { - const senderorg = await this.organizationService.findOne(measurements.organizationId); - const orguser = await this.userService.findByEmail(senderorg.orgEmail); - if(user.organizationId !== measurements.organizationId && user.role !== Role.ApiUser) { - this.logger.error(`Organization in measurement is not same as user's organization`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Organization in measurement is not same as user's organization`, - }) - ); - }); - } - - if(user.role === Role.ApiUser) { - if(senderorg.api_user_id !== user.api_user_id) { - this.logger.error(`Organization ${senderorg.name} in measurement is not part of your organization`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Organization ${senderorg.name} in measurement is not part of your organization`, - }) - ); - }); - } - else if(orguser.role != Role.OrganizationAdmin) { - this.logger.error(`Unauthorized`); - return new Promise((resolve, reject) => { - reject( - new UnauthorizedException({ - success: false, - message: `Unauthorized`, - }) - ); - }); - } - else { - //@ts-ignore - user.organizationId = measurements.organizationId; - } - } - } - - if (id.trim() === "" && id.trim() === undefined) { - this.logger.error(`id should not be empty`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `id should not be empty`, - }) - ); - }); - } - id = id.trim(); - let device: DeviceDTO | null = await this.deviceService.findDeviceByDeveloperExternalId(id, user.organizationId); - if (device === null) { - this.logger.error(`Invalid device id`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Invalid device id`, - }) - ); - }); - } - - if (measurements.timezone !== null && measurements.timezone !== undefined && measurements.timezone.toString().trim() !== '') { - measurements.timezone = measurements.timezone.toString().trim(); - let allTimezoneNamesLowerCase: Array = []; - //momentTimeZone.tz.names().forEach(ele=>console.log(ele.toLowerCase())); - momentTimeZone.tz.names().forEach(ele => allTimezoneNamesLowerCase.push(ele.toLowerCase())); - //console.log(allTimezoneNamesLowerCase); - if (!allTimezoneNamesLowerCase.includes(measurements.timezone.toLowerCase())) { - this.logger.error(`Invalid time zone: ${measurements.timezone}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Invalid time zone: ${measurements.timezone}`, - }) - ); - }); - } - measurements.timezone = momentTimeZone.tz.names()[allTimezoneNamesLowerCase.findIndex(ele => ele === measurements.timezone.toLowerCase())]; - let dateInvalid: boolean = false; - measurements.reads.forEach(ele => { - for (let key in ele) { - - if (key === 'starttimestamp' || key === 'endtimestamp') { - if (ele[key]) { - const dateTimeRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.{0,1}\d{0,3}$/; - //@ts-ignore - if (ele[key].includes('.')) { - //@ts-ignore - if (Number.isNaN(parseFloat(ele[key].substring(ele[key].indexOf('.'), ele[key].length)))) { - this.logger.error(`Invalid date sent ${ele[key]}` + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`); - throw new ConflictException({ - success: false, - message: `Invalid date sent ${ele[key]}` + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, - }) - } - } - - //@ts-ignore - if (!dateTimeRegex.test(ele[key])) { - dateInvalid = true; - this.logger.error(`Invalid date sent ${ele[key]}` + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`); - throw new ConflictException({ - success: false, - message: `Invalid date sent ${ele[key]}` + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, - }) - } - else { - - let dateTime; - dateTime = momentTimeZone.tz(ele[key], measurements.timezone); - if (!dateTime.isValid()) { - dateInvalid = true; - this.logger.error(`Invalid date sent ${ele[key]}`); - throw new ConflictException({ - success: false, - message: `Invalid date sent ${ele[key]}`, - }) - } - else { - let milliSeondsToAddSentInRequest: string = ''; - //@ts-ignore - if (ele[key].includes('.') && parseInt(ele[key].substring(ele[key].indexOf('.'), ele[key].length)) != NaN) { - - //@ts-ignore - milliSeondsToAddSentInRequest = ele[key].substring(ele[key].indexOf('.'), ele[key].length); - } - let utcString: string = dateTime.clone().utc().format(); - - if (milliSeondsToAddSentInRequest != '') { - utcString = utcString.substring(0, utcString.length - 1) + milliSeondsToAddSentInRequest + 'Z'; - } - else { - utcString = utcString.substring(0, utcString.length - 1) + '.000Z'; - } - //@ts-ignore - ele[key] = utcString; - } - - } - } - } - } - }); - if (dateInvalid) { - this.logger.error(`Invalid date please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Invalid date please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, - }) - ); - }); - } - device.createdAt = momentTimeZone.tz(device.createdAt, measurements.timezone).toDate(); - device.commissioningDate = momentTimeZone - .tz(new Date(device?.commissioningDate), measurements.timezone) - .format(); - } - - //check for according to read type if start time stamp and end time stamps are sent - if (measurements.type === ReadType.History) { - let datesContainingNullOrEmptyValues: boolean = false; - let datevalid: boolean = true; - let allDatesAreBeforeCreatedAt: boolean = true; - let allStartDatesAreBeforeEnddate: boolean = true; - let readvalue: boolean = true; - let historyallStartDatesAreAftercommissioningDate: boolean = true; - let historyallEndDatesAreAftercommissioningDate: boolean = true; - measurements.reads.forEach(ele => { - //@ts-ignore - if (ele.starttimestamp === null || ele.starttimestamp === undefined || ele.starttimestamp === "" || ele.endtimestamp === null || ele.endtimestamp === undefined || ele.endtimestamp === "") { - datesContainingNullOrEmptyValues = true; - } - //@ts-ignore - let startdateformate = isValidUTCDateFormat(ele.starttimestamp) - //dateFormateToCheck.test(ele.starttimestamp); - //@ts-ignore - let enddateformate = isValidUTCDateFormat(ele.endtimestamp); - - if (!startdateformate || !enddateformate) { - datevalid = false; - } - if (device && device.createdAt) { - if (new Date(ele.endtimestamp).getTime() > new Date(device.createdAt).getTime()) { - allDatesAreBeforeCreatedAt = false; - } - if (new Date(ele.starttimestamp).getTime() > new Date(device.createdAt).getTime()) { - allDatesAreBeforeCreatedAt = false; - } - if (new Date(ele.starttimestamp).getTime() > new Date(ele.endtimestamp).getTime()) { - allStartDatesAreBeforeEnddate = false; - } - } - - if (ele.value < 0) { - readvalue = false; - } - if (device && device.commissioningDate) { - //const cur = new Date().toLocaleString('en-US', { timeZone: measurements.timezone }) - - if (new Date(ele.starttimestamp).getTime() <= new Date(device.commissioningDate).getTime()) { - historyallStartDatesAreAftercommissioningDate = false; - } - if (new Date(ele.endtimestamp).getTime() <= new Date(device.commissioningDate).getTime()) { - historyallEndDatesAreAftercommissioningDate = false; - } - } - }); - - - if (datesContainingNullOrEmptyValues) { - this.logger.error(`One ore more Start Date and End Date values are not sent for History, start and end date is required for History meter ready type`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: 'One ore more Start Date and End Date values are not sent for History, start and end date is required for History meter ready type', - }), - ); - }); - } - if (!datevalid) { - this.logger.error(`Invalid Start Date and/or End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: ' Invalid Start Date and/or End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', - }), - ); - }); - } - if (!allStartDatesAreBeforeEnddate) { - - this.logger.error(`starttimestamp should be prior to endtimestamp. One or more measurements starttimestamp is greater than endtimestamp`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `starttimestamp should be prior to endtimestamp. One or more measurements starttimestamp is greater than endtimestamp `, - }) - ); - }); - } - if (!allDatesAreBeforeCreatedAt) { - this.logger.error(`For History reading start timestamp and end timestamp should be prior to device onboarding date. One or more measurements endtimestamp and or start timestamp is greater than device OnBoarding Date ${device?.createdAt}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `For History reading start timestamp and end timestamp should be prior to device onboarding date. One or more measurements endtimestamp and or start timestamp is greater than device OnBoarding Date ${device?.createdAt}`, - }) - ); - }); - } - - if (!readvalue) { - this.logger.error(`meter read value should be greater then 0`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `meter read value should be greater then 0 `, - }) - ); - }); - } - if (!historyallStartDatesAreAftercommissioningDate) { - this.logger.error(`One or more measurements starttimestamp should be greater than to device Commissioning Date ${device?.commissioningDate}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One or more measurements starttimestamp should be greater than to device Commissioning Date ${device?.commissioningDate}`, - }) - ); - }); - } - if (!historyallEndDatesAreAftercommissioningDate) { - this.logger.error(`One or more measurements endtimestamp should be greater than to device commissioningDate date ${device?.commissioningDate}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One or more measurements endtimestamp should be greater than to device commissioningDate date ${device?.commissioningDate}`, - }) - ); - }); - } - } - if (measurements.type === ReadType.Delta || measurements.type === ReadType.ReadMeter) { - this.logger.log("Line No: 505"); - let datesContainingNullOrEmptyValues: boolean = false; - let datevalid1: boolean = true; - let allDatesAreAfterCreatedAt: boolean = true; - let allDatesAreAftercommissioningDate: boolean = true; - let allEndDatesAreBeforSystemDate: boolean = true; - let enddate: any; - let currentdate: Date = new Date(); - measurements.reads.forEach(ele => { - this.logger.log("Line No: 512"); - //@ts-ignore - if (ele.endtimestamp === null || ele.endtimestamp === undefined || ele.endtimestamp === "") { - datesContainingNullOrEmptyValues = true; - } - //@ts-ignore - let enddateformate = isValidUTCDateFormat(ele.endtimestamp); - - if (!enddateformate) { - datevalid1 = false; - } - //check validation with onboarding date - if (device && device.createdAt) { - if (new Date(ele.endtimestamp).getTime() <= new Date(device.createdAt).getTime()) { - allDatesAreAfterCreatedAt = false; - enddate = ele.endtimestamp - } - } - //check validation with commissioning Date - if (device && device.commissioningDate) { - if (new Date(ele.endtimestamp).getTime() <= new Date(device.commissioningDate).getTime()) { - allDatesAreAftercommissioningDate = false; - enddate = ele.endtimestamp - } - } - - //check validation with System Date - if (new Date(ele.endtimestamp).getTime() > new Date().getTime()) { - allEndDatesAreBeforSystemDate = false; - enddate = ele.endtimestamp - } - - }); - if (datesContainingNullOrEmptyValues) { - this.logger.error(`One ore more End Date values are not sent for ${measurements.type}, end date is required`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One ore more End Date values are not sent for ${measurements.type}, end date is required`, - }), - ); - }); - } - if (!datevalid1) { - this.logger.error(`Invalid End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: ' Invalid End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', - }), - ); - }); - } - if (measurements.timezone !== null && measurements.timezone !== undefined && measurements.timezone.toString().trim() !== '') { - enddate = momentTimeZone.tz(enddate, measurements.timezone); - currentdate = momentTimeZone.tz(currentdate, measurements.timezone).toDate(); - - } - if (!allDatesAreAfterCreatedAt) { - this.logger.error(`One or more measurements endtimestamp ${enddate} is less than or equal to device onboarding date ${device?.createdAt}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One or more measurements endtimestamp ${enddate} is less than or equal to device onboarding date ${device?.createdAt}`, - }) - ); - }); - } - if (!allDatesAreAftercommissioningDate) { - this.logger.error(`One or more measurements endtimestamp ${enddate} should be greater than to device commissioningDate date${device?.commissioningDate}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One or more measurements endtimestamp ${enddate} should be greater than to device commissioningDate date${device?.commissioningDate}`, - }) - ); - }); - } - if (!allEndDatesAreBeforSystemDate) { - this.logger.error(`One or more measurements endtimestamp ${enddate} is greater than current date ${currentdate}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One or more measurements endtimestamp ${enddate} is greater than current date ${currentdate}`, - }) - ); - }); - } - } - - // negative value validation - if (measurements.type === ReadType.History || measurements.type === ReadType.Delta) { - - let readvalue: boolean = true; - measurements.reads.forEach(ele => { - if (ele.value <= 0) { - readvalue = false; - } - }) - if (!readvalue) { - this.logger.error(`meter read value should be greater then 0`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `meter read value should be greater then 0 `, - }) - ); - }); - } - } - // device organization and user organization validation - if (device && device.organizationId !== user.organizationId) { - this.logger.error(`Device doesnt belongs to the requested users organization`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Device doesnt belongs to the requested users organization`, - }) - ); - }); - } - - if (measurements.reads.length > 1) { - this.logger.error(`can not allow multiple reads simultaneously`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `can not allow multiple reads simultaneously `, - }) - ); - }); - } - return await this.internalReadsService.newstoreRead(device.externalId, measurements); - } - - /** - * new api for read add by superadmin - * id param is deivce externalid - * @param id :string - * @param organizationId - * @param measurements - * @param user - * @returns {NewIntmediateMeterReadDTO} - */ - - @Post('addByAdmin/new/:id') - @ApiResponse({ - status: HttpStatus.OK, - description: 'New meter reads for historical data, Delta readings and Aggregate Readings', - type: [NewIntmediateMeterReadDTO], - }) - @ApiQuery({ - name: 'organizationId', - required: false, - type: Number, - description: 'This query parameter is used to for admin...', - - }) - @UseGuards(AuthGuard('jwt'), RolesGuard,PermissionGuard) - @Roles(Role.Admin, Role.DeviceOwner, Role.OrganizationAdmin) - @Permission('Write') - @ACLModules('READS_MANAGEMENT_CRUDL') - public async newstoreReadaddbyadmin( - @Param('id') id: string, - @Query('organizationId') organizationId: number | null, - @Body() measurements: NewIntmediateMeterReadDTO, - @UserDecorator() user: ILoggedInUser, - ): Promise { - this.logger.verbose(`With in newstoreReadaddbyadmin`); - if (id.trim() === "" && id.trim() === undefined) { - this.logger.error(`id should not be empty`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `id should not be empty`, - }) - ); - }); - } - id = id.trim(); - if (organizationId === null || organizationId === undefined|| isNaN(organizationId)) { - organizationId = user.organizationId - } - let device: DeviceDTO | null = await this.deviceService.findDeviceByDeveloperExternalId(id, organizationId); - //console.log(device); - if (device === null) { - this.logger.error(`Invalid device id`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Invalid device id`, - }) - ); - }); - } - - if (measurements.timezone !== null && measurements.timezone !== undefined && measurements.timezone.toString().trim() !== '') { - measurements.timezone = measurements.timezone.toString().trim(); - let allTimezoneNamesLowerCase: Array = []; - //momentTimeZone.tz.names().forEach(ele=>console.log(ele.toLowerCase())); - momentTimeZone.tz.names().forEach(ele => allTimezoneNamesLowerCase.push(ele.toLowerCase())); - //console.log(allTimezoneNamesLowerCase); - if (!allTimezoneNamesLowerCase.includes(measurements.timezone.toLowerCase())) { - this.logger.error(`Invalid time zone: ${measurements.timezone}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Invalid time zone: ${measurements.timezone}`, - }) - ); - }); - } - measurements.timezone = momentTimeZone.tz.names()[allTimezoneNamesLowerCase.findIndex(ele => ele === measurements.timezone.toLowerCase())]; - let dateInvalid: boolean = false; - measurements.reads.forEach(ele => { - for (let key in ele) { - - if (key === 'starttimestamp' || key === 'endtimestamp') { - if (ele[key]) { - const dateTimeRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.{0,1}\d{0,3}$/; - //@ts-ignore - if (ele[key].includes('.')) { - //@ts-ignore - if (Number.isNaN(parseFloat(ele[key].substring(ele[key].indexOf('.'), ele[key].length)))) { - this.logger.error(`Invalid date sent ${ele[key]}` + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`); - throw new ConflictException({ - success: false, - message: `Invalid date sent ${ele[key]}` + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, - }) - } - } - - //@ts-ignore - if (!dateTimeRegex.test(ele[key])) { - dateInvalid = true; - this.logger.error(`Invalid date sent ${ele[key]}` + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`); - throw new ConflictException({ - success: false, - message: `Invalid date sent ${ele[key]}` + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, - }) - } - else { - - let dateTime; - dateTime = momentTimeZone.tz(ele[key], measurements.timezone); - if (!dateTime.isValid()) { - this.logger.error(`Invalid date sent ${ele[key]}`); - dateInvalid = true; - throw new ConflictException({ - success: false, - message: `Invalid date sent ${ele[key]}`, - }) - } - else { - let milliSeondsToAddSentInRequest: string = ''; - //@ts-ignore - if (ele[key].includes('.') && parseInt(ele[key].substring(ele[key].indexOf('.'), ele[key].length)) != NaN) { - - //@ts-ignore - milliSeondsToAddSentInRequest = ele[key].substring(ele[key].indexOf('.'), ele[key].length); - } - let utcString: string = dateTime.clone().utc().format(); - - if (milliSeondsToAddSentInRequest != '') { - utcString = utcString.substring(0, utcString.length - 1) + milliSeondsToAddSentInRequest + 'Z'; - } - else { - utcString = utcString.substring(0, utcString.length - 1) + '.000Z'; - } - //@ts-ignore - ele[key] = utcString; - } - - } - } - } - } - }); - if (dateInvalid) { - this.logger.error(`Invalid date please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Invalid date please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, - }) - ); - }); - } - device.createdAt = momentTimeZone.tz(device.createdAt, measurements.timezone).toDate(); - device.commissioningDate = momentTimeZone - .tz(new Date(device?.commissioningDate), measurements.timezone) - .format(); - } - - //check for according to read type if start time stamp and end time stamps are sent - if (measurements.type === ReadType.History) { - let datesContainingNullOrEmptyValues: boolean = false; - let datevalid: boolean = true; - let allDatesAreBeforeCreatedAt: boolean = true; - let allStartDatesAreBeforeEnddate: boolean = true; - let readvalue: boolean = true; - let historyallStartDatesAreAftercommissioningDate: boolean = true; - let historyallEndDatesAreAftercommissioningDate: boolean = true; - measurements.reads.forEach(ele => { - //@ts-ignore - if (ele.starttimestamp === null || ele.starttimestamp === undefined || ele.starttimestamp === "" || ele.endtimestamp === null || ele.endtimestamp === undefined || ele.endtimestamp === "") { - datesContainingNullOrEmptyValues = true; - } - //@ts-ignore - let startdateformate = isValidUTCDateFormat(ele.starttimestamp) - //dateFormateToCheck.test(ele.starttimestamp); - //@ts-ignore - let enddateformate = isValidUTCDateFormat(ele.endtimestamp); - - if (!startdateformate || !enddateformate) { - datevalid = false; - } - if (device && device.createdAt) { - if (new Date(ele.endtimestamp).getTime() > new Date(device.createdAt).getTime()) { - allDatesAreBeforeCreatedAt = false; - } - if (new Date(ele.starttimestamp).getTime() > new Date(device.createdAt).getTime()) { - allDatesAreBeforeCreatedAt = false; - } - if (new Date(ele.starttimestamp).getTime() > new Date(ele.endtimestamp).getTime()) { - allStartDatesAreBeforeEnddate = false; - } - } - - if (ele.value < 0) { - readvalue = false; - } - if (device && device.commissioningDate) { - //const cur = new Date().toLocaleString('en-US', { timeZone: measurements.timezone }) - - if (new Date(ele.starttimestamp).getTime() <= new Date(device.commissioningDate).getTime()) { - historyallStartDatesAreAftercommissioningDate = false; - } - if (new Date(ele.endtimestamp).getTime() <= new Date(device.commissioningDate).getTime()) { - historyallEndDatesAreAftercommissioningDate = false; - } - } - }); - - - if (datesContainingNullOrEmptyValues) { - this.logger.error(`One ore more Start Date and End Date values are not sent for History, start and end date is required for History meter ready typ`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: 'One ore more Start Date and End Date values are not sent for History, start and end date is required for History meter ready type', - }), - ); - }); - } - if (!datevalid) { - this.logger.error(`Invalid Start Date and/or End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: ' Invalid Start Date and/or End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', - }), - ); - }); - } - if (!allStartDatesAreBeforeEnddate) { - - this.logger.error(`starttimestamp should be prior to endtimestamp. One or more measurements starttimestamp is greater than endtimestamp`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `starttimestamp should be prior to endtimestamp. One or more measurements starttimestamp is greater than endtimestamp `, - }) - ); - }); - } - if (!allDatesAreBeforeCreatedAt) { - this.logger.error(`For History reading start timestamp and end timestamp should be prior to device onboarding date. One or more measurements endtimestamp and or start timestamp is greater than device OnBoarding Date ${device?.createdAt}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `For History reading start timestamp and end timestamp should be prior to device onboarding date. One or more measurements endtimestamp and or start timestamp is greater than device OnBoarding Date ${device?.createdAt}`, - }) - ); - }); - } - - if (!readvalue) { - this.logger.error(`meter read value should be greater then 0`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `meter read value should be greater then 0 `, - }) - ); - }); - } - if (!historyallStartDatesAreAftercommissioningDate) { - this.logger.error(`One or more measurements starttimestamp should be greater than to device Commissioning Date ${device?.commissioningDate}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One or more measurements starttimestamp should be greater than to device Commissioning Date ${device?.commissioningDate}`, - }) - ); - }); - } - if (!historyallEndDatesAreAftercommissioningDate) { - this.logger.error(`One or more measurements endtimestamp should be greater than to device Commissioning Date ${device?.commissioningDate}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One or more measurements endtimestamp should be greater than to device commissioningDate date ${device?.commissioningDate}`, - }) - ); - }); - } - } - if (measurements.type === ReadType.Delta || measurements.type === ReadType.ReadMeter) { - this.logger.log("Line No: 505"); - let datesContainingNullOrEmptyValues: boolean = false; - let datevalid1: boolean = true; - let allDatesAreAfterCreatedAt: boolean = true; - let allDatesAreAftercommissioningDate: boolean = true; - let allEndDatesAreBeforSystemDate: boolean = true; - let enddate: any; - let currentdate: Date = new Date(); - measurements.reads.forEach(ele => { - this.logger.log("Line No: 512"); - //@ts-ignore - if (ele.endtimestamp === null || ele.endtimestamp === undefined || ele.endtimestamp === "") { - datesContainingNullOrEmptyValues = true; - } - //@ts-ignore - let enddateformate = isValidUTCDateFormat(ele.endtimestamp); - - if (!enddateformate) { - datevalid1 = false; - } - //check validation with onboarding date - if (device && device.createdAt) { - if (new Date(ele.endtimestamp).getTime() <= new Date(device.createdAt).getTime()) { - allDatesAreAfterCreatedAt = false; - enddate = ele.endtimestamp - } - } - //check validation with commissioning Date - if (device && device.commissioningDate) { - if (new Date(ele.endtimestamp).getTime() <= new Date(device.commissioningDate).getTime()) { - allDatesAreAftercommissioningDate = false; - enddate = ele.endtimestamp - } - } - - //check validation with System Date - if (new Date(ele.endtimestamp).getTime() > new Date().getTime()) { - allEndDatesAreBeforSystemDate = false; - enddate = ele.endtimestamp - } - - }); - if (datesContainingNullOrEmptyValues) { - this.logger.error(`One ore more End Date values are not sent for ${measurements.type}, end date is required`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One ore more End Date values are not sent for ${measurements.type}, end date is required`, - }), - ); - }); - } - if (!datevalid1) { - this.logger.error(`Invalid End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: ' Invalid End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', - }), - ); - }); - } - if (measurements.timezone !== null && measurements.timezone !== undefined && measurements.timezone.toString().trim() !== '') { - enddate = momentTimeZone.tz(enddate, measurements.timezone); - currentdate = momentTimeZone.tz(currentdate, measurements.timezone).toDate(); - - } - if (!allDatesAreAfterCreatedAt) { - this.logger.error(`One or more measurements endtimestamp ${enddate} is less than or equal to device onboarding date ${device?.createdAt}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One or more measurements endtimestamp ${enddate} is less than or equal to device onboarding date ${device?.createdAt}`, - }) - ); - }); - } - if (!allDatesAreAftercommissioningDate) { - this.logger.error(`One or more measurements endtimestamp ${enddate} should be greater than to device commissioningDate date${device?.commissioningDate}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One or more measurements endtimestamp ${enddate} should be greater than to device commissioningDate date${device?.commissioningDate}`, - }) - ); - }); - } - if (!allEndDatesAreBeforSystemDate) { - this.logger.error(`One or more measurements endtimestamp ${enddate} is greater than current date ${currentdate}`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `One or more measurements endtimestamp ${enddate} is greater than current date ${currentdate}`, - }) - ); - }); - } - } - - // negative value validation - if (measurements.type === ReadType.History || measurements.type === ReadType.Delta) { - - let readvalue: boolean = true; - measurements.reads.forEach(ele => { - if (ele.value <= 0) { - readvalue = false; - } - }) - if (!readvalue) { - this.logger.error(`meter read value should be greater then 0`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `meter read value should be greater then 0 `, - }) - ); - }); - } - } - // device organization and user organization validation - if (device && device.organizationId !== organizationId) { - this.logger.error(`Device doesnt belongs to the requested users organization`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Device doesnt belongs to the requested users organization`, - }) - ); - }); - } - - if (measurements.reads.length > 1) { - this.logger.error(`can not allow multiple reads simultaneously`); - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `can not allow multiple reads simultaneously `, - }) - ); - }); - } - return await this.internalReadsService.newstoreRead(device.externalId, measurements); - } - - /** - * this api create for last read of device by external id - * @returns {enddate:DateTime,value:number} - */ - @Get('/latestread/:externalId') - @ApiResponse({ - status: HttpStatus.OK, - description: 'Returns the latest meter read of the given device', - }) - @UseGuards(AuthGuard(['jwt','oauth2-client-password']),PermissionGuard) - @Permission('Read') - @ACLModules('READS_MANAGEMENT_CRUDL') - public async getLatestMeterRead( - @Param("externalId") externalId: string, - - @UserDecorator() user: ILoggedInUser, - ) { - this.logger.verbose(`With in getLatestMeterRead`); - let device: DeviceDTO | null - if (user.role === 'Buyer' || user.role === 'Admin'|| user.role === 'ApiUser') { - // in buyer case externalid means insert id - device = await this.deviceService.findOne(parseInt(externalId)); - - } else { - device = await this.deviceService.findDeviceByDeveloperExternalId(externalId, user.organizationId); - - } - - if (device === null) { - - return new Promise((resolve, reject) => { - reject( - new ConflictException({ - success: false, - message: `Invalid device id`, - }) - ); - }); - } - - let deviceExternalId; - let latestReadObject; - let latestRead; - - deviceExternalId = device.externalId; - - if (!device.meterReadtype) { - this.logger.error(`Read not found`); - throw new HttpException('Read not found', 400) - } - else { - - latestReadObject = await this.internalReadsService.latestread(deviceExternalId, device.createdAt); - - if (typeof latestReadObject === 'undefined' || latestReadObject.length == 0) { - this.logger.error(`Read Not found`); - throw new HttpException('Read Not found', 400) - } - if (user.role === 'Buyer') { - return { - externalId: device.developerExternalId, - timestamp: latestReadObject[0].timestamp, - value: latestReadObject[0].value - } - } - - return { - "enddate": latestReadObject[0].timestamp, - "value": latestReadObject[0].value - } - } - } - -} +import { + BaseReadsController, + FilterDTO, + ReadDTO, + ReadsService as BaseReadsService, +} from '@energyweb/energy-api-influxdb'; +import { + Body, + Controller, + Get, + HttpStatus, + Inject, + Param, + Post, + Query, + UseGuards, + ConflictException, + HttpException, + BadRequestException, + Logger, + UnauthorizedException, +} from '@nestjs/common'; +import { ApiBearerAuth, ApiResponse, ApiTags, ApiQuery } from '@nestjs/swagger'; +import { BASE_READ_SERVICE } from './const'; +import { ReadsService } from './reads.service'; +import { AuthGuard } from '@nestjs/passport'; +import { Roles } from '../user/decorators/roles.decorator'; +import { RolesGuard } from '../../guards/RolesGuard'; +import { Role } from '../../utils/enums'; +import { NewIntmediateMeterReadDTO } from '../reads/dto/intermediate_meter_read.dto'; +import { DeviceService } from '../device'; +import { UserDecorator } from '../user/decorators/user.decorator'; +import { ILoggedInUser, IUser } from '../../models'; +import { DeviceDTO } from '../device/dto'; +import { ReadType } from '../../utils/enums'; +import { isValidUTCDateFormat } from '../../utils/checkForISOStringFormat'; +import * as momentTimeZone from 'moment-timezone'; +import { filterNoOffLimit } from './dto/filter-no-off-limit.dto'; +import { getLocalTimeZoneFromDevice } from '../../utils/localTimeDetailsForDevice'; +import { PermissionGuard } from '../../guards'; +import { Permission } from '../permission/decorators/permission.decorator'; +import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator'; +import { OrganizationService } from '../organization/organization.service'; +import { UserService } from '../user/user.service'; + +@Controller('meter-reads') +@ApiBearerAuth('access-token') +@ApiTags('meter-reads') +export class ReadsController extends BaseReadsController { + private readonly logger = new Logger(ReadsController.name); + + constructor( + private internalReadsService: ReadsService, + private deviceService: DeviceService, + @Inject(BASE_READ_SERVICE) + baseReadsService: BaseReadsService, + private readonly organizationService: OrganizationService, + private readonly userService: UserService, + ) { + super(baseReadsService); + } + /** + * This api user for get all the timezone list and also from serach key + * @param searchKeyword :string + * @returns {string[]} + */ + @Get('/time-zones') + @UseGuards(PermissionGuard) + @Permission('Read') + @ACLModules('READS_MANAGEMENT_CRUDL') + @ApiResponse({ + status: HttpStatus.OK, + description: 'Returns valid time-zones list', + }) + getTimezones( + @Query('timezoneSearchKeyword') searchKeyword?: string, + ): string[] { + this.logger.verbose(`With in getTimezones`); + if (searchKeyword) { + return momentTimeZone.tz + .names() + .filter((timezone) => + timezone.toLowerCase().includes(searchKeyword.toLowerCase()), + ); + } else { + return momentTimeZone.tz.names(); + } + } + + /** + * This api route use for to get all read of devcie + * @param meterId :string + * @param filter:{FilterDTO} + * @returns {ReadDTO[]} + */ + @Get('/:externalId') + @ApiResponse({ + status: HttpStatus.OK, + type: [ReadDTO], + description: 'Returns time-series of meter reads', + }) + @UseGuards(AuthGuard('jwt'), PermissionGuard) + @Permission('Read') + @ACLModules('READS_MANAGEMENT_CRUDL') + public async getReads( + @Param('externalId') meterId: string, + @Query() filter: FilterDTO, + // @UserDecorator() user: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in getReads`); + let device: DeviceDTO | null = await this.deviceService.findReads(meterId); + + if (device === null) { + this.logger.error(`Invalid device id`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Invalid device id`, + }), + ); + }); + } + return super.getReads(device.externalId, filter); + } + + /** + * this api route use for all meter read by externalId + * @param meterId :string + * @param filter {filterNoOffLimit} + * @param pagenumber :number + * @param month :number + * @param year :number + * @param user {ILoggedInUser} + * @returns {ReadDTO} + */ + @Get('new/:externalId') + @ApiQuery({ name: 'Month', type: Number, required: false }) + @ApiQuery({ name: 'Year', type: Number, required: false }) + @ApiQuery({ name: 'pagenumber', type: Number, required: false }) + @ApiResponse({ + status: HttpStatus.OK, + type: [ReadDTO], + description: 'Returns time-series of meter reads', + }) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) + @Permission('Read') + @ACLModules('READS_MANAGEMENT_CRUDL') + public async newgetReads( + @Param('externalId') meterId: string, + @Query() filter: filterNoOffLimit, + @Query('pagenumber') pagenumber: number | null, + @Query('Month') month: number | null, + @Query('Year') year: number | null, + @UserDecorator() user: ILoggedInUser, + ) /*: Promise*/ { + this.logger.verbose(`With in newgetReads`); + //finding the device details throught the device service + let orguser: IUser | null; + if (filter.organizationId) { + const organization = await this.organizationService.findOne( + filter.organizationId, + ); + orguser = await this.userService.findByEmail(organization.orgEmail); + if (user.role === Role.ApiUser) { + if (user.api_user_id != organization.api_user_id) { + this.logger.error( + `An apiuser cannot view the reads of other apiuser's`, + ); + throw new BadRequestException({ + success: false, + message: `An apiuser cannot view the reads of other apiuser's`, + }); + } else { + user.organizationId = filter.organizationId; + } + } else { + if ( + user.role === Role.OrganizationAdmin && + user.organizationId != filter.organizationId + ) { + this.logger.error( + `An developer can't view the reads of other organization`, + ); + throw new BadRequestException({ + success: false, + message: `An developer can't view the reads of other organization`, + }); + } + + if ( + user.role != Role.Admin && + user.api_user_id != organization.api_user_id + ) { + this.logger.error( + `An developer cannot view the reads of other ApiUsers's`, + ); + throw new BadRequestException({ + success: false, + message: `An developer cannot view the reads of other ApiUsers's`, + }); + } + user.organizationId = filter.organizationId; + } + } + + filter.offset = 0; + filter.limit = 5; + let device: DeviceDTO | null; + if (month && !year) { + this.logger.error(`Year is required when month is given`); + throw new HttpException('Year is required when month is given', 400); + } + + if ( + user.role === 'Buyer' || + user.role === 'Admin' || + (filter.organizationId != undefined && orguser.role === 'Buyer') || + (user.role === 'ApiUser' && filter.organizationId == undefined) + ) { + if (isNaN(parseInt(meterId))) { + this.logger.error( + `The URL param externalId should be number.. please provide the device id of which you want to query`, + ); + throw new BadRequestException({ + success: false, + message: `The URL param externalId should be number.. please provide the device id of which you want to query`, + }); + } + device = await this.deviceService.findOne(parseInt(meterId)); + //@ts-ignore + if ( + orguser != undefined && + device.api_user_id === null && + orguser.role === enums_1.Role.Buyer + ) { + this.logger.error( + `An buyer of apiuser can't view the reads of direct organization`, + ); + throw new BadRequestException({ + success: false, + message: `An buyer of apiuser can't view the reads of direct organization`, + }); + } + if (user.role === Role.Buyer) { + //@ts-ignore + if (device.api_user_id != null) { + this.logger.error( + `An buyer can't view the reads of apiuser's organization`, + ); + throw new BadRequestException({ + success: false, + message: `An buyer can't view the reads of apiuser's organization`, + }); + } + + if ( + orguser != undefined && + device.organizationId === orguser.organization.id + ) { + this.logger.error( + `The organizationId given not same as the device's organization`, + ); + throw new BadRequestException({ + success: false, + message: `The organizationId given not same as the device's organization `, + }); + } + } + } else { + device = await this.deviceService.findDeviceByDeveloperExternalId( + meterId, + user.organizationId, + ); + } + + if (device === null) { + this.logger.error(`Invalid device id`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Invalid device id`, + }), + ); + }); + } + + if (filter.readType === 'accumulated' && filter.accumulationType) { + return this.internalReadsService.getAccumulatedReads( + device.externalId, + user.organizationId, + device.developerExternalId, + filter.accumulationType, + month, + year, + ); + } else if (filter.readType === 'meterReads') { + let timezone = getLocalTimeZoneFromDevice(filter.start, device); + this.logger.log('the timezone we got from all reads is:::' + timezone); + const returnedObject = await this.internalReadsService.getAllRead( + device.externalId, + filter, + device.createdAt, + pagenumber, + ); + this.logger.log( + 'THE RETURNED OBJECT KEYS:::' + Object.keys(returnedObject), + ); + Object.assign(returnedObject, { timezone: timezone }); + this.logger.log( + 'THE CHANGED OBJECT KEYS::::::' + Object.keys(returnedObject), + ); + return returnedObject; + } else { + this.logger.error(`Invalid readType parameter`); + throw new HttpException('Invalid readType parameter', 400); + } + } + /* */ + + // @Get('/:meter/difference') + // @ApiResponse({ + // status: HttpStatus.OK, + // type: [ReadDTO], + // description: + // 'Returns time-series of difference between subsequent meter reads', + // }) + // @)UseGuards(AuthGuard('jwt')) + // public async getReadsDifference( + // @Param('meter') meterId: string, + // @Query() filter: FilterDTO, + // ): Promise { + // let device: DeviceDTO | null = await this.deviceService.findReads(meterId); + + // if (device === null) { + + // return new Promise((resolve, reject) => { + // reject( + // new ConflictException({ + // success: false, + // message: `Invalid device id`, + // }) + // ); + // }); + // } + // return super.getReadsDifference(device.externalId, filter); + // } + + // @Get('group/:groupId/aggregate') + // @ApiResponse({ + // status: HttpStatus.OK, + // type: [AggregatedReadDTO], + // description: + // 'Returns aggregated time-series of difference between subsequent meter reads', + // }) + // public async getGroupAggregatedReads( + // @Param('groupId') groupId: number, + // @Query() filter: AggregateFilterDTO, + // ): Promise { + // return this.internalReadsService.getGroupAggregatedReads(groupId, filter); + // } + + // @Get('/:meter/aggregate') + // @ApiResponse({ + // status: HttpStatus.OK, + // type: [AggregatedReadDTO], + // description: + // 'Returns aggregated time-series of difference between subsequent meter reads', + // }) + // public async getReadsAggregates( + // @Param('meter') meterId: string, + // @Query() filter: AggregateFilterDTO, + // ): Promise { + // let device: DeviceDTO | null = await this.deviceService.findReads(meterId); + + // if (device === null) { + + // return new Promise((resolve, reject) => { + // reject( + // new ConflictException({ + // success: false, + // message: `Invalid device id`, + // }) + // ); + // }); + // } + // return super.getReadsAggregates(device.externalId, filter); + // } + + // @Post('/:id') + // @UseGuards(AuthGuard('jwt'), RolesGuard) + // @Roles(Role.Admin, Role.DeviceOwner, Role.OrganizationAdmin) + // public async storeReads( + // @Param('id') id: string, + // @Body() measurements: MeasurementDTO, + // ): Promise { + // return await this.internalReadsService.storeRead(id, measurements); + // } + + /** + * This api route use for add meter read of devices + * @param id + * @param measurements + * @param user + * @returns {NewIntmediateMeterReadDTO} + */ + @Post('new/:id') + @ApiResponse({ + status: HttpStatus.OK, + description: + 'New meter reads for historical data, Delta readings and Aggregate Readings', + type: [NewIntmediateMeterReadDTO], + }) + @UseGuards( + AuthGuard(['jwt', 'oauth2-client-password']), + RolesGuard, + PermissionGuard, + ) + @Roles(Role.Admin, Role.DeviceOwner, Role.OrganizationAdmin, Role.ApiUser) + @Permission('Write') + @ACLModules('READS_MANAGEMENT_CRUDL') + public async newstoreRead( + @Param('id') id: string, + @Body() measurements: NewIntmediateMeterReadDTO, + @UserDecorator() user: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in newstoreRead`); + if (measurements.organizationId) { + const senderorg = await this.organizationService.findOne( + measurements.organizationId, + ); + const orguser = await this.userService.findByEmail(senderorg.orgEmail); + if ( + user.organizationId !== measurements.organizationId && + user.role !== Role.ApiUser + ) { + this.logger.error( + `Organization in measurement is not same as user's organization`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Organization in measurement is not same as user's organization`, + }), + ); + }); + } + + if (user.role === Role.ApiUser) { + if (senderorg.api_user_id !== user.api_user_id) { + this.logger.error( + `Organization ${senderorg.name} in measurement is not part of your organization`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Organization ${senderorg.name} in measurement is not part of your organization`, + }), + ); + }); + } else if (orguser.role != Role.OrganizationAdmin) { + this.logger.error(`Unauthorized`); + return new Promise((resolve, reject) => { + reject( + new UnauthorizedException({ + success: false, + message: `Unauthorized`, + }), + ); + }); + } else { + //@ts-ignore + user.organizationId = measurements.organizationId; + } + } + } + + if (id.trim() === '' && id.trim() === undefined) { + this.logger.error(`id should not be empty`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `id should not be empty`, + }), + ); + }); + } + id = id.trim(); + let device: DeviceDTO | null = + await this.deviceService.findDeviceByDeveloperExternalId( + id, + user.organizationId, + ); + if (device === null) { + this.logger.error(`Invalid device id`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Invalid device id`, + }), + ); + }); + } + + if ( + measurements.timezone !== null && + measurements.timezone !== undefined && + measurements.timezone.toString().trim() !== '' + ) { + measurements.timezone = measurements.timezone.toString().trim(); + let allTimezoneNamesLowerCase: Array = []; + //momentTimeZone.tz.names().forEach(ele=>console.log(ele.toLowerCase())); + momentTimeZone.tz + .names() + .forEach((ele) => allTimezoneNamesLowerCase.push(ele.toLowerCase())); + //console.log(allTimezoneNamesLowerCase); + if ( + !allTimezoneNamesLowerCase.includes(measurements.timezone.toLowerCase()) + ) { + this.logger.error(`Invalid time zone: ${measurements.timezone}`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Invalid time zone: ${measurements.timezone}`, + }), + ); + }); + } + measurements.timezone = + momentTimeZone.tz.names()[ + allTimezoneNamesLowerCase.findIndex( + (ele) => ele === measurements.timezone.toLowerCase(), + ) + ]; + let dateInvalid: boolean = false; + measurements.reads.forEach((ele) => { + for (let key in ele) { + if (key === 'starttimestamp' || key === 'endtimestamp') { + if (ele[key]) { + const dateTimeRegex = + /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.{0,1}\d{0,3}$/; + //@ts-ignore + if (ele[key].includes('.')) { + //@ts-ignore + if ( + Number.isNaN( + parseFloat( + ele[key].substring( + ele[key].indexOf('.'), + ele[key].length, + ), + ), + ) + ) { + this.logger.error( + `Invalid date sent ${ele[key]}` + + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + ); + throw new ConflictException({ + success: false, + message: + `Invalid date sent ${ele[key]}` + + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + }); + } + } + + //@ts-ignore + if (!dateTimeRegex.test(ele[key])) { + dateInvalid = true; + this.logger.error( + `Invalid date sent ${ele[key]}` + + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + ); + throw new ConflictException({ + success: false, + message: + `Invalid date sent ${ele[key]}` + + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + }); + } else { + let dateTime; + dateTime = momentTimeZone.tz(ele[key], measurements.timezone); + if (!dateTime.isValid()) { + dateInvalid = true; + this.logger.error(`Invalid date sent ${ele[key]}`); + throw new ConflictException({ + success: false, + message: `Invalid date sent ${ele[key]}`, + }); + } else { + let milliSeondsToAddSentInRequest: string = ''; + //@ts-ignore + if ( + ele[key].includes('.') && + parseInt( + ele[key].substring( + ele[key].indexOf('.'), + ele[key].length, + ), + ) != NaN + ) { + //@ts-ignore + milliSeondsToAddSentInRequest = ele[key].substring( + ele[key].indexOf('.'), + ele[key].length, + ); + } + let utcString: string = dateTime.clone().utc().format(); + + if (milliSeondsToAddSentInRequest != '') { + utcString = + utcString.substring(0, utcString.length - 1) + + milliSeondsToAddSentInRequest + + 'Z'; + } else { + utcString = + utcString.substring(0, utcString.length - 1) + '.000Z'; + } + //@ts-ignore + ele[key] = utcString; + } + } + } + } + } + }); + if (dateInvalid) { + this.logger.error( + `Invalid date please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Invalid date please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + }), + ); + }); + } + device.createdAt = momentTimeZone + .tz(device.createdAt, measurements.timezone) + .toDate(); + device.commissioningDate = momentTimeZone + .tz(new Date(device?.commissioningDate), measurements.timezone) + .format(); + } + + //check for according to read type if start time stamp and end time stamps are sent + if (measurements.type === ReadType.History) { + let datesContainingNullOrEmptyValues: boolean = false; + let datevalid: boolean = true; + let allDatesAreBeforeCreatedAt: boolean = true; + let allStartDatesAreBeforeEnddate: boolean = true; + let readvalue: boolean = true; + let historyallStartDatesAreAftercommissioningDate: boolean = true; + let historyallEndDatesAreAftercommissioningDate: boolean = true; + measurements.reads.forEach((ele) => { + //@ts-ignore + if ( + ele.starttimestamp === null || + ele.starttimestamp === undefined || + ele.starttimestamp === '' || + ele.endtimestamp === null || + ele.endtimestamp === undefined || + ele.endtimestamp === '' + ) { + datesContainingNullOrEmptyValues = true; + } + //@ts-ignore + let startdateformate = isValidUTCDateFormat(ele.starttimestamp); + //dateFormateToCheck.test(ele.starttimestamp); + //@ts-ignore + let enddateformate = isValidUTCDateFormat(ele.endtimestamp); + + if (!startdateformate || !enddateformate) { + datevalid = false; + } + if (device && device.createdAt) { + if ( + new Date(ele.endtimestamp).getTime() > + new Date(device.createdAt).getTime() + ) { + allDatesAreBeforeCreatedAt = false; + } + if ( + new Date(ele.starttimestamp).getTime() > + new Date(device.createdAt).getTime() + ) { + allDatesAreBeforeCreatedAt = false; + } + if ( + new Date(ele.starttimestamp).getTime() > + new Date(ele.endtimestamp).getTime() + ) { + allStartDatesAreBeforeEnddate = false; + } + } + + if (ele.value < 0) { + readvalue = false; + } + if (device && device.commissioningDate) { + //const cur = new Date().toLocaleString('en-US', { timeZone: measurements.timezone }) + + if ( + new Date(ele.starttimestamp).getTime() <= + new Date(device.commissioningDate).getTime() + ) { + historyallStartDatesAreAftercommissioningDate = false; + } + if ( + new Date(ele.endtimestamp).getTime() <= + new Date(device.commissioningDate).getTime() + ) { + historyallEndDatesAreAftercommissioningDate = false; + } + } + }); + + if (datesContainingNullOrEmptyValues) { + this.logger.error( + `One ore more Start Date and End Date values are not sent for History, start and end date is required for History meter ready type`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + 'One ore more Start Date and End Date values are not sent for History, start and end date is required for History meter ready type', + }), + ); + }); + } + if (!datevalid) { + this.logger.error( + `Invalid Start Date and/or End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Invalid Start Date and/or End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + }), + ); + }); + } + if (!allStartDatesAreBeforeEnddate) { + this.logger.error( + `starttimestamp should be prior to endtimestamp. One or more measurements starttimestamp is greater than endtimestamp`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `starttimestamp should be prior to endtimestamp. One or more measurements starttimestamp is greater than endtimestamp `, + }), + ); + }); + } + if (!allDatesAreBeforeCreatedAt) { + this.logger.error( + `For History reading start timestamp and end timestamp should be prior to device onboarding date. One or more measurements endtimestamp and or start timestamp is greater than device OnBoarding Date ${device?.createdAt}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `For History reading start timestamp and end timestamp should be prior to device onboarding date. One or more measurements endtimestamp and or start timestamp is greater than device OnBoarding Date ${device?.createdAt}`, + }), + ); + }); + } + + if (!readvalue) { + this.logger.error(`meter read value should be greater then 0`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `meter read value should be greater then 0 `, + }), + ); + }); + } + if (!historyallStartDatesAreAftercommissioningDate) { + this.logger.error( + `One or more measurements starttimestamp should be greater than to device Commissioning Date ${device?.commissioningDate}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One or more measurements starttimestamp should be greater than to device Commissioning Date ${device?.commissioningDate}`, + }), + ); + }); + } + if (!historyallEndDatesAreAftercommissioningDate) { + this.logger.error( + `One or more measurements endtimestamp should be greater than to device commissioningDate date ${device?.commissioningDate}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One or more measurements endtimestamp should be greater than to device commissioningDate date ${device?.commissioningDate}`, + }), + ); + }); + } + } + if ( + measurements.type === ReadType.Delta || + measurements.type === ReadType.ReadMeter + ) { + this.logger.log('Line No: 505'); + let datesContainingNullOrEmptyValues: boolean = false; + let datevalid1: boolean = true; + let allDatesAreAfterCreatedAt: boolean = true; + let allDatesAreAftercommissioningDate: boolean = true; + let allEndDatesAreBeforSystemDate: boolean = true; + let enddate: any; + let currentdate: Date = new Date(); + measurements.reads.forEach((ele) => { + this.logger.log('Line No: 512'); + //@ts-ignore + if ( + ele.endtimestamp === null || + ele.endtimestamp === undefined || + ele.endtimestamp === '' + ) { + datesContainingNullOrEmptyValues = true; + } + //@ts-ignore + let enddateformate = isValidUTCDateFormat(ele.endtimestamp); + + if (!enddateformate) { + datevalid1 = false; + } + //check validation with onboarding date + if (device && device.createdAt) { + if ( + new Date(ele.endtimestamp).getTime() <= + new Date(device.createdAt).getTime() + ) { + allDatesAreAfterCreatedAt = false; + enddate = ele.endtimestamp; + } + } + //check validation with commissioning Date + if (device && device.commissioningDate) { + if ( + new Date(ele.endtimestamp).getTime() <= + new Date(device.commissioningDate).getTime() + ) { + allDatesAreAftercommissioningDate = false; + enddate = ele.endtimestamp; + } + } + + //check validation with System Date + if (new Date(ele.endtimestamp).getTime() > new Date().getTime()) { + allEndDatesAreBeforSystemDate = false; + enddate = ele.endtimestamp; + } + }); + if (datesContainingNullOrEmptyValues) { + this.logger.error( + `One ore more End Date values are not sent for ${measurements.type}, end date is required`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One ore more End Date values are not sent for ${measurements.type}, end date is required`, + }), + ); + }); + } + if (!datevalid1) { + this.logger.error( + `Invalid End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Invalid End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + }), + ); + }); + } + if ( + measurements.timezone !== null && + measurements.timezone !== undefined && + measurements.timezone.toString().trim() !== '' + ) { + enddate = momentTimeZone.tz(enddate, measurements.timezone); + currentdate = momentTimeZone + .tz(currentdate, measurements.timezone) + .toDate(); + } + if (!allDatesAreAfterCreatedAt) { + this.logger.error( + `One or more measurements endtimestamp ${enddate} is less than or equal to device onboarding date ${device?.createdAt}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One or more measurements endtimestamp ${enddate} is less than or equal to device onboarding date ${device?.createdAt}`, + }), + ); + }); + } + if (!allDatesAreAftercommissioningDate) { + this.logger.error( + `One or more measurements endtimestamp ${enddate} should be greater than to device commissioningDate date${device?.commissioningDate}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One or more measurements endtimestamp ${enddate} should be greater than to device commissioningDate date${device?.commissioningDate}`, + }), + ); + }); + } + if (!allEndDatesAreBeforSystemDate) { + this.logger.error( + `One or more measurements endtimestamp ${enddate} is greater than current date ${currentdate}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One or more measurements endtimestamp ${enddate} is greater than current date ${currentdate}`, + }), + ); + }); + } + } + + // negative value validation + if ( + measurements.type === ReadType.History || + measurements.type === ReadType.Delta + ) { + let readvalue: boolean = true; + measurements.reads.forEach((ele) => { + if (ele.value <= 0) { + readvalue = false; + } + }); + if (!readvalue) { + this.logger.error(`meter read value should be greater then 0`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `meter read value should be greater then 0 `, + }), + ); + }); + } + } + // device organization and user organization validation + if (device && device.organizationId !== user.organizationId) { + this.logger.error( + `Device doesnt belongs to the requested users organization`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Device doesnt belongs to the requested users organization`, + }), + ); + }); + } + + if (measurements.reads.length > 1) { + this.logger.error(`can not allow multiple reads simultaneously`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `can not allow multiple reads simultaneously `, + }), + ); + }); + } + return await this.internalReadsService.newstoreRead( + device.externalId, + measurements, + ); + } + + /** + * new api for read add by superadmin + * id param is deivce externalid + * @param id :string + * @param organizationId + * @param measurements + * @param user + * @returns {NewIntmediateMeterReadDTO} + */ + + @Post('addByAdmin/new/:id') + @ApiResponse({ + status: HttpStatus.OK, + description: + 'New meter reads for historical data, Delta readings and Aggregate Readings', + type: [NewIntmediateMeterReadDTO], + }) + @ApiQuery({ + name: 'organizationId', + required: false, + type: Number, + description: 'This query parameter is used to for admin...', + }) + @UseGuards(AuthGuard('jwt'), RolesGuard, PermissionGuard) + @Roles(Role.Admin, Role.DeviceOwner, Role.OrganizationAdmin) + @Permission('Write') + @ACLModules('READS_MANAGEMENT_CRUDL') + public async newstoreReadaddbyadmin( + @Param('id') id: string, + @Query('organizationId') organizationId: number | null, + @Body() measurements: NewIntmediateMeterReadDTO, + @UserDecorator() user: ILoggedInUser, + ): Promise { + this.logger.verbose(`With in newstoreReadaddbyadmin`); + if (id.trim() === '' && id.trim() === undefined) { + this.logger.error(`id should not be empty`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `id should not be empty`, + }), + ); + }); + } + id = id.trim(); + if ( + organizationId === null || + organizationId === undefined || + isNaN(organizationId) + ) { + organizationId = user.organizationId; + } + let device: DeviceDTO | null = + await this.deviceService.findDeviceByDeveloperExternalId( + id, + organizationId, + ); + //console.log(device); + if (device === null) { + this.logger.error(`Invalid device id`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Invalid device id`, + }), + ); + }); + } + + if ( + measurements.timezone !== null && + measurements.timezone !== undefined && + measurements.timezone.toString().trim() !== '' + ) { + measurements.timezone = measurements.timezone.toString().trim(); + let allTimezoneNamesLowerCase: Array = []; + //momentTimeZone.tz.names().forEach(ele=>console.log(ele.toLowerCase())); + momentTimeZone.tz + .names() + .forEach((ele) => allTimezoneNamesLowerCase.push(ele.toLowerCase())); + //console.log(allTimezoneNamesLowerCase); + if ( + !allTimezoneNamesLowerCase.includes(measurements.timezone.toLowerCase()) + ) { + this.logger.error(`Invalid time zone: ${measurements.timezone}`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Invalid time zone: ${measurements.timezone}`, + }), + ); + }); + } + measurements.timezone = + momentTimeZone.tz.names()[ + allTimezoneNamesLowerCase.findIndex( + (ele) => ele === measurements.timezone.toLowerCase(), + ) + ]; + let dateInvalid: boolean = false; + measurements.reads.forEach((ele) => { + for (let key in ele) { + if (key === 'starttimestamp' || key === 'endtimestamp') { + if (ele[key]) { + const dateTimeRegex = + /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.{0,1}\d{0,3}$/; + //@ts-ignore + if (ele[key].includes('.')) { + //@ts-ignore + if ( + Number.isNaN( + parseFloat( + ele[key].substring( + ele[key].indexOf('.'), + ele[key].length, + ), + ), + ) + ) { + this.logger.error( + `Invalid date sent ${ele[key]}` + + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + ); + throw new ConflictException({ + success: false, + message: + `Invalid date sent ${ele[key]}` + + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + }); + } + } + + //@ts-ignore + if (!dateTimeRegex.test(ele[key])) { + dateInvalid = true; + this.logger.error( + `Invalid date sent ${ele[key]}` + + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + ); + throw new ConflictException({ + success: false, + message: + `Invalid date sent ${ele[key]}` + + ` please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + }); + } else { + let dateTime; + dateTime = momentTimeZone.tz(ele[key], measurements.timezone); + if (!dateTime.isValid()) { + this.logger.error(`Invalid date sent ${ele[key]}`); + dateInvalid = true; + throw new ConflictException({ + success: false, + message: `Invalid date sent ${ele[key]}`, + }); + } else { + let milliSeondsToAddSentInRequest: string = ''; + //@ts-ignore + if ( + ele[key].includes('.') && + parseInt( + ele[key].substring( + ele[key].indexOf('.'), + ele[key].length, + ), + ) != NaN + ) { + //@ts-ignore + milliSeondsToAddSentInRequest = ele[key].substring( + ele[key].indexOf('.'), + ele[key].length, + ); + } + let utcString: string = dateTime.clone().utc().format(); + + if (milliSeondsToAddSentInRequest != '') { + utcString = + utcString.substring(0, utcString.length - 1) + + milliSeondsToAddSentInRequest + + 'Z'; + } else { + utcString = + utcString.substring(0, utcString.length - 1) + '.000Z'; + } + //@ts-ignore + ele[key] = utcString; + } + } + } + } + } + }); + if (dateInvalid) { + this.logger.error( + `Invalid date please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Invalid date please sent valid date, format for dates is YYYY-MM-DD hh:mm:ss example 2020-02-19 19:20:55 or to include milliseconds add dot and upto 3 digits after seconds example 2020-02-19 19:20:55.2 or 2020-02-19 19:20:54.333`, + }), + ); + }); + } + device.createdAt = momentTimeZone + .tz(device.createdAt, measurements.timezone) + .toDate(); + device.commissioningDate = momentTimeZone + .tz(new Date(device?.commissioningDate), measurements.timezone) + .format(); + } + + //check for according to read type if start time stamp and end time stamps are sent + if (measurements.type === ReadType.History) { + let datesContainingNullOrEmptyValues: boolean = false; + let datevalid: boolean = true; + let allDatesAreBeforeCreatedAt: boolean = true; + let allStartDatesAreBeforeEnddate: boolean = true; + let readvalue: boolean = true; + let historyallStartDatesAreAftercommissioningDate: boolean = true; + let historyallEndDatesAreAftercommissioningDate: boolean = true; + measurements.reads.forEach((ele) => { + //@ts-ignore + if ( + ele.starttimestamp === null || + ele.starttimestamp === undefined || + ele.starttimestamp === '' || + ele.endtimestamp === null || + ele.endtimestamp === undefined || + ele.endtimestamp === '' + ) { + datesContainingNullOrEmptyValues = true; + } + //@ts-ignore + let startdateformate = isValidUTCDateFormat(ele.starttimestamp); + //dateFormateToCheck.test(ele.starttimestamp); + //@ts-ignore + let enddateformate = isValidUTCDateFormat(ele.endtimestamp); + + if (!startdateformate || !enddateformate) { + datevalid = false; + } + if (device && device.createdAt) { + if ( + new Date(ele.endtimestamp).getTime() > + new Date(device.createdAt).getTime() + ) { + allDatesAreBeforeCreatedAt = false; + } + if ( + new Date(ele.starttimestamp).getTime() > + new Date(device.createdAt).getTime() + ) { + allDatesAreBeforeCreatedAt = false; + } + if ( + new Date(ele.starttimestamp).getTime() > + new Date(ele.endtimestamp).getTime() + ) { + allStartDatesAreBeforeEnddate = false; + } + } + + if (ele.value < 0) { + readvalue = false; + } + if (device && device.commissioningDate) { + //const cur = new Date().toLocaleString('en-US', { timeZone: measurements.timezone }) + + if ( + new Date(ele.starttimestamp).getTime() <= + new Date(device.commissioningDate).getTime() + ) { + historyallStartDatesAreAftercommissioningDate = false; + } + if ( + new Date(ele.endtimestamp).getTime() <= + new Date(device.commissioningDate).getTime() + ) { + historyallEndDatesAreAftercommissioningDate = false; + } + } + }); + + if (datesContainingNullOrEmptyValues) { + this.logger.error( + `One ore more Start Date and End Date values are not sent for History, start and end date is required for History meter ready typ`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + 'One ore more Start Date and End Date values are not sent for History, start and end date is required for History meter ready type', + }), + ); + }); + } + if (!datevalid) { + this.logger.error( + `Invalid Start Date and/or End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Invalid Start Date and/or End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + }), + ); + }); + } + if (!allStartDatesAreBeforeEnddate) { + this.logger.error( + `starttimestamp should be prior to endtimestamp. One or more measurements starttimestamp is greater than endtimestamp`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `starttimestamp should be prior to endtimestamp. One or more measurements starttimestamp is greater than endtimestamp `, + }), + ); + }); + } + if (!allDatesAreBeforeCreatedAt) { + this.logger.error( + `For History reading start timestamp and end timestamp should be prior to device onboarding date. One or more measurements endtimestamp and or start timestamp is greater than device OnBoarding Date ${device?.createdAt}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `For History reading start timestamp and end timestamp should be prior to device onboarding date. One or more measurements endtimestamp and or start timestamp is greater than device OnBoarding Date ${device?.createdAt}`, + }), + ); + }); + } + + if (!readvalue) { + this.logger.error(`meter read value should be greater then 0`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `meter read value should be greater then 0 `, + }), + ); + }); + } + if (!historyallStartDatesAreAftercommissioningDate) { + this.logger.error( + `One or more measurements starttimestamp should be greater than to device Commissioning Date ${device?.commissioningDate}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One or more measurements starttimestamp should be greater than to device Commissioning Date ${device?.commissioningDate}`, + }), + ); + }); + } + if (!historyallEndDatesAreAftercommissioningDate) { + this.logger.error( + `One or more measurements endtimestamp should be greater than to device Commissioning Date ${device?.commissioningDate}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One or more measurements endtimestamp should be greater than to device commissioningDate date ${device?.commissioningDate}`, + }), + ); + }); + } + } + if ( + measurements.type === ReadType.Delta || + measurements.type === ReadType.ReadMeter + ) { + this.logger.log('Line No: 505'); + let datesContainingNullOrEmptyValues: boolean = false; + let datevalid1: boolean = true; + let allDatesAreAfterCreatedAt: boolean = true; + let allDatesAreAftercommissioningDate: boolean = true; + let allEndDatesAreBeforSystemDate: boolean = true; + let enddate: any; + let currentdate: Date = new Date(); + measurements.reads.forEach((ele) => { + this.logger.log('Line No: 512'); + //@ts-ignore + if ( + ele.endtimestamp === null || + ele.endtimestamp === undefined || + ele.endtimestamp === '' + ) { + datesContainingNullOrEmptyValues = true; + } + //@ts-ignore + let enddateformate = isValidUTCDateFormat(ele.endtimestamp); + + if (!enddateformate) { + datevalid1 = false; + } + //check validation with onboarding date + if (device && device.createdAt) { + if ( + new Date(ele.endtimestamp).getTime() <= + new Date(device.createdAt).getTime() + ) { + allDatesAreAfterCreatedAt = false; + enddate = ele.endtimestamp; + } + } + //check validation with commissioning Date + if (device && device.commissioningDate) { + if ( + new Date(ele.endtimestamp).getTime() <= + new Date(device.commissioningDate).getTime() + ) { + allDatesAreAftercommissioningDate = false; + enddate = ele.endtimestamp; + } + } + + //check validation with System Date + if (new Date(ele.endtimestamp).getTime() > new Date().getTime()) { + allEndDatesAreBeforSystemDate = false; + enddate = ele.endtimestamp; + } + }); + if (datesContainingNullOrEmptyValues) { + this.logger.error( + `One ore more End Date values are not sent for ${measurements.type}, end date is required`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One ore more End Date values are not sent for ${measurements.type}, end date is required`, + }), + ); + }); + } + if (!datevalid1) { + this.logger.error( + `Invalid End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: + ' Invalid End Date, valid format is YYYY-MM-DDThh:mm:ss.millisecondsZ example 2022-10-18T11:35:27.640Z ', + }), + ); + }); + } + if ( + measurements.timezone !== null && + measurements.timezone !== undefined && + measurements.timezone.toString().trim() !== '' + ) { + enddate = momentTimeZone.tz(enddate, measurements.timezone); + currentdate = momentTimeZone + .tz(currentdate, measurements.timezone) + .toDate(); + } + if (!allDatesAreAfterCreatedAt) { + this.logger.error( + `One or more measurements endtimestamp ${enddate} is less than or equal to device onboarding date ${device?.createdAt}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One or more measurements endtimestamp ${enddate} is less than or equal to device onboarding date ${device?.createdAt}`, + }), + ); + }); + } + if (!allDatesAreAftercommissioningDate) { + this.logger.error( + `One or more measurements endtimestamp ${enddate} should be greater than to device commissioningDate date${device?.commissioningDate}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One or more measurements endtimestamp ${enddate} should be greater than to device commissioningDate date${device?.commissioningDate}`, + }), + ); + }); + } + if (!allEndDatesAreBeforSystemDate) { + this.logger.error( + `One or more measurements endtimestamp ${enddate} is greater than current date ${currentdate}`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `One or more measurements endtimestamp ${enddate} is greater than current date ${currentdate}`, + }), + ); + }); + } + } + + // negative value validation + if ( + measurements.type === ReadType.History || + measurements.type === ReadType.Delta + ) { + let readvalue: boolean = true; + measurements.reads.forEach((ele) => { + if (ele.value <= 0) { + readvalue = false; + } + }); + if (!readvalue) { + this.logger.error(`meter read value should be greater then 0`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `meter read value should be greater then 0 `, + }), + ); + }); + } + } + // device organization and user organization validation + if (device && device.organizationId !== organizationId) { + this.logger.error( + `Device doesnt belongs to the requested users organization`, + ); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Device doesnt belongs to the requested users organization`, + }), + ); + }); + } + + if (measurements.reads.length > 1) { + this.logger.error(`can not allow multiple reads simultaneously`); + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `can not allow multiple reads simultaneously `, + }), + ); + }); + } + return await this.internalReadsService.newstoreRead( + device.externalId, + measurements, + ); + } + + /** + * this api create for last read of device by external id + * @returns {enddate:DateTime,value:number} + */ + @Get('/latestread/:externalId') + @ApiResponse({ + status: HttpStatus.OK, + description: 'Returns the latest meter read of the given device', + }) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) + @Permission('Read') + @ACLModules('READS_MANAGEMENT_CRUDL') + public async getLatestMeterRead( + @Param('externalId') externalId: string, + + @UserDecorator() user: ILoggedInUser, + ) { + this.logger.verbose(`With in getLatestMeterRead`); + let device: DeviceDTO | null; + if ( + user.role === 'Buyer' || + user.role === 'Admin' || + user.role === 'ApiUser' + ) { + // in buyer case externalid means insert id + device = await this.deviceService.findOne(parseInt(externalId)); + } else { + device = await this.deviceService.findDeviceByDeveloperExternalId( + externalId, + user.organizationId, + ); + } + + if (device === null) { + return new Promise((resolve, reject) => { + reject( + new ConflictException({ + success: false, + message: `Invalid device id`, + }), + ); + }); + } + + let deviceExternalId; + let latestReadObject; + let latestRead; + + deviceExternalId = device.externalId; + + if (!device.meterReadtype) { + this.logger.error(`Read not found`); + throw new HttpException('Read not found', 400); + } else { + latestReadObject = await this.internalReadsService.latestread( + deviceExternalId, + device.createdAt, + ); + + if ( + typeof latestReadObject === 'undefined' || + latestReadObject.length == 0 + ) { + this.logger.error(`Read Not found`); + throw new HttpException('Read Not found', 400); + } + if (user.role === 'Buyer') { + return { + externalId: device.developerExternalId, + timestamp: latestReadObject[0].timestamp, + value: latestReadObject[0].value, + }; + } + + return { + enddate: latestReadObject[0].timestamp, + value: latestReadObject[0].value, + }; + } + } +} diff --git a/apps/drec-api/src/pods/reads/reads.module.ts b/apps/drec-api/src/pods/reads/reads.module.ts index 11004505a..4bbf45736 100755 --- a/apps/drec-api/src/pods/reads/reads.module.ts +++ b/apps/drec-api/src/pods/reads/reads.module.ts @@ -12,10 +12,10 @@ import { BaseReadServiceForCi } from './baseReadServiceForCi.service'; import { DeviceGroupModule } from '../device-group/device-group.module'; import { TypeOrmModule } from '@nestjs/typeorm'; -import {AggregateMeterRead } from './aggregate_readvalue.entity'; -import {HistoryIntermediate_MeterRead} from './history_intermideate_meterread.entity'; -import {DeltaFirstRead} from './delta_firstread.entity' - const baseReadServiceProvider = { +import { AggregateMeterRead } from './aggregate_readvalue.entity'; +import { HistoryIntermediate_MeterRead } from './history_intermideate_meterread.entity'; +import { DeltaFirstRead } from './delta_firstread.entity'; +const baseReadServiceProvider = { provide: BASE_READ_SERVICE, useFactory: (configService: ConfigService) => { if (configService.get('MODE') == 'CI') { @@ -28,19 +28,21 @@ import {DeltaFirstRead} from './delta_firstread.entity' }; @Module({ - imports: [ - TypeOrmModule.forFeature([AggregateMeterRead,HistoryIntermediate_MeterRead,DeltaFirstRead]), + TypeOrmModule.forFeature([ + AggregateMeterRead, + HistoryIntermediate_MeterRead, + DeltaFirstRead, + ]), ConfigModule, CqrsModule, DeviceModule, DeviceGroupModule, UserModule, OrganizationModule, - ], controllers: [ReadsController], providers: [baseReadServiceProvider, ReadsService], - exports: [baseReadServiceProvider,ReadsService], + exports: [baseReadServiceProvider, ReadsService], }) export class ReadsModule {} diff --git a/apps/drec-api/src/pods/reads/reads.service.spec.ts b/apps/drec-api/src/pods/reads/reads.service.spec.ts index 2cdb5aaea..aeaf4b3f7 100644 --- a/apps/drec-api/src/pods/reads/reads.service.spec.ts +++ b/apps/drec-api/src/pods/reads/reads.service.spec.ts @@ -1,70 +1,73 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { Repository } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { ReadsService } from './reads.service'; -import { AggregateMeterRead } from './aggregate_readvalue.entity'; -import { HistoryIntermediate_MeterRead } from './history_intermideate_meterread.entity'; -import { DeltaFirstRead } from './delta_firstread.entity'; -import { ReadsService as BaseReadService } from '@energyweb/energy-api-influxdb'; -import { DeviceService } from '../device'; -import { DeviceGroupService } from '../device-group/device-group.service'; -import { OrganizationService } from '../organization/organization.service'; -import { EventBus } from '@nestjs/cqrs'; - -describe('ReadsService', () => { - let service: ReadsService; - let aggregateRepository: Repository; - let historyRepository: Repository; - let deltaRepository: Repository; - let baseReadsService: BaseReadService; - let deviceService: DeviceService; - let deviceGroupService: DeviceGroupService; - let organizationService: OrganizationService; - let eventBus: EventBus; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [ReadsService, - { - provide: getRepositoryToken(AggregateMeterRead), - useClass: Repository, - }, - { - provide: getRepositoryToken(HistoryIntermediate_MeterRead), - useClass: Repository, - }, - { - provide: getRepositoryToken(DeltaFirstRead), - useClass: Repository, - }, - { - provide: BaseReadService, - useValue: {} as any, - }, - { - provide: DeviceService, - useValue: {} as any, - }, - { - provide: DeviceGroupService, - useValue: {} as any, - }, - { - provide: OrganizationService, - useValue: {} as any, - }, - { - provide: EventBus, - useValue: {} as any, - }, - ], - }).compile(); - - service = module.get(ReadsService); - aggregateRepository = module.get>(getRepositoryToken(AggregateMeterRead)); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { Repository } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { ReadsService } from './reads.service'; +import { AggregateMeterRead } from './aggregate_readvalue.entity'; +import { HistoryIntermediate_MeterRead } from './history_intermideate_meterread.entity'; +import { DeltaFirstRead } from './delta_firstread.entity'; +import { ReadsService as BaseReadService } from '@energyweb/energy-api-influxdb'; +import { DeviceService } from '../device'; +import { DeviceGroupService } from '../device-group/device-group.service'; +import { OrganizationService } from '../organization/organization.service'; +import { EventBus } from '@nestjs/cqrs'; + +describe('ReadsService', () => { + let service: ReadsService; + let aggregateRepository: Repository; + let historyRepository: Repository; + let deltaRepository: Repository; + let baseReadsService: BaseReadService; + let deviceService: DeviceService; + let deviceGroupService: DeviceGroupService; + let organizationService: OrganizationService; + let eventBus: EventBus; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + ReadsService, + { + provide: getRepositoryToken(AggregateMeterRead), + useClass: Repository, + }, + { + provide: getRepositoryToken(HistoryIntermediate_MeterRead), + useClass: Repository, + }, + { + provide: getRepositoryToken(DeltaFirstRead), + useClass: Repository, + }, + { + provide: BaseReadService, + useValue: {} as any, + }, + { + provide: DeviceService, + useValue: {} as any, + }, + { + provide: DeviceGroupService, + useValue: {} as any, + }, + { + provide: OrganizationService, + useValue: {} as any, + }, + { + provide: EventBus, + useValue: {} as any, + }, + ], + }).compile(); + + service = module.get(ReadsService); + aggregateRepository = module.get>( + getRepositoryToken(AggregateMeterRead), + ); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/reads/reads.service.ts b/apps/drec-api/src/pods/reads/reads.service.ts index 785ddff47..57803e52e 100755 --- a/apps/drec-api/src/pods/reads/reads.service.ts +++ b/apps/drec-api/src/pods/reads/reads.service.ts @@ -1,5 +1,21 @@ -import { Inject, Injectable, Logger, NotFoundException, ConflictException, HttpException, HttpStatus } from '@nestjs/common'; -import { FindOneOptions, Repository, Brackets, SelectQueryBuilder, In, FindConditions, Any } from 'typeorm'; +import { + Inject, + Injectable, + Logger, + NotFoundException, + ConflictException, + HttpException, + HttpStatus, +} from '@nestjs/common'; +import { + FindOneOptions, + Repository, + Brackets, + SelectQueryBuilder, + In, + FindConditions, + Any, +} from 'typeorm'; import axios from 'axios'; import { @@ -25,23 +41,35 @@ import { DeviceGroupService } from '../device-group/device-group.service'; import { HistoryIntermediate_MeterRead } from './history_intermideate_meterread.entity'; import { AggregateMeterRead } from './aggregate_readvalue.entity'; import { flattenDeep, values, groupBy, mean, sum, head } from 'lodash'; -import { NewIntmediateMeterReadDTO, IntmediateMeterReadDTO } from './dto/intermediate_meter_read.dto'; -import { Iintermediate, NewReadDTO, IAggregateintermediate } from '../../models' +import { + NewIntmediateMeterReadDTO, + IntmediateMeterReadDTO, +} from './dto/intermediate_meter_read.dto'; +import { + Iintermediate, + NewReadDTO, + IAggregateintermediate, +} from '../../models'; import { InjectRepository } from '@nestjs/typeorm'; import { GetMarketplaceOrganizationHandler } from '@energyweb/origin-backend/dist/js/src/pods/organization/handlers/get-marketplace-organization.handler'; import { ReadStatus } from '../../utils/enums'; -import { DeltaFirstRead } from './delta_firstread.entity' -import { HistoryNextInssuanceStatus } from '../../utils/enums/history_next_issuance.enum' -import { ReadFilterDTO } from './dto/filter.dto' +import { DeltaFirstRead } from './delta_firstread.entity'; +import { HistoryNextInssuanceStatus } from '../../utils/enums/history_next_issuance.enum'; +import { ReadFilterDTO } from './dto/filter.dto'; import * as mapBoxTimeSpace from '@mapbox/timespace'; import * as momentTimeZone from 'moment-timezone'; -import { InfluxDB, QueryApi, } from '@influxdata/influxdb-client'; +import { InfluxDB, QueryApi } from '@influxdata/influxdb-client'; import { Cron, CronExpression } from '@nestjs/schedule'; import { response } from 'express'; import { EndReservationdateDTO } from '../device-group/dto'; import { timestamp } from 'rxjs/operators'; -import { getFormattedOffSetFromOffsetAsJson, getLocalTime, getLocalTimeZoneFromDevice, getOffsetFromTimeZoneName } from '../../utils/localTimeDetailsForDevice'; +import { + getFormattedOffSetFromOffsetAsJson, + getLocalTime, + getLocalTimeZoneFromDevice, + getOffsetFromTimeZoneName, +} from '../../utils/localTimeDetailsForDevice'; import { log } from 'console'; export type TUserBaseEntity = ExtendedBaseEntity & IAggregateintermediate; @@ -54,16 +82,18 @@ export class ReadsService { private readonly influxDB: InfluxDB; private readonly queryApi: QueryApi; constructor( - @InjectRepository(AggregateMeterRead) private readonly repository: Repository, - @InjectRepository(HistoryIntermediate_MeterRead) private readonly historyrepository: Repository, - @InjectRepository(DeltaFirstRead) private readonly deltarepository: Repository, + @InjectRepository(AggregateMeterRead) + private readonly repository: Repository, + @InjectRepository(HistoryIntermediate_MeterRead) + private readonly historyrepository: Repository, + @InjectRepository(DeltaFirstRead) + private readonly deltarepository: Repository, @Inject(BASE_READ_SERVICE) private baseReadsService: BaseReadService, private readonly deviceService: DeviceService, private readonly deviceGroupService: DeviceGroupService, private readonly organizationService: OrganizationService, private readonly eventBus: EventBus, - ) { //@ts-ignore const url = process.env.INFLUXDB_URL; @@ -140,7 +170,6 @@ export class ReadsService { await this.storeGenerationReading(id, filteredMeasurements, device); } - private async storeGenerationReading( id: string, measurements: MeasurementDTO, @@ -279,28 +308,26 @@ export class ReadsService { this.logger.debug( `capacity: ${capacity}, meteredTimePeriod: ${meteredTimePeriod}, deviceAge: ${deviceAge}, degradation: ${degradation}, yieldValue: ${yieldValue}`, ); - this.logger.debug(`${read.value + margin * read.value < maxEnergy ? 'Passed' : 'Failed'}, MaxEnergy: ${maxEnergy}`, + this.logger.debug( + `${read.value + margin * read.value < maxEnergy ? 'Passed' : 'Failed'}, MaxEnergy: ${maxEnergy}`, ); return Math.round(read.value + margin * read.value) < maxEnergy; } - public findlastRead(deviceId: string): Promise { return this.repository.find({ where: { externalId: deviceId }, order: { id: 'DESC', }, - take: 1 + take: 1, }); - } // new meter read process public async newstoreRead( id: string, measurements: NewIntmediateMeterReadDTO, - ): Promise { this.logger.debug('DREC is storing smart meter reads:'); this.logger.debug(JSON.stringify(measurements)); @@ -311,9 +338,16 @@ export class ReadsService { throw new NotFoundException(`No device found with external id ${id}`); } - - if (device.timezone === null && measurements.timezone !== null && measurements.timezone !== undefined && measurements.timezone.toString().trim() !== '') { - await this.deviceService.updatetimezone(device.externalId, measurements.timezone); + if ( + device.timezone === null && + measurements.timezone !== null && + measurements.timezone !== undefined && + measurements.timezone.toString().trim() !== '' + ) { + await this.deviceService.updatetimezone( + device.externalId, + measurements.timezone, + ); } const roundedMeasurements = this.NewroundMeasurementsToUnit(measurements); @@ -327,8 +361,9 @@ export class ReadsService { await this.newstoreGenerationReading(id, filteredMeasurements, device); } - - private NewroundMeasurementsToUnit(measurement: NewIntmediateMeterReadDTO): NewIntmediateMeterReadDTO { + private NewroundMeasurementsToUnit( + measurement: NewIntmediateMeterReadDTO, + ): NewIntmediateMeterReadDTO { const getMultiplier = (unit: Unit) => { switch (unit) { case Unit.Wh: @@ -352,11 +387,9 @@ export class ReadsService { })), unit: Unit.Wh, type: measurement.type, - }; } - private async NewfilterMeasurements( deviceId: string, measurement: NewIntmediateMeterReadDTO, @@ -364,51 +397,61 @@ export class ReadsService { ): Promise { //@ts-ignore const final = await this.NewfindLatestRead(deviceId, device.createdAt); - console.log("final", final) + console.log('final', final); let reads: any = []; - if (measurement.type === "History") { - + if (measurement.type === 'History') { await new Promise((resolve, reject) => { measurement.reads.forEach(async (element, measurmentreadindex) => { - - const requeststartdate = DateTime.fromISO(new Date(element.starttimestamp).toISOString()); - const requestcurrentend = DateTime.fromISO(new Date(element.endtimestamp).toISOString()); + const requeststartdate = DateTime.fromISO( + new Date(element.starttimestamp).toISOString(), + ); + const requestcurrentend = DateTime.fromISO( + new Date(element.endtimestamp).toISOString(), + ); const meteredTimePeriod = Math.abs( - requeststartdate.diff(requestcurrentend, ['hours']).toObject()?.hours || 0, + requeststartdate.diff(requestcurrentend, ['hours']).toObject() + ?.hours || 0, ); - const checkhistroyreading = await this.checkhistoryreadexist(device.externalId, element.starttimestamp, element.endtimestamp); + const checkhistroyreading = await this.checkhistoryreadexist( + device.externalId, + element.starttimestamp, + element.endtimestamp, + ); // console.log(checkhistroyreading) //@ts-ignore const historyAge = new Date(device.createdAt); historyAge.setFullYear(historyAge.getFullYear() - 3); - console.log("historyAge"); + console.log('historyAge'); if (checkhistroyreading) { return reject( new ConflictException({ success: false, - message: `There are already one or more historical entries for this device which are conflicting current reading start date and/or end date ` - + message: `There are already one or more historical entries for this device which are conflicting current reading start date and/or end date `, }), ); } //@ts-ignore - if (requeststartdate <= DateTime.fromISO(new Date(historyAge).toISOString()) || + if ( + requeststartdate <= + DateTime.fromISO(new Date(historyAge).toISOString()) || //@ts-ignore - requeststartdate >= DateTime.fromISO(new Date(device?.createdAt).toISOString()) || - requestcurrentend <= DateTime.fromISO(new Date(historyAge).toISOString()) || + requeststartdate >= + DateTime.fromISO(new Date(device?.createdAt).toISOString()) || + requestcurrentend <= + DateTime.fromISO(new Date(historyAge).toISOString()) || //@ts-ignore - requestcurrentend >= DateTime.fromISO(new Date(device?.createdAt).toISOString())) { - + requestcurrentend >= + DateTime.fromISO(new Date(device?.createdAt).toISOString()) + ) { return reject( new ConflictException({ success: false, //@ts-ignore - message: `For History Type Reads of devices start time and/or end time should be within 3 year of device onboarding, ex: device onboarded date: ${device?.createdAt}maximum date allowed for start and end date should be within 3 year in past from onboarded date, ${device?.createdAt}` - + message: `For History Type Reads of devices start time and/or end time should be within 3 year of device onboarding, ex: device onboarded date: ${device?.createdAt}maximum date allowed for start and end date should be within 3 year in past from onboarded date, ${device?.createdAt}`, }), ); } @@ -422,110 +465,116 @@ export class ReadsService { // }); let read: ReadDTO = { timestamp: new Date(element.endtimestamp), - value: element.value - - } - const historyvalidation = await this.NewhistoryvalidateEnergy(read, device, meteredTimePeriod, measurement, requeststartdate.toJSDate(), requestcurrentend.toJSDate()) - console.log(historyvalidation) + value: element.value, + }; + const historyvalidation = await this.NewhistoryvalidateEnergy( + read, + device, + meteredTimePeriod, + measurement, + requeststartdate.toJSDate(), + requestcurrentend.toJSDate(), + ); + console.log(historyvalidation); if (historyvalidation) { reads.push({ timestamp: new Date(element.endtimestamp), value: element.value, - }) + }); } else { - console.log("436") + console.log('436'); return reject( new ConflictException({ success: false, - message: 'Failed,read value is greater than from MaxEnergy' + message: 'Failed,read value is greater than from MaxEnergy', }), ); } if (measurmentreadindex == measurement.reads.length - 1) { - resolve(true); } - - }) + }); }); return { reads: reads, unit: measurement.unit, - }; - } - else if (measurement.type === 'Delta') { - + } else if (measurement.type === 'Delta') { if (!final) { await new Promise((resolve, reject) => { measurement.reads.forEach(async (element, measurmentreadindex) => { - if (final && final['timestamp']) { - //@ts-ignore - if (new Date(element.endtimestamp).getTime() < new Date(final.timestamp).getTime()) { + if ( + new Date(element.endtimestamp).getTime() < + new Date(final.timestamp).getTime() + ) { return reject( new ConflictException({ success: false, message: //@ts-ignore - `The sent date for reading ${element.endtimestamp} is less than last sent meter read date ${final.timestamp}` - + `The sent date for reading ${element.endtimestamp} is less than last sent meter read date ${final.timestamp}`, }), ); } } let read: ReadDTO = { timestamp: new Date(element.endtimestamp), - value: element.value - } + value: element.value, + }; // if (deltafirstvalidation) { reads.push({ timestamp: new Date(element.endtimestamp), - value: element.value - }) + value: element.value, + }); await this.deltarepository.save({ readsvalue: element.value, externalId: deviceId, unit: measurement.unit, - readsEndDate: element.endtimestamp.toString() - + readsEndDate: element.endtimestamp.toString(), }); // } if (measurmentreadindex == measurement.reads.length - 1) { resolve(true); } - }) + }); }); await this.deviceService.updatereadtype(deviceId, measurement.type); return { reads: reads, - unit: measurement.unit - } + unit: measurement.unit, + }; } else { - - if (device?.meterReadtype != measurement.type && device?.meterReadtype != null) { - throw new NotFoundException(`In this device you can add read for ${device?.meterReadtype} type but you are sending ${measurement.type}`); - + if ( + device?.meterReadtype != measurement.type && + device?.meterReadtype != null + ) { + throw new NotFoundException( + `In this device you can add read for ${device?.meterReadtype} type but you are sending ${measurement.type}`, + ); } else { await new Promise((resolve, reject) => { measurement.reads.forEach((element, measurmentreadindex) => { - console.log("endtimestamp", element.endtimestamp); + console.log('endtimestamp', element.endtimestamp); console.log(typeof element.endtimestamp); - console.log("timestamp", final.timestamp); + console.log('timestamp', final.timestamp); console.log(typeof final.timestamp); - console.log("Stimestamp", final.timestamp.toISOString()); + console.log('Stimestamp', final.timestamp.toISOString()); console.log(typeof final.timestamp.toISOString()); if (final && final['timestamp']) { //@ts-ignore - if (new Date(element.endtimestamp).getTime() < new Date(final.timestamp).getTime()) { + if ( + new Date(element.endtimestamp).getTime() < + new Date(final.timestamp).getTime() + ) { return reject( new ConflictException({ success: false, message: //@ts-ignore - `The sent date for reading ${element.endtimestamp} is less than last sent meter read date ${final.timestamp.toISOString()}` + `The sent date for reading ${element.endtimestamp} is less than last sent meter read date ${final.timestamp.toISOString()}`, }), ); } @@ -536,40 +585,38 @@ export class ReadsService { // }) let read: ReadDTO = { timestamp: new Date(element.endtimestamp), - value: element.value - } - const newdeltavalidation = this.NewvalidateEnergy(read, final, device); + value: element.value, + }; + const newdeltavalidation = this.NewvalidateEnergy( + read, + final, + device, + ); if (newdeltavalidation.success) { reads.push({ timestamp: new Date(element.endtimestamp), - value: element.value - }) - + value: element.value, + }); } else { return reject( new ConflictException({ success: false, - message: newdeltavalidation.message - - + message: newdeltavalidation.message, }), ); } if (measurmentreadindex == measurement.reads.length - 1) { resolve(true); } - }) + }); }); return { reads: reads, unit: measurement.unit, }; - } } - - } - else if (measurement.type === 'Aggregate') { + } else if (measurement.type === 'Aggregate') { if (!final) { await new Promise((resolve, reject) => { measurement.reads.forEach(async (element, measurmentreadindex) => { @@ -578,68 +625,63 @@ export class ReadsService { if (lastvalue.length > 0) { Delta = Math.abs(element.value - lastvalue[0].value); - if (new Date(element.endtimestamp).getTime() < new Date(lastvalue[0].datetime).getTime() || element.value <= lastvalue[0].value) { + if ( + new Date(element.endtimestamp).getTime() < + new Date(lastvalue[0].datetime).getTime() || + element.value <= lastvalue[0].value + ) { return reject( new ConflictException({ success: false, - message: - `The sent date/value for reading ${element.endtimestamp}/${element.value} is less than last sent mter read date/value ${lastvalue[0].datetime}/${lastvalue[0].value} ` - + message: `The sent date/value for reading ${element.endtimestamp}/${element.value} is less than last sent mter read date/value ${lastvalue[0].datetime}/${lastvalue[0].value} `, }), ); } let read: ReadDTO = { timestamp: new Date(element.endtimestamp), - value: Delta - } - const firstvalidation = this.firstvalidateEnergy(read, device) + value: Delta, + }; + const firstvalidation = this.firstvalidateEnergy(read, device); if (firstvalidation.success) { await this.repository.save({ value: element.value, deltaValue: Delta, externalId: deviceId, unit: measurement.unit, - datetime: element.endtimestamp.toString() - + datetime: element.endtimestamp.toString(), }); reads.push({ timestamp: new Date(element.endtimestamp), - value: Delta - }) + value: Delta, + }); } else { return reject( new ConflictException({ success: false, - message: firstvalidation.message - - + message: firstvalidation.message, }), ); } - } - else { + } else { let read: ReadDTO = { timestamp: new Date(element.endtimestamp), - value: element.value - } - const firstvalidation = this.firstvalidateEnergy(read, device) + value: element.value, + }; + const firstvalidation = this.firstvalidateEnergy(read, device); if (firstvalidation.success) { await this.repository.save({ value: element.value, deltaValue: Delta, externalId: deviceId, unit: measurement.unit, - datetime: element.endtimestamp.toString() - + datetime: element.endtimestamp.toString(), }); } else { return reject( new ConflictException({ success: false, - message: firstvalidation.message - - + message: firstvalidation.message, }), ); } @@ -647,32 +689,37 @@ export class ReadsService { if (measurmentreadindex == measurement.reads.length - 1) { resolve(true); } - }) + }); }); await this.deviceService.updatereadtype(deviceId, measurement.type); return { reads: reads, unit: measurement.unit, }; - } else { - if (device?.meterReadtype != measurement.type && device?.meterReadtype != null) { - throw new NotFoundException(`In this device you can add read for ${device?.meterReadtype} type but you are sending ${measurement.type}`); + if ( + device?.meterReadtype != measurement.type && + device?.meterReadtype != null + ) { + throw new NotFoundException( + `In this device you can add read for ${device?.meterReadtype} type but you are sending ${measurement.type}`, + ); } await new Promise((resolve, reject) => { measurement.reads.forEach(async (element, measurmentreadindex) => { - const lastvalue = await this.findlastRead(deviceId); let Delta; if (lastvalue.length > 0) { Delta = Math.abs(element.value - lastvalue[0].value); - if (new Date(element.endtimestamp).getTime() < new Date(lastvalue[0].datetime).getTime() || element.value <= lastvalue[0].value) { + if ( + new Date(element.endtimestamp).getTime() < + new Date(lastvalue[0].datetime).getTime() || + element.value <= lastvalue[0].value + ) { return reject( new ConflictException({ success: false, - message: - `The sent date/value for reading ${element.endtimestamp}/${element.value} is less than last sent mter read date/value ${lastvalue[0].datetime}/${lastvalue[0].value} ` - + message: `The sent date/value for reading ${element.endtimestamp}/${element.value} is less than last sent mter read date/value ${lastvalue[0].datetime}/${lastvalue[0].value} `, }), ); } @@ -680,64 +727,62 @@ export class ReadsService { //@ts-ignore let read: ReadDTO = { timestamp: new Date(element.endtimestamp), - value: Delta - } + value: Delta, + }; const newvalidation = this.NewvalidateEnergy(read, final, device); if (newvalidation.success) { reads.push({ timestamp: new Date(element.endtimestamp), - value: Delta - }) + value: Delta, + }); await this.repository.save({ value: element.value, deltaValue: Delta, externalId: deviceId, unit: measurement.unit, - datetime: element.endtimestamp.toString() - + datetime: element.endtimestamp.toString(), }); } else { return reject( new ConflictException({ success: false, - message: newvalidation.message - - + message: newvalidation.message, }), ); } - } if (measurmentreadindex == measurement.reads.length - 1) { resolve(true); } - }) + }); }); return { reads: reads, unit: measurement.unit, }; - } } - - } - async NewfindLatestRead(meterId: string, deviceregisterdate: Date): Promise { - + async NewfindLatestRead( + meterId: string, + deviceregisterdate: Date, + ): Promise { //@ts-ignore const fluxQuery = `from(bucket: "${process.env.INFLUXDB_BUCKET}") |> range(start: ${deviceregisterdate}, stop: now()) |> filter(fn: (r) => r.meter == "${meterId}" and r._field == "read") - |> last()` + |> last()`; const reads = await this.execute(fluxQuery); return reads[0]; } - async findLastReadForMeterWithinRange(meterId: string, startdate: Date, enddate: Date): Promise> { - + async findLastReadForMeterWithinRange( + meterId: string, + startdate: Date, + enddate: Date, + ): Promise> { const fluxQuery = `from(bucket: "${process.env.INFLUXDB_BUCKET}") |> range(start: ${startdate.getTime()}, stop: ${enddate.getTime()}) |> filter(fn: (r) => r.meter == "${meterId}" and r._field == "read") @@ -753,7 +798,6 @@ export class ReadsService { })); } get dbReader() { - //@ts-ignore const url = process.env.INFLUXDB_URL; //@ts-ignore @@ -762,21 +806,21 @@ export class ReadsService { const org = process.env.INFLUXDB_ORG; //@ts-ignore - return new InfluxDB({ url, token }).getQueryApi(org) + return new InfluxDB({ url, token }).getQueryApi(org); } private async checkhistoryreadexist( deviceid: string, startDate: Date, - endDate: Date - + endDate: Date, ): Promise { - const query = this.getexisthistorydevcielogFilteredQuery(deviceid, + const query = this.getexisthistorydevcielogFilteredQuery( + deviceid, startDate, - endDate); + endDate, + ); //console.log("historyexistdevicequery"); try { - const device = await query.getRawMany(); return device.length > 0; @@ -785,28 +829,39 @@ export class ReadsService { this.logger.error(`Failed to retrieve device`, error.stack); // throw new InternalServerErrorException('Failed to retrieve users'); } - } - private getexisthistorydevcielogFilteredQuery(deviceid: string, + private getexisthistorydevcielogFilteredQuery( + deviceid: string, startDate: Date, - endDate: Date): SelectQueryBuilder { + endDate: Date, + ): SelectQueryBuilder { console.log(startDate); console.log(endDate); // const { organizationName, status } = filterDto; const query = this.historyrepository - .createQueryBuilder("devicehistory"). - where("devicehistory.externalId = :deviceid", { deviceid: deviceid }) + .createQueryBuilder('devicehistory') + .where('devicehistory.externalId = :deviceid', { deviceid: deviceid }) .andWhere( - new Brackets((db) => { - db.where("devicehistory.readsStartDate BETWEEN :startDateFirstWhere AND :endDateFirstWhere ", { startDateFirstWhere: startDate, endDateFirstWhere: endDate }) - .orWhere("devicehistory.readsEndDate BETWEEN :startDateSecondtWhere AND :endDateSecondWhere", { startDateSecondtWhere: startDate, endDateSecondWhere: endDate }) - .orWhere(":startdateThirdWhere BETWEEN devicehistory.readsStartDate AND devicehistory.readsEndDate", { startdateThirdWhere: startDate }) - .orWhere(":enddateforthdWhere BETWEEN devicehistory.readsStartDate AND devicehistory.readsEndDate", { enddateforthdWhere: endDate }) - + db.where( + 'devicehistory.readsStartDate BETWEEN :startDateFirstWhere AND :endDateFirstWhere ', + { startDateFirstWhere: startDate, endDateFirstWhere: endDate }, + ) + .orWhere( + 'devicehistory.readsEndDate BETWEEN :startDateSecondtWhere AND :endDateSecondWhere', + { startDateSecondtWhere: startDate, endDateSecondWhere: endDate }, + ) + .orWhere( + ':startdateThirdWhere BETWEEN devicehistory.readsStartDate AND devicehistory.readsEndDate', + { startdateThirdWhere: startDate }, + ) + .orWhere( + ':enddateforthdWhere BETWEEN devicehistory.readsStartDate AND devicehistory.readsEndDate', + { enddateforthdWhere: endDate }, + ); }), - ) + ); //console.log(query.getQuery()) return query; @@ -814,7 +869,6 @@ export class ReadsService { private firstvalidateEnergy( read: ReadDTO, device: DeviceDTO, - ): { success: boolean; message: string } { const computeMaxEnergy = ( capacity: number, @@ -826,12 +880,17 @@ export class ReadsService { // Max calculated energy formula // Old formula: Device capacity [kW] * metered time period [h] * device age [years] * degradation [%/year] * yield [kWh/kW] //New formula: Device capacity [kW] * metered time period [h] * (Yield [kWh/kW] / 8760)* (1-degradation [%/year])^(device age [years] - 1) - this.logger.debug("New formula: Device capacity [kW] * metered time period [h] * (Yield [kWh/kW] / 8760)* (1-degradation [%/year])^(device age [years] - 1)") + this.logger.debug( + 'New formula: Device capacity [kW] * metered time period [h] * (Yield [kWh/kW] / 8760)* (1-degradation [%/year])^(device age [years] - 1)', + ); return ( - capacity * meteredTimePeriod * (yieldValue / 8760) * Math.pow((1 - degradationPercentage), deviceAge - 1) + capacity * + meteredTimePeriod * + (yieldValue / 8760) * + Math.pow(1 - degradationPercentage, deviceAge - 1) ); }; - this.logger.debug(JSON.stringify(read)) + this.logger.debug(JSON.stringify(read)); const degradation = 0.5; // [%/year] const degradationPercentage = degradation / 100; const yieldValue = device.yieldValue || 2000; // [kWh/kW] @@ -862,13 +921,14 @@ export class ReadsService { degradationPercentage, yieldValue, ); - const finalmax = maxEnergy * (120 / 100) + const finalmax = maxEnergy * (120 / 100); this.logger.debug( `capacity: ${capacity}, meteredTimePeriod: ${meteredTimePeriod}, deviceAge: ${deviceAge}, degradation: ${degradation}, yieldValue: ${yieldValue}`, ); - this.logger.debug(`${read.value < finalmax ? 'Passed' : 'Failed'}, MaxEnergy: ${finalmax}`, + this.logger.debug( + `${read.value < finalmax ? 'Passed' : 'Failed'}, MaxEnergy: ${finalmax}`, ); - console.log("hgfgfdt871", Math.round(read.value)) + console.log('hgfgfdt871', Math.round(read.value)); if (read.value < finalmax) { return { success: true, @@ -885,7 +945,6 @@ export class ReadsService { read: ReadDTO, final: ReadDTO, device: DeviceDTO, - ): { success: boolean; message: string } { const computeMaxEnergy = ( capacity: number, @@ -897,9 +956,14 @@ export class ReadsService { // Max calculated energy formula // Old formula: Device capacity [kW] * metered time period [h] * device age [years] * degradation [%/year] * yield [kWh/kW] //New formula: Device capacity [kW] * metered time period [h] * (Yield [kWh/kW] / 8760)* (1-degradation [%/year])^(device age [years] - 1) - this.logger.debug("New formula: Device capacity [kW] * metered time period [h] * (Yield [kWh/kW] / 8760)* (1-degradation [%/year])^(device age [years] - 1)") + this.logger.debug( + 'New formula: Device capacity [kW] * metered time period [h] * (Yield [kWh/kW] / 8760)* (1-degradation [%/year])^(device age [years] - 1)', + ); return ( - capacity * meteredTimePeriod * (yieldValue / 8760) * Math.pow((1 - degradationPercentage), deviceAge - 1) + capacity * + meteredTimePeriod * + (yieldValue / 8760) * + Math.pow(1 - degradationPercentage, deviceAge - 1) ); }; const degradation = 0.5; // [%/year] @@ -928,11 +992,12 @@ export class ReadsService { degradationPercentage, yieldValue, ); - const finalmax = maxEnergy * (120 / 100) + const finalmax = maxEnergy * (120 / 100); this.logger.debug( `capacity: ${capacity}, meteredTimePeriod: ${meteredTimePeriod}, deviceAge: ${deviceAge}, degradation: ${degradation}, yieldValue: ${yieldValue}`, ); - this.logger.debug(`${read.value < finalmax ? 'Passed' : 'Failed'}, MaxEnergy: ${finalmax}`, + this.logger.debug( + `${read.value < finalmax ? 'Passed' : 'Failed'}, MaxEnergy: ${finalmax}`, ); //console.log(Math.round(read.value + margin * read.value) < maxEnergy) if (read.value < finalmax) { @@ -956,7 +1021,7 @@ export class ReadsService { requestmeteredTimePeriod: number, measurement: NewIntmediateMeterReadDTO, startdate: Date, - enddate: Date + enddate: Date, ): Promise { const computeMaxEnergy = ( capacity: number, @@ -968,17 +1033,22 @@ export class ReadsService { // Max calculated energy formula // Old formula: Device capacity [kW] * metered time period [h] * device age [years] * degradation [%/year] * yield [kWh/kW] //New formula: Device capacity [kW] * metered time period [h] * (Yield [kWh/kW] / 8760)* (1-degradation [%/year])^(device age [years] - 1) - this.logger.debug("New formula: Device capacity [kW] * metered time period [h] * (Yield [kWh/kW] / 8760)* (1-degradation [%/year])^(device age [years] - 1)") + this.logger.debug( + 'New formula: Device capacity [kW] * metered time period [h] * (Yield [kWh/kW] / 8760)* (1-degradation [%/year])^(device age [years] - 1)', + ); return ( - capacity * meteredTimePeriod * (yieldValue / 8760) * Math.pow((1 - degradationPercentage), deviceAge - 1) + capacity * + meteredTimePeriod * + (yieldValue / 8760) * + Math.pow(1 - degradationPercentage, deviceAge - 1) ); }; - this.logger.debug(JSON.stringify(read)) + this.logger.debug(JSON.stringify(read)); const degradation = 0.5; // [%/year] const degradationPercentage = degradation / 100; const yieldValue = device.yieldValue || 2000; // [kWh/kW] - const capacity = device.capacity * 1000; // capacity in KilloWatt and read in Wh so coverting in Watt + const capacity = device.capacity * 1000; // capacity in KilloWatt and read in Wh so coverting in Watt const commissioningDate = DateTime.fromISO(device.commissioningDate); const currentDate = DateTime.now(); let deviceAge = @@ -996,14 +1066,14 @@ export class ReadsService { degradationPercentage, yieldValue, ); - const finalmax = maxEnergy * (120 / 100) + const finalmax = maxEnergy * (120 / 100); this.logger.debug( `capacity: ${capacity}, meteredTimePeriod: ${meteredTimePeriod}, deviceAge: ${deviceAge}, degradation: ${degradation}, yieldValue: ${yieldValue}`, ); - this.logger.debug(`${read.value < finalmax ? 'Passed' : 'Failed'}, MaxEnergy: ${finalmax}`, + this.logger.debug( + `${read.value < finalmax ? 'Passed' : 'Failed'}, MaxEnergy: ${finalmax}`, ); - if (read.value < finalmax) { this.historyrepository.save({ type: measurement.type, @@ -1011,33 +1081,44 @@ export class ReadsService { unit: measurement.unit, readsvalue: read.value, readsStartDate: startdate, - readsEndDate: enddate - }) - console.log("1267"); + readsEndDate: enddate, + }); + console.log('1267'); if (device.groupId != null) { - const historynextissue = await this.deviceGroupService.getNextHistoryissuanceDevicelogafterreservation( - device.externalId, - device.groupId - ); - console.log("historynextissue"); + const historynextissue = + await this.deviceGroupService.getNextHistoryissuanceDevicelogafterreservation( + device.externalId, + device.groupId, + ); + console.log('historynextissue'); if (historynextissue != undefined) { let stdate = new Date(startdate).getTime(); let eddate = new Date(enddate).getTime(); //@ts-ignore - let reservSdate = new Date(historynextissue.reservationStartDate).getTime(); + let reservSdate = new Date( + historynextissue.reservationStartDate, + ).getTime(); console.log(reservSdate); //@ts-ignore - let reservEdate = new Date(historynextissue.reservationEndDate).getTime(); + let reservEdate = new Date( + historynextissue.reservationEndDate, + ).getTime(); console.log(reservEdate); - console.log((stdate >= reservSdate && stdate < reservEdate)); + console.log(stdate >= reservSdate && stdate < reservEdate); console.log(eddate <= reservEdate && eddate > reservSdate); - if ((stdate >= reservSdate && stdate < reservEdate) && (eddate <= reservEdate && eddate > reservSdate)) { + if ( + stdate >= reservSdate && + stdate < reservEdate && + eddate <= reservEdate && + eddate > reservSdate + ) { //@ts-ignore - this.deviceGroupService.HistoryUpdatecertificateissuedate(historynextissue.id, HistoryNextInssuanceStatus.Pending); + this.deviceGroupService.HistoryUpdatecertificateissuedate( + historynextissue.id, + HistoryNextInssuanceStatus.Pending, + ); } - } - } return read.value < finalmax; } else { @@ -1047,10 +1128,8 @@ export class ReadsService { // message: `${read.value + margin * read.value < finalmax ? 'Passed' : 'Failed'}, MaxEnergy: ${finalmax}`, // }); } - } - private async newstoreGenerationReading( id: string, measurements: MeasurementDTO, @@ -1095,15 +1174,18 @@ export class ReadsService { return Math.floor(sum(array)); } } - public async getCheckHistoryCertificateIssueDateLogForDevice(deviceid: string, + public async getCheckHistoryCertificateIssueDateLogForDevice( + deviceid: string, startDate: Date, - endDate: Date): Promise { - const query = this.gethistorydevcielogFilteredQuery(deviceid, + endDate: Date, + ): Promise { + const query = this.gethistorydevcielogFilteredQuery( + deviceid, startDate, - endDate); + endDate, + ); //console.log("devicequery"); try { - const device = await query.getRawMany(); // console.log(device); const devices = device.map((s: any) => { @@ -1112,7 +1194,7 @@ export class ReadsService { readsStartDate: s.devicehistory_readsStartDate, readsEndDate: s.devicehistory_readsEndDate, readsvalue: s.devicehistory_readsvalue, - externalId: s.devicehistory_externalId + externalId: s.devicehistory_externalId, }; return item; }); @@ -1125,31 +1207,50 @@ export class ReadsService { } } - private gethistorydevcielogFilteredQuery(deviceid: string, + private gethistorydevcielogFilteredQuery( + deviceid: string, startDate: Date, - endDate: Date): SelectQueryBuilder { + endDate: Date, + ): SelectQueryBuilder { // const { organizationName, status } = filterDto; const query = this.historyrepository - .createQueryBuilder("devicehistory"). - where("devicehistory.externalId = :deviceid", { deviceid: deviceid }) + .createQueryBuilder('devicehistory') + .where('devicehistory.externalId = :deviceid', { deviceid: deviceid }) .andWhere( new Brackets((db) => { db.where( new Brackets((db1) => { - db1.where("devicehistory.readsStartDate BETWEEN :reservationStartDate1 AND :reservationEndDate1", { reservationStartDate1: startDate, reservationEndDate1: endDate }) - .orWhere("devicehistory.readsStartDate = :reservationStartDate", { reservationStartDate: startDate }) - }) - ) - .andWhere( - new Brackets((db2) => { - db2.where("devicehistory.readsEndDate BETWEEN :reservationStartDate2 AND :reservationEndDate2", { reservationStartDate2: startDate, reservationEndDate2: endDate }) - .orWhere("devicehistory.readsEndDate = :reservationEndDate ", { reservationEndDate: endDate }) - }) - ) - + db1 + .where( + 'devicehistory.readsStartDate BETWEEN :reservationStartDate1 AND :reservationEndDate1', + { + reservationStartDate1: startDate, + reservationEndDate1: endDate, + }, + ) + .orWhere( + 'devicehistory.readsStartDate = :reservationStartDate', + { reservationStartDate: startDate }, + ); + }), + ).andWhere( + new Brackets((db2) => { + db2 + .where( + 'devicehistory.readsEndDate BETWEEN :reservationStartDate2 AND :reservationEndDate2', + { + reservationStartDate2: startDate, + reservationEndDate2: endDate, + }, + ) + .orWhere('devicehistory.readsEndDate = :reservationEndDate ', { + reservationEndDate: endDate, + }); + }), + ); }), ) - .andWhere("devicehistory.certificate_issued != true") + .andWhere('devicehistory.certificate_issued != true'); // //console.log(query.getQuery()) return query; } @@ -1165,10 +1266,11 @@ export class ReadsService { enddate: Date, ): Promise { // await this.checkNameConflict(data.name); - const historydevice = await this.getDeviceHistoryCertificateIssueDate({ id: id }); + const historydevice = await this.getDeviceHistoryCertificateIssueDate({ + id: id, + }); let updatedhistoryissue = new HistoryIntermediate_MeterRead(); if (historydevice) { - historydevice.certificate_issuance_startdate = startdate; historydevice.certificate_issuance_enddate = enddate; historydevice.certificate_issued = true; @@ -1176,42 +1278,56 @@ export class ReadsService { } return updatedhistoryissue; } - async getAggregateMeterReadsFirstEntryOfDevice(meterId: string): Promise { - + async getAggregateMeterReadsFirstEntryOfDevice( + meterId: string, + ): Promise { return this.repository.find({ where: { - externalId: meterId + externalId: meterId, }, - take: 1 - }) - - + take: 1, + }); } // add new function for Delta firstread filter - async getDeltaMeterReadsFirstEntryOfDevice(meterId: string): Promise { - + async getDeltaMeterReadsFirstEntryOfDevice( + meterId: string, + ): Promise { return this.deltarepository.find({ where: { - externalId: meterId - } - }) + externalId: meterId, + }, + }); } /* */ timeOffset: any; - async getAllRead(externalId, filter, deviceOnboarded, pageNumber: number): Promise { + async getAllRead( + externalId, + filter, + deviceOnboarded, + pageNumber: number, + ): Promise { if (new Date(filter.start).getTime() == new Date(filter.end).getTime()) { - throw new HttpException('The given start and end timestamps are the same', 400) + throw new HttpException( + 'The given start and end timestamps are the same', + 400, + ); } let historyread = []; let ongoing = []; let finalongoing = []; - console.log("page number:::::::::::::::::::::::::::::::::::::::::::" + pageNumber) + console.log( + 'page number:::::::::::::::::::::::::::::::::::::::::::' + pageNumber, + ); let sizeOfPage = 5; let numberOfPages = 0; - let numberOfHistReads = await this.getnumberOfHistReads(externalId, filter.start, filter.end); + let numberOfHistReads = await this.getnumberOfHistReads( + externalId, + filter.start, + filter.end, + ); let numberOfOngReads = 0; let numberOfReads = numberOfHistReads + numberOfOngReads; if (numberOfHistReads > 0) { @@ -1223,7 +1339,12 @@ export class ReadsService { filter.offset = sizeOfPage * (pageNumber - 1); filter.limit = sizeOfPage; } - numberOfOngReads = await this.getnumberOfOngReads(filter.start, filter.end, externalId, deviceOnboarded); + numberOfOngReads = await this.getnumberOfOngReads( + filter.start, + filter.end, + externalId, + deviceOnboarded, + ); console.log(numberOfOngReads); if (numberOfOngReads > numberOfHistReads) { numberOfPages = Math.ceil(numberOfOngReads / sizeOfPage); @@ -1231,36 +1352,58 @@ export class ReadsService { numberOfReads = numberOfHistReads + numberOfOngReads; // numberOfPages=Math.ceil(numberOfReads/sizeOfPage) if (numberOfHistReads == 0 && numberOfOngReads == 0) { - - return { historyread, ongoing, "numberOfReads": numberOfReads, "numberOfPages": 0, "currentPageNumber": 0 } + return { + historyread, + ongoing, + numberOfReads: numberOfReads, + numberOfPages: 0, + currentPageNumber: 0, + }; } - if ((typeof pageNumber === 'number' && !isNaN(pageNumber)) && pageNumber > numberOfPages) { - - return { historyread, ongoing, "numberOfReads": numberOfReads, "numberOfPages": numberOfPages, "currentPageNumber": 1 }; + if ( + typeof pageNumber === 'number' && + !isNaN(pageNumber) && + pageNumber > numberOfPages + ) { + return { + historyread, + ongoing, + numberOfReads: numberOfReads, + numberOfPages: numberOfPages, + currentPageNumber: 1, + }; } //if ((new Date(filter.start).getTime() <= new Date(deviceOnboarded).getTime() && new Date(filter.end).getTime() <= new Date(deviceOnboarded).getTime()) || (filter.start <= device_onboarded && filter.end > device_onboarded)) { - if (new Date(filter.start).getTime() <= new Date(deviceOnboarded).getTime()) { - - const query = await this.getexisthistorydevcielogFilteredQuery(externalId, filter.start, filter.end); + if ( + new Date(filter.start).getTime() <= new Date(deviceOnboarded).getTime() + ) { + const query = await this.getexisthistorydevcielogFilteredQuery( + externalId, + filter.start, + filter.end, + ); - console.log("history query executed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); - console.log("historyexistdevicequery"); + console.log( + 'history query executed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', + ); + console.log('historyexistdevicequery'); try { - const histroread = await query.limit(filter.limit).offset(filter.offset).getRawMany(); + const histroread = await query + .limit(filter.limit) + .offset(filter.offset) + .getRawMany(); //console.log("histroread", histroread); - await histroread.forEach(element => { - + await histroread.forEach((element) => { historyread.push({ startdate: element.devicehistory_readsStartDate, enddate: element.devicehistory_readsEndDate, - value: element.devicehistory_readsvalue - }) - - }) + value: element.devicehistory_readsvalue, + }); + }); } catch (error) { - console.log(error) + console.log(error); this.logger.error(`Failed to retrieve device`, error.stack); } } @@ -1268,24 +1411,33 @@ export class ReadsService { //console.log(deviceOnboarded); // console.log(filter.end); if (new Date(deviceOnboarded).getTime() < new Date(filter.end).getTime()) { - console.log("offset::::::::::::" + filter.offset + "\nlimit:::::::::::::" + filter.limit + "\n device onboarded::::::::::" + deviceOnboarded.toString() + "\nend:::::::::" + filter.end.toString()) + console.log( + 'offset::::::::::::' + + filter.offset + + '\nlimit:::::::::::::' + + filter.limit + + '\n device onboarded::::::::::' + + deviceOnboarded.toString() + + '\nend:::::::::' + + filter.end.toString(), + ); let readsFilter: FilterDTO = { - offset: filter.offset, limit: filter.limit, start: filter.start.toString(), end: filter.end.toString(), }; - if (new Date(filter.start).getTime() > new Date(deviceOnboarded).getTime()) { + if ( + new Date(filter.start).getTime() > new Date(deviceOnboarded).getTime() + ) { readsFilter = { offset: filter.offset, limit: filter.limit, start: filter.start.toString(), end: filter.end.toString(), }; - } - else { + } else { readsFilter = { offset: filter.offset, limit: filter.limit, @@ -1296,8 +1448,16 @@ export class ReadsService { // console.log("device onboarded:::::::::" + deviceOnboarded + "\nend:::::::::::::::::" + filter.end); - if (new Date(filter.start).getTime() < new Date(deviceOnboarded).getTime() || new Date(filter.end).getTime() > new Date(deviceOnboarded).getTime()) { - let finalongoing = await this.getPaginatedData(externalId, readsFilter, pageNumber); + if ( + new Date(filter.start).getTime() < + new Date(deviceOnboarded).getTime() || + new Date(filter.end).getTime() > new Date(deviceOnboarded).getTime() + ) { + let finalongoing = await this.getPaginatedData( + externalId, + readsFilter, + pageNumber, + ); //console.log("final ongoing:::::::", finalongoing); // const nextPage = pageNumber + 1; @@ -1315,12 +1475,18 @@ export class ReadsService { let previousReadTime; if (pageNumber > 1) { const previousPage = pageNumber - 1; - const previousPageData = await this.getPaginatedData(externalId, readsFilter, previousPage); + const previousPageData = await this.getPaginatedData( + externalId, + readsFilter, + previousPage, + ); if (previousPageData.length > 0) { // @ts-ignore previousReadTime = previousPageData[0].timestamp; // @ts-ignore - console.log("previous page read data[0]::::" + previousPageData[0].timestamp); + console.log( + 'previous page read data[0]::::' + previousPageData[0].timestamp, + ); } else { previousReadTime = null; } @@ -1330,12 +1496,16 @@ export class ReadsService { const currentRead = finalongoing[i]; let startdate; if (i === 0 && pageNumber == 1) { - startdate = new Date(Math.max(new Date(deviceOnboarded).getTime(), new Date(filter.start).getTime())); + startdate = new Date( + Math.max( + new Date(deviceOnboarded).getTime(), + new Date(filter.start).getTime(), + ), + ); } else if (i == 0 && pageNumber != 1) { // @ts-ignore startdate = previousReadTime; - } - else { + } else { startdate = transformedFinalOngoing[i - 1].enddate; } // @ts-ignore @@ -1345,15 +1515,14 @@ export class ReadsService { startdate: transformedFinalOngoing[i - 1].enddate, enddate: enddate, // @ts-ignore - value: currentRead.value + value: currentRead.value, }); - } - else { + } else { transformedFinalOngoing.push({ startdate: startdate, enddate: enddate, //@ts-ignore - value: currentRead.value + value: currentRead.value, }); } } @@ -1361,33 +1530,54 @@ export class ReadsService { } } // console.log(ongoing); - console.log("count of ong reads:::::::::::::::::::::::::::::::::::" + await this.getnumberOfOngReads(filter.start, filter.end, externalId, deviceOnboarded)) + console.log( + 'count of ong reads:::::::::::::::::::::::::::::::::::' + + (await this.getnumberOfOngReads( + filter.start, + filter.end, + externalId, + deviceOnboarded, + )), + ); if (typeof pageNumber === 'number' && !isNaN(pageNumber)) { - - return { historyread, ongoing, "numberOfReads": numberOfReads, "numberOfPages": numberOfPages, "currentPageNumber": pageNumber }; - } - else { - return { historyread, ongoing, "numberOfReads": numberOfReads, "numberOfPages": numberOfPages, "currentPageNumber": 1 }; + return { + historyread, + ongoing, + numberOfReads: numberOfReads, + numberOfPages: numberOfPages, + currentPageNumber: pageNumber, + }; + } else { + return { + historyread, + ongoing, + numberOfReads: numberOfReads, + numberOfPages: numberOfPages, + currentPageNumber: 1, + }; } - - } async getnumberOfHistReads(deviceId, startDate, endDate) { - const query = this.historyrepository.createQueryBuilder("devicehistory") - .where("devicehistory.externalId = :deviceId", { deviceId }) - .andWhere("devicehistory.readsStartDate <= :endDate", { endDate }) - .andWhere("devicehistory.readsEndDate >= :startDate", { startDate }); + const query = this.historyrepository + .createQueryBuilder('devicehistory') + .where('devicehistory.externalId = :deviceId', { deviceId }) + .andWhere('devicehistory.readsStartDate <= :endDate', { endDate }) + .andWhere('devicehistory.readsEndDate >= :startDate', { startDate }); const count = await query.getCount(); return count; } - - async getnumberOfOngReads(start: Date, end: Date, externalId, onboarded: Date) { - console.log(externalId) + async getnumberOfOngReads( + start: Date, + end: Date, + externalId, + onboarded: Date, + ) { + console.log(externalId); if (new Date(onboarded).getTime() > new Date(end).getTime()) { - console.log('The given dates are not for on-going reads') + console.log('The given dates are not for on-going reads'); return 0; } let fluxquery = ``; @@ -1396,9 +1586,7 @@ export class ReadsService { |> range(start: ${start}, stop: ${end}) |> filter(fn: (r) => r._measurement == "read" and r.meter == "${externalId}") |> count()`; - } - - else { + } else { fluxquery = `from(bucket: "${process.env.INFLUXDB_BUCKET}") |> range(start: ${onboarded}, stop: ${end}) |> filter(fn: (r) => r._measurement == "read"and r.meter == "${externalId}") @@ -1409,17 +1597,15 @@ export class ReadsService { return noOfReads; } - async ongExecute(query: any) { const data: any = await this.dbReader.collectRows(query); if (typeof data[0] === 'undefined' || data.length == 0) { - console.log("type of data is undefined") + console.log('type of data is undefined'); return 0; } return Number(data[0]._value); } - async latestread(meterId, deviceOnboarded) { let query = ` from(bucket: "${process.env.INFLUXDB_BUCKET}") @@ -1432,52 +1618,66 @@ from(bucket: "${process.env.INFLUXDB_BUCKET}") } /* */ - async getAccumulatedReads(meter: string, organizationId, developerExternalId, accumulationType, month: number, year: number) { + async getAccumulatedReads( + meter: string, + organizationId, + developerExternalId, + accumulationType, + month: number, + year: number, + ) { let startDate; let numberOfDays; let endDate; if (month && year) { startDate = this.convertToISODate(month, year); numberOfDays = this.getNumberOfDaysInMonth(month, year); - endDate = DateTime.fromISO(startDate).plus({ days: numberOfDays }).minus({ seconds: 1 }).toISODate() + "T00:00:00Z"; + endDate = + DateTime.fromISO(startDate) + .plus({ days: numberOfDays }) + .minus({ seconds: 1 }) + .toISODate() + 'T00:00:00Z'; } if (year && !month) { month = 1; startDate = this.convertToISODate(month, year); - console.log("startDate for year:::::::::::::" + startDate); - - endDate = DateTime.fromISO(startDate) - .plus({ years: 1 }) - .minus({ seconds: 1 }) - .toISO({ suppressMilliseconds: true, includeOffset: false }) + "Z"; + console.log('startDate for year:::::::::::::' + startDate); + endDate = + DateTime.fromISO(startDate) + .plus({ years: 1 }) + .minus({ seconds: 1 }) + .toISO({ suppressMilliseconds: true, includeOffset: false }) + 'Z'; } - console.log("startDate::::::::::::" + startDate); - console.log("End DAte:::::::::::::" + endDate); + console.log('startDate::::::::::::' + startDate); + console.log('End DAte:::::::::::::' + endDate); meter = meter; let tempResults = []; - let finalResults: { timestamp?: string, value?: any }[] = []; + let finalResults: { timestamp?: string; value?: any }[] = []; let response; let url; - const offSet = await this.getOffSetForInfluxQuery(developerExternalId, organizationId, startDate); - console.log("THE OFFSET RETURNED:::" + offSet); + const offSet = await this.getOffSetForInfluxQuery( + developerExternalId, + organizationId, + startDate, + ); + console.log('THE OFFSET RETURNED:::' + offSet); const formattedOffSet = offSet.formattedOffset; const monthlyQuery = `SELECT time, SUM("read") AS total_meter_reads FROM "read" WHERE time >= '${startDate}' AND time < '${endDate}' AND meter = '${meter}'GROUP BY time(1d,${formattedOffSet})`; const yearlyQuery = `SELECT time, SUM("read") AS total_meter_reads FROM "read" WHERE time >= '${startDate}' AND time < '${endDate}' AND meter = '${meter}'GROUP BY time(30d,${formattedOffSet})`; - console.log("accumulation type:::::::::::::::::" + accumulationType); + console.log('accumulation type:::::::::::::::::' + accumulationType); if (accumulationType === 'Monthly' && month && year) { url = `${process.env.INFLUXDB_URL}/query?db=${process.env.INFLUXDB_DB}&q=${monthlyQuery}`; - } - - else if (accumulationType === 'Yearly' && year) { + } else if (accumulationType === 'Yearly' && year) { url = `${process.env.INFLUXDB_URL}/query?db=${process.env.INFLUXDB_DB}&q=${yearlyQuery}`; - } - - else { - throw new HttpException('Invalid accumulationType', HttpStatus.BAD_REQUEST); + } else { + throw new HttpException( + 'Invalid accumulationType', + HttpStatus.BAD_REQUEST, + ); } const config = { @@ -1494,20 +1694,19 @@ from(bucket: "${process.env.INFLUXDB_BUCKET}") throw new HttpException('Some Error occured', HttpStatus.AMBIGUOUS); } - if (!response.data.results[0].series) { throw new HttpException('No reads found', HttpStatus.CONFLICT); } - tempResults = this.readFilterNullUndefined(response.data.results[0].series[0].values) + tempResults = this.readFilterNullUndefined( + response.data.results[0].series[0].values, + ); } catch (error) { console.error(error); throw error; } - - for (let i = 0; i < tempResults.length; i++) { - let resultObj: { startTime?: string, endTime?: string, value?: any } = {}; + let resultObj: { startTime?: string; endTime?: string; value?: any } = {}; for (let j = 0; j < 2; j++) { if (j % 2 === 0) { const startDateStr = new Date(tempResults[i][j]).getTime(); @@ -1530,25 +1729,26 @@ from(bucket: "${process.env.INFLUXDB_BUCKET}") finalResults.push(resultObj); } console.log(finalResults); - return { 'aggregateType': accumulationType, 'accumulatedReads': finalResults, 'timezone': offSet.localTimeZone }; + return { + aggregateType: accumulationType, + accumulatedReads: finalResults, + timezone: offSet.localTimeZone, + }; } readFilterNullUndefined(arr) { for (let i = 0; i < arr.length; i++) { - for (let j = 0; j < 2; j++) { if (j % 2 != 0) { - if ((arr[i])[j] == null || (arr[i])[j] == undefined) { - (arr[i])[j] = 0; + if (arr[i][j] == null || arr[i][j] == undefined) { + arr[i][j] = 0; } } } - } return arr; } - convertToISODate(month, year) { const isoDate = DateTime.fromObject({ year: year, @@ -1557,7 +1757,7 @@ from(bucket: "${process.env.INFLUXDB_BUCKET}") hour: 0, minute: 0, second: 0, - zone: 'utc' + zone: 'utc', }).toISO({ suppressMilliseconds: true }); return isoDate; @@ -1570,18 +1770,17 @@ from(bucket: "${process.env.INFLUXDB_BUCKET}") day: 1, hour: 0, minute: 0, - second: 0 + second: 0, }).daysInMonth; } // @Cron(CronExpression.EVERY_10_SECONDS) // async addOffSetToStartAndEndDates(externalId,organizationId,startDate,endDate) - // { + // { // let device = await this.deviceService.findDeviceByDeveloperExternalId(externalId, organizationId); // console.log("DEVICE:::::::::::"+device) - // console.log("THIS IS THE LAT "+device.latitude+"AND LONG"+device.longitude); // const localTime=getLocalTime(startDate,device);//timezone of the device. // console.log("calling the localtimezone function") @@ -1592,7 +1791,6 @@ from(bucket: "${process.env.INFLUXDB_BUCKET}") // console.log("FINAL OFFSET HOURS::::::"+offset.hours); // console.log("FINAL OFFSET MINUTES::::::"+offset.minutes); - // const parsedStartDate = new Date(startDate); // const parsedEndDate = new Date(endDate); @@ -1614,21 +1812,36 @@ from(bucket: "${process.env.INFLUXDB_BUCKET}") // } - - async getPaginatedData(meter: string, filter: any, page: number): Promise { - console.log("page: " + page); + async getPaginatedData( + meter: string, + filter: any, + page: number, + ): Promise { + console.log('page: ' + page); const pageSize = filter.limit; const skipCount = (page - 1) * pageSize; - const data = await this.retrieveDataWithLastValue(meter, filter, skipCount, pageSize); - console.log("data:", data); + const data = await this.retrieveDataWithLastValue( + meter, + filter, + skipCount, + pageSize, + ); + console.log('data:', data); return data; } - async retrieveDataWithLastValue(meter: string, filter: any, skipCount: number, pageSize: number): Promise { + async retrieveDataWithLastValue( + meter: string, + filter: any, + skipCount: number, + pageSize: number, + ): Promise { let currentQuery: string; if (filter.lastValue) { - let newDateTime = new Date(new Date(filter.lastValue).getTime() + 1000).toISOString(); + let newDateTime = new Date( + new Date(filter.lastValue).getTime() + 1000, + ).toISOString(); currentQuery = `from(bucket: "${process.env.INFLUXDB_BUCKET}") |> range(start: ${newDateTime}, stop: ${filter.end}) |> filter(fn: (r) => r.meter == "${meter}" and r._field == "read") @@ -1656,13 +1869,18 @@ from(bucket: "${process.env.INFLUXDB_BUCKET}") })); } - // - async getOffSetForInfluxQuery(developerExternalId, organizationId, startDate) { - + async getOffSetForInfluxQuery( + developerExternalId, + organizationId, + startDate, + ) { let localTime = null; let formattedOffset = null; - let device = await this.deviceService.findDeviceByDeveloperExternalId(developerExternalId, organizationId); + let device = await this.deviceService.findDeviceByDeveloperExternalId( + developerExternalId, + organizationId, + ); // console.log("DEVICE:::::::::::" + device); if (device.latitude && device.longitude) { // console.log("THIS IS THE LAT " + device.latitude + "AND LONG" + device.longitude); @@ -1680,21 +1898,23 @@ from(bucket: "${process.env.INFLUXDB_BUCKET}") // console.log("FINAL OFFSET HOURS::::::" + typeof (offset.hours)); // console.log("FINAL OFFSET MINUTES::::::" + typeof (offset.minutes)); - const offSetHoursString = (offset.hours).toString(); - const offSetMinutesString = (offset.minutes).toString(); + const offSetHoursString = offset.hours.toString(); + const offSetMinutesString = offset.minutes.toString(); formattedOffset = offSetHoursString + 'h' + offSetMinutesString + 'm'; - console.log("FORMATTED OFFSET BEING RETURNED:::" + formattedOffset); - - return { 'formattedOffset': formattedOffset, 'offSetHours': offset.hours, 'offSetMinutes': offset.minutes, 'localTimeZone': localTimeZoneName }; + console.log('FORMATTED OFFSET BEING RETURNED:::' + formattedOffset); + return { + formattedOffset: formattedOffset, + offSetHours: offset.hours, + offSetMinutes: offset.minutes, + localTimeZone: localTimeZoneName, + }; } - async getOngoingReads(meter, filter): Promise { - - console.log("IN THE FUNCTION TO GET ONGOING READS"); + console.log('IN THE FUNCTION TO GET ONGOING READS'); const url = process.env.INFLUXDB_URL; const token = process.env.INFLUXDB_TOKEN; @@ -1712,7 +1932,6 @@ from(bucket: "${process.env.INFLUXDB_BUCKET}") const result = await queryApi.collectRows(fluxQuery); console.log(result); console.log('\ncollect-rows query SUCCESS'); - return result + return result; } - -} \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/sdgbenefit/dto/add_sdgbenefit.dto.ts b/apps/drec-api/src/pods/sdgbenefit/dto/add_sdgbenefit.dto.ts index 78331ae1c..1ee974131 100755 --- a/apps/drec-api/src/pods/sdgbenefit/dto/add_sdgbenefit.dto.ts +++ b/apps/drec-api/src/pods/sdgbenefit/dto/add_sdgbenefit.dto.ts @@ -3,42 +3,37 @@ import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; import { Expose } from 'class-transformer'; import { - IsEnum, - IsBoolean, - IsString, - IsNotEmpty, - IsNumber, + IsEnum, + IsBoolean, + IsString, + IsNotEmpty, + IsNumber, } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { ISdgBenefit } from '../../../models'; @Entity() -export class SdgBenefitDTO implements Omit{ - - @ApiProperty() - @IsString() - SdgbenefitName: string; +export class SdgBenefitDTO implements Omit { + @ApiProperty() + @IsString() + SdgbenefitName: string; - @ApiProperty() - @IsString() - sdgbenefitdescription: string; + @ApiProperty() + @IsString() + sdgbenefitdescription: string; - - @ApiProperty() - - @IsNumber() - sdgbenefitBitposition: number; + @ApiProperty() + @IsNumber() + sdgbenefitBitposition: number; } export class SDGBCodeNameDTO { - @ApiProperty({ type: String }) - @IsString() - - @Expose() - name: string; - - @ApiProperty({ type: String }) - @IsString() - - @Expose() - value: string; - } \ No newline at end of file + @ApiProperty({ type: String }) + @IsString() + @Expose() + name: string; + + @ApiProperty({ type: String }) + @IsString() + @Expose() + value: string; +} diff --git a/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.controller.ts b/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.controller.ts index 3b8473d92..bf9a7fe25 100755 --- a/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.controller.ts +++ b/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.controller.ts @@ -1,65 +1,68 @@ -import { Controller,Post,Get, - Body, - HttpStatus, - Logger, - } from '@nestjs/common'; import { - ApiBearerAuth, - ApiResponse, - ApiTags, - ApiSecurity, - } from '@nestjs/swagger'; - import {SdgBenefitDTO,SDGBCodeNameDTO} from './dto/add_sdgbenefit.dto' - import {SdgbenefitService} from './sdgbenefit.service'; - import { plainToClass } from 'class-transformer'; + Controller, + Post, + Get, + Body, + HttpStatus, + Logger, +} from '@nestjs/common'; +import { + ApiBearerAuth, + ApiResponse, + ApiTags, + ApiSecurity, +} from '@nestjs/swagger'; +import { SdgBenefitDTO, SDGBCodeNameDTO } from './dto/add_sdgbenefit.dto'; +import { SdgbenefitService } from './sdgbenefit.service'; +import { plainToClass } from 'class-transformer'; @ApiTags('SdgBenefit') @ApiBearerAuth('access-token') @ApiSecurity('drec') @Controller('sdgbenefit') export class SdgbenefitController { - private readonly logger = new Logger(SdgbenefitController.name); + private readonly logger = new Logger(SdgbenefitController.name); - constructor(private readonly SdgbenefitService: SdgbenefitService) {} + constructor(private readonly SdgbenefitService: SdgbenefitService) {} -/** - * this Api rout use for add sdg Benifites name and code - * @param createsdgbenefitDto - * @returns - */ + /** + * this Api rout use for add sdg Benifites name and code + * @param createsdgbenefitDto + * @returns + */ @Post() - create(@Body() createsdgbenefitDto: SdgBenefitDTO) { - this.logger.verbose(`With in create`); - return this.SdgbenefitService.create(createsdgbenefitDto); - } + create(@Body() createsdgbenefitDto: SdgBenefitDTO) { + this.logger.verbose(`With in create`); + return this.SdgbenefitService.create(createsdgbenefitDto); + } - /** - * - * @returns - */ - @Get() - @ApiResponse({ - status: HttpStatus.OK, - type: [SDGBCodeNameDTO], - description: 'Returns all SDGBenefites', -}) - findAll() { - this.logger.verbose(`With in findAll`); - return this.SdgbenefitService.findAll(); - } + /** + * + * @returns + */ + @Get() + @ApiResponse({ + status: HttpStatus.OK, + type: [SDGBCodeNameDTO], + description: 'Returns all SDGBenefites', + }) + findAll() { + this.logger.verbose(`With in findAll`); + return this.SdgbenefitService.findAll(); + } -/** - * this api rout use for get all sdg benefit from class not any tbale - * @returns {SDGBCodeNameDTO} - */ - @Get('/code') - @ApiResponse({ - status: HttpStatus.OK, - type: [SDGBCodeNameDTO], - description: 'Returns all SDGBenefites', - }) - getFuelTypes(): SDGBCodeNameDTO[] { - this.logger.verbose(`With in getFuelTypes`); - const sdgbcode = this.SdgbenefitService.getSDGBCode(); - return sdgbcode.map((sdgb) => plainToClass(SDGBCodeNameDTO, sdgb)); - } + /** + * this api rout use for get all sdg benefit from class not any tbale + * @returns {SDGBCodeNameDTO} + */ + @Get('/code') + @ApiResponse({ + status: HttpStatus.OK, + type: [SDGBCodeNameDTO], + description: 'Returns all SDGBenefites', + }) + getFuelTypes(): SDGBCodeNameDTO[] { + this.logger.verbose(`With in getFuelTypes`); + const sdgbcode = this.SdgbenefitService.getSDGBCode(); + return sdgbcode.map((sdgb) => plainToClass(SDGBCodeNameDTO, sdgb)); + } } diff --git a/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.entity.ts b/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.entity.ts index c163efcb4..07982ed3d 100755 --- a/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.entity.ts +++ b/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.entity.ts @@ -1,42 +1,40 @@ import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; import { - DeviceStatus, - Installation, - Integrator, - OffTaker, - Sector, - StandardCompliance, + DeviceStatus, + Installation, + Integrator, + OffTaker, + Sector, + StandardCompliance, } from '../../utils/enums'; import { - IsEnum, - IsBoolean, - IsString, - IsNotEmpty, - IsNumber, + IsEnum, + IsBoolean, + IsString, + IsNotEmpty, + IsNumber, } from 'class-validator'; import { ISdgBenefit } from '../../models'; @Entity('sdgbenefit') export class SdgBenefit extends ExtendedBaseEntity implements ISdgBenefit { + constructor(sdgbenefit: Partial) { + super(); + Object.assign(this, sdgbenefit); + } + @PrimaryGeneratedColumn() + id: number; - constructor(sdgbenefit: Partial) { - super(); - Object.assign(this, sdgbenefit); - } - @PrimaryGeneratedColumn() - id: number; + @Column() + @IsString() + SdgbenefitName: string; - @Column() - @IsString() - SdgbenefitName: string; + @Column() + @IsString() + sdgbenefitdescription: string; - @Column() - @IsString() - sdgbenefitdescription: string; - - - @Column() - @IsNumber() - sdgbenefitBitposition: number; -} \ No newline at end of file + @Column() + @IsNumber() + sdgbenefitBitposition: number; +} diff --git a/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.module.ts b/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.module.ts index 17449b800..0f19f6407 100755 --- a/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.module.ts +++ b/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.module.ts @@ -2,10 +2,10 @@ import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { SdgbenefitController } from './sdgbenefit.controller'; import { SdgbenefitService } from './sdgbenefit.service'; -import {SdgBenefit} from './sdgbenefit.entity' +import { SdgBenefit } from './sdgbenefit.entity'; @Module({ imports: [TypeOrmModule.forFeature([SdgBenefit])], controllers: [SdgbenefitController], - providers: [SdgbenefitService] + providers: [SdgbenefitService], }) export class SdgbenefitModule {} diff --git a/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.service.spec.ts b/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.service.spec.ts index afe868299..fea62b3f0 100644 --- a/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.service.spec.ts +++ b/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.service.spec.ts @@ -1,29 +1,31 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { Repository } from 'typeorm'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { SdgbenefitService } from './sdgbenefit.service'; -import { SdgBenefit } from './sdgbenefit.entity'; - - -describe('SdgbenefitService', () => { - let service: SdgbenefitService; - let repository: Repository; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [SdgbenefitService, - { - provide: getRepositoryToken(SdgBenefit), - useClass: Repository, - }, - ], - }).compile(); - - service = module.get(SdgbenefitService); - repository = module.get>(getRepositoryToken(SdgBenefit)); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { Repository } from 'typeorm'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { SdgbenefitService } from './sdgbenefit.service'; +import { SdgBenefit } from './sdgbenefit.entity'; + +describe('SdgbenefitService', () => { + let service: SdgbenefitService; + let repository: Repository; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + SdgbenefitService, + { + provide: getRepositoryToken(SdgBenefit), + useClass: Repository, + }, + ], + }).compile(); + + service = module.get(SdgbenefitService); + repository = module.get>( + getRepositoryToken(SdgBenefit), + ); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.service.ts b/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.service.ts index e4e548888..410523382 100755 --- a/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.service.ts +++ b/apps/drec-api/src/pods/sdgbenefit/sdgbenefit.service.ts @@ -1,42 +1,40 @@ import { - Injectable, - NotFoundException, - NotAcceptableException, - Logger, - ConflictException, + Injectable, + NotFoundException, + NotAcceptableException, + Logger, + ConflictException, } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; -import { SdgBenefitDTO,SDGBCodeNameDTO } from './dto/add_sdgbenefit.dto'; +import { SdgBenefitDTO, SDGBCodeNameDTO } from './dto/add_sdgbenefit.dto'; import { SdgBenefit } from './sdgbenefit.entity'; -import {SDGBenefits} from '../../models/Sdgbenefit' +import { SDGBenefits } from '../../models/Sdgbenefit'; @Injectable() export class SdgbenefitService { - private readonly logger = new Logger(SdgbenefitService.name); - - constructor( - @InjectRepository(SdgBenefit) private readonly repository: Repository, - - ) { } - - public async create(createTestapiDto: SdgBenefitDTO): Promise { - this.logger.verbose(`With in create`); - return await this.repository.save({ - ...createTestapiDto, - }); - } - - - public async findAll(): Promise { - this.logger.verbose(`With in findAll`); - return this.repository.find(); - } - - getSDGBCode(): SDGBCodeNameDTO[] { - this.logger.verbose(`With in getSDGBCode`); - return SDGBenefits; - } - + private readonly logger = new Logger(SdgbenefitService.name); + + constructor( + @InjectRepository(SdgBenefit) + private readonly repository: Repository, + ) {} + + public async create(createTestapiDto: SdgBenefitDTO): Promise { + this.logger.verbose(`With in create`); + return await this.repository.save({ + ...createTestapiDto, + }); + } + + public async findAll(): Promise { + this.logger.verbose(`With in findAll`); + return this.repository.find(); + } + + getSDGBCode(): SDGBCodeNameDTO[] { + this.logger.verbose(`With in getSDGBCode`); + return SDGBenefits; + } } diff --git a/apps/drec-api/src/pods/user/api-user.entity.ts b/apps/drec-api/src/pods/user/api-user.entity.ts index 3056ff338..341c5e171 100755 --- a/apps/drec-api/src/pods/user/api-user.entity.ts +++ b/apps/drec-api/src/pods/user/api-user.entity.ts @@ -1,4 +1,11 @@ -import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany, BeforeUpdate } from 'typeorm'; +import { + Entity, + PrimaryGeneratedColumn, + Column, + ManyToOne, + OneToMany, + BeforeUpdate, +} from 'typeorm'; import { Exclude } from 'class-transformer'; import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; import { ApiProperty } from '@nestjs/swagger'; @@ -6,24 +13,21 @@ import { UserStatus, UserPermissionStatus } from '../../utils/enums'; import { IsEnum, IsString, IsArray } from 'class-validator'; import { IUser } from '../../models'; import { Organization } from '../organization/organization.entity'; -import { ACLModulePermissions } from '../permission/permission.entity' +import { ACLModulePermissions } from '../permission/permission.entity'; @Entity({ name: 'api_user' }) export class ApiUserEntity { - constructor() { - - } + constructor() {} @PrimaryGeneratedColumn('uuid') api_user_id: string; - @ApiProperty({ enum: UserPermissionStatus, enumName: 'UserPermissionStatus' }) - @Column({ default: UserPermissionStatus.Request, nullable: true }) - @IsEnum(UserPermissionStatus) - permission_status: UserPermissionStatus; + @ApiProperty({ enum: UserPermissionStatus, enumName: 'UserPermissionStatus' }) + @Column({ default: UserPermissionStatus.Request, nullable: true }) + @IsEnum(UserPermissionStatus) + permission_status: UserPermissionStatus; - @ApiProperty({ type: () => [Number] }) - @Column('simple-array', { nullable: true }) - @IsArray() - permissionIds: number[]; - + @ApiProperty({ type: () => [Number] }) + @Column('simple-array', { nullable: true }) + @IsArray() + permissionIds: number[]; } diff --git a/apps/drec-api/src/pods/user/decorators/match.decorator.ts b/apps/drec-api/src/pods/user/decorators/match.decorator.ts index 250f9e03f..41327cdd8 100755 --- a/apps/drec-api/src/pods/user/decorators/match.decorator.ts +++ b/apps/drec-api/src/pods/user/decorators/match.decorator.ts @@ -1,28 +1,32 @@ -import {registerDecorator, ValidationArguments, ValidationOptions, ValidatorConstraint, ValidatorConstraintInterface} from 'class-validator'; +import { + registerDecorator, + ValidationArguments, + ValidationOptions, + ValidatorConstraint, + ValidatorConstraintInterface, +} from 'class-validator'; export function Match(property: string, validationOptions?: ValidationOptions) { - return (object: any, propertyName: string) => { - registerDecorator({ - target: object.constructor, - propertyName, - options: validationOptions, - constraints: [property], - validator: MatchConstraint, - }); - }; + return (object: any, propertyName: string) => { + registerDecorator({ + target: object.constructor, + propertyName, + options: validationOptions, + constraints: [property], + validator: MatchConstraint, + }); + }; } -@ValidatorConstraint({name: 'Match'}) +@ValidatorConstraint({ name: 'Match' }) export class MatchConstraint implements ValidatorConstraintInterface { - - validate(value: any, args: ValidationArguments) { - const [relatedPropertyName] = args.constraints; - const relatedValue = (args.object as any)[relatedPropertyName]; - return value === relatedValue; - } - defaultMessage(args: ValidationArguments) { - const [constraintProperty]: (() => any)[] = args.constraints; - return ` ${args.property} does not match with ${constraintProperty} `; - } - -} \ No newline at end of file + validate(value: any, args: ValidationArguments) { + const [relatedPropertyName] = args.constraints; + const relatedValue = (args.object as any)[relatedPropertyName]; + return value === relatedValue; + } + defaultMessage(args: ValidationArguments) { + const [constraintProperty]: (() => any)[] = args.constraints; + return ` ${args.property} does not match with ${constraintProperty} `; + } +} diff --git a/apps/drec-api/src/pods/user/dto/create-user.dto.ts b/apps/drec-api/src/pods/user/dto/create-user.dto.ts index e1ca5e37b..180649c28 100755 --- a/apps/drec-api/src/pods/user/dto/create-user.dto.ts +++ b/apps/drec-api/src/pods/user/dto/create-user.dto.ts @@ -1,9 +1,17 @@ -import { ApiProperty, PickType ,IntersectionType} from '@nestjs/swagger'; +import { ApiProperty, PickType, IntersectionType } from '@nestjs/swagger'; import { UserDTO } from './user.dto'; import { OrganizationDTO } from '../../organization/dto/organization.dto'; -import { IsNotEmpty, IsString, Matches,MinLength, MaxLength, IsOptional, IsUUID } from 'class-validator'; -import { UserRegistrationData,UserORGRegistrationData } from '../../../models'; -import {Match} from '../decorators/match.decorator'; +import { + IsNotEmpty, + IsString, + Matches, + MinLength, + MaxLength, + IsOptional, + IsUUID, +} from 'class-validator'; +import { UserRegistrationData, UserORGRegistrationData } from '../../../models'; +import { Match } from '../decorators/match.decorator'; // export class CreateUserDTO // extends PickType(UserDTO, [ // 'title', @@ -11,11 +19,10 @@ import {Match} from '../decorators/match.decorator'; // 'lastName', // 'email', // 'telephone' - + // ] as const) // implements UserRegistrationData // { - // @ApiProperty({ type: String }) // @MaxLength(20) @@ -27,24 +34,15 @@ import {Match} from '../decorators/match.decorator'; // @IsString() // password: string; - - // } export class CreateUserORGDTO extends IntersectionType( - PickType(UserDTO, [ - 'firstName', - 'lastName', - 'email', - - ] as const), - PickType(OrganizationDTO,['organizationType']as const) - ) - + PickType(UserDTO, ['firstName', 'lastName', 'email'] as const), + PickType(OrganizationDTO, ['organizationType'] as const), + ) implements UserORGRegistrationData { - @ApiProperty({ type: String }) @MaxLength(20) @Matches(/((?=.*[0-9])(?=.*[A-Za-z]).{6,})/, { @@ -55,15 +53,15 @@ export class CreateUserORGDTO @IsString() password: string; - @ApiProperty({ type: String }) + @ApiProperty({ type: String }) @Match('password') confirmPassword?: string; - + @ApiProperty({ type: String }) @IsString() @IsNotEmpty() orgName?: string; - + /* note not to use g flag in regex nest https://github.com/typestack/class-validator/issues/484#issuecomment-595821457 @@ -86,7 +84,7 @@ export class CreateUserORGDTO // }) // @IsString() // secretKey?: string; - + @IsString() @IsUUID('all', { message: 'Invalid UUID format' }) @IsOptional() diff --git a/apps/drec-api/src/pods/user/dto/new-user.dto.ts b/apps/drec-api/src/pods/user/dto/new-user.dto.ts index bc685f453..e05aae61b 100755 --- a/apps/drec-api/src/pods/user/dto/new-user.dto.ts +++ b/apps/drec-api/src/pods/user/dto/new-user.dto.ts @@ -34,8 +34,4 @@ export class NewUserDTO implements Omit { password: string; // permissions: IModulePermissionsConfig; // moduleName: string; - } - - - diff --git a/apps/drec-api/src/pods/user/dto/update-password.dto.ts b/apps/drec-api/src/pods/user/dto/update-password.dto.ts index b35a69e44..d91eee690 100755 --- a/apps/drec-api/src/pods/user/dto/update-password.dto.ts +++ b/apps/drec-api/src/pods/user/dto/update-password.dto.ts @@ -1,7 +1,7 @@ import { UserPasswordUpdate } from '@energyweb/origin-backend-core'; import { ApiProperty } from '@nestjs/swagger'; import { IsEmail, IsNotEmpty, IsString } from 'class-validator'; -import {Match} from '../decorators/match.decorator'; +import { Match } from '../decorators/match.decorator'; export class UpdatePasswordDTO implements UserPasswordUpdate { @ApiProperty({ type: String }) @IsNotEmpty() @@ -18,14 +18,12 @@ export class UpdateChangePasswordDTO { // @ApiProperty({ type: String }) // @IsEmail() // email: string; - - @ApiProperty({ type: String }) @IsNotEmpty() @IsString() newPassword: string; - + @ApiProperty({ type: String }) @Match('newPassword') confirmPassword?: string; @@ -34,6 +32,4 @@ export class ForgetPasswordDTO { @ApiProperty({ type: String }) @IsEmail() email: string; - } - diff --git a/apps/drec-api/src/pods/user/dto/user.dto.ts b/apps/drec-api/src/pods/user/dto/user.dto.ts index c51530586..3cb73d346 100755 --- a/apps/drec-api/src/pods/user/dto/user.dto.ts +++ b/apps/drec-api/src/pods/user/dto/user.dto.ts @@ -1,6 +1,10 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { Expose } from 'class-transformer'; -import { IFullOrganization, IUser,IModulePermissionsConfig } from '../../../models'; +import { + IFullOrganization, + IUser, + IModulePermissionsConfig, +} from '../../../models'; import { Role, UserStatus } from '../../../utils/enums'; import { diff --git a/apps/drec-api/src/pods/user/oauth_client.service.spec.ts b/apps/drec-api/src/pods/user/oauth_client.service.spec.ts index f94508edb..8d2db3dae 100644 --- a/apps/drec-api/src/pods/user/oauth_client.service.spec.ts +++ b/apps/drec-api/src/pods/user/oauth_client.service.spec.ts @@ -1,229 +1,291 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { OauthClientCredentialsService } from './oauth_client.service'; -import { Repository, DeepPartial } from 'typeorm'; -import { OauthClientCredentials } from './oauth_client_credentials.entity'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { ApiUserEntity } from './api-user.entity'; -import { v4 as uuid } from 'uuid'; -import { OrganizationStatus, Role, UserPermissionStatus, UserStatus } from '../../utils/enums'; -import * as crypto from 'crypto'; - - -describe('OauthClientCredentialsService', () => { - let service: OauthClientCredentialsService; - let repository:Repository; - let apiUserEntityRepository: Repository; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [OauthClientCredentialsService, - { - provide: getRepositoryToken(OauthClientCredentials), - useClass: Repository, - }, - { - provide: getRepositoryToken(ApiUserEntity), - useClass: Repository, - }, - ], - }).compile(); - - service = module.get(OauthClientCredentialsService); - repository = module.get>(getRepositoryToken(OauthClientCredentials)); - apiUserEntityRepository = module.get>(getRepositoryToken(ApiUserEntity)); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); - - describe('createAPIUser', ()=> { - it('should save an API user with a generated UUID', async () => { - const mockApiUserEntity: DeepPartial = { - api_user_id: uuid(), - permission_status: UserPermissionStatus.Request, - }; - const saveSpy = jest.spyOn(apiUserEntityRepository, 'save').mockResolvedValue(mockApiUserEntity as any); - const result = await service.createAPIUser(); - - expect(saveSpy).toHaveBeenCalledWith({ api_user_id: expect.any(String) }); - - expect(result).toEqual(mockApiUserEntity); - }); - }); - - describe('get', () => { - const api_user_id= uuid(); - const mockClientCredentialEntity: DeepPartial = { - id: 1, - api_user_id: api_user_id, - client_id: 'Some Client Credential Entity', - user: { - id: 1, - firstName: 'testfName', - lastName: 'testlName', - email: 'testsweya1@gmail.com', - password: 'Drec@1234', - notifications: null, - status: UserStatus.Active, - role: Role.ApiUser, - roleId: 6, - organization: { - id: 1, - name: 'ORG_APIUSER', - address: 'any address', - organizationType: Role.ApiUser, - orgEmail: 'testsweya1@gmail.com', - status: OrganizationStatus.Active, - api_user_id: api_user_id, - }, - moduleName: null, - api_user_id: api_user_id, - updatedAt: new Date(), - } - }; - it('should return the entity with the provided api_user_id', async () => { - - const findOneSpy = jest.spyOn(repository, 'findOne').mockResolvedValue(mockClientCredentialEntity as any); - - const result = await service.get(mockClientCredentialEntity.api_user_id); - - expect(findOneSpy).toHaveBeenCalledWith({ api_user_id: mockClientCredentialEntity.api_user_id }); - - expect(result).toEqual(mockClientCredentialEntity); - }); - - it('should return null if entity with the provided api_user_id is not found', async () => { - - const findOneSpy = jest.spyOn(repository, 'findOne').mockResolvedValue(null); - - const result = await service.get('af8af558-ce8a-419e-a2fb-1ba225ffd813'); - - expect(findOneSpy).toHaveBeenCalledWith({ api_user_id: 'af8af558-ce8a-419e-a2fb-1ba225ffd813' }); - - expect(result).toBeNull(); - }); - }); - - describe('store', () => { - const api_user_id= uuid(); - const mockClientCredentialEntity: DeepPartial = { - id: 1, - api_user_id: api_user_id, - client_id: 'Some Client Credential Entity', - user: { - id: 1, - firstName: 'testfName', - lastName: 'testlName', - email: 'testsweya1@gmail.com', - password: 'Drec@1234', - notifications: null, - status: UserStatus.Active, - role: Role.ApiUser, - roleId: 6, - organization: { - id: 1, - name: 'ORG_APIUSER', - address: 'any address', - organizationType: Role.ApiUser, - orgEmail: 'testsweya1@gmail.com', - status: OrganizationStatus.Active, - api_user_id: api_user_id, - }, - moduleName: null, - api_user_id: api_user_id, - updatedAt: new Date(), - } - }; - - it('should store client credentials successfully', async () => { - const saveSpy = jest.spyOn(repository, 'save').mockResolvedValue(mockClientCredentialEntity as any); - const result = await service.store(mockClientCredentialEntity.client_id, mockClientCredentialEntity.api_user_id); - expect(saveSpy).toHaveBeenCalledWith({ client_id: expect.any(String), api_user_id: expect.any(String) }); - expect(result).toEqual(mockClientCredentialEntity); - }); - - it('should store the correct client_id', async () => { - const saveSpy = jest.spyOn(repository, 'save').mockResolvedValue(mockClientCredentialEntity as any); - const result = await service.store(mockClientCredentialEntity.client_id, mockClientCredentialEntity.api_user_id); - expect(saveSpy).toHaveBeenCalledWith({ client_id: expect.any(String), api_user_id: expect.any(String) }); - expect(result.client_id).toEqual(mockClientCredentialEntity.client_id); - }); - - it('should store the correct api_user_id', async () => { - const saveSpy = jest.spyOn(repository, 'save').mockResolvedValue(mockClientCredentialEntity as any); - const result = await service.store(mockClientCredentialEntity.client_id, mockClientCredentialEntity.api_user_id); - expect(saveSpy).toHaveBeenCalledWith({ client_id: expect.any(String), api_user_id: expect.any(String) }); - expect(result.api_user_id).toEqual(mockClientCredentialEntity.api_user_id); - }); - }); - - describe('findOneByApiUserId', ()=> { - const mockApiUserEntity: DeepPartial = { - api_user_id: uuid(), - permission_status: UserPermissionStatus.Request, - }; - - it('should find an API user by its ID', async () => { - const findOneSpy = jest.spyOn(apiUserEntityRepository, 'findOne').mockResolvedValue(mockApiUserEntity as any); - - const result = await service.findOneByApiUserId(mockApiUserEntity.api_user_id); - - expect(findOneSpy).toHaveBeenCalledWith({ where: { api_user_id: mockApiUserEntity.api_user_id } }); - expect(result).toBeDefined(); - }); - - it('should return an API user with the correct api_user_id', async () => { - const findOneSpy = jest.spyOn(apiUserEntityRepository, 'findOne').mockResolvedValue(mockApiUserEntity as any); - - const result = await service.findOneByApiUserId(mockApiUserEntity.api_user_id); - - expect(findOneSpy).toHaveBeenCalledWith({ where: { api_user_id: mockApiUserEntity.api_user_id } }); - expect(result.api_user_id).toEqual(mockApiUserEntity.api_user_id); - }); - - it('should handle an empty api_user_id', async () => { - await expect(service.findOneByApiUserId('')).rejects.toThrow(); - }); - - it('should handle a non-existent api_user_id', async () => { - const mockApiUserEntity: ApiUserEntity = undefined; - const findOneSpy = jest.spyOn(apiUserEntityRepository, 'findOne').mockResolvedValue(mockApiUserEntity as any); - const result = await service.findOneByApiUserId('dfd2f57d-f2b8-4057-bf48-c19f1a5aa949'); - expect(findOneSpy).toHaveBeenCalledWith({ where: { api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa949' } }); - expect(result).toBeUndefined(); - }); - - }); -/* - describe('generateKeys', ()=> { - it('should generate keys and store public key for valid API user ID', async () => { - // Mock key pair generation - const mockPrivateKey = 'mockPrivateKey'; - const mockPublicKey = 'mockPublicKey'; - crypto.generateKeyPairSync.mockReturnValueOnce({ privateKey: mockPrivateKey, publicKey: mockPublicKey }); - - const apiUserId = 'validUserId'; - const yourClassInstance = new YourClass(mockStore); - - const privateKey = await yourClassInstance.generateKeys(apiUserId); - - expect(privateKey).toEqual(mockPrivateKey); - expect(mockStore).toHaveBeenCalledWith(mockPublicKey, apiUserId); - }); - - it('should generate keys and store public key even when API user ID is not provided', async () => { - // Mock key pair generation - const mockPrivateKey = 'mockPrivateKey'; - const mockPublicKey = 'mockPublicKey'; - crypto.generateKeyPairSync.mockReturnValueOnce({ privateKey: mockPrivateKey, publicKey: mockPublicKey }); - - const yourClassInstance = new YourClass(mockStore); - - const privateKey = await yourClassInstance.generateKeys(); - - expect(privateKey).toEqual(mockPrivateKey); - expect(mockStore).toHaveBeenCalledWith(mockPublicKey, undefined); - }); - }); */ -}); +import { Test, TestingModule } from '@nestjs/testing'; +import { OauthClientCredentialsService } from './oauth_client.service'; +import { Repository, DeepPartial } from 'typeorm'; +import { OauthClientCredentials } from './oauth_client_credentials.entity'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { ApiUserEntity } from './api-user.entity'; +import { v4 as uuid } from 'uuid'; +import { + OrganizationStatus, + Role, + UserPermissionStatus, + UserStatus, +} from '../../utils/enums'; +import * as crypto from 'crypto'; + +describe('OauthClientCredentialsService', () => { + let service: OauthClientCredentialsService; + let repository: Repository; + let apiUserEntityRepository: Repository; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + OauthClientCredentialsService, + { + provide: getRepositoryToken(OauthClientCredentials), + useClass: Repository, + }, + { + provide: getRepositoryToken(ApiUserEntity), + useClass: Repository, + }, + ], + }).compile(); + + service = module.get( + OauthClientCredentialsService, + ); + repository = module.get>( + getRepositoryToken(OauthClientCredentials), + ); + apiUserEntityRepository = module.get>( + getRepositoryToken(ApiUserEntity), + ); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); + + describe('createAPIUser', () => { + it('should save an API user with a generated UUID', async () => { + const mockApiUserEntity: DeepPartial = { + api_user_id: uuid(), + permission_status: UserPermissionStatus.Request, + }; + const saveSpy = jest + .spyOn(apiUserEntityRepository, 'save') + .mockResolvedValue(mockApiUserEntity as any); + const result = await service.createAPIUser(); + + expect(saveSpy).toHaveBeenCalledWith({ api_user_id: expect.any(String) }); + + expect(result).toEqual(mockApiUserEntity); + }); + }); + + describe('get', () => { + const api_user_id = uuid(); + const mockClientCredentialEntity: DeepPartial = { + id: 1, + api_user_id: api_user_id, + client_id: 'Some Client Credential Entity', + user: { + id: 1, + firstName: 'testfName', + lastName: 'testlName', + email: 'testsweya1@gmail.com', + password: 'Drec@1234', + notifications: null, + status: UserStatus.Active, + role: Role.ApiUser, + roleId: 6, + organization: { + id: 1, + name: 'ORG_APIUSER', + address: 'any address', + organizationType: Role.ApiUser, + orgEmail: 'testsweya1@gmail.com', + status: OrganizationStatus.Active, + api_user_id: api_user_id, + }, + moduleName: null, + api_user_id: api_user_id, + updatedAt: new Date(), + }, + }; + it('should return the entity with the provided api_user_id', async () => { + const findOneSpy = jest + .spyOn(repository, 'findOne') + .mockResolvedValue(mockClientCredentialEntity as any); + + const result = await service.get(mockClientCredentialEntity.api_user_id); + + expect(findOneSpy).toHaveBeenCalledWith({ + api_user_id: mockClientCredentialEntity.api_user_id, + }); + + expect(result).toEqual(mockClientCredentialEntity); + }); + + it('should return null if entity with the provided api_user_id is not found', async () => { + const findOneSpy = jest + .spyOn(repository, 'findOne') + .mockResolvedValue(null); + + const result = await service.get('af8af558-ce8a-419e-a2fb-1ba225ffd813'); + + expect(findOneSpy).toHaveBeenCalledWith({ + api_user_id: 'af8af558-ce8a-419e-a2fb-1ba225ffd813', + }); + + expect(result).toBeNull(); + }); + }); + + describe('store', () => { + const api_user_id = uuid(); + const mockClientCredentialEntity: DeepPartial = { + id: 1, + api_user_id: api_user_id, + client_id: 'Some Client Credential Entity', + user: { + id: 1, + firstName: 'testfName', + lastName: 'testlName', + email: 'testsweya1@gmail.com', + password: 'Drec@1234', + notifications: null, + status: UserStatus.Active, + role: Role.ApiUser, + roleId: 6, + organization: { + id: 1, + name: 'ORG_APIUSER', + address: 'any address', + organizationType: Role.ApiUser, + orgEmail: 'testsweya1@gmail.com', + status: OrganizationStatus.Active, + api_user_id: api_user_id, + }, + moduleName: null, + api_user_id: api_user_id, + updatedAt: new Date(), + }, + }; + + it('should store client credentials successfully', async () => { + const saveSpy = jest + .spyOn(repository, 'save') + .mockResolvedValue(mockClientCredentialEntity as any); + const result = await service.store( + mockClientCredentialEntity.client_id, + mockClientCredentialEntity.api_user_id, + ); + expect(saveSpy).toHaveBeenCalledWith({ + client_id: expect.any(String), + api_user_id: expect.any(String), + }); + expect(result).toEqual(mockClientCredentialEntity); + }); + + it('should store the correct client_id', async () => { + const saveSpy = jest + .spyOn(repository, 'save') + .mockResolvedValue(mockClientCredentialEntity as any); + const result = await service.store( + mockClientCredentialEntity.client_id, + mockClientCredentialEntity.api_user_id, + ); + expect(saveSpy).toHaveBeenCalledWith({ + client_id: expect.any(String), + api_user_id: expect.any(String), + }); + expect(result.client_id).toEqual(mockClientCredentialEntity.client_id); + }); + + it('should store the correct api_user_id', async () => { + const saveSpy = jest + .spyOn(repository, 'save') + .mockResolvedValue(mockClientCredentialEntity as any); + const result = await service.store( + mockClientCredentialEntity.client_id, + mockClientCredentialEntity.api_user_id, + ); + expect(saveSpy).toHaveBeenCalledWith({ + client_id: expect.any(String), + api_user_id: expect.any(String), + }); + expect(result.api_user_id).toEqual( + mockClientCredentialEntity.api_user_id, + ); + }); + }); + + describe('findOneByApiUserId', () => { + const mockApiUserEntity: DeepPartial = { + api_user_id: uuid(), + permission_status: UserPermissionStatus.Request, + }; + + it('should find an API user by its ID', async () => { + const findOneSpy = jest + .spyOn(apiUserEntityRepository, 'findOne') + .mockResolvedValue(mockApiUserEntity as any); + + const result = await service.findOneByApiUserId( + mockApiUserEntity.api_user_id, + ); + + expect(findOneSpy).toHaveBeenCalledWith({ + where: { api_user_id: mockApiUserEntity.api_user_id }, + }); + expect(result).toBeDefined(); + }); + + it('should return an API user with the correct api_user_id', async () => { + const findOneSpy = jest + .spyOn(apiUserEntityRepository, 'findOne') + .mockResolvedValue(mockApiUserEntity as any); + + const result = await service.findOneByApiUserId( + mockApiUserEntity.api_user_id, + ); + + expect(findOneSpy).toHaveBeenCalledWith({ + where: { api_user_id: mockApiUserEntity.api_user_id }, + }); + expect(result.api_user_id).toEqual(mockApiUserEntity.api_user_id); + }); + + it('should handle an empty api_user_id', async () => { + await expect(service.findOneByApiUserId('')).rejects.toThrow(); + }); + + it('should handle a non-existent api_user_id', async () => { + const mockApiUserEntity: ApiUserEntity = undefined; + const findOneSpy = jest + .spyOn(apiUserEntityRepository, 'findOne') + .mockResolvedValue(mockApiUserEntity as any); + const result = await service.findOneByApiUserId( + 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa949', + ); + expect(findOneSpy).toHaveBeenCalledWith({ + where: { api_user_id: 'dfd2f57d-f2b8-4057-bf48-c19f1a5aa949' }, + }); + expect(result).toBeUndefined(); + }); + }); + /* + describe('generateKeys', ()=> { + it('should generate keys and store public key for valid API user ID', async () => { + // Mock key pair generation + const mockPrivateKey = 'mockPrivateKey'; + const mockPublicKey = 'mockPublicKey'; + crypto.generateKeyPairSync.mockReturnValueOnce({ privateKey: mockPrivateKey, publicKey: mockPublicKey }); + + const apiUserId = 'validUserId'; + const yourClassInstance = new YourClass(mockStore); + + const privateKey = await yourClassInstance.generateKeys(apiUserId); + + expect(privateKey).toEqual(mockPrivateKey); + expect(mockStore).toHaveBeenCalledWith(mockPublicKey, apiUserId); + }); + + it('should generate keys and store public key even when API user ID is not provided', async () => { + // Mock key pair generation + const mockPrivateKey = 'mockPrivateKey'; + const mockPublicKey = 'mockPublicKey'; + crypto.generateKeyPairSync.mockReturnValueOnce({ privateKey: mockPrivateKey, publicKey: mockPublicKey }); + + const yourClassInstance = new YourClass(mockStore); + + const privateKey = await yourClassInstance.generateKeys(); + + expect(privateKey).toEqual(mockPrivateKey); + expect(mockStore).toHaveBeenCalledWith(mockPublicKey, undefined); + }); + }); */ +}); diff --git a/apps/drec-api/src/pods/user/oauth_client.service.ts b/apps/drec-api/src/pods/user/oauth_client.service.ts index 0ef020351..683af62bd 100755 --- a/apps/drec-api/src/pods/user/oauth_client.service.ts +++ b/apps/drec-api/src/pods/user/oauth_client.service.ts @@ -1,142 +1,170 @@ -import { Injectable, HttpException, HttpStatus, } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; -import { OauthClientCredentials } from './oauth_client_credentials.entity'; -import { randomBytes, createCipheriv, createDecipheriv } from 'crypto'; -import { ApiUserEntity } from './api-user.entity'; -import { v4 as uuid } from 'uuid'; -import crypto from 'crypto'; -import fs from 'fs'; -import { Response } from 'express'; - -const algorithm = 'aes-256-cbc'; - -@Injectable() -export class OauthClientCredentialsService { - constructor( - @InjectRepository(OauthClientCredentials) - private readonly clientCredentialsRepository: Repository, - @InjectRepository(ApiUserEntity) - private readonly apiUserEntityRepository: Repository, - ) { } - - async createAPIUser():Promise - { - //@ts-ignore - return await this.apiUserEntityRepository.save({api_user_id:uuid()}); - - } - - - async store(client_id: string, userid: string): Promise { - const clientCredentials = new OauthClientCredentials(); - clientCredentials.client_id = client_id; - //clientCredentials.client_secret = this.encryptclient_secret(client_secret); - clientCredentials.api_user_id = userid; - return await this.clientCredentialsRepository.save(clientCredentials); - } - - async get(api_user_id: string) { - return await this.clientCredentialsRepository.findOne({api_user_id: api_user_id}); - } - - - - async replace(id: number, client_id: string, userid: number): Promise { - const clientCredentials = await this.clientCredentialsRepository.findOne(id); - if (!clientCredentials) { - // Handle error, throw exception, etc. - } - clientCredentials.client_id = client_id; - //clientCredentials.client_secret = client_secret; - // clientCredentials.userid = userid; - return await this.clientCredentialsRepository.save(clientCredentials); - } - - - - async edit(id: number, client_id: string,): Promise { - const clientCredentials = await this.clientCredentialsRepository.findOne(id); - if (!clientCredentials) { - // Handle error, throw exception, etc. - } - clientCredentials.client_id = client_id; - //clientCredentials.client_secret = this.encryptclient_secret(client_secret); - return await this.clientCredentialsRepository.save(clientCredentials); - } - - - - generateClientCredentials(): { client_id: string, client_secret: string } { - const client_id = randomBytes(16).toString('hex'); - const client_secret = randomBytes(32).toString('hex'); - return { client_id, client_secret: client_secret }; - - } - - async findOneByclient_id(client_id: string): Promise { - return this.clientCredentialsRepository.findOne({ where: { client_id } }); - } - - async findOneByclient_idAndUserId(client_id: string, api_user_id: number) - : Promise { - return this.clientCredentialsRepository.findOne({ where: { client_id, api_user_id } }); - } - async findOneByuserid(api_user_id: string): Promise { - return this.clientCredentialsRepository.findOne({ where: { api_user_id } }); - } - - - - encryptclient_secret(client_secret) { - console.log(algorithm, process.env.CLIENT_CREDENTIALS_ENCRYPTION_KEY); - const iv = randomBytes(16); // Generate a random IV - - const cipher = createCipheriv(algorithm, process.env.CLIENT_CREDENTIALS_ENCRYPTION_KEY, iv); - let encrypted = cipher.update(client_secret, 'utf8', 'hex'); - encrypted += cipher.final('hex'); - return iv.toString('hex')+encrypted; - } - - decryptclient_secret(encryptedclient_secret) { - const iv = Buffer.from(encryptedclient_secret.slice(0, 32), 'hex'); - - const decipher = createDecipheriv(algorithm, process.env.CLIENT_CREDENTIALS_ENCRYPTION_KEY, iv); - let decrypted = decipher.update(encryptedclient_secret.slice(32), 'hex', 'utf8'); - decrypted += decipher.final('utf8'); - return decrypted; - } - - async findOneByApiUserId(api_user_id : string) : Promise { - return await this.apiUserEntityRepository.findOne({ where: {api_user_id} }); - } - - async generateKeys(api_user_id?: string) { - const { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', { - modulusLength: 2048, - publicKeyEncoding: {type: 'spki', format: 'pem'}, - privateKeyEncoding: {type: 'pkcs8', format: 'pem'} - }); - await this.store(publicKey, api_user_id); - - return privateKey; - } - - async createKeyFile(api_user_id: string, res: Response) { - try { - const privateKey = await this.generateKeys(api_user_id); // Generate the private key using your service - fs.writeFileSync('private_key.pem', privateKey); // Write the private key to a file - const file = fs.readFileSync('private_key.pem'); // Read the file as a buffer - res.setHeader('Content-Disposition', 'attachment; filename=private_key.pem'); - res.setHeader('Content-Type', 'application/octet-stream'); - //res.send(file); - res.write(file, 'utf-8', () => { - console.log('The CSV file streamed successfully!'); - res.end(); - }); - - } catch (error) { - throw new HttpException('Error Occured', HttpStatus.INTERNAL_SERVER_ERROR); - } - } -} \ No newline at end of file +import { Injectable, HttpException, HttpStatus } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { Repository } from 'typeorm'; +import { OauthClientCredentials } from './oauth_client_credentials.entity'; +import { randomBytes, createCipheriv, createDecipheriv } from 'crypto'; +import { ApiUserEntity } from './api-user.entity'; +import { v4 as uuid } from 'uuid'; +import crypto from 'crypto'; +import fs from 'fs'; +import { Response } from 'express'; + +const algorithm = 'aes-256-cbc'; + +@Injectable() +export class OauthClientCredentialsService { + constructor( + @InjectRepository(OauthClientCredentials) + private readonly clientCredentialsRepository: Repository, + @InjectRepository(ApiUserEntity) + private readonly apiUserEntityRepository: Repository, + ) {} + + async createAPIUser(): Promise { + //@ts-ignore + return await this.apiUserEntityRepository.save({ api_user_id: uuid() }); + } + + async store( + client_id: string, + userid: string, + ): Promise { + const clientCredentials = new OauthClientCredentials(); + clientCredentials.client_id = client_id; + //clientCredentials.client_secret = this.encryptclient_secret(client_secret); + clientCredentials.api_user_id = userid; + return await this.clientCredentialsRepository.save(clientCredentials); + } + + async get(api_user_id: string) { + return await this.clientCredentialsRepository.findOne({ + api_user_id: api_user_id, + }); + } + + async replace( + id: number, + client_id: string, + userid: number, + ): Promise { + const clientCredentials = + await this.clientCredentialsRepository.findOne(id); + if (!clientCredentials) { + // Handle error, throw exception, etc. + } + clientCredentials.client_id = client_id; + //clientCredentials.client_secret = client_secret; + // clientCredentials.userid = userid; + return await this.clientCredentialsRepository.save(clientCredentials); + } + + async edit(id: number, client_id: string): Promise { + const clientCredentials = + await this.clientCredentialsRepository.findOne(id); + if (!clientCredentials) { + // Handle error, throw exception, etc. + } + clientCredentials.client_id = client_id; + //clientCredentials.client_secret = this.encryptclient_secret(client_secret); + return await this.clientCredentialsRepository.save(clientCredentials); + } + + generateClientCredentials(): { client_id: string; client_secret: string } { + const client_id = randomBytes(16).toString('hex'); + const client_secret = randomBytes(32).toString('hex'); + return { client_id, client_secret: client_secret }; + } + + async findOneByclient_id( + client_id: string, + ): Promise { + return this.clientCredentialsRepository.findOne({ where: { client_id } }); + } + + async findOneByclient_idAndUserId( + client_id: string, + api_user_id: number, + ): Promise { + return this.clientCredentialsRepository.findOne({ + where: { client_id, api_user_id }, + }); + } + async findOneByuserid( + api_user_id: string, + ): Promise { + return this.clientCredentialsRepository.findOne({ where: { api_user_id } }); + } + + encryptclient_secret(client_secret) { + console.log(algorithm, process.env.CLIENT_CREDENTIALS_ENCRYPTION_KEY); + const iv = randomBytes(16); // Generate a random IV + + const cipher = createCipheriv( + algorithm, + process.env.CLIENT_CREDENTIALS_ENCRYPTION_KEY, + iv, + ); + let encrypted = cipher.update(client_secret, 'utf8', 'hex'); + encrypted += cipher.final('hex'); + return iv.toString('hex') + encrypted; + } + + decryptclient_secret(encryptedclient_secret) { + const iv = Buffer.from(encryptedclient_secret.slice(0, 32), 'hex'); + + const decipher = createDecipheriv( + algorithm, + process.env.CLIENT_CREDENTIALS_ENCRYPTION_KEY, + iv, + ); + let decrypted = decipher.update( + encryptedclient_secret.slice(32), + 'hex', + 'utf8', + ); + decrypted += decipher.final('utf8'); + return decrypted; + } + + async findOneByApiUserId( + api_user_id: string, + ): Promise { + return await this.apiUserEntityRepository.findOne({ + where: { api_user_id }, + }); + } + + async generateKeys(api_user_id?: string) { + const { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', { + modulusLength: 2048, + publicKeyEncoding: { type: 'spki', format: 'pem' }, + privateKeyEncoding: { type: 'pkcs8', format: 'pem' }, + }); + await this.store(publicKey, api_user_id); + + return privateKey; + } + + async createKeyFile(api_user_id: string, res: Response) { + try { + const privateKey = await this.generateKeys(api_user_id); // Generate the private key using your service + fs.writeFileSync('private_key.pem', privateKey); // Write the private key to a file + const file = fs.readFileSync('private_key.pem'); // Read the file as a buffer + res.setHeader( + 'Content-Disposition', + 'attachment; filename=private_key.pem', + ); + res.setHeader('Content-Type', 'application/octet-stream'); + //res.send(file); + res.write(file, 'utf-8', () => { + console.log('The CSV file streamed successfully!'); + res.end(); + }); + } catch (error) { + throw new HttpException( + 'Error Occured', + HttpStatus.INTERNAL_SERVER_ERROR, + ); + } + } +} diff --git a/apps/drec-api/src/pods/user/oauth_client_credentials.entity.ts b/apps/drec-api/src/pods/user/oauth_client_credentials.entity.ts index c6ffb197a..a3089cd87 100755 --- a/apps/drec-api/src/pods/user/oauth_client_credentials.entity.ts +++ b/apps/drec-api/src/pods/user/oauth_client_credentials.entity.ts @@ -1,26 +1,30 @@ -import { Column, Entity, PrimaryGeneratedColumn, ManyToOne, JoinColumn } from 'typeorm'; -import { User } from './user.entity'; - - - -@Entity({ name: 'oauth_client_credentials'}) -export class OauthClientCredentials { - @PrimaryGeneratedColumn() - id: number; - -// @Column() -// userId: number; - - @Column({ unique: true, type: 'text' }) - client_id: string; -/* - @Column() - client_secret: string; -*/ - @Column() - api_user_id:string; - - @ManyToOne(() => User) - @JoinColumn({ name: 'api_user_id' }) - user: User; -} \ No newline at end of file +import { + Column, + Entity, + PrimaryGeneratedColumn, + ManyToOne, + JoinColumn, +} from 'typeorm'; +import { User } from './user.entity'; + +@Entity({ name: 'oauth_client_credentials' }) +export class OauthClientCredentials { + @PrimaryGeneratedColumn() + id: number; + + // @Column() + // userId: number; + + @Column({ unique: true, type: 'text' }) + client_id: string; + /* + @Column() + client_secret: string; +*/ + @Column() + api_user_id: string; + + @ManyToOne(() => User) + @JoinColumn({ name: 'api_user_id' }) + user: User; +} diff --git a/apps/drec-api/src/pods/user/user.controller.ts b/apps/drec-api/src/pods/user/user.controller.ts index cff47e92f..22c4a7d04 100755 --- a/apps/drec-api/src/pods/user/user.controller.ts +++ b/apps/drec-api/src/pods/user/user.controller.ts @@ -35,12 +35,21 @@ import { CreateUserORGDTO } from './dto/create-user.dto'; import { EmailConfirmationResponse, Role } from '../../utils/enums'; import { IEmailConfirmationToken, ILoggedInUser } from '../../models'; import { UpdateOwnUserSettingsDTO } from './dto/update-own-user-settings.dto'; -import { ActiveUserGuard, PermissionGuard, RolesGuard, WithoutAuthGuard } from '../../guards'; +import { + ActiveUserGuard, + PermissionGuard, + RolesGuard, + WithoutAuthGuard, +} from '../../guards'; import { UpdateUserProfileDTO } from './dto/update-user-profile.dto'; -import { UpdatePasswordDTO, UpdateChangePasswordDTO, ForgetPasswordDTO } from './dto/update-password.dto'; +import { + UpdatePasswordDTO, + UpdateChangePasswordDTO, + ForgetPasswordDTO, +} from './dto/update-password.dto'; import { EmailConfirmationService } from '../email-confirmation/email-confirmation.service'; import { SuccessResponseDTO } from '@energyweb/origin-backend-utils'; -import { EmailConfirmation } from '../email-confirmation/email-confirmation.entity' +import { EmailConfirmation } from '../email-confirmation/email-confirmation.entity'; import { Permission } from '../permission/decorators/permission.decorator'; import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator'; import { Request, Response } from 'express'; @@ -57,15 +66,15 @@ export class UserController { private readonly userService: UserService, private readonly emailConfirmationService: EmailConfirmationService, private readonly oauthClientService: OauthClientCredentialsService, - ) { } + ) {} /** * This api route use for get user information - * @param param0 + * @param param0 * @returns {UserDTO} */ @Get('me') - @UseGuards(AuthGuard(['jwt','oauth2-client-password'])) /*,PermissionGuard) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password'])) /*,PermissionGuard) @Permission('Read') @ACLModules('USER_MANAGEMENT_CRUDL') */ @ApiResponse({ @@ -74,17 +83,21 @@ export class UserController { description: 'Get my user profile', }) me(@UserDecorator() { id }: UserDTO): Promise { - console.log("With in user me"); + console.log('With in user me'); return this.userService.findById(id); } -/** - * This api user for get the user info by user id - * @param id - * @param loggedUser - * @returns {UserDTO} - */ + /** + * This api user for get the user info by user id + * @param id + * @param loggedUser + * @returns {UserDTO} + */ @Get(':id') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), ActiveUserGuard, PermissionGuard) + @UseGuards( + AuthGuard(['jwt', 'oauth2-client-password']), + ActiveUserGuard, + PermissionGuard, + ) @Permission('Read') @ACLModules('USER_MANAGEMENT_CRUDL') @ApiResponse({ @@ -98,7 +111,7 @@ export class UserController { ): Promise { return await this.userService.canViewUserData(id, loggedUser); } -/** + /** @Post('register') @ApiBody({ type: CreateUserDTO }) @ApiResponse({ @@ -112,12 +125,12 @@ export class UserController { return this.userService.create(userRegistrationData); } */ - + /** - * add new for adding user with organization - * @body {CreateUserORGDTO} - * @returns {UserDTO} - */ + * add new for adding user with organization + * @body {CreateUserORGDTO} + * @returns {UserDTO} + */ @Post('register') @ApiBody({ type: CreateUserORGDTO }) @UseGuards(WithoutAuthGuard, PermissionGuard) @@ -130,8 +143,8 @@ export class UserController { }) public async register( @Body() userRegistrationData: CreateUserORGDTO, - @Req() request: Request - ): Promise { + @Req() request: Request, + ): Promise { const user = request.user; /* console.log(request.headers); if (request.headers['client_id'] && request.headers['client_secret']) { @@ -145,41 +158,52 @@ export class UserController { client = await this.userService.validateClient(process.env.client_id, process.env.client_secret); } */ - if (userRegistrationData.organizationType === '' || userRegistrationData.organizationType === null || userRegistrationData.organizationType === undefined) { + if ( + userRegistrationData.organizationType === '' || + userRegistrationData.organizationType === null || + userRegistrationData.organizationType === undefined + ) { return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: `organizationType should not be empty`, - }) + }), ); }); } //@ts-ignore - if (userRegistrationData.organizationType.toLowerCase() != "Buyer".toLowerCase() && userRegistrationData.organizationType.toLowerCase() != "Developer".toLowerCase() && userRegistrationData.organizationType.toLowerCase() != "ApiUser".toLowerCase()) { + if ( + userRegistrationData.organizationType.toLowerCase() != + 'Buyer'.toLowerCase() && + userRegistrationData.organizationType.toLowerCase() != + 'Developer'.toLowerCase() && + userRegistrationData.organizationType.toLowerCase() != + 'ApiUser'.toLowerCase() + ) { return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: `organizationType value should be Developer/Buyer/ApiUser`, - }) + }), ); }); } - if (userRegistrationData.orgName.trim() === "") { + if (userRegistrationData.orgName.trim() === '') { return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, message: `orgName should not be empty`, - }) + }), ); }); } /* if (client) { userRegistrationData['client'] = client; } */ - if(!userRegistrationData.api_user_id) { + if (!userRegistrationData.api_user_id) { //@ts-ignore userRegistrationData.api_user_id = user.api_user_id; } @@ -191,7 +215,11 @@ export class UserController { * @returns {UserDTO} . */ @Put('profile') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), ActiveUserGuard ,PermissionGuard) + @UseGuards( + AuthGuard(['jwt', 'oauth2-client-password']), + ActiveUserGuard, + PermissionGuard, + ) @Permission('Write') @ACLModules('USER_MANAGEMENT_CRUDL') @ApiBody({ type: UpdateUserProfileDTO }) @@ -214,7 +242,11 @@ export class UserController { * @returns {UserDTO} . */ @Put('password') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), ActiveUserGuard ,PermissionGuard) + @UseGuards( + AuthGuard(['jwt', 'oauth2-client-password']), + ActiveUserGuard, + PermissionGuard, + ) @Permission('Write') @ACLModules('USER_MANAGEMENT_CRUDL') @ApiBody({ type: UpdatePasswordDTO }) @@ -230,9 +262,9 @@ export class UserController { return this.userService.updatePassword(email, body); } /** - * This api route to update the password by validating token . - * @returns {UserDTO} . - */ + * This api route to update the password by validating token . + * @returns {UserDTO} . + */ @Put('reset/password/:token') @UseGuards(WithoutAuthGuard, PermissionGuard) //@UseGuards(PermissionGuard) @@ -246,33 +278,36 @@ export class UserController { }) @ApiParam({ name: 'token', type: String }) public async updatechangePassword( - @Param('token') token: IEmailConfirmationToken['token'], @Body() body: UpdateChangePasswordDTO, ): Promise { - const emailregex: RegExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ + const emailregex: RegExp = + /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; let emailConfirmation: any; if (emailregex.test(token)) { emailConfirmation = await this.userService.findOne({ email: token }); return this.userService.updatechangePassword(emailConfirmation, body); } else { - emailConfirmation = await this.emailConfirmationService.findOne({ token }); + emailConfirmation = await this.emailConfirmationService.findOne({ + token, + }); if (!emailConfirmation) { throw new ConflictException({ success: false, errors: `User Not exist .`, }); - } - return this.userService.updatechangePassword(emailConfirmation.user, body); + return this.userService.updatechangePassword( + emailConfirmation.user, + body, + ); } - } -/** - * this api route use for confirm user email from email click in register time - * @param token :stirng - * @returns {EmailConfirmationResponse}:"Email confirmed successfully" - */ + /** + * this api route use for confirm user email from email click in register time + * @param token :stirng + * @returns {EmailConfirmationResponse}:"Email confirmed successfully" + */ @Put('confirm-email/:token') @UseGuards(WithoutAuthGuard, PermissionGuard) //@UseGuards(PermissionGuard) @@ -292,11 +327,11 @@ export class UserController { /** * This api route use for resend confirm email after login if user not confirm email at register time - * @param param0 - * @returns + * @param param0 + * @returns */ @Put('resend-confirm-email') - @UseGuards(AuthGuard(['jwt','oauth2-client-password']), PermissionGuard) + @UseGuards(AuthGuard(['jwt', 'oauth2-client-password']), PermissionGuard) @Permission('Write') @ACLModules('USER_MANAGEMENT_CRUDL') @ApiResponse({ @@ -310,12 +345,12 @@ export class UserController { return this.emailConfirmationService.sendConfirmationEmail(email); } -/** - * This api route use for if user forget password and want to change password - * @param req - * @param body - * @returns {SuccessResponseDTO} - */ + /** + * This api route use for if user forget password and want to change password + * @param req + * @param body + * @returns {SuccessResponseDTO} + */ @Post('forget-password') @UseGuards(WithoutAuthGuard, PermissionGuard) /*@UseGuards(PermissionGuard) */ @@ -328,8 +363,9 @@ export class UserController { }) public async Forgetpassword( @Req() req: Request, - @Body() body: ForgetPasswordDTO - ): Promise { /* + @Body() body: ForgetPasswordDTO, + ): Promise { + /* const user = await this.userService.findByEmail(body.email); //@ts-ignore let client = await this.oauthClientCredentialService.findOneByuserid(user.api_user_id) diff --git a/apps/drec-api/src/pods/user/user.entity.ts b/apps/drec-api/src/pods/user/user.entity.ts index 48a0101af..43ce6085d 100755 --- a/apps/drec-api/src/pods/user/user.entity.ts +++ b/apps/drec-api/src/pods/user/user.entity.ts @@ -1,12 +1,19 @@ -import { Entity, PrimaryGeneratedColumn, Column, ManyToOne,OneToMany,BeforeUpdate } from 'typeorm'; +import { + Entity, + PrimaryGeneratedColumn, + Column, + ManyToOne, + OneToMany, + BeforeUpdate, +} from 'typeorm'; import { Exclude } from 'class-transformer'; import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; import { ApiProperty } from '@nestjs/swagger'; -import { Role, UserStatus,PermissionString } from '../../utils/enums'; +import { Role, UserStatus, PermissionString } from '../../utils/enums'; import { IsEnum, IsString } from 'class-validator'; import { IUser } from '../../models'; import { Organization } from '../organization/organization.entity'; -import {ACLModulePermissions} from '../permission/permission.entity' +import { ACLModulePermissions } from '../permission/permission.entity'; @Entity() export class User extends ExtendedBaseEntity implements IUser { constructor(user: Partial) { @@ -61,7 +68,7 @@ export class User extends ExtendedBaseEntity implements IUser { @Column() @IsEnum(Role) role: Role; - + @Column() @Exclude() roleId: number; @@ -71,14 +78,14 @@ export class User extends ExtendedBaseEntity implements IUser { onDelete: 'CASCADE', }) organization: Organization; - + // @ApiProperty({ type: () => [ACLModulePermissions] }) // @OneToMany(() => ACLModulePermissions, (permission) => permission.user, { // eager: true, // }) @IsEnum(PermissionString) - permissions?:PermissionString; - + permissions?: PermissionString; + moduleName: string; @Column({ nullable: true }) @@ -91,5 +98,4 @@ export class User extends ExtendedBaseEntity implements IUser { // updateTimestamp() { // this.updatedAt = new Date(); // Set the updatedAt field to the current date and time // } - } diff --git a/apps/drec-api/src/pods/user/user.module.ts b/apps/drec-api/src/pods/user/user.module.ts index 33bcdaa75..d5a07a79a 100755 --- a/apps/drec-api/src/pods/user/user.module.ts +++ b/apps/drec-api/src/pods/user/user.module.ts @@ -1,21 +1,30 @@ -import { Module,forwardRef } from '@nestjs/common'; +import { Module, forwardRef } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { UserService } from './user.service'; import { UserController } from './user.controller'; import { User } from './user.entity'; import { EmailConfirmationModule } from '../email-confirmation/email-confirmation.module'; -import {OrganizationModule} from '../organization/organization.module' -import {UserRole} from './user_role.entity' +import { OrganizationModule } from '../organization/organization.module'; +import { UserRole } from './user_role.entity'; import { OauthClientCredentialsService } from './oauth_client.service'; import { OauthClientCredentials } from './oauth_client_credentials.entity'; import { ApiUserEntity } from './api-user.entity'; -import {UserLoginSessionEntity} from './user_login_session.entity' +import { UserLoginSessionEntity } from './user_login_session.entity'; @Module({ - imports: [TypeOrmModule.forFeature([User,UserRole,OauthClientCredentials,ApiUserEntity,UserLoginSessionEntity]), forwardRef(() => EmailConfirmationModule), - forwardRef(() => OrganizationModule)], - providers: [UserService,OauthClientCredentialsService], + imports: [ + TypeOrmModule.forFeature([ + User, + UserRole, + OauthClientCredentials, + ApiUserEntity, + UserLoginSessionEntity, + ]), + forwardRef(() => EmailConfirmationModule), + forwardRef(() => OrganizationModule), + ], + providers: [UserService, OauthClientCredentialsService], controllers: [UserController], - exports: [UserService,OauthClientCredentialsService], + exports: [UserService, OauthClientCredentialsService], }) export class UserModule {} diff --git a/apps/drec-api/src/pods/user/user.service.spec.ts b/apps/drec-api/src/pods/user/user.service.spec.ts index 82a2f09cd..c62642884 100644 --- a/apps/drec-api/src/pods/user/user.service.spec.ts +++ b/apps/drec-api/src/pods/user/user.service.spec.ts @@ -1,901 +1,1006 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { UserService } from './user.service'; -import { Repository, DeepPartial, FindManyOptions } from 'typeorm'; -import { User } from './user.entity'; -import { getRepositoryToken } from '@nestjs/typeorm'; -import { UserRole } from './user_role.entity'; -import { EmailConfirmationService } from '../email-confirmation/email-confirmation.service'; -import { OauthClientCredentialsService } from './oauth_client.service'; -import { OrganizationService } from '../organization/organization.service'; -import { ApiUserEntity } from './api-user.entity'; -import { UserLoginSessionEntity } from './user_login_session.entity'; -import { CreateUserORGDTO } from './dto/create-user.dto'; -import { Organization } from '../organization/organization.entity'; -import { OrganizationStatus, Role, UserPermissionStatus, UserStatus } from '../../utils/enums'; -import { v4 as uuid } from 'uuid'; -import { ConflictException, NotFoundException } from '@nestjs/common'; -import { EmailConfirmation } from '../email-confirmation/email-confirmation.entity'; -import { IUser } from '../../models'; -import exp from 'constants'; - - -describe('UserService', () => { - let service: UserService; - let repository: Repository; - let rolerepository: Repository; - let emailConfirmationService: EmailConfirmationService; - let oauthClientCredentialsService: OauthClientCredentialsService; - let organizationService: OrganizationService; - let apiUserEntityRepository: Repository; - let userloginSessionRepository: Repository; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [UserService, - { - provide: getRepositoryToken(User), - useClass: Repository, - }, - { - provide: getRepositoryToken(UserRole), - useClass: Repository, - }, - { - provide: EmailConfirmationService, - useValue: { - create: jest.fn(), - get: jest.fn(), - admincreate: jest.fn(), - } as any, - }, - { - provide: OauthClientCredentialsService, - useValue: { - findOneByApiUserId: jest.fn(), - } as any, - }, - { - provide: OrganizationService, - useValue: { - isNameAlreadyTaken: jest.fn(), - newcreate: jest.fn(), - } as any, - }, - { - provide: getRepositoryToken(ApiUserEntity), - useClass: Repository, - }, - { - provide: getRepositoryToken(UserLoginSessionEntity), - useClass: Repository, - }, - ], - }) - .compile(); - - service = module.get(UserService); - repository = module.get>(getRepositoryToken(User)); - rolerepository = module.get>(getRepositoryToken(UserRole)); - oauthClientCredentialsService = module.get(OauthClientCredentialsService); - organizationService = module.get(OrganizationService); - emailConfirmationService = module.get(EmailConfirmationService); - apiUserEntityRepository = module.get>(getRepositoryToken(ApiUserEntity)); - userloginSessionRepository = module.get>(getRepositoryToken(UserLoginSessionEntity)); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); - - describe('newcreate', () => { - - it('should create a new user with valid input data when it is not invite', async()=> { - - let userData: CreateUserORGDTO = { - firstName: "test", - lastName: "ApiUser", - email: "testsweya3@gmail.com", - organizationType: "ApiUser", - password: "Drec@1234", - confirmPassword: "Drec@1234", - orgName: "DIRECT_ORG_DEVELOPER1", - orgAddress: "Chennai", - api_user_id: uuid(), - } as CreateUserORGDTO; - - const orgData : Organization = { - id: 1, - name: userData.orgName, - //@ts-ignore - organizationType: userData.organizationType, - //@ts-ignore - orgEmail: userData.email, - address: userData.orgAddress, - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: userData.api_user_id, - } as Organization; - - const mockApiUserEntity: ApiUserEntity = { - api_user_id: userData.api_user_id, - permission_status: UserPermissionStatus.Request, - permissionIds:[] - }; - jest.spyOn(service, 'checkForExistingUser').mockResolvedValue(undefined); - jest.spyOn(oauthClientCredentialsService, 'findOneByApiUserId').mockResolvedValue({ api_user_id: userData.api_user_id, permission_status: UserPermissionStatus.Request, permissionIds: []}); - jest.spyOn(organizationService, 'isNameAlreadyTaken').mockResolvedValue(false); - jest.spyOn(organizationService, 'newcreate').mockResolvedValue(orgData); - jest.spyOn(repository, 'save').mockImplementation((user) => Promise.resolve(user as DeepPartial & User)); - - const result = await service.newcreate(userData); - - expect(result).toBeDefined(); - //@ts-ignore - expect(service.checkForExistingUser).toHaveBeenCalledWith(userData.email.toLowerCase()); - expect(oauthClientCredentialsService.findOneByApiUserId).toHaveBeenCalledWith(userData.api_user_id); - expect(organizationService.isNameAlreadyTaken).toHaveBeenCalledWith(userData.orgName); - expect(organizationService.newcreate).toHaveBeenCalledWith(expect.objectContaining({ - name: userData.orgName, - //@ts-ignore - organizationType: userData.organizationType, - //@ts-ignore - orgEmail: userData.email, - address: userData.orgAddress, - api_user_id: userData.api_user_id, - })); - - expect(repository.save).toHaveBeenCalledWith(expect.objectContaining({ - //@ts-ignore - firstName: userData.firstName, - //@ts-ignore - lastName: userData.lastName, - //@ts-ignore - email: userData.email.toLowerCase(), - password: expect.any(String), - notifications: true, - status: UserStatus.Active, - role: Role.ApiUser, - roleId: 6, - organization: { id: 1 }, - api_user_id: userData.api_user_id, - })); - }); - - it('should throw a ConflictException if organization name already exists', async () => { - const isNameAlreadyTakenSpy = jest.spyOn(organizationService, 'isNameAlreadyTaken').mockResolvedValue(true); - - // Test data - const userData: CreateUserORGDTO = { - firstName: "test", - lastName: "ApiUser", - email: "testsweya5@gmail.com", - organizationType: "ApiUser", - password: "Drec@1234", - confirmPassword: "Drec@1234", - orgName: "DIRECT_ORG_DEVELOPER1", - orgAddress: "Chennai", - api_user_id: uuid(), - } as CreateUserORGDTO; - - const mockOrganizationEntity ={ - id: 1, - name: 'DIRECT_ORG_DEVELOPER1', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - orgEmail: 'testsweya@gmail.com', - organizationType: Role.OrganizationAdmin, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiuserId', - } as Organization - - const mockuserEntity = { - id: 1, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya5@gmail.com', - password: 'Drec@1234', - notifications: null, - status: UserStatus.Active, - role: Role.OrganizationAdmin, - roleId: 2, - api_user_id: "apiuserId", - organization: mockOrganizationEntity, - moduleName: null, - updatedAt: new Date(), - } as User; - - const mockemailConfirmationEntity = { - id: 1, - confirmed: true, - token: 'ab3bb2e439028fa3387c8959a7199f1d5646ee9805f44c5b24b0a4ae4ade3c9e4903ef646d15db71f9bac2d5fbbd38fa2d265fabfee32fddc8b8c02dc38ec63a', - expiryTimestamp: 1708269930, - user: mockuserEntity, - } as EmailConfirmation; - - jest.spyOn(repository, 'findOne').mockResolvedValue(mockuserEntity); - jest.spyOn(emailConfirmationService, 'get').mockResolvedValue(mockemailConfirmationEntity); - jest.spyOn(organizationService, 'isNameAlreadyTaken').mockResolvedValue(true); - - await expect(service.newcreate(userData)).rejects.toThrowError(ConflictException); - }); - }); - - describe('adminnewcreate', ()=> { - it('should create a new user with valid input data', async () => { - let userData: CreateUserORGDTO = { - firstName: "test", - lastName: "ApiUser", - email: "testsweya2@gmail.com", - organizationType: "Developer", - password: "Drec@1234", - confirmPassword: "Drec@1234", - orgName: "DIRECT_DEVELOPER1", - orgAddress: "Chennai", - api_user_id: 'b44f8e86-3a9b-427b-8376-fdda83a1a8f4', - } as CreateUserORGDTO; - - const orgData: Organization = { - id: 1, - api_user_id: userData.api_user_id, - name: userData.orgName, - //@ts-ignore - organizationType: userData.organizationType, - //@ts-ignore - orgEmail: userData.email, - address: userData.orgAddress, - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - } as Organization; - - const mockApiUserEntity: ApiUserEntity = { - api_user_id: userData.api_user_id, - permission_status: UserPermissionStatus.Request, - permissionIds: [] - }; - - jest.spyOn(service, 'checkForExistingUser').mockResolvedValue(undefined); - jest.spyOn(organizationService, 'isNameAlreadyTaken').mockResolvedValue(false); - jest.spyOn(organizationService, 'newcreate').mockResolvedValue(orgData); - jest.spyOn(repository, 'save').mockImplementation((user) => Promise.resolve(user as DeepPartial & User)); - - const resultPromise = service.adminnewcreate(userData); - - await expect(resultPromise).resolves.toBeDefined(); - //@ts-ignore - await expect(service.checkForExistingUser).toHaveBeenCalledWith(userData.email.toLowerCase()); - await expect(organizationService.isNameAlreadyTaken).toHaveBeenCalledWith(userData.orgName); - await expect(organizationService.newcreate).toHaveBeenCalledWith({ - name: userData.orgName, - //api_user_id: userData.api_user_id, - //@ts-ignore - organizationType: userData.organizationType, - //@ts-ignore - orgEmail: userData.email, - address: userData.orgAddress, - }); - - await expect(repository.save).toHaveBeenCalledWith(expect.objectContaining({ - //@ts-ignore - firstName: userData.firstName, - //@ts-ignore - lastName: userData.lastName, - //@ts-ignore - email: userData.email.toLowerCase(), - password: expect.any(String), - notifications: true, - status: UserStatus.Active, - role: Role.OrganizationAdmin, - roleId: 2, - organization: { id: 1 }, - //api_user_id: userData.api_user_id, - })); - }); - - it('should throw a ConflictException if organization name already exists', async () => { - const isNameAlreadyTakenSpy = jest.spyOn(organizationService, 'isNameAlreadyTaken').mockResolvedValue(true); - - // Test data - const userData: CreateUserORGDTO = { - firstName: "test", - lastName: "ApiUser", - email: "testsweya5@gmail.com", - organizationType: "ApiUser", - password: "Drec@1234", - confirmPassword: "Drec@1234", - orgName: "DIRECT_ORG_DEVELOPER1", - orgAddress: "Chennai", - api_user_id: uuid(), - } as CreateUserORGDTO; - - const mockOrganizationEntity ={ - id: 1, - name: 'DIRECT_ORG_DEVELOPER1', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - orgEmail: 'testsweya@gmail.com', - organizationType: Role.OrganizationAdmin, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiuserId', - } as Organization - - const mockuserEntity = { - id: 1, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya5@gmail.com', - password: 'Drec@1234', - notifications: null, - status: UserStatus.Active, - role: Role.OrganizationAdmin, - roleId: 2, - api_user_id: "apiuserId", - organization: mockOrganizationEntity, - moduleName: null, - updatedAt: new Date(), - } as User; - - const mockemailConfirmationEntity = { - id: 1, - confirmed: true, - token: 'ab3bb2e439028fa3387c8959a7199f1d5646ee9805f44c5b24b0a4ae4ade3c9e4903ef646d15db71f9bac2d5fbbd38fa2d265fabfee32fddc8b8c02dc38ec63a', - expiryTimestamp: 1708269930, - user: mockuserEntity, - } as EmailConfirmation; - - jest.spyOn(repository, 'findOne').mockResolvedValue(mockuserEntity); - jest.spyOn(emailConfirmationService, 'get').mockResolvedValue(mockemailConfirmationEntity); - - jest.spyOn(organizationService, 'isNameAlreadyTaken').mockResolvedValue(true); - - await expect(service.adminnewcreate(userData)).rejects.toThrowError(ConflictException); - }); - }); - - describe('getAll', ()=> { - - let mockOrganizationEntity1 ={ - id: 1, - name: 'DIRECT_ORG_DEVELOPER1', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - orgEmail: 'testsweya@gmail.com', - organizationType: Role.OrganizationAdmin, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiuserId', - } as Organization; - - let mockOrganizationEntity2 ={ - id: 2, - name: 'DIRECT_ORG_DEVELOPER1', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - orgEmail: 'testsweya6@gmail.com', - organizationType: Role.OrganizationAdmin, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiuserId', - } as Organization; - - let userss : IUser[] = [{ - id: 1, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya@gmail.com', - notifications: null, - status: UserStatus.Active, - role: Role.OrganizationAdmin, - roleId: 2, - organization: mockOrganizationEntity1, - moduleName: null, - }, { - id: 2, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya5@gmail.com', - notifications: null, - status: UserStatus.Active, - role: Role.User, - roleId: 4, - organization: mockOrganizationEntity1, - moduleName: null, - }, { - id: 3, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya2@gmail.com', - notifications: null, - status: UserStatus.Active, - role: Role.DeviceOwner, - roleId: 3, - organization: mockOrganizationEntity1, - moduleName: null, - }, { - id: 4, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya6@gmail.com', - notifications: null, - status: UserStatus.Active, - role: Role.OrganizationAdmin, - roleId: 2, - organization: mockOrganizationEntity2, - moduleName: null, - }, { - id: 5, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya4@gmail.com', - notifications: null, - status: UserStatus.Active, - role: Role.User, - roleId: 2, - organization: mockOrganizationEntity2, - moduleName: null, - }]; - - it('should get all users when no options are provided', async () => { - const getAllSpy = jest.spyOn(repository,'find').mockResolvedValue(userss as User[]); - - const users = await service.getAll(); - - expect(users).toBeDefined(); - expect(users).toHaveLength(userss.length); - expect(users).toEqual(userss); - //await expect(getAllSpy).toHaveBeenCalledWith(); - }); - - it('should get users based on provided options', async () => { - const getAllSpy = jest.spyOn(repository,'find').mockResolvedValue([{ - id: 1, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya@gmail.com', - notifications: null, - status: UserStatus.Active, - role: Role.OrganizationAdmin, - roleId: 2, - organization: mockOrganizationEntity1, - moduleName: null, - },{ - id: 4, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya6@gmail.com', - notifications: null, - status: UserStatus.Active, - role: Role.OrganizationAdmin, - roleId: 2, - organization: mockOrganizationEntity2, - moduleName: null, - }] as User[]); - - const options: FindManyOptions = { - where: { - role: Role.OrganizationAdmin - }, - }; - - const users = await service.getAll(options); - - await expect(getAllSpy).toHaveBeenCalledWith(options); - - expect(users).toHaveLength(2); - }); - - it('should handle empty results', async () => { - const getAllSpy = jest.spyOn(repository,'find').mockResolvedValue([]); - - const users = await service.getAll(); - - //await expect(getAllSpy).toHaveBeenCalledWith(); - expect(users).toHaveLength(0); - }); - }); - - describe('findById', ()=> { - - let mockOrganizationEntity ={ - id: 1, - name: 'DIRECT_ORG_DEVELOPER1', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - orgEmail: 'testsweya@gmail.com', - organizationType: Role.ApiUser, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiuserId', - } as Organization - - let mockuserEntity = { - id: 1, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya5@gmail.com', - password: 'Drec@1234', - notifications: null, - status: UserStatus.Active, - role: Role.ApiUser, - roleId: 2, - api_user_id: "apiuserId", - organization: mockOrganizationEntity, - moduleName: null, - updatedAt: new Date(), - } as User; - - const mockApiUserEntity: ApiUserEntity = { - api_user_id: mockuserEntity.api_user_id, - permission_status: UserPermissionStatus.Request, - permissionIds:[] - }; - - it('should return the user when a user with the provided ID exists', async () => { - const userId = 1; - - const findOneSpy = jest.spyOn(service, 'findOne').mockResolvedValue(mockuserEntity); - jest.spyOn(apiUserEntityRepository,'findOne').mockResolvedValue(mockApiUserEntity); - - const user = await service.findById(userId); - - expect(findOneSpy).toHaveBeenCalledWith({id: userId}); - expect(user).toEqual(mockuserEntity); - }); - - it('should throw NotFoundException when no user with the provided ID is found', async () => { - const userId = 999; - - const findOneSpy = jest.spyOn(service, 'findOne').mockResolvedValue(undefined); - jest.spyOn(apiUserEntityRepository,'findOne').mockResolvedValue(mockApiUserEntity); - - await expect(service.findById(userId)).rejects.toThrow(NotFoundException); - - expect(findOneSpy).toHaveBeenCalledWith({id: userId}); - - }); - - it('should include permission_status when the found user has a role of Role.ApiUser', async () => { - const userId = 1; - //@ts-ignore - mockuserEntity.permission_status = UserPermissionStatus.Active; - const findOneSpy = jest.spyOn(service, 'findOne').mockResolvedValue(mockuserEntity); - const permission_statusSpy = jest.spyOn(service, 'get_apiuser_permission_status').mockResolvedValue(mockApiUserEntity); - jest.spyOn(apiUserEntityRepository,'findOne').mockResolvedValue(mockApiUserEntity); - - const user = await service.findById(userId); - - expect(findOneSpy).toHaveBeenCalledWith({id: userId}); - expect(permission_statusSpy).toHaveBeenCalledWith(mockuserEntity.api_user_id); - //@ts-ignore - expect(user.permission_status).toBe(UserPermissionStatus.Request); - }); - - it('should not include permission_status when the found user has a role other than Role.ApiUser', async () => { - const userId = 1; - const OrganizationEntity ={ - id: 1, - name: 'DIRECT_ORG_DEVELOPER1', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - orgEmail: 'testsweya@gmail.com', - organizationType: Role.OrganizationAdmin, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiuserId', - } as Organization - - let userEntity = { - id: 1, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya5@gmail.com', - password: 'Drec@1234', - notifications: null, - status: UserStatus.Active, - role: Role.OrganizationAdmin, - roleId: 2, - api_user_id: "apiuserId", - organization: OrganizationEntity, - moduleName: null, - updatedAt: new Date(), - } as User; - - const apiUserEntity: ApiUserEntity = { - api_user_id: userEntity.api_user_id, - permission_status: UserPermissionStatus.Request, - permissionIds:[] - }; - const findOneSpy = jest.spyOn(service, 'findOne').mockResolvedValue(userEntity); - jest.spyOn(apiUserEntityRepository,'findOne').mockResolvedValue(undefined); - - const user = await service.findById(userId); - - expect(findOneSpy).toHaveBeenCalledWith({id: userId}); - //@ts-ignore - expect(user.permission_status).toBeUndefined(); - }); - }); - - describe('findByEmail', () => { - - let mockOrganizationEntity ={ - id: 1, - name: 'DIRECT_ORG_DEVELOPER1', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - orgEmail: 'testsweya@gmail.com', - organizationType: Role.ApiUser, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiuserId', - } as Organization - - let mockuserEntity = { - id: 1, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya@gmail.com', - password: 'Drec@1234', - notifications: null, - status: UserStatus.Active, - role: Role.ApiUser, - roleId: 2, - api_user_id: "apiuserId", - organization: mockOrganizationEntity, - moduleName: null, - updatedAt: new Date(), - } as User; - - const mockApiUserEntity: ApiUserEntity = { - api_user_id: mockuserEntity.api_user_id, - permission_status: UserPermissionStatus.Request, - permissionIds:[] - }; - - it('should return the user with the provided email', async () => { - const email = 'testsweya@gmail.com'; - - const findOneSpy = jest.spyOn(service, 'findOne').mockResolvedValue(mockuserEntity); - - const result = await service.findByEmail(email); - - expect(result).toEqual(mockuserEntity); - expect(findOneSpy).toHaveBeenCalledWith({ email: email.toLowerCase() }); - }); - - it('should return null when no user with the provided email is found', async () => { - const email = 'nonexistent@example.com'; - - jest.spyOn(service, 'findOne').mockResolvedValue(null); - - const result = await service.findByEmail(email); - - expect(result).toBeNull(); - expect(service.findOne).toHaveBeenCalledWith({ email: email.toLowerCase() }); - }); - }); - - describe('getUserAndPasswordByEmail', () => { - - let mockOrganizationEntity ={ - id: 1, - name: 'DIRECT_ORG_DEVELOPER1', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - orgEmail: 'testsweya@gmail.com', - organizationType: Role.ApiUser, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiuserId', - } as Organization - - let mockuserEntity = { - id: 1, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya@gmail.com', - password: 'Drec@1234', - notifications: null, - status: UserStatus.Active, - role: Role.ApiUser, - roleId: 2, - api_user_id: "apiuserId", - organization: mockOrganizationEntity, - moduleName: null, - updatedAt: new Date(), - } as User; - - const mockApiUserEntity: ApiUserEntity = { - api_user_id: mockuserEntity.api_user_id, - permission_status: UserPermissionStatus.Request, - permissionIds:[] - }; - - it('should return the user with the provided email and password', async () => { - const email = 'test@example.com'; - const password = 'password123'; - - const findOneSpy = jest.spyOn(repository, 'findOne').mockResolvedValue(mockuserEntity); - - const result = await service.getUserAndPasswordByEmail(email); - - expect(result).toEqual(mockuserEntity); - expect(findOneSpy).toHaveBeenCalledWith( - { email }, - { select: ['id', 'email', 'password'] }, - ); - }); - - it('should return null when no user with the provided email is found', async () => { - const email = 'nonexistent@example.com'; - - const findOneSpy = jest.spyOn(repository, 'findOne').mockResolvedValue(null); - - const result = await service.getUserAndPasswordByEmail(email); - - expect(result).toBeNull(); - expect(findOneSpy).toHaveBeenCalledWith( - { email }, - { select: ['id', 'email', 'password'] }, - ); - }); - }); - - describe('findOne', ()=> { - let mockOrganizationEntity ={ - id: 1, - name: 'DIRECT_ORG_DEVELOPER1', - address: 'Bangalore', - zipCode: null, - city: null, - country: null, - blockchainAccountAddress: null, - blockchainAccountSignedMessage: null, - orgEmail: 'testsweya@gmail.com', - organizationType: Role.ApiUser, - status: OrganizationStatus.Active, - users: [], - invitations: [], - documentIds: [], - api_user_id: 'apiuserId', - } as Organization - - let mockuserEntity = { - id: 1, - firstName: 'Dev', - lastName: 'lastName', - email: 'testsweya@gmail.com', - password: 'Drec@1234', - notifications: null, - status: UserStatus.Active, - role: Role.ApiUser, - roleId: 2, - api_user_id: "apiuserId", - organization: mockOrganizationEntity, - moduleName: null, - updatedAt: new Date(), - } as User; - - const mockApiUserEntity: ApiUserEntity = { - api_user_id: mockuserEntity.api_user_id, - permission_status: UserPermissionStatus.Request, - permissionIds:[] - }; - - let mockemailConfirmationEntity = { - id: 1, - confirmed: true, - token: 'ab3bb2e439028fa3387c8959a7199f1d5646ee9805f44c5b24b0a4ae4ade3c9e4903ef646d15db71f9bac2d5fbbd38fa2d265fabfee32fddc8b8c02dc38ec63a', - expiryTimestamp: 1708269930, - user: mockuserEntity, - } as EmailConfirmation; - - it('should return null if no user is found based on the provided conditions', async () => { - const findOneSpy = jest.spyOn(repository, 'findOne').mockResolvedValue(null); - - const result = await service.findOne({ email: mockuserEntity.email }); - - expect(result).toBeNull(); - expect(findOneSpy).toHaveBeenCalledWith( - { email: mockuserEntity.email }, - { relations: ['organization'] }, - ); - expect(emailConfirmationService.get).not.toHaveBeenCalled(); - }); - - it('should return the user with emailConfirmed set to true if email confirmation exists', async () => { - const findOneSpy = jest.spyOn(repository, 'findOne').mockResolvedValue(mockuserEntity); - - const emailConfirmationSpy = jest.spyOn(emailConfirmationService, 'get').mockResolvedValue(mockemailConfirmationEntity); - - const result = await service.findOne({ email: 'test@example.com' }); - - expect(result).toEqual(expect.objectContaining(mockuserEntity)); - expect(result.emailConfirmed).toBe(true); - expect(findOneSpy).toHaveBeenCalledWith( - { email: 'test@example.com' }, - { relations: ['organization'] }, - ); - expect(emailConfirmationSpy).toHaveBeenCalledWith(1); - }); - - it('should return the user with emailConfirmed set to false if no email confirmation exists', async () => { - jest.spyOn(repository, 'findOne').mockResolvedValue(mockuserEntity); - - jest.spyOn(emailConfirmationService, 'get').mockResolvedValue(null); - - const result = await service.findOne({ email: 'test@example.com' }); - - expect(result).toEqual(expect.objectContaining(mockuserEntity)); - expect(result.emailConfirmed).toBe(false); - expect(repository.findOne).toHaveBeenCalledWith( - { email: 'test@example.com' }, - { relations: ['organization'] }, - ); - expect(emailConfirmationService.get).toHaveBeenCalledWith(1); - }); - }); -}); +import { Test, TestingModule } from '@nestjs/testing'; +import { UserService } from './user.service'; +import { Repository, DeepPartial, FindManyOptions } from 'typeorm'; +import { User } from './user.entity'; +import { getRepositoryToken } from '@nestjs/typeorm'; +import { UserRole } from './user_role.entity'; +import { EmailConfirmationService } from '../email-confirmation/email-confirmation.service'; +import { OauthClientCredentialsService } from './oauth_client.service'; +import { OrganizationService } from '../organization/organization.service'; +import { ApiUserEntity } from './api-user.entity'; +import { UserLoginSessionEntity } from './user_login_session.entity'; +import { CreateUserORGDTO } from './dto/create-user.dto'; +import { Organization } from '../organization/organization.entity'; +import { + OrganizationStatus, + Role, + UserPermissionStatus, + UserStatus, +} from '../../utils/enums'; +import { v4 as uuid } from 'uuid'; +import { ConflictException, NotFoundException } from '@nestjs/common'; +import { EmailConfirmation } from '../email-confirmation/email-confirmation.entity'; +import { IUser } from '../../models'; +import exp from 'constants'; + +describe('UserService', () => { + let service: UserService; + let repository: Repository; + let rolerepository: Repository; + let emailConfirmationService: EmailConfirmationService; + let oauthClientCredentialsService: OauthClientCredentialsService; + let organizationService: OrganizationService; + let apiUserEntityRepository: Repository; + let userloginSessionRepository: Repository; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + UserService, + { + provide: getRepositoryToken(User), + useClass: Repository, + }, + { + provide: getRepositoryToken(UserRole), + useClass: Repository, + }, + { + provide: EmailConfirmationService, + useValue: { + create: jest.fn(), + get: jest.fn(), + admincreate: jest.fn(), + } as any, + }, + { + provide: OauthClientCredentialsService, + useValue: { + findOneByApiUserId: jest.fn(), + } as any, + }, + { + provide: OrganizationService, + useValue: { + isNameAlreadyTaken: jest.fn(), + newcreate: jest.fn(), + } as any, + }, + { + provide: getRepositoryToken(ApiUserEntity), + useClass: Repository, + }, + { + provide: getRepositoryToken(UserLoginSessionEntity), + useClass: Repository, + }, + ], + }).compile(); + + service = module.get(UserService); + repository = module.get>(getRepositoryToken(User)); + rolerepository = module.get>( + getRepositoryToken(UserRole), + ); + oauthClientCredentialsService = module.get( + OauthClientCredentialsService, + ); + organizationService = module.get(OrganizationService); + emailConfirmationService = module.get( + EmailConfirmationService, + ); + apiUserEntityRepository = module.get>( + getRepositoryToken(ApiUserEntity), + ); + userloginSessionRepository = module.get>( + getRepositoryToken(UserLoginSessionEntity), + ); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); + + describe('newcreate', () => { + it('should create a new user with valid input data when it is not invite', async () => { + let userData: CreateUserORGDTO = { + firstName: 'test', + lastName: 'ApiUser', + email: 'testsweya3@gmail.com', + organizationType: 'ApiUser', + password: 'Drec@1234', + confirmPassword: 'Drec@1234', + orgName: 'DIRECT_ORG_DEVELOPER1', + orgAddress: 'Chennai', + api_user_id: uuid(), + } as CreateUserORGDTO; + + const orgData: Organization = { + id: 1, + name: userData.orgName, + //@ts-ignore + organizationType: userData.organizationType, + //@ts-ignore + orgEmail: userData.email, + address: userData.orgAddress, + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: userData.api_user_id, + } as Organization; + + const mockApiUserEntity: ApiUserEntity = { + api_user_id: userData.api_user_id, + permission_status: UserPermissionStatus.Request, + permissionIds: [], + }; + jest.spyOn(service, 'checkForExistingUser').mockResolvedValue(undefined); + jest + .spyOn(oauthClientCredentialsService, 'findOneByApiUserId') + .mockResolvedValue({ + api_user_id: userData.api_user_id, + permission_status: UserPermissionStatus.Request, + permissionIds: [], + }); + jest + .spyOn(organizationService, 'isNameAlreadyTaken') + .mockResolvedValue(false); + jest.spyOn(organizationService, 'newcreate').mockResolvedValue(orgData); + jest + .spyOn(repository, 'save') + .mockImplementation((user) => + Promise.resolve(user as DeepPartial & User), + ); + + const result = await service.newcreate(userData); + + expect(result).toBeDefined(); + //@ts-ignore + expect(service.checkForExistingUser).toHaveBeenCalledWith( + userData.email.toLowerCase(), + ); + expect( + oauthClientCredentialsService.findOneByApiUserId, + ).toHaveBeenCalledWith(userData.api_user_id); + expect(organizationService.isNameAlreadyTaken).toHaveBeenCalledWith( + userData.orgName, + ); + expect(organizationService.newcreate).toHaveBeenCalledWith( + expect.objectContaining({ + name: userData.orgName, + //@ts-ignore + organizationType: userData.organizationType, + //@ts-ignore + orgEmail: userData.email, + address: userData.orgAddress, + api_user_id: userData.api_user_id, + }), + ); + + expect(repository.save).toHaveBeenCalledWith( + expect.objectContaining({ + //@ts-ignore + firstName: userData.firstName, + //@ts-ignore + lastName: userData.lastName, + //@ts-ignore + email: userData.email.toLowerCase(), + password: expect.any(String), + notifications: true, + status: UserStatus.Active, + role: Role.ApiUser, + roleId: 6, + organization: { id: 1 }, + api_user_id: userData.api_user_id, + }), + ); + }); + + it('should throw a ConflictException if organization name already exists', async () => { + const isNameAlreadyTakenSpy = jest + .spyOn(organizationService, 'isNameAlreadyTaken') + .mockResolvedValue(true); + + // Test data + const userData: CreateUserORGDTO = { + firstName: 'test', + lastName: 'ApiUser', + email: 'testsweya5@gmail.com', + organizationType: 'ApiUser', + password: 'Drec@1234', + confirmPassword: 'Drec@1234', + orgName: 'DIRECT_ORG_DEVELOPER1', + orgAddress: 'Chennai', + api_user_id: uuid(), + } as CreateUserORGDTO; + + const mockOrganizationEntity = { + id: 1, + name: 'DIRECT_ORG_DEVELOPER1', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + orgEmail: 'testsweya@gmail.com', + organizationType: Role.OrganizationAdmin, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiuserId', + } as Organization; + + const mockuserEntity = { + id: 1, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya5@gmail.com', + password: 'Drec@1234', + notifications: null, + status: UserStatus.Active, + role: Role.OrganizationAdmin, + roleId: 2, + api_user_id: 'apiuserId', + organization: mockOrganizationEntity, + moduleName: null, + updatedAt: new Date(), + } as User; + + const mockemailConfirmationEntity = { + id: 1, + confirmed: true, + token: + 'ab3bb2e439028fa3387c8959a7199f1d5646ee9805f44c5b24b0a4ae4ade3c9e4903ef646d15db71f9bac2d5fbbd38fa2d265fabfee32fddc8b8c02dc38ec63a', + expiryTimestamp: 1708269930, + user: mockuserEntity, + } as EmailConfirmation; + + jest.spyOn(repository, 'findOne').mockResolvedValue(mockuserEntity); + jest + .spyOn(emailConfirmationService, 'get') + .mockResolvedValue(mockemailConfirmationEntity); + jest + .spyOn(organizationService, 'isNameAlreadyTaken') + .mockResolvedValue(true); + + await expect(service.newcreate(userData)).rejects.toThrowError( + ConflictException, + ); + }); + }); + + describe('adminnewcreate', () => { + it('should create a new user with valid input data', async () => { + let userData: CreateUserORGDTO = { + firstName: 'test', + lastName: 'ApiUser', + email: 'testsweya2@gmail.com', + organizationType: 'Developer', + password: 'Drec@1234', + confirmPassword: 'Drec@1234', + orgName: 'DIRECT_DEVELOPER1', + orgAddress: 'Chennai', + api_user_id: 'b44f8e86-3a9b-427b-8376-fdda83a1a8f4', + } as CreateUserORGDTO; + + const orgData: Organization = { + id: 1, + api_user_id: userData.api_user_id, + name: userData.orgName, + //@ts-ignore + organizationType: userData.organizationType, + //@ts-ignore + orgEmail: userData.email, + address: userData.orgAddress, + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + } as Organization; + + const mockApiUserEntity: ApiUserEntity = { + api_user_id: userData.api_user_id, + permission_status: UserPermissionStatus.Request, + permissionIds: [], + }; + + jest.spyOn(service, 'checkForExistingUser').mockResolvedValue(undefined); + jest + .spyOn(organizationService, 'isNameAlreadyTaken') + .mockResolvedValue(false); + jest.spyOn(organizationService, 'newcreate').mockResolvedValue(orgData); + jest + .spyOn(repository, 'save') + .mockImplementation((user) => + Promise.resolve(user as DeepPartial & User), + ); + + const resultPromise = service.adminnewcreate(userData); + + await expect(resultPromise).resolves.toBeDefined(); + //@ts-ignore + await expect(service.checkForExistingUser).toHaveBeenCalledWith( + userData.email.toLowerCase(), + ); + await expect(organizationService.isNameAlreadyTaken).toHaveBeenCalledWith( + userData.orgName, + ); + await expect(organizationService.newcreate).toHaveBeenCalledWith({ + name: userData.orgName, + //api_user_id: userData.api_user_id, + //@ts-ignore + organizationType: userData.organizationType, + //@ts-ignore + orgEmail: userData.email, + address: userData.orgAddress, + }); + + await expect(repository.save).toHaveBeenCalledWith( + expect.objectContaining({ + //@ts-ignore + firstName: userData.firstName, + //@ts-ignore + lastName: userData.lastName, + //@ts-ignore + email: userData.email.toLowerCase(), + password: expect.any(String), + notifications: true, + status: UserStatus.Active, + role: Role.OrganizationAdmin, + roleId: 2, + organization: { id: 1 }, + //api_user_id: userData.api_user_id, + }), + ); + }); + + it('should throw a ConflictException if organization name already exists', async () => { + const isNameAlreadyTakenSpy = jest + .spyOn(organizationService, 'isNameAlreadyTaken') + .mockResolvedValue(true); + + // Test data + const userData: CreateUserORGDTO = { + firstName: 'test', + lastName: 'ApiUser', + email: 'testsweya5@gmail.com', + organizationType: 'ApiUser', + password: 'Drec@1234', + confirmPassword: 'Drec@1234', + orgName: 'DIRECT_ORG_DEVELOPER1', + orgAddress: 'Chennai', + api_user_id: uuid(), + } as CreateUserORGDTO; + + const mockOrganizationEntity = { + id: 1, + name: 'DIRECT_ORG_DEVELOPER1', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + orgEmail: 'testsweya@gmail.com', + organizationType: Role.OrganizationAdmin, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiuserId', + } as Organization; + + const mockuserEntity = { + id: 1, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya5@gmail.com', + password: 'Drec@1234', + notifications: null, + status: UserStatus.Active, + role: Role.OrganizationAdmin, + roleId: 2, + api_user_id: 'apiuserId', + organization: mockOrganizationEntity, + moduleName: null, + updatedAt: new Date(), + } as User; + + const mockemailConfirmationEntity = { + id: 1, + confirmed: true, + token: + 'ab3bb2e439028fa3387c8959a7199f1d5646ee9805f44c5b24b0a4ae4ade3c9e4903ef646d15db71f9bac2d5fbbd38fa2d265fabfee32fddc8b8c02dc38ec63a', + expiryTimestamp: 1708269930, + user: mockuserEntity, + } as EmailConfirmation; + + jest.spyOn(repository, 'findOne').mockResolvedValue(mockuserEntity); + jest + .spyOn(emailConfirmationService, 'get') + .mockResolvedValue(mockemailConfirmationEntity); + + jest + .spyOn(organizationService, 'isNameAlreadyTaken') + .mockResolvedValue(true); + + await expect(service.adminnewcreate(userData)).rejects.toThrowError( + ConflictException, + ); + }); + }); + + describe('getAll', () => { + let mockOrganizationEntity1 = { + id: 1, + name: 'DIRECT_ORG_DEVELOPER1', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + orgEmail: 'testsweya@gmail.com', + organizationType: Role.OrganizationAdmin, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiuserId', + } as Organization; + + let mockOrganizationEntity2 = { + id: 2, + name: 'DIRECT_ORG_DEVELOPER1', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + orgEmail: 'testsweya6@gmail.com', + organizationType: Role.OrganizationAdmin, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiuserId', + } as Organization; + + let userss: IUser[] = [ + { + id: 1, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya@gmail.com', + notifications: null, + status: UserStatus.Active, + role: Role.OrganizationAdmin, + roleId: 2, + organization: mockOrganizationEntity1, + moduleName: null, + }, + { + id: 2, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya5@gmail.com', + notifications: null, + status: UserStatus.Active, + role: Role.User, + roleId: 4, + organization: mockOrganizationEntity1, + moduleName: null, + }, + { + id: 3, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya2@gmail.com', + notifications: null, + status: UserStatus.Active, + role: Role.DeviceOwner, + roleId: 3, + organization: mockOrganizationEntity1, + moduleName: null, + }, + { + id: 4, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya6@gmail.com', + notifications: null, + status: UserStatus.Active, + role: Role.OrganizationAdmin, + roleId: 2, + organization: mockOrganizationEntity2, + moduleName: null, + }, + { + id: 5, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya4@gmail.com', + notifications: null, + status: UserStatus.Active, + role: Role.User, + roleId: 2, + organization: mockOrganizationEntity2, + moduleName: null, + }, + ]; + + it('should get all users when no options are provided', async () => { + const getAllSpy = jest + .spyOn(repository, 'find') + .mockResolvedValue(userss as User[]); + + const users = await service.getAll(); + + expect(users).toBeDefined(); + expect(users).toHaveLength(userss.length); + expect(users).toEqual(userss); + //await expect(getAllSpy).toHaveBeenCalledWith(); + }); + + it('should get users based on provided options', async () => { + const getAllSpy = jest.spyOn(repository, 'find').mockResolvedValue([ + { + id: 1, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya@gmail.com', + notifications: null, + status: UserStatus.Active, + role: Role.OrganizationAdmin, + roleId: 2, + organization: mockOrganizationEntity1, + moduleName: null, + }, + { + id: 4, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya6@gmail.com', + notifications: null, + status: UserStatus.Active, + role: Role.OrganizationAdmin, + roleId: 2, + organization: mockOrganizationEntity2, + moduleName: null, + }, + ] as User[]); + + const options: FindManyOptions = { + where: { + role: Role.OrganizationAdmin, + }, + }; + + const users = await service.getAll(options); + + await expect(getAllSpy).toHaveBeenCalledWith(options); + + expect(users).toHaveLength(2); + }); + + it('should handle empty results', async () => { + const getAllSpy = jest.spyOn(repository, 'find').mockResolvedValue([]); + + const users = await service.getAll(); + + //await expect(getAllSpy).toHaveBeenCalledWith(); + expect(users).toHaveLength(0); + }); + }); + + describe('findById', () => { + let mockOrganizationEntity = { + id: 1, + name: 'DIRECT_ORG_DEVELOPER1', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + orgEmail: 'testsweya@gmail.com', + organizationType: Role.ApiUser, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiuserId', + } as Organization; + + let mockuserEntity = { + id: 1, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya5@gmail.com', + password: 'Drec@1234', + notifications: null, + status: UserStatus.Active, + role: Role.ApiUser, + roleId: 2, + api_user_id: 'apiuserId', + organization: mockOrganizationEntity, + moduleName: null, + updatedAt: new Date(), + } as User; + + const mockApiUserEntity: ApiUserEntity = { + api_user_id: mockuserEntity.api_user_id, + permission_status: UserPermissionStatus.Request, + permissionIds: [], + }; + + it('should return the user when a user with the provided ID exists', async () => { + const userId = 1; + + const findOneSpy = jest + .spyOn(service, 'findOne') + .mockResolvedValue(mockuserEntity); + jest + .spyOn(apiUserEntityRepository, 'findOne') + .mockResolvedValue(mockApiUserEntity); + + const user = await service.findById(userId); + + expect(findOneSpy).toHaveBeenCalledWith({ id: userId }); + expect(user).toEqual(mockuserEntity); + }); + + it('should throw NotFoundException when no user with the provided ID is found', async () => { + const userId = 999; + + const findOneSpy = jest + .spyOn(service, 'findOne') + .mockResolvedValue(undefined); + jest + .spyOn(apiUserEntityRepository, 'findOne') + .mockResolvedValue(mockApiUserEntity); + + await expect(service.findById(userId)).rejects.toThrow(NotFoundException); + + expect(findOneSpy).toHaveBeenCalledWith({ id: userId }); + }); + + it('should include permission_status when the found user has a role of Role.ApiUser', async () => { + const userId = 1; + //@ts-ignore + mockuserEntity.permission_status = UserPermissionStatus.Active; + const findOneSpy = jest + .spyOn(service, 'findOne') + .mockResolvedValue(mockuserEntity); + const permission_statusSpy = jest + .spyOn(service, 'get_apiuser_permission_status') + .mockResolvedValue(mockApiUserEntity); + jest + .spyOn(apiUserEntityRepository, 'findOne') + .mockResolvedValue(mockApiUserEntity); + + const user = await service.findById(userId); + + expect(findOneSpy).toHaveBeenCalledWith({ id: userId }); + expect(permission_statusSpy).toHaveBeenCalledWith( + mockuserEntity.api_user_id, + ); + //@ts-ignore + expect(user.permission_status).toBe(UserPermissionStatus.Request); + }); + + it('should not include permission_status when the found user has a role other than Role.ApiUser', async () => { + const userId = 1; + const OrganizationEntity = { + id: 1, + name: 'DIRECT_ORG_DEVELOPER1', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + orgEmail: 'testsweya@gmail.com', + organizationType: Role.OrganizationAdmin, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiuserId', + } as Organization; + + let userEntity = { + id: 1, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya5@gmail.com', + password: 'Drec@1234', + notifications: null, + status: UserStatus.Active, + role: Role.OrganizationAdmin, + roleId: 2, + api_user_id: 'apiuserId', + organization: OrganizationEntity, + moduleName: null, + updatedAt: new Date(), + } as User; + + const apiUserEntity: ApiUserEntity = { + api_user_id: userEntity.api_user_id, + permission_status: UserPermissionStatus.Request, + permissionIds: [], + }; + const findOneSpy = jest + .spyOn(service, 'findOne') + .mockResolvedValue(userEntity); + jest + .spyOn(apiUserEntityRepository, 'findOne') + .mockResolvedValue(undefined); + + const user = await service.findById(userId); + + expect(findOneSpy).toHaveBeenCalledWith({ id: userId }); + //@ts-ignore + expect(user.permission_status).toBeUndefined(); + }); + }); + + describe('findByEmail', () => { + let mockOrganizationEntity = { + id: 1, + name: 'DIRECT_ORG_DEVELOPER1', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + orgEmail: 'testsweya@gmail.com', + organizationType: Role.ApiUser, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiuserId', + } as Organization; + + let mockuserEntity = { + id: 1, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya@gmail.com', + password: 'Drec@1234', + notifications: null, + status: UserStatus.Active, + role: Role.ApiUser, + roleId: 2, + api_user_id: 'apiuserId', + organization: mockOrganizationEntity, + moduleName: null, + updatedAt: new Date(), + } as User; + + const mockApiUserEntity: ApiUserEntity = { + api_user_id: mockuserEntity.api_user_id, + permission_status: UserPermissionStatus.Request, + permissionIds: [], + }; + + it('should return the user with the provided email', async () => { + const email = 'testsweya@gmail.com'; + + const findOneSpy = jest + .spyOn(service, 'findOne') + .mockResolvedValue(mockuserEntity); + + const result = await service.findByEmail(email); + + expect(result).toEqual(mockuserEntity); + expect(findOneSpy).toHaveBeenCalledWith({ email: email.toLowerCase() }); + }); + + it('should return null when no user with the provided email is found', async () => { + const email = 'nonexistent@example.com'; + + jest.spyOn(service, 'findOne').mockResolvedValue(null); + + const result = await service.findByEmail(email); + + expect(result).toBeNull(); + expect(service.findOne).toHaveBeenCalledWith({ + email: email.toLowerCase(), + }); + }); + }); + + describe('getUserAndPasswordByEmail', () => { + let mockOrganizationEntity = { + id: 1, + name: 'DIRECT_ORG_DEVELOPER1', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + orgEmail: 'testsweya@gmail.com', + organizationType: Role.ApiUser, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiuserId', + } as Organization; + + let mockuserEntity = { + id: 1, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya@gmail.com', + password: 'Drec@1234', + notifications: null, + status: UserStatus.Active, + role: Role.ApiUser, + roleId: 2, + api_user_id: 'apiuserId', + organization: mockOrganizationEntity, + moduleName: null, + updatedAt: new Date(), + } as User; + + const mockApiUserEntity: ApiUserEntity = { + api_user_id: mockuserEntity.api_user_id, + permission_status: UserPermissionStatus.Request, + permissionIds: [], + }; + + it('should return the user with the provided email and password', async () => { + const email = 'test@example.com'; + const password = 'password123'; + + const findOneSpy = jest + .spyOn(repository, 'findOne') + .mockResolvedValue(mockuserEntity); + + const result = await service.getUserAndPasswordByEmail(email); + + expect(result).toEqual(mockuserEntity); + expect(findOneSpy).toHaveBeenCalledWith( + { email }, + { select: ['id', 'email', 'password'] }, + ); + }); + + it('should return null when no user with the provided email is found', async () => { + const email = 'nonexistent@example.com'; + + const findOneSpy = jest + .spyOn(repository, 'findOne') + .mockResolvedValue(null); + + const result = await service.getUserAndPasswordByEmail(email); + + expect(result).toBeNull(); + expect(findOneSpy).toHaveBeenCalledWith( + { email }, + { select: ['id', 'email', 'password'] }, + ); + }); + }); + + describe('findOne', () => { + let mockOrganizationEntity = { + id: 1, + name: 'DIRECT_ORG_DEVELOPER1', + address: 'Bangalore', + zipCode: null, + city: null, + country: null, + blockchainAccountAddress: null, + blockchainAccountSignedMessage: null, + orgEmail: 'testsweya@gmail.com', + organizationType: Role.ApiUser, + status: OrganizationStatus.Active, + users: [], + invitations: [], + documentIds: [], + api_user_id: 'apiuserId', + } as Organization; + + let mockuserEntity = { + id: 1, + firstName: 'Dev', + lastName: 'lastName', + email: 'testsweya@gmail.com', + password: 'Drec@1234', + notifications: null, + status: UserStatus.Active, + role: Role.ApiUser, + roleId: 2, + api_user_id: 'apiuserId', + organization: mockOrganizationEntity, + moduleName: null, + updatedAt: new Date(), + } as User; + + const mockApiUserEntity: ApiUserEntity = { + api_user_id: mockuserEntity.api_user_id, + permission_status: UserPermissionStatus.Request, + permissionIds: [], + }; + + let mockemailConfirmationEntity = { + id: 1, + confirmed: true, + token: + 'ab3bb2e439028fa3387c8959a7199f1d5646ee9805f44c5b24b0a4ae4ade3c9e4903ef646d15db71f9bac2d5fbbd38fa2d265fabfee32fddc8b8c02dc38ec63a', + expiryTimestamp: 1708269930, + user: mockuserEntity, + } as EmailConfirmation; + + it('should return null if no user is found based on the provided conditions', async () => { + const findOneSpy = jest + .spyOn(repository, 'findOne') + .mockResolvedValue(null); + + const result = await service.findOne({ email: mockuserEntity.email }); + + expect(result).toBeNull(); + expect(findOneSpy).toHaveBeenCalledWith( + { email: mockuserEntity.email }, + { relations: ['organization'] }, + ); + expect(emailConfirmationService.get).not.toHaveBeenCalled(); + }); + + it('should return the user with emailConfirmed set to true if email confirmation exists', async () => { + const findOneSpy = jest + .spyOn(repository, 'findOne') + .mockResolvedValue(mockuserEntity); + + const emailConfirmationSpy = jest + .spyOn(emailConfirmationService, 'get') + .mockResolvedValue(mockemailConfirmationEntity); + + const result = await service.findOne({ email: 'test@example.com' }); + + expect(result).toEqual(expect.objectContaining(mockuserEntity)); + expect(result.emailConfirmed).toBe(true); + expect(findOneSpy).toHaveBeenCalledWith( + { email: 'test@example.com' }, + { relations: ['organization'] }, + ); + expect(emailConfirmationSpy).toHaveBeenCalledWith(1); + }); + + it('should return the user with emailConfirmed set to false if no email confirmation exists', async () => { + jest.spyOn(repository, 'findOne').mockResolvedValue(mockuserEntity); + + jest.spyOn(emailConfirmationService, 'get').mockResolvedValue(null); + + const result = await service.findOne({ email: 'test@example.com' }); + + expect(result).toEqual(expect.objectContaining(mockuserEntity)); + expect(result.emailConfirmed).toBe(false); + expect(repository.findOne).toHaveBeenCalledWith( + { email: 'test@example.com' }, + { relations: ['organization'] }, + ); + expect(emailConfirmationService.get).toHaveBeenCalledWith(1); + }); + }); +}); diff --git a/apps/drec-api/src/pods/user/user.service.ts b/apps/drec-api/src/pods/user/user.service.ts index fc090bb3f..703c9114e 100755 --- a/apps/drec-api/src/pods/user/user.service.ts +++ b/apps/drec-api/src/pods/user/user.service.ts @@ -1,797 +1,832 @@ -import { - ConflictException, - Injectable, - Inject, - Logger, - UnprocessableEntityException, - UnauthorizedException, - NotFoundException, - InternalServerErrorException, - forwardRef -} from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; -import bcrypt from 'bcryptjs'; -import { - FindConditions, - Repository, - FindManyOptions, - SelectQueryBuilder, - Not -} from 'typeorm'; -import { ILoggedInUser, IUser, UserPasswordUpdate, UserChangePasswordUpdate } from '../../models'; -import { Role, UserStatus, UserPermissionStatus } from '../../utils/enums'; -import { CreateUserORGDTO } from './dto/create-user.dto'; -import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; -import { validate } from 'class-validator'; -import { UserRole } from './user_role.entity'; -import { UserDTO } from './dto/user.dto'; -import { User } from './user.entity'; -import { UpdateUserProfileDTO } from './dto/update-user-profile.dto'; -import { EmailConfirmationService } from '../email-confirmation/email-confirmation.service'; -import { UpdateUserDTO } from '../admin/dto/update-user.dto'; -import { UserFilterDTO } from '../admin/dto/user-filter.dto'; -import { OrganizationService } from '../organization/organization.service'; -import { IEmailConfirmationToken, ISuccessResponse } from '../../models'; -import { OauthClientCredentialsService } from './oauth_client.service'; -export type TUserBaseEntity = ExtendedBaseEntity & IUser; -import { ApiUserEntity } from './api-user.entity'; -import { UserLoginSessionEntity } from './user_login_session.entity' -@Injectable() -export class UserService { - private readonly logger = new Logger(UserService.name); - - constructor( - @InjectRepository(User) private readonly repository: Repository, - @InjectRepository(UserRole) private rolerepository: Repository, - private readonly emailConfirmationService: EmailConfirmationService, - private readonly oauthClientCredentialsService: OauthClientCredentialsService, - @Inject(forwardRef(() => OrganizationService)) private organizationService: OrganizationService, - @InjectRepository(ApiUserEntity) - private readonly apiUserEntityRepository: Repository, - @InjectRepository(UserLoginSessionEntity) - private readonly userloginSessionRepository: Repository, - - ) { } - - public async seed( - data: CreateUserORGDTO, - - organizationId: number | null, - role?: Role, - status?: UserStatus, - ): Promise { - await this.checkForExistingUser(data.email); - - return this.repository.save({ - // title: data.title, - firstName: data.firstName, - lastName: data.lastName, - email: data.email.toLowerCase(), - // telephone: data.telephone, - password: this.hashPassword(data.password), - role: role || Role.Admin, - status: status || UserStatus.Active, - organization: organizationId ? { id: organizationId } : {}, - }); - } - - // public async create(data: CreateUserDTO): Promise { - // await this.checkForExistingUser(data.email); - // const user = await this.repository.save({ - // title: data.title, - // firstName: data.firstName, - // lastName: data.lastName, - // email: data.email.toLowerCase(), - // telephone: data.telephone, - // password: this.hashPassword(data.password), - // notifications: true, - // status: UserStatus.Pending, - // role: Role.OrganizationAdmin, - // }); - - // await this.emailConfirmationService.create(user); - - // return new User(user); - // } - public async newcreate(data: CreateUserORGDTO, - status?: UserStatus, inviteuser?: Boolean): Promise { - await this.checkForExistingUser(data.email.toLowerCase()); - //@ts-ignore - let api_user = await this.oauthClientCredentialsService.findOneByApiUserId(data.api_user_id); - /* - if (data.organizationType.toLowerCase() == 'ApiUser'.toLowerCase()) { - console.log("came here iasjdajsdojsdojasd"); - api_user = await this.oauthClientCredentialsService.createAPIUser(); - console.log("api_user", api_user); - } */ - var org_id; - if (!inviteuser) { - const orgdata = { - name: data.orgName !== undefined ? data.orgName : '', - organizationType: data.organizationType, - // secretKey: data.secretKey, - orgEmail: data.email, - address: data.orgAddress - - } - - orgdata['api_user_id'] = api_user.api_user_id; - - /* - if (data.organizationType.toLowerCase() == 'ApiUser'.toLowerCase()) { - orgdata['api_user_id'] = api_user.api_user_id; - } - else if (data['client']) { - orgdata['api_user_id'] = data['client'].api_user_id; - } - */ - if (await this.organizationService.isNameAlreadyTaken(orgdata.name)) { - throw new ConflictException({ - success: false, - message: `Organization "${data.orgName}" is already existed,please use another Organization name`, - }); - - } else { - - const org = await this.organizationService.newcreate(orgdata) - org_id = org.id; - this.logger.debug( - `Successfully registered a new organization with id ${JSON.stringify(org)}`, - ); - - - } - - } - //@ts-ignore - if (data.orgid) { - //@ts-ignore - org_id = data.orgid; - } - var role; - var roleId; - if (data.organizationType === 'Buyer' || data.organizationType === 'buyer') { - role = Role.Buyer - roleId = 4; - } else if (data.organizationType === 'Developer' || data.organizationType === 'Developer') { - role = Role.OrganizationAdmin - roleId = 2; - } else if (data.organizationType === 'ApiUser' || data.organizationType === 'apiuser') { - role = Role.ApiUser - roleId = 6; - } - - const user = await this.repository.save({ - firstName: data.firstName, - lastName: data.lastName, - email: data.email.toLowerCase(), - password: this.hashPassword(data.password), - notifications: true, - status: status || UserStatus.Active, - role: role, - roleId: roleId, - organization: org_id ? { id: org_id } : {}, - //api_user_id: api_user ? api_user.api_user_id : data['client'] ? data['client'].api_user_id : null - api_user_id: api_user ? api_user.api_user_id : null, - }); - this.logger.debug( - `Successfully registered a new user with id ${JSON.stringify(user)}`, - ); - // if (inviteuser) { - // await this.emailConfirmationService.create(user, data.orgName, true); - // } else { - // } - /* - if (api_user) { - let clienCredentialsData = await this.oauthClientCredentialsService.generateClientCredentials(); - await this.oauthClientCredentialsService.store(clienCredentialsData.client_id, clienCredentialsData.client_secret, api_user.api_user_id); - let newUser = new User(user); - newUser['client_id'] = clienCredentialsData.client_id; - newUser['client_secret'] = clienCredentialsData.client_secret; - await this.emailConfirmationService.create(user); - return newUser; - } - */ - /* - if (data.organizationType === 'ApiUser' || data.organizationType === 'apiuser') { - //@ts-ignore - user['client_id'] = data.client.client_id; - //@ts-ignore - user['client_secret'] = data.client.client_secret; - } - */ - - await this.emailConfirmationService.create(user); - //return new User(user); - return user; - } - - public async adminnewcreate(data: CreateUserORGDTO, - status?: UserStatus, inviteuser?: Boolean): Promise { - await this.checkForExistingUser(data.email.toLowerCase()); - var org_id; - if (!inviteuser) { - const orgdata = { - name: data.orgName !== undefined ? data.orgName : '', - organizationType: data.organizationType, - // secretKey: data.secretKey, - orgEmail: data.email, - address: data.orgAddress - - } - - if (await this.organizationService.isNameAlreadyTaken(orgdata.name)) { - throw new ConflictException({ - success: false, - message: `Organization "${data.orgName}" is already existed,please use another Organization name`, - }); - - } else { - - const org = await this.organizationService.newcreate(orgdata) - org_id = org.id; - this.logger.debug( - `Successfully registered a new organization with id ${JSON.stringify(org)}`, - ); - } - } - - var role; - var roleId; - if (data.organizationType === 'Buyer' || data.organizationType === 'buyer') { - role = Role.Buyer - roleId = 4; - } else { - role = Role.OrganizationAdmin - roleId = 2; - } - - // const getrole = await this.rolerepository.findOne({ name: role }) - // console.log(getrole); - - const user = await this.repository.save({ - firstName: data.firstName, - lastName: data.lastName, - email: data.email.toLowerCase(), - password: this.hashPassword(data.password), - notifications: true, - status: status || UserStatus.Active, - role: role, - roleId: roleId, - organization: org_id ? { id: org_id } : {}, - - }); - this.logger.debug( - `Successfully registered a new user with id ${JSON.stringify(user)}`, - ); - // if (inviteuser) { - // await this.emailConfirmationService.create(user, data.orgName, true); - // } else { - await this.emailConfirmationService.admincreate(user, data.password); - // } - - return new User(user); - } - - public async checkForExistingUser(email: string): Promise { - - const isExistingUser = await this.hasUser({ email }); - - if (isExistingUser) { - const message = `User with email ${email} already exists`; - - this.logger.error(message); - throw new ConflictException({ - success: false, - message, - }); - } - } -/* - async validateClient(client_id, client_secret) { - // console.log(client_id); - // console.log(client_secret); - // this.oauthClientCredentialsService.findOneByclient_id - const client = await this.oauthClientCredentialsService.findOneByclient_id(client_id); - if (!client) { - throw new UnauthorizedException('Invalid client credentials'); - } - client.client_secret = this.oauthClientCredentialsService.decryptclient_secret(client.client_secret); - if (client.client_secret !== client_secret) { - throw new UnauthorizedException('Invalid client credentials'); - } - return client; - } -*/ - public async getAll(options?: FindManyOptions): Promise { - return this.repository.find(options); - } - - async findById(id: number): Promise { - const user = await this.findOne({ id }); - if (!user) { - throw new NotFoundException(`No user found with id ${id}`); - } - - //@ts-ignore - if (user.role === Role.ApiUser) { - //@ts-ignore - const api_user = await this.get_apiuser_permission_status(user.api_user_id); - user['permission_status'] = api_user.permission_status; - - } - return user; - } - - public async findByIds(ids: number[]): Promise { - return await this.repository.findByIds(ids); - } - - async findByEmail(email: string): Promise { - const lowerCaseEmail = email.toLowerCase(); - - return this.findOne({ email: lowerCaseEmail }); - } - - async getUserAndPasswordByEmail( - email: string, - ): Promise<(Pick & { password: string }) | null> { - const user = await this.repository.findOne( - { email }, - { - select: ['id', 'email', 'password'], - }, - ); - - return user ?? null; - } - - async findOne(conditions: FindConditions): Promise { - const user = await (this.repository.findOne(conditions, { - relations: ['organization'], - - }) as Promise as Promise); - - if (user) { - const emailConfirmation = await this.emailConfirmationService.get( - user.id, - ); - - user.emailConfirmed = emailConfirmation?.confirmed || false; - } - - return user ?? null; - } - - private hashPassword(password: string) { - return bcrypt.hashSync(password, 8); - } - - private async hasUser(conditions: FindConditions) { - return Boolean(await this.findOne(conditions)); - } - - async setNotifications( - id: number, - notifications: boolean, - ): Promise { - await this.repository.update(id, { notifications }); - - return this.findById(id); - } - - async addToOrganization( - userId: number, - organizationId: number, - ): Promise { - await this.repository.update(userId, { - organization: { id: organizationId }, - status: UserStatus.Active - }); - } - - - public getatleastoneotheruserinOrg(organizationId: number, userId): Promise { - - return this.repository.find({ - where: { - id: Not(userId), - organization: organizationId - }, - order: { - id: 'DESC', - }, - take: 1 - }); - - } - - async removeFromOrganization(userId: number): Promise { - await this.repository.update(userId, { organization: undefined }); - } - - async remove(userId: number): Promise { - - await this.emailConfirmationService.remove(userId) - await this.repository.delete(userId); - } - - async updateProfile( - id: number, - { firstName, lastName, email }: UpdateUserProfileDTO, - ): Promise { - const updateEntity = new User({ - - firstName, - lastName, - email: email.toLowerCase(), - - }); - - const validationErrors = await validate(updateEntity, { - skipUndefinedProperties: true, - }); - - if (validationErrors.length > 0) { - throw new UnprocessableEntityException({ - success: false, - errors: validationErrors, - }); - } - const updateuser = await this.findById(id); - //@ts-ignore - if (!(updateuser.email === email.toLowerCase())) { - //@ts-ignore - await this.checkForExistingUser(email.toLowerCase()); - } - await this.repository.update(id, updateEntity); - - return this.findOne({ id }); - } - - async updatePassword( - email: string, - user: UserPasswordUpdate, - ): Promise { - const _user = await this.getUserAndPasswordByEmail(email); - - if (_user && bcrypt.compareSync(user.oldPassword, _user.password)) { - const updateEntity = new User({ - password: this.hashPassword(user.newPassword), - }); - - const validationErrors = await validate(updateEntity, { - skipUndefinedProperties: true, - }); - - if (validationErrors.length > 0) { - throw new UnprocessableEntityException({ - success: false, - errors: validationErrors, - }); - } - - await this.repository.update(_user.id, updateEntity); - return this.findOne({ id: _user.id }); - } - - throw new ConflictException({ - success: false, - errors: `Incorrect current password.`, - }); - } - - - async updatechangePassword( - emailConfirmation: UserDTO, - user: UserChangePasswordUpdate, - ): Promise { - // const emailConfirmation = await this.emailConfirmationService.findOne({ token }); - - //const _user = await this.findById(emailConfirmation.id); - - if (emailConfirmation) { - const updateEntity = new User({ - password: this.hashPassword(user.newPassword), - }); - - const validationErrors = await validate(updateEntity, { - skipUndefinedProperties: true, - }); - - if (validationErrors.length > 0) { - throw new UnprocessableEntityException({ - success: false, - errors: validationErrors, - }); - } - - await this.repository.update(emailConfirmation.id, updateEntity); - return emailConfirmation; - - } - - throw new ConflictException({ - success: false, - errors: `User Not exist .`, - }); - } - - public async changeRole( - userId: number, - role: Role, - ): Promise { - this.logger.log(`Changing user role for userId=${userId} to ${role}`); - const getrole = await this.rolerepository.findOne({ name: role }) - // var roleId; - // if (role === Role.DeviceOwner) { - // roleId = 3 - // }if else (role === Role.OrganizationAdmin) { - // roleId = 3 - // } - // else { - // roleId = 5 - // } - await this.repository.update(userId, { role, roleId: getrole.id }); - return this.findOne({ id: userId }); - } - - - async getPlatformAdmin(): Promise { - return this.findOne({ role: Role.Admin }); - } - - public async getUsersByFilter(filterDto: UserFilterDTO, pageNumber: number, limit: number): Promise<{ users: IUser[], currentPage: number, totalPages: number, totalCount: number }> { - const query = await this.getFilteredQuery(filterDto); - try { - - - let [users, totalCount] = await query - .andWhere(`role != :role`, { role: Role.ApiUser }) - .skip((pageNumber - 1) * limit).take(limit).getManyAndCount(); - const totalPages = Math.ceil(totalCount / limit); - - return { - users: users, - currentPage: pageNumber, - totalPages, - totalCount - } - } catch (error) { - this.logger.error(`Failed to retrieve users`, error.stack); - throw new InternalServerErrorException('Failed to retrieve users'); - } - } - - private getFilteredQuery(filterDto: UserFilterDTO): SelectQueryBuilder { - const { organizationName, status } = filterDto; - const query = this.repository - .createQueryBuilder('user') - .leftJoinAndSelect('user.organization', 'organization') - .orderBy('user.createdAt', 'DESC'); - if (organizationName) { - const baseQuery = 'organization.name ILIKE :organizationName'; - query.andWhere(baseQuery, { organizationName: `%${organizationName}%` }); - } - if (status) { - query.andWhere(`user.status = '${status}'`); - } - return query; - } - - async update( - id: number, - data: UpdateUserDTO, - ): Promise { - - const validationErrors = await validate(data, { - skipUndefinedProperties: true, - }); - if (validationErrors.length > 0) { - throw new UnprocessableEntityException({ - success: false, - errors: validationErrors, - }); - } - - const updateuser = await this.findById(id); - //@ts-ignore - if (!(updateuser.email === data.email)) { - //@ts-ignore - await this.checkForExistingUser(data.email); - } - - await this.repository.update(id, { - - firstName: data.firstName, - lastName: data.lastName, - email: data.email, - status: data.status, - }); - - return this.findOne({ id }); - } - - public async canViewUserData( - userId: IUser['id'], - loggedInUser: ILoggedInUser, - ): Promise { - const user = await this.findById(userId); - - const isOwnUser = loggedInUser.id === userId; - const isOrgAdmin = - loggedInUser.organizationId === user.organization?.id && - loggedInUser.hasRole(Role.OrganizationAdmin); - const isAdmin = loggedInUser.hasRole(Role.Admin); - - const canViewUserData = isOwnUser || isOrgAdmin || isAdmin; - - if (!canViewUserData) { - throw new UnauthorizedException({ - success: false, - message: `Unable to fetch user data. Unauthorized.`, - }); - } - //@ts-ignore - if (user.role === Role.ApiUser) { - //@ts-ignore - const api_user = await this.get_apiuser_permission_status(user.api_user_id); - user['permission_status'] = api_user.permission_status; - - } - return user; - } - public async geytokenforResetPassword(email): Promise { - - - return await this.emailConfirmationService.ConfirmationEmailForResetPassword(email); - - - } - - public async sentinvitiontoUser(inviteuser, email, invitationId) { - const getcurrenttoken = await this.emailConfirmationService.getByEmail(email) - if (!getcurrenttoken) { - return { - message: 'Token not found', - success: false, - }; - } - const { id, confirmed } = getcurrenttoken; - let { token, expiryTimestamp } = await this.emailConfirmationService.generatetoken(getcurrenttoken, id); - await this.emailConfirmationService.sendInvitation(inviteuser, email, invitationId); - } - - public async findUserByOrganization(organizationId: number, pageNumber: number, limit: number) { - return await this.repository - .createQueryBuilder('user') - .leftJoinAndSelect('user.organization', 'organization') - .where('organization.id = :organizationId', { organizationId }) - .orderBy('user.createdAt', 'DESC') - .skip((pageNumber - 1) * limit) - .take(limit) - .getManyAndCount(); - } - /**get all user of apiuser */ - public async findUserByApiUserId(api_user_id: string, pageNumber: number, limit: number, org_id?) { - return await this.repository - .createQueryBuilder('user') - .leftJoinAndSelect('user.organization', 'organization') - .where('user.api_user_id = :api_user_id', { api_user_id }) - .andWhere(`role != :role`, { role: Role.ApiUser }) - .orderBy('user.createdAt', 'DESC') - .skip((pageNumber - 1) * limit) - .take(limit) - .getManyAndCount(); - } - /** ApiUser Fuction*/ - - async getApiuser(api_id: string): Promise { - return await this.apiUserEntityRepository.findOne(api_id); - } - /** - * This Function added for request of permission to apiuser in apiuser table - * @param api_id - * @param permissionIds - */ - async apiuser_permission_request(api_id, permissionIds) { - - await this.apiUserEntityRepository.update(api_id, { - permissionIds: permissionIds, - permission_status: UserPermissionStatus.Request - - }) - } - async apiuser_permission_accepted_byadmin(api_id: string, status: UserPermissionStatus) { - - // const approve_apiuser_permissiom = await this.apiUserEntityRepository.findOne(api_id ) - - await this.apiUserEntityRepository.update(api_id, { - - permission_status: status - - }) - return await this.apiUserEntityRepository.findOne(api_id); - } - /** - * This service method use for get info of permission request status(Request,Active and Deactive) - * @param api_id - * @returns - */ - async get_apiuser_permission_status(api_id: string) { - - const status_apiuser_permissiom = await this.apiUserEntityRepository.findOne(api_id) - - return status_apiuser_permissiom; - } - - /** - * this function create for get user list of ApiUser - * @param organizationName - * @param pageNumber - * @param limit - * @returns - */ - public async getApiUsers(organizationName: string, pageNumber: number, limit: number): Promise<{ users: IUser[], currentPage: number, totalPages: number, totalCount: number }> { - let filterDto = new UserFilterDTO; - filterDto.organizationName = organizationName; - const query = await this.getFilteredQuery(filterDto); - try { - const [apiusers, totalCount] = await query - .andWhere(`user.role = :role`, { role: Role.ApiUser }) - .skip((pageNumber - 1) * limit) - .take(limit) - .getManyAndCount(); - - const totalPages = Math.ceil(totalCount / limit); - return { - users: apiusers, - currentPage: pageNumber, - totalPages, - totalCount - } - } catch (error) { - this.logger.error(`Failed to retrieve apiusers`, error.stack); - throw new InternalServerErrorException('Failed to retrieve apiusers'); - } - } - - /** - * - * @param email - * @param token - * @returns - */ - - async createUserSession(user: any, token: string) { - - await this.userloginSessionRepository.save({ - userId: user.id, - accesstoken_hash: token - }) - return; - } - /** - * - * @param userId - * @returns - */ - async removeUsersession(userId:number) { - return await this.userloginSessionRepository.delete( - { userId:userId } - ); - } - - // async getToken(token, userid):Promise { - // await this.userloginSessionRepository.findOne({ - // where: { - // token: token, - // UserId: userid - // } - // }) - // } - - async hasgetUserTokenvalid(conditions: FindConditions) { - return Boolean(await this.userloginSessionRepository.findOne(conditions)); - } -} +import { + ConflictException, + Injectable, + Inject, + Logger, + UnprocessableEntityException, + UnauthorizedException, + NotFoundException, + InternalServerErrorException, + forwardRef, +} from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import bcrypt from 'bcryptjs'; +import { + FindConditions, + Repository, + FindManyOptions, + SelectQueryBuilder, + Not, +} from 'typeorm'; +import { + ILoggedInUser, + IUser, + UserPasswordUpdate, + UserChangePasswordUpdate, +} from '../../models'; +import { Role, UserStatus, UserPermissionStatus } from '../../utils/enums'; +import { CreateUserORGDTO } from './dto/create-user.dto'; +import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; +import { validate } from 'class-validator'; +import { UserRole } from './user_role.entity'; +import { UserDTO } from './dto/user.dto'; +import { User } from './user.entity'; +import { UpdateUserProfileDTO } from './dto/update-user-profile.dto'; +import { EmailConfirmationService } from '../email-confirmation/email-confirmation.service'; +import { UpdateUserDTO } from '../admin/dto/update-user.dto'; +import { UserFilterDTO } from '../admin/dto/user-filter.dto'; +import { OrganizationService } from '../organization/organization.service'; +import { IEmailConfirmationToken, ISuccessResponse } from '../../models'; +import { OauthClientCredentialsService } from './oauth_client.service'; +export type TUserBaseEntity = ExtendedBaseEntity & IUser; +import { ApiUserEntity } from './api-user.entity'; +import { UserLoginSessionEntity } from './user_login_session.entity'; +@Injectable() +export class UserService { + private readonly logger = new Logger(UserService.name); + + constructor( + @InjectRepository(User) private readonly repository: Repository, + @InjectRepository(UserRole) private rolerepository: Repository, + private readonly emailConfirmationService: EmailConfirmationService, + private readonly oauthClientCredentialsService: OauthClientCredentialsService, + @Inject(forwardRef(() => OrganizationService)) + private organizationService: OrganizationService, + @InjectRepository(ApiUserEntity) + private readonly apiUserEntityRepository: Repository, + @InjectRepository(UserLoginSessionEntity) + private readonly userloginSessionRepository: Repository, + ) {} + + public async seed( + data: CreateUserORGDTO, + + organizationId: number | null, + role?: Role, + status?: UserStatus, + ): Promise { + await this.checkForExistingUser(data.email); + + return this.repository.save({ + // title: data.title, + firstName: data.firstName, + lastName: data.lastName, + email: data.email.toLowerCase(), + // telephone: data.telephone, + password: this.hashPassword(data.password), + role: role || Role.Admin, + status: status || UserStatus.Active, + organization: organizationId ? { id: organizationId } : {}, + }); + } + + // public async create(data: CreateUserDTO): Promise { + // await this.checkForExistingUser(data.email); + // const user = await this.repository.save({ + // title: data.title, + // firstName: data.firstName, + // lastName: data.lastName, + // email: data.email.toLowerCase(), + // telephone: data.telephone, + // password: this.hashPassword(data.password), + // notifications: true, + // status: UserStatus.Pending, + // role: Role.OrganizationAdmin, + // }); + + // await this.emailConfirmationService.create(user); + + // return new User(user); + // } + public async newcreate( + data: CreateUserORGDTO, + status?: UserStatus, + inviteuser?: Boolean, + ): Promise { + await this.checkForExistingUser(data.email.toLowerCase()); + //@ts-ignore + let api_user = await this.oauthClientCredentialsService.findOneByApiUserId( + data.api_user_id, + ); + /* + if (data.organizationType.toLowerCase() == 'ApiUser'.toLowerCase()) { + console.log("came here iasjdajsdojsdojasd"); + api_user = await this.oauthClientCredentialsService.createAPIUser(); + console.log("api_user", api_user); + } */ + var org_id; + if (!inviteuser) { + const orgdata = { + name: data.orgName !== undefined ? data.orgName : '', + organizationType: data.organizationType, + // secretKey: data.secretKey, + orgEmail: data.email, + address: data.orgAddress, + }; + + orgdata['api_user_id'] = api_user.api_user_id; + + /* + if (data.organizationType.toLowerCase() == 'ApiUser'.toLowerCase()) { + orgdata['api_user_id'] = api_user.api_user_id; + } + else if (data['client']) { + orgdata['api_user_id'] = data['client'].api_user_id; + } + */ + if (await this.organizationService.isNameAlreadyTaken(orgdata.name)) { + throw new ConflictException({ + success: false, + message: `Organization "${data.orgName}" is already existed,please use another Organization name`, + }); + } else { + const org = await this.organizationService.newcreate(orgdata); + org_id = org.id; + this.logger.debug( + `Successfully registered a new organization with id ${JSON.stringify(org)}`, + ); + } + } + //@ts-ignore + if (data.orgid) { + //@ts-ignore + org_id = data.orgid; + } + var role; + var roleId; + if ( + data.organizationType === 'Buyer' || + data.organizationType === 'buyer' + ) { + role = Role.Buyer; + roleId = 4; + } else if ( + data.organizationType === 'Developer' || + data.organizationType === 'Developer' + ) { + role = Role.OrganizationAdmin; + roleId = 2; + } else if ( + data.organizationType === 'ApiUser' || + data.organizationType === 'apiuser' + ) { + role = Role.ApiUser; + roleId = 6; + } + + const user = await this.repository.save({ + firstName: data.firstName, + lastName: data.lastName, + email: data.email.toLowerCase(), + password: this.hashPassword(data.password), + notifications: true, + status: status || UserStatus.Active, + role: role, + roleId: roleId, + organization: org_id ? { id: org_id } : {}, + //api_user_id: api_user ? api_user.api_user_id : data['client'] ? data['client'].api_user_id : null + api_user_id: api_user ? api_user.api_user_id : null, + }); + this.logger.debug( + `Successfully registered a new user with id ${JSON.stringify(user)}`, + ); + // if (inviteuser) { + // await this.emailConfirmationService.create(user, data.orgName, true); + // } else { + // } + /* + if (api_user) { + let clienCredentialsData = await this.oauthClientCredentialsService.generateClientCredentials(); + await this.oauthClientCredentialsService.store(clienCredentialsData.client_id, clienCredentialsData.client_secret, api_user.api_user_id); + let newUser = new User(user); + newUser['client_id'] = clienCredentialsData.client_id; + newUser['client_secret'] = clienCredentialsData.client_secret; + await this.emailConfirmationService.create(user); + return newUser; + } + */ + /* + if (data.organizationType === 'ApiUser' || data.organizationType === 'apiuser') { + //@ts-ignore + user['client_id'] = data.client.client_id; + //@ts-ignore + user['client_secret'] = data.client.client_secret; + } + */ + + await this.emailConfirmationService.create(user); + //return new User(user); + return user; + } + + public async adminnewcreate( + data: CreateUserORGDTO, + status?: UserStatus, + inviteuser?: Boolean, + ): Promise { + await this.checkForExistingUser(data.email.toLowerCase()); + var org_id; + if (!inviteuser) { + const orgdata = { + name: data.orgName !== undefined ? data.orgName : '', + organizationType: data.organizationType, + // secretKey: data.secretKey, + orgEmail: data.email, + address: data.orgAddress, + }; + + if (await this.organizationService.isNameAlreadyTaken(orgdata.name)) { + throw new ConflictException({ + success: false, + message: `Organization "${data.orgName}" is already existed,please use another Organization name`, + }); + } else { + const org = await this.organizationService.newcreate(orgdata); + org_id = org.id; + this.logger.debug( + `Successfully registered a new organization with id ${JSON.stringify(org)}`, + ); + } + } + + var role; + var roleId; + if ( + data.organizationType === 'Buyer' || + data.organizationType === 'buyer' + ) { + role = Role.Buyer; + roleId = 4; + } else { + role = Role.OrganizationAdmin; + roleId = 2; + } + + // const getrole = await this.rolerepository.findOne({ name: role }) + // console.log(getrole); + + const user = await this.repository.save({ + firstName: data.firstName, + lastName: data.lastName, + email: data.email.toLowerCase(), + password: this.hashPassword(data.password), + notifications: true, + status: status || UserStatus.Active, + role: role, + roleId: roleId, + organization: org_id ? { id: org_id } : {}, + }); + this.logger.debug( + `Successfully registered a new user with id ${JSON.stringify(user)}`, + ); + // if (inviteuser) { + // await this.emailConfirmationService.create(user, data.orgName, true); + // } else { + await this.emailConfirmationService.admincreate(user, data.password); + // } + + return new User(user); + } + + public async checkForExistingUser(email: string): Promise { + const isExistingUser = await this.hasUser({ email }); + + if (isExistingUser) { + const message = `User with email ${email} already exists`; + + this.logger.error(message); + throw new ConflictException({ + success: false, + message, + }); + } + } + /* + async validateClient(client_id, client_secret) { + // console.log(client_id); + // console.log(client_secret); + // this.oauthClientCredentialsService.findOneByclient_id + const client = await this.oauthClientCredentialsService.findOneByclient_id(client_id); + if (!client) { + throw new UnauthorizedException('Invalid client credentials'); + } + client.client_secret = this.oauthClientCredentialsService.decryptclient_secret(client.client_secret); + if (client.client_secret !== client_secret) { + throw new UnauthorizedException('Invalid client credentials'); + } + return client; + } +*/ + public async getAll(options?: FindManyOptions): Promise { + return this.repository.find(options); + } + + async findById(id: number): Promise { + const user = await this.findOne({ id }); + if (!user) { + throw new NotFoundException(`No user found with id ${id}`); + } + + //@ts-ignore + if (user.role === Role.ApiUser) { + //@ts-ignore + const api_user = await this.get_apiuser_permission_status( + user.api_user_id, + ); + user['permission_status'] = api_user.permission_status; + } + return user; + } + + public async findByIds(ids: number[]): Promise { + return await this.repository.findByIds(ids); + } + + async findByEmail(email: string): Promise { + const lowerCaseEmail = email.toLowerCase(); + + return this.findOne({ email: lowerCaseEmail }); + } + + async getUserAndPasswordByEmail( + email: string, + ): Promise<(Pick & { password: string }) | null> { + const user = await this.repository.findOne( + { email }, + { + select: ['id', 'email', 'password'], + }, + ); + + return user ?? null; + } + + async findOne(conditions: FindConditions): Promise { + const user = await (this.repository.findOne(conditions, { + relations: ['organization'], + }) as Promise as Promise); + + if (user) { + const emailConfirmation = await this.emailConfirmationService.get( + user.id, + ); + + user.emailConfirmed = emailConfirmation?.confirmed || false; + } + + return user ?? null; + } + + private hashPassword(password: string) { + return bcrypt.hashSync(password, 8); + } + + private async hasUser(conditions: FindConditions) { + return Boolean(await this.findOne(conditions)); + } + + async setNotifications( + id: number, + notifications: boolean, + ): Promise { + await this.repository.update(id, { notifications }); + + return this.findById(id); + } + + async addToOrganization( + userId: number, + organizationId: number, + ): Promise { + await this.repository.update(userId, { + organization: { id: organizationId }, + status: UserStatus.Active, + }); + } + + public getatleastoneotheruserinOrg( + organizationId: number, + userId, + ): Promise { + return this.repository.find({ + where: { + id: Not(userId), + organization: organizationId, + }, + order: { + id: 'DESC', + }, + take: 1, + }); + } + + async removeFromOrganization(userId: number): Promise { + await this.repository.update(userId, { organization: undefined }); + } + + async remove(userId: number): Promise { + await this.emailConfirmationService.remove(userId); + await this.repository.delete(userId); + } + + async updateProfile( + id: number, + { firstName, lastName, email }: UpdateUserProfileDTO, + ): Promise { + const updateEntity = new User({ + firstName, + lastName, + email: email.toLowerCase(), + }); + + const validationErrors = await validate(updateEntity, { + skipUndefinedProperties: true, + }); + + if (validationErrors.length > 0) { + throw new UnprocessableEntityException({ + success: false, + errors: validationErrors, + }); + } + const updateuser = await this.findById(id); + //@ts-ignore + if (!(updateuser.email === email.toLowerCase())) { + //@ts-ignore + await this.checkForExistingUser(email.toLowerCase()); + } + await this.repository.update(id, updateEntity); + + return this.findOne({ id }); + } + + async updatePassword( + email: string, + user: UserPasswordUpdate, + ): Promise { + const _user = await this.getUserAndPasswordByEmail(email); + + if (_user && bcrypt.compareSync(user.oldPassword, _user.password)) { + const updateEntity = new User({ + password: this.hashPassword(user.newPassword), + }); + + const validationErrors = await validate(updateEntity, { + skipUndefinedProperties: true, + }); + + if (validationErrors.length > 0) { + throw new UnprocessableEntityException({ + success: false, + errors: validationErrors, + }); + } + + await this.repository.update(_user.id, updateEntity); + return this.findOne({ id: _user.id }); + } + + throw new ConflictException({ + success: false, + errors: `Incorrect current password.`, + }); + } + + async updatechangePassword( + emailConfirmation: UserDTO, + user: UserChangePasswordUpdate, + ): Promise { + // const emailConfirmation = await this.emailConfirmationService.findOne({ token }); + + //const _user = await this.findById(emailConfirmation.id); + + if (emailConfirmation) { + const updateEntity = new User({ + password: this.hashPassword(user.newPassword), + }); + + const validationErrors = await validate(updateEntity, { + skipUndefinedProperties: true, + }); + + if (validationErrors.length > 0) { + throw new UnprocessableEntityException({ + success: false, + errors: validationErrors, + }); + } + + await this.repository.update(emailConfirmation.id, updateEntity); + return emailConfirmation; + } + + throw new ConflictException({ + success: false, + errors: `User Not exist .`, + }); + } + + public async changeRole( + userId: number, + role: Role, + ): Promise { + this.logger.log(`Changing user role for userId=${userId} to ${role}`); + const getrole = await this.rolerepository.findOne({ name: role }); + // var roleId; + // if (role === Role.DeviceOwner) { + // roleId = 3 + // }if else (role === Role.OrganizationAdmin) { + // roleId = 3 + // } + // else { + // roleId = 5 + // } + await this.repository.update(userId, { role, roleId: getrole.id }); + return this.findOne({ id: userId }); + } + + async getPlatformAdmin(): Promise { + return this.findOne({ role: Role.Admin }); + } + + public async getUsersByFilter( + filterDto: UserFilterDTO, + pageNumber: number, + limit: number, + ): Promise<{ + users: IUser[]; + currentPage: number; + totalPages: number; + totalCount: number; + }> { + const query = await this.getFilteredQuery(filterDto); + try { + let [users, totalCount] = await query + .andWhere(`role != :role`, { role: Role.ApiUser }) + .skip((pageNumber - 1) * limit) + .take(limit) + .getManyAndCount(); + const totalPages = Math.ceil(totalCount / limit); + + return { + users: users, + currentPage: pageNumber, + totalPages, + totalCount, + }; + } catch (error) { + this.logger.error(`Failed to retrieve users`, error.stack); + throw new InternalServerErrorException('Failed to retrieve users'); + } + } + + private getFilteredQuery(filterDto: UserFilterDTO): SelectQueryBuilder { + const { organizationName, status } = filterDto; + const query = this.repository + .createQueryBuilder('user') + .leftJoinAndSelect('user.organization', 'organization') + .orderBy('user.createdAt', 'DESC'); + if (organizationName) { + const baseQuery = 'organization.name ILIKE :organizationName'; + query.andWhere(baseQuery, { organizationName: `%${organizationName}%` }); + } + if (status) { + query.andWhere(`user.status = '${status}'`); + } + return query; + } + + async update( + id: number, + data: UpdateUserDTO, + ): Promise { + const validationErrors = await validate(data, { + skipUndefinedProperties: true, + }); + if (validationErrors.length > 0) { + throw new UnprocessableEntityException({ + success: false, + errors: validationErrors, + }); + } + + const updateuser = await this.findById(id); + //@ts-ignore + if (!(updateuser.email === data.email)) { + //@ts-ignore + await this.checkForExistingUser(data.email); + } + + await this.repository.update(id, { + firstName: data.firstName, + lastName: data.lastName, + email: data.email, + status: data.status, + }); + + return this.findOne({ id }); + } + + public async canViewUserData( + userId: IUser['id'], + loggedInUser: ILoggedInUser, + ): Promise { + const user = await this.findById(userId); + + const isOwnUser = loggedInUser.id === userId; + const isOrgAdmin = + loggedInUser.organizationId === user.organization?.id && + loggedInUser.hasRole(Role.OrganizationAdmin); + const isAdmin = loggedInUser.hasRole(Role.Admin); + + const canViewUserData = isOwnUser || isOrgAdmin || isAdmin; + + if (!canViewUserData) { + throw new UnauthorizedException({ + success: false, + message: `Unable to fetch user data. Unauthorized.`, + }); + } + //@ts-ignore + if (user.role === Role.ApiUser) { + //@ts-ignore + const api_user = await this.get_apiuser_permission_status( + user.api_user_id, + ); + user['permission_status'] = api_user.permission_status; + } + return user; + } + public async geytokenforResetPassword(email): Promise { + return await this.emailConfirmationService.ConfirmationEmailForResetPassword( + email, + ); + } + + public async sentinvitiontoUser(inviteuser, email, invitationId) { + const getcurrenttoken = + await this.emailConfirmationService.getByEmail(email); + if (!getcurrenttoken) { + return { + message: 'Token not found', + success: false, + }; + } + const { id, confirmed } = getcurrenttoken; + let { token, expiryTimestamp } = + await this.emailConfirmationService.generatetoken(getcurrenttoken, id); + await this.emailConfirmationService.sendInvitation( + inviteuser, + email, + invitationId, + ); + } + + public async findUserByOrganization( + organizationId: number, + pageNumber: number, + limit: number, + ) { + return await this.repository + .createQueryBuilder('user') + .leftJoinAndSelect('user.organization', 'organization') + .where('organization.id = :organizationId', { organizationId }) + .orderBy('user.createdAt', 'DESC') + .skip((pageNumber - 1) * limit) + .take(limit) + .getManyAndCount(); + } + /**get all user of apiuser */ + public async findUserByApiUserId( + api_user_id: string, + pageNumber: number, + limit: number, + org_id?, + ) { + return await this.repository + .createQueryBuilder('user') + .leftJoinAndSelect('user.organization', 'organization') + .where('user.api_user_id = :api_user_id', { api_user_id }) + .andWhere(`role != :role`, { role: Role.ApiUser }) + .orderBy('user.createdAt', 'DESC') + .skip((pageNumber - 1) * limit) + .take(limit) + .getManyAndCount(); + } + /** ApiUser Fuction*/ + + async getApiuser(api_id: string): Promise { + return await this.apiUserEntityRepository.findOne(api_id); + } + /** + * This Function added for request of permission to apiuser in apiuser table + * @param api_id + * @param permissionIds + */ + async apiuser_permission_request(api_id, permissionIds) { + await this.apiUserEntityRepository.update(api_id, { + permissionIds: permissionIds, + permission_status: UserPermissionStatus.Request, + }); + } + async apiuser_permission_accepted_byadmin( + api_id: string, + status: UserPermissionStatus, + ) { + // const approve_apiuser_permissiom = await this.apiUserEntityRepository.findOne(api_id ) + + await this.apiUserEntityRepository.update(api_id, { + permission_status: status, + }); + return await this.apiUserEntityRepository.findOne(api_id); + } + /** + * This service method use for get info of permission request status(Request,Active and Deactive) + * @param api_id + * @returns + */ + async get_apiuser_permission_status(api_id: string) { + const status_apiuser_permissiom = + await this.apiUserEntityRepository.findOne(api_id); + + return status_apiuser_permissiom; + } + + /** + * this function create for get user list of ApiUser + * @param organizationName + * @param pageNumber + * @param limit + * @returns + */ + public async getApiUsers( + organizationName: string, + pageNumber: number, + limit: number, + ): Promise<{ + users: IUser[]; + currentPage: number; + totalPages: number; + totalCount: number; + }> { + let filterDto = new UserFilterDTO(); + filterDto.organizationName = organizationName; + const query = await this.getFilteredQuery(filterDto); + try { + const [apiusers, totalCount] = await query + .andWhere(`user.role = :role`, { role: Role.ApiUser }) + .skip((pageNumber - 1) * limit) + .take(limit) + .getManyAndCount(); + + const totalPages = Math.ceil(totalCount / limit); + return { + users: apiusers, + currentPage: pageNumber, + totalPages, + totalCount, + }; + } catch (error) { + this.logger.error(`Failed to retrieve apiusers`, error.stack); + throw new InternalServerErrorException('Failed to retrieve apiusers'); + } + } + + /** + * + * @param email + * @param token + * @returns + */ + + async createUserSession(user: any, token: string) { + await this.userloginSessionRepository.save({ + userId: user.id, + accesstoken_hash: token, + }); + return; + } + /** + * + * @param userId + * @returns + */ + async removeUsersession(userId: number) { + return await this.userloginSessionRepository.delete({ userId: userId }); + } + + // async getToken(token, userid):Promise { + // await this.userloginSessionRepository.findOne({ + // where: { + // token: token, + // UserId: userid + // } + // }) + // } + + async hasgetUserTokenvalid( + conditions: FindConditions, + ) { + return Boolean(await this.userloginSessionRepository.findOne(conditions)); + } +} diff --git a/apps/drec-api/src/pods/user/user_login_session.entity.ts b/apps/drec-api/src/pods/user/user_login_session.entity.ts index c2116e142..400fe2b9e 100644 --- a/apps/drec-api/src/pods/user/user_login_session.entity.ts +++ b/apps/drec-api/src/pods/user/user_login_session.entity.ts @@ -1,26 +1,26 @@ -import { - Entity, - PrimaryGeneratedColumn, - Column, - CreateDateColumn, -} from 'typeorm'; - -@Entity({ name:'user_login_session'}) -export class UserLoginSessionEntity { - @PrimaryGeneratedColumn() - id: number; - - @Column({ nullable: false }) - userId: number; - - @CreateDateColumn({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' }) - createdAt: Date; - @CreateDateColumn({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' }) - updatedAt: Date; - - @Column() - accesstoken_hash: string; - - // @Column({ type: 'boolean', nullable: true }) - // status: boolean; -} \ No newline at end of file +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, +} from 'typeorm'; + +@Entity({ name: 'user_login_session' }) +export class UserLoginSessionEntity { + @PrimaryGeneratedColumn() + id: number; + + @Column({ nullable: false }) + userId: number; + + @CreateDateColumn({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' }) + createdAt: Date; + @CreateDateColumn({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' }) + updatedAt: Date; + + @Column() + accesstoken_hash: string; + + // @Column({ type: 'boolean', nullable: true }) + // status: boolean; +} diff --git a/apps/drec-api/src/pods/user/user_role.entity.ts b/apps/drec-api/src/pods/user/user_role.entity.ts index 2a29589a3..146840c49 100755 --- a/apps/drec-api/src/pods/user/user_role.entity.ts +++ b/apps/drec-api/src/pods/user/user_role.entity.ts @@ -1,25 +1,24 @@ -import { - Entity, - PrimaryGeneratedColumn, - Column, - CreateDateColumn, - } from 'typeorm'; - - @Entity('user_role') - export class UserRole { - @PrimaryGeneratedColumn() - id: number; - - @Column({ type: 'varchar', length: 255, nullable: false }) - name: string; - - @CreateDateColumn({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' }) - createdAt: Date; - - @Column({ type: 'varchar', length: 255, nullable: true }) - description: string; - - @Column({ type: 'boolean', nullable: true }) - status: boolean; - } - \ No newline at end of file +import { + Entity, + PrimaryGeneratedColumn, + Column, + CreateDateColumn, +} from 'typeorm'; + +@Entity('user_role') +export class UserRole { + @PrimaryGeneratedColumn() + id: number; + + @Column({ type: 'varchar', length: 255, nullable: false }) + name: string; + + @CreateDateColumn({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' }) + createdAt: Date; + + @Column({ type: 'varchar', length: 255, nullable: true }) + description: string; + + @Column({ type: 'boolean', nullable: true }) + status: boolean; +} diff --git a/apps/drec-api/src/pods/yield-config/dto/index.ts b/apps/drec-api/src/pods/yield-config/dto/index.ts index 0a3cf7031..8278fee18 100755 --- a/apps/drec-api/src/pods/yield-config/dto/index.ts +++ b/apps/drec-api/src/pods/yield-config/dto/index.ts @@ -1,3 +1,3 @@ export * from './new-yieldconfig.dto'; export * from './yield-config.dto'; -export * from './update-yieldvalue.dto'; \ No newline at end of file +export * from './update-yieldvalue.dto'; diff --git a/apps/drec-api/src/pods/yield-config/dto/new-yieldconfig.dto.ts b/apps/drec-api/src/pods/yield-config/dto/new-yieldconfig.dto.ts index b43292656..f168acbdb 100755 --- a/apps/drec-api/src/pods/yield-config/dto/new-yieldconfig.dto.ts +++ b/apps/drec-api/src/pods/yield-config/dto/new-yieldconfig.dto.ts @@ -1,40 +1,29 @@ import { - IsString, - IsEnum, - IsBoolean, - IsArray, - IsNumber, - IsOptional, - } from 'class-validator'; - import { ApiProperty } from '@nestjs/swagger'; - - import { IYieldConfig } from '../../../models'; - import { - YieldStatus, - -} from '../../../utils/enums'; - export class NewYieldConfigDTO - implements Omit - { - + IsString, + IsEnum, + IsBoolean, + IsArray, + IsNumber, + IsOptional, +} from 'class-validator'; +import { ApiProperty } from '@nestjs/swagger'; +import { IYieldConfig } from '../../../models'; +import { YieldStatus } from '../../../utils/enums'; +export class NewYieldConfigDTO implements Omit { @ApiProperty({ type: String }) - @IsString() countryName: string; @ApiProperty({ type: String }) - @IsString() countryCode: string; @ApiProperty({ type: Number }) @IsNumber() yieldValue: number; - + @ApiProperty({ enum: YieldStatus, enumName: 'yieldstatus' }) @IsEnum(YieldStatus) status: YieldStatus; - - } - \ No newline at end of file +} diff --git a/apps/drec-api/src/pods/yield-config/dto/update-yieldvalue.dto.ts b/apps/drec-api/src/pods/yield-config/dto/update-yieldvalue.dto.ts index 857f5fd02..f4a60ddcf 100755 --- a/apps/drec-api/src/pods/yield-config/dto/update-yieldvalue.dto.ts +++ b/apps/drec-api/src/pods/yield-config/dto/update-yieldvalue.dto.ts @@ -1,39 +1,30 @@ import { - IsString, - IsEnum, - IsBoolean, - IsArray, - IsNumber, - IsOptional, + IsString, + IsEnum, + IsBoolean, + IsArray, + IsNumber, + IsOptional, } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; -import { - YieldStatus, - -} from '../../../utils/enums'; +import { YieldStatus } from '../../../utils/enums'; import { IYieldConfig } from '../../../models'; export class UpdateYieldValueDTO - implements Omit + implements Omit { - - @ApiProperty({ type: String }) - @IsString() - countryName: string; - - @ApiProperty({ type: String }) - @IsString() - countryCode: string; - @ApiProperty() - @IsNumber() - - yieldValue: number; - - @ApiProperty({ enum: YieldStatus, enumName: 'yieldstatus' }) - @IsEnum(YieldStatus) - status: YieldStatus; - - - - + @ApiProperty({ type: String }) + @IsString() + countryName: string; + + @ApiProperty({ type: String }) + @IsString() + countryCode: string; + @ApiProperty() + @IsNumber() + yieldValue: number; + + @ApiProperty({ enum: YieldStatus, enumName: 'yieldstatus' }) + @IsEnum(YieldStatus) + status: YieldStatus; } diff --git a/apps/drec-api/src/pods/yield-config/dto/yield-config.dto.ts b/apps/drec-api/src/pods/yield-config/dto/yield-config.dto.ts index cfaa42296..4a2cf12db 100755 --- a/apps/drec-api/src/pods/yield-config/dto/yield-config.dto.ts +++ b/apps/drec-api/src/pods/yield-config/dto/yield-config.dto.ts @@ -13,12 +13,8 @@ import { ValidateNested, } from 'class-validator'; import { OrganizationDTO } from '../../organization/dto'; -import { - YieldStatus, - -} from '../../../utils/enums'; +import { YieldStatus } from '../../../utils/enums'; export class YieldConfigDTO implements IYieldConfig { - @ApiProperty({ type: Number }) @IsNumber() @Expose() @@ -38,11 +34,9 @@ export class YieldConfigDTO implements IYieldConfig { @IsNotEmpty() @IsNumber() yieldValue: number; - + @ApiProperty({ enum: YieldStatus, enumName: 'yieldstatus' }) @IsNotEmpty() @IsEnum(YieldStatus) status: YieldStatus; - - } diff --git a/apps/drec-api/src/pods/yield-config/yieldconfig.controller.ts b/apps/drec-api/src/pods/yield-config/yieldconfig.controller.ts index 100df0eb4..d19617b31 100755 --- a/apps/drec-api/src/pods/yield-config/yieldconfig.controller.ts +++ b/apps/drec-api/src/pods/yield-config/yieldconfig.controller.ts @@ -12,7 +12,7 @@ import { Query, ParseIntPipe, ConflictException, - HttpException + HttpException, } from '@nestjs/common'; import { ApiBearerAuth, @@ -28,7 +28,7 @@ import { plainToClass } from 'class-transformer'; import { YieldConfigService } from './yieldconfig.service'; import { YieldConfigDTO, NewYieldConfigDTO, UpdateYieldValueDTO } from './dto'; -import { countryCodesList } from '../../models/country-code' +import { countryCodesList } from '../../models/country-code'; import { Roles } from '../user/decorators/roles.decorator'; import { Role } from '../../utils/enums'; import { RolesGuard } from '../../guards/RolesGuard'; @@ -43,20 +43,21 @@ import { ACLModules } from '../access-control-layer-module-service/decorator/acl @ApiSecurity('drec') @Controller('yield/config') export class YieldConfigController { - constructor(private readonly yieldconfigService: YieldConfigService) { } + constructor(private readonly yieldconfigService: YieldConfigService) {} - -/** - * This api route use for get all yield value of country - * @returns {YieldConfigDTO[]} - */ + /** + * This api route use for get all yield value of country + * @returns {YieldConfigDTO[]} + */ @Get() - @UseGuards(AuthGuard('jwt'), ActiveUserGuard, RolesGuard,PermissionGuard) + @UseGuards(AuthGuard('jwt'), ActiveUserGuard, RolesGuard, PermissionGuard) @Roles(Role.Admin) @Permission('Read') @ACLModules('YIELD_CONFIG_MANAGEMENT_CRUDL') - @ApiOkResponse({ type: [YieldConfigDTO], description: 'Returns all country yield value' }) - + @ApiOkResponse({ + type: [YieldConfigDTO], + description: 'Returns all country yield value', + }) async getAll(): Promise { return this.yieldconfigService.getAll(); } @@ -67,12 +68,11 @@ export class YieldConfigController { * @returns {YieldConfigDTO} */ @Get('/:id') - @UseGuards(AuthGuard('jwt'), ActiveUserGuard, RolesGuard,PermissionGuard) + @UseGuards(AuthGuard('jwt'), ActiveUserGuard, RolesGuard, PermissionGuard) @Roles(Role.Admin) @Permission('Read') @ACLModules('YIELD_CONFIG_MANAGEMENT_CRUDL') @ApiOkResponse({ type: [YieldConfigDTO], description: 'Returns all Devices' }) - async get(@Param('id') id: number): Promise { return this.yieldconfigService.findById(id); } @@ -83,7 +83,7 @@ export class YieldConfigController { * @returns {YieldConfigDTO} */ @Post() - @UseGuards(AuthGuard('jwt'), RolesGuard,PermissionGuard) + @UseGuards(AuthGuard('jwt'), RolesGuard, PermissionGuard) @Permission('Write') @ACLModules('YIELD_CONFIG_MANAGEMENT_CRUDL') //@Roles(Role.Admin) @@ -96,16 +96,24 @@ export class YieldConfigController { @UserDecorator() loggedUser: ILoggedInUser, @Body() yieldToRegister: NewYieldConfigDTO, ): Promise { - yieldToRegister.countryCode = yieldToRegister.countryCode.toUpperCase(); - if (yieldToRegister.countryCode && typeof yieldToRegister.countryCode === "string" && yieldToRegister.countryCode.length === 3) { + if ( + yieldToRegister.countryCode && + typeof yieldToRegister.countryCode === 'string' && + yieldToRegister.countryCode.length === 3 + ) { let countries = countryCodesList; - if (countries.find(ele => ele.countryCode === yieldToRegister.countryCode) === undefined) { + if ( + countries.find( + (ele) => ele.countryCode === yieldToRegister.countryCode, + ) === undefined + ) { return new Promise((resolve, reject) => { reject( new ConflictException({ success: false, - message: ' Invalid countryCode and countryName, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', + message: + ' Invalid countryCode and countryName, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', }), ); }); @@ -115,7 +123,8 @@ export class YieldConfigController { reject( new ConflictException({ success: false, - message: ' Invalid countryCode and countryName, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', + message: + ' Invalid countryCode and countryName, some of the valid country codes are "GBR" - "United Kingdom of Great Britain and Northern Ireland", "CAN" - "Canada" "IND" - "India", "DEU"- "Germany"', }), ); }); @@ -125,15 +134,15 @@ export class YieldConfigController { } /** - * + * * @param id :number - * @param body - * @param loggedUser + * @param body + * @param loggedUser * @returns {YieldConfigDTO} */ @Patch('/update/:id') @Roles(Role.Admin) - @UseGuards(AuthGuard('jwt'), RolesGuard,PermissionGuard) + @UseGuards(AuthGuard('jwt'), RolesGuard, PermissionGuard) @Permission('Update') @ACLModules('YIELD_CONFIG_MANAGEMENT_CRUDL') @ApiBody({ type: UpdateYieldValueDTO }) @@ -147,7 +156,6 @@ export class YieldConfigController { @Body() body: UpdateYieldValueDTO, @UserDecorator() loggedUser: ILoggedInUser, ): Promise { - return this.yieldconfigService.update(id, body, loggedUser); } } diff --git a/apps/drec-api/src/pods/yield-config/yieldconfig.entity.ts b/apps/drec-api/src/pods/yield-config/yieldconfig.entity.ts index 84f2bd03e..a5c5ec5bf 100755 --- a/apps/drec-api/src/pods/yield-config/yieldconfig.entity.ts +++ b/apps/drec-api/src/pods/yield-config/yieldconfig.entity.ts @@ -9,13 +9,11 @@ import { Organization } from '../organization/organization.entity'; @Entity({ name: 'yieldconfig' }) export class YieldConfig extends ExtendedBaseEntity implements IYieldConfig { - constructor(yieldvalue?: Partial) { super(); Object.assign(this, yieldvalue); } @ApiProperty({ type: Number }) - @PrimaryGeneratedColumn('uuid') id: number; @@ -33,21 +31,19 @@ export class YieldConfig extends ExtendedBaseEntity implements IYieldConfig { @Column() @IsNumber() yieldValue: number; - + @ApiProperty({ type: Number }) @Column() @IsNumber() created_By: number; - + @ApiProperty({ type: Number }) @Column() @IsNumber() updated_By: number; - + @ApiProperty({ enum: YieldStatus, enumName: 'yieldstatus' }) @Column({ default: YieldStatus.yes }) @IsEnum(YieldStatus) status: YieldStatus; - - } diff --git a/apps/drec-api/src/pods/yield-config/yieldconfig.module.ts b/apps/drec-api/src/pods/yield-config/yieldconfig.module.ts index d1c4d287e..4f663ad59 100755 --- a/apps/drec-api/src/pods/yield-config/yieldconfig.module.ts +++ b/apps/drec-api/src/pods/yield-config/yieldconfig.module.ts @@ -6,8 +6,7 @@ import { YieldConfigService } from './yieldconfig.service'; import { UserModule } from '../user/user.module'; @Module({ - imports: [TypeOrmModule.forFeature([YieldConfig]), -UserModule], + imports: [TypeOrmModule.forFeature([YieldConfig]), UserModule], providers: [YieldConfigService], exports: [YieldConfigService], controllers: [YieldConfigController], diff --git a/apps/drec-api/src/pods/yield-config/yieldconfig.service.spec.ts b/apps/drec-api/src/pods/yield-config/yieldconfig.service.spec.ts index dca538523..4b4d85340 100644 --- a/apps/drec-api/src/pods/yield-config/yieldconfig.service.spec.ts +++ b/apps/drec-api/src/pods/yield-config/yieldconfig.service.spec.ts @@ -1,28 +1,31 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { Repository } from 'typeorm'; -import { YieldConfigService } from './yieldconfig.service'; -import { YieldConfig } from './yieldconfig.entity'; -import { getRepositoryToken } from '@nestjs/typeorm'; - -describe('YieldConfigService', () => { - let service: YieldConfigService; - let repository: Repository; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [YieldConfigService, - { - provide: getRepositoryToken(YieldConfig), - useClass: Repository, - }, - ], - }).compile(); - - service = module.get(YieldConfigService); - repository = module.get>(getRepositoryToken(YieldConfig)); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); \ No newline at end of file +import { Test, TestingModule } from '@nestjs/testing'; +import { Repository } from 'typeorm'; +import { YieldConfigService } from './yieldconfig.service'; +import { YieldConfig } from './yieldconfig.entity'; +import { getRepositoryToken } from '@nestjs/typeorm'; + +describe('YieldConfigService', () => { + let service: YieldConfigService; + let repository: Repository; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [ + YieldConfigService, + { + provide: getRepositoryToken(YieldConfig), + useClass: Repository, + }, + ], + }).compile(); + + service = module.get(YieldConfigService); + repository = module.get>( + getRepositoryToken(YieldConfig), + ); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/apps/drec-api/src/pods/yield-config/yieldconfig.service.ts b/apps/drec-api/src/pods/yield-config/yieldconfig.service.ts index 6a557de80..90ab20e1a 100755 --- a/apps/drec-api/src/pods/yield-config/yieldconfig.service.ts +++ b/apps/drec-api/src/pods/yield-config/yieldconfig.service.ts @@ -10,32 +10,34 @@ import { import { validate } from 'class-validator'; import { InjectRepository } from '@nestjs/typeorm'; import { FindOneOptions, Repository } from 'typeorm'; -import { IYieldConfig,ILoggedInUser } from '../../models' +import { IYieldConfig, ILoggedInUser } from '../../models'; import { NewYieldConfigDTO } from './dto/new-yieldconfig.dto'; import { defaults } from 'lodash'; -import { YieldConfigDTO,UpdateYieldValueDTO} from './dto'; +import { YieldConfigDTO, UpdateYieldValueDTO } from './dto'; import { ExtendedBaseEntity } from '@energyweb/origin-backend-utils'; import { FindConditions, FindManyOptions, Between } from 'typeorm'; import cleanDeep from 'clean-deep'; export type TUserBaseEntity = ExtendedBaseEntity & IYieldConfig; -import { YieldConfig } from './yieldconfig.entity' +import { YieldConfig } from './yieldconfig.entity'; @Injectable() export class YieldConfigService { private readonly logger = new Logger(YieldConfigService.name); constructor( - @InjectRepository(YieldConfig) private readonly repository: Repository, - ) { } + @InjectRepository(YieldConfig) + private readonly repository: Repository, + ) {} async getAll(): Promise { - console.log(this.repository.find()) + console.log(this.repository.find()); return this.repository.find(); } - - public async create(data: NewYieldConfigDTO, loggedUser: any): Promise { - + public async create( + data: NewYieldConfigDTO, + loggedUser: any, + ): Promise { await this.checkForExistingyieldvalue(data.countryCode, data.countryName); - if (data.yieldValue === 0 ) { + if (data.yieldValue === 0) { throw new BadRequestException({ success: false, message: `add the valid yield value`, @@ -46,13 +48,15 @@ export class YieldConfigService { countryName: data.countryName, yieldValue: data.yieldValue, created_By: loggedUser.id, - status:data.status + status: data.status, }); - return new YieldConfig(yieldvalue); } - private async checkForExistingyieldvalue(countryCode: string, countryname: string): Promise { + private async checkForExistingyieldvalue( + countryCode: string, + countryname: string, + ): Promise { const isExistingUser = await this.hasvalue({ countryCode }); if (isExistingUser) { const message = `Yield value for this country ${countryname} already exists`; @@ -67,9 +71,12 @@ export class YieldConfigService { private async hasvalue(conditions: FindConditions) { return Boolean(await this.findOne(conditions)); } - async findOne(conditions: FindConditions): Promise { - const yieldvalue = await (this.repository.findOne(conditions) as Promise as Promise); - + async findOne( + conditions: FindConditions, + ): Promise { + const yieldvalue = await (this.repository.findOne( + conditions, + ) as Promise as Promise); return yieldvalue; } @@ -81,16 +88,15 @@ export class YieldConfigService { return yieldvaluebyId; } - async findByCountryCode(countryCode:string) { - return await this.repository.findOne({countryCode}); + async findByCountryCode(countryCode: string) { + return await this.repository.findOne({ countryCode }); } async update( id: number, data: UpdateYieldValueDTO, - user:ILoggedInUser + user: ILoggedInUser, ): Promise { - await this.findById(id); const validationErrors = await validate(data, { skipUndefinedProperties: true, @@ -105,12 +111,10 @@ export class YieldConfigService { await this.repository.update(id, { yieldValue: data.yieldValue, - // status: data.status, - updated_By:user.id + // status: data.status, + updated_By: user.id, }); return this.findOne({ id }); } - - -} \ No newline at end of file +} diff --git a/apps/drec-api/src/utils/PowerFormatter.ts b/apps/drec-api/src/utils/PowerFormatter.ts index 6d44cf05a..c4ea723f7 100755 --- a/apps/drec-api/src/utils/PowerFormatter.ts +++ b/apps/drec-api/src/utils/PowerFormatter.ts @@ -3,45 +3,53 @@ import { BigNumber } from '@ethersproject/bignumber'; import { BigNumber as BigNumberEthers } from 'ethers'; export class PowerFormatter { - static readonly displayUnit: string = 'kWh'; - static readonly capacityDisplayUnit: string = 'kW'; + static readonly displayUnit: string = 'kWh'; + static readonly capacityDisplayUnit: string = 'kW'; - static readonly decimalPlaces: number = 3; + static readonly decimalPlaces: number = 3; - private static formatter = new Intl.NumberFormat('en-US', { - style: 'decimal', - minimumFractionDigits: 0, - maximumFractionDigits: PowerFormatter.decimalPlaces - }); + private static formatter = new Intl.NumberFormat('en-US', { + style: 'decimal', + minimumFractionDigits: 0, + maximumFractionDigits: PowerFormatter.decimalPlaces, + }); - static getBaseValueFromValueInDisplayUnit(valueInDisplayUnit: number): string { - return BigNumber.from(valueInDisplayUnit) - .mul(Unit[PowerFormatter.displayUnit as keyof typeof Unit]) - .toString(); - } + static getBaseValueFromValueInDisplayUnit( + valueInDisplayUnit: number, + ): string { + return BigNumber.from(valueInDisplayUnit) + .mul(Unit[PowerFormatter.displayUnit as keyof typeof Unit]) + .toString(); + } - static getBaseValueFromValueInDisplayUnitInEthers(amount): string { - //@ts-ignore - return BigNumberEthers.from(PowerFormatter.getBaseValueFromValueInDisplayUnit(Number(amount)) - ); - } + static getBaseValueFromValueInDisplayUnitInEthers(amount): string { + //@ts-ignore + return BigNumberEthers.from( + PowerFormatter.getBaseValueFromValueInDisplayUnit(Number(amount)), + ); + } - static format(powerInWatt: number, includeDisplayUnit?: boolean): string { - if (!powerInWatt) { - const result = includeDisplayUnit ? `0 ${PowerFormatter.displayUnit}` : '0'; - return result; - } - return `${PowerFormatter.formatter.format( - BigNumber.from(powerInWatt) - .div(Unit[PowerFormatter.displayUnit as keyof typeof Unit]) - .toNumber() - )}${includeDisplayUnit ? ' ' + PowerFormatter.displayUnit : ''}`; + static format(powerInWatt: number, includeDisplayUnit?: boolean): string { + if (!powerInWatt) { + const result = includeDisplayUnit + ? `0 ${PowerFormatter.displayUnit}` + : '0'; + return result; } + return `${PowerFormatter.formatter.format( + BigNumber.from(powerInWatt) + .div(Unit[PowerFormatter.displayUnit as keyof typeof Unit]) + .toNumber(), + )}${includeDisplayUnit ? ' ' + PowerFormatter.displayUnit : ''}`; + } - static capacityFormatDisplay(powerInWatt: number, includeDisplayUnit?: boolean): string { - // @ts-ignore - return `${PowerFormatter.formatter.format(powerInWatt / Unit[PowerFormatter.displayUnit])}${ - includeDisplayUnit ? ' ' + PowerFormatter.capacityDisplayUnit : '' - }`; - } + static capacityFormatDisplay( + powerInWatt: number, + includeDisplayUnit?: boolean, + ): string { + // @ts-ignore + return `${PowerFormatter.formatter.format(powerInWatt / Unit[PowerFormatter.displayUnit])}${ + includeDisplayUnit ? ' ' + PowerFormatter.capacityDisplayUnit : '' + }`; + } } diff --git a/apps/drec-api/src/utils/checkForISOStringFormat.ts b/apps/drec-api/src/utils/checkForISOStringFormat.ts index 138043cfe..49726bc61 100755 --- a/apps/drec-api/src/utils/checkForISOStringFormat.ts +++ b/apps/drec-api/src/utils/checkForISOStringFormat.ts @@ -1,10 +1,14 @@ -import moment from 'moment'; - -export const isValidUTCDateFormat =(dateInput:string) =>{ - let dateFormateToCheck = new RegExp(/\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\d\.\d{1,}Z/); - ; - const dateFormat = 'YYYY-MM-DDTHH:mm:ssZ'; - const momentDateFormatToCheck = moment(dateInput).format(dateFormat); - - return dateFormateToCheck.test(dateInput) && moment(momentDateFormatToCheck, dateFormat, true).isValid(); -} +import moment from 'moment'; + +export const isValidUTCDateFormat = (dateInput: string) => { + let dateFormateToCheck = new RegExp( + /\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\d\.\d{1,}Z/, + ); + const dateFormat = 'YYYY-MM-DDTHH:mm:ssZ'; + const momentDateFormatToCheck = moment(dateInput).format(dateFormat); + + return ( + dateFormateToCheck.test(dateInput) && + moment(momentDateFormatToCheck, dateFormat, true).isValid() + ); +}; diff --git a/apps/drec-api/src/utils/enums/capacity-range.enum.ts b/apps/drec-api/src/utils/enums/capacity-range.enum.ts index f7b22a51a..feb738309 100755 --- a/apps/drec-api/src/utils/enums/capacity-range.enum.ts +++ b/apps/drec-api/src/utils/enums/capacity-range.enum.ts @@ -1,7 +1,7 @@ export enum CapacityRange { - firstRange ='0.1W - 1kW', + firstRange = '0.1W - 1kW', secondRange = '1.01kW - 50kW', thirdRange = '51kW - 500kW', fourthRange = '500kW - 5MW', - fifthRange = '5MW+' + fifthRange = '5MW+', } diff --git a/apps/drec-api/src/utils/enums/certificate-type.enum.ts b/apps/drec-api/src/utils/enums/certificate-type.enum.ts index 02597b964..b22b55f51 100755 --- a/apps/drec-api/src/utils/enums/certificate-type.enum.ts +++ b/apps/drec-api/src/utils/enums/certificate-type.enum.ts @@ -1,4 +1,4 @@ export enum CertificateType { - REC='REC', - CarbonCredit = 'Carbon Credit' + REC = 'REC', + CarbonCredit = 'Carbon Credit', } diff --git a/apps/drec-api/src/utils/enums/device-status.enum.ts b/apps/drec-api/src/utils/enums/device-status.enum.ts index c33f06478..b3598bdea 100755 --- a/apps/drec-api/src/utils/enums/device-status.enum.ts +++ b/apps/drec-api/src/utils/enums/device-status.enum.ts @@ -4,11 +4,10 @@ export enum DeviceStatus { Active = 'Active', } export enum IRECDeviceStatus { - NotRegistered='NotRegistered',//(these for D-rec purpose not I-rec status) - DeviceNameCreated='DeviceNameCreated',//(these for D-rec purpose not I-rec status) + NotRegistered = 'NotRegistered', //(these for D-rec purpose not I-rec status) + DeviceNameCreated = 'DeviceNameCreated', //(these for D-rec purpose not I-rec status) Submitted = 'Submitted', Rejected = 'Rejected', Referred = 'Referred', - Approved='Approved' + Approved = 'Approved', } - diff --git a/apps/drec-api/src/utils/enums/fuel&devicetype-code.enum.ts b/apps/drec-api/src/utils/enums/fuel&devicetype-code.enum.ts index 5092c6969..c1b1f499d 100755 --- a/apps/drec-api/src/utils/enums/fuel&devicetype-code.enum.ts +++ b/apps/drec-api/src/utils/enums/fuel&devicetype-code.enum.ts @@ -1,13 +1,12 @@ -export enum FuelCode { - ES100='ES100', -//ES990 = 'ES990', - -} - -export enum DevicetypeCode{ - TC110='TC110', - TC120='TC120', - TC130='TC130', - TC140='TC140', - TC150='TC150' -} \ No newline at end of file +export enum FuelCode { + ES100 = 'ES100', + //ES990 = 'ES990', +} + +export enum DevicetypeCode { + TC110 = 'TC110', + TC120 = 'TC120', + TC130 = 'TC130', + TC140 = 'TC140', + TC150 = 'TC150', +} diff --git a/apps/drec-api/src/utils/enums/history_next_issuance.enum.ts b/apps/drec-api/src/utils/enums/history_next_issuance.enum.ts index 8df8e446e..518e348af 100755 --- a/apps/drec-api/src/utils/enums/history_next_issuance.enum.ts +++ b/apps/drec-api/src/utils/enums/history_next_issuance.enum.ts @@ -1,7 +1,5 @@ export enum HistoryNextInssuanceStatus { - Pending = 'Pending', - Running = 'Running', - Completed = 'Completed', - - } - \ No newline at end of file + Pending = 'Pending', + Running = 'Running', + Completed = 'Completed', +} diff --git a/apps/drec-api/src/utils/enums/index.ts b/apps/drec-api/src/utils/enums/index.ts index 51de4d01a..2b0bb8b7c 100755 --- a/apps/drec-api/src/utils/enums/index.ts +++ b/apps/drec-api/src/utils/enums/index.ts @@ -17,5 +17,4 @@ export * from './read-type.enum'; export * from './certificate-type.enum'; export * from './history_next_issuance.enum'; export * from './fuel&devicetype-code.enum'; -export * from './sdgbenefits.enum' - +export * from './sdgbenefits.enum'; diff --git a/apps/drec-api/src/utils/enums/off-taker.enum.ts b/apps/drec-api/src/utils/enums/off-taker.enum.ts index 9a1a428cd..8f777459f 100755 --- a/apps/drec-api/src/utils/enums/off-taker.enum.ts +++ b/apps/drec-api/src/utils/enums/off-taker.enum.ts @@ -1,13 +1,12 @@ export enum OffTaker { School = 'School', - Education="Education", + Education = 'Education', HealthFacility = 'Health Facility', Residential = 'Residential', Commercial = 'Commercial', Industrial = 'Industrial', PublicSector = 'Public Sector', - Agriculture='Agriculture', - Utility='Utility', - OffGridCommunity='Off-Grid Community' - -} \ No newline at end of file + Agriculture = 'Agriculture', + Utility = 'Utility', + OffGridCommunity = 'Off-Grid Community', +} diff --git a/apps/drec-api/src/utils/enums/read-type.enum.ts b/apps/drec-api/src/utils/enums/read-type.enum.ts index 98148d223..6d07e0c71 100755 --- a/apps/drec-api/src/utils/enums/read-type.enum.ts +++ b/apps/drec-api/src/utils/enums/read-type.enum.ts @@ -1,20 +1,18 @@ export enum ReadType { - History = 'History', - Delta = 'Delta', - ReadMeter = 'Aggregate', - - } + History = 'History', + Delta = 'Delta', + ReadMeter = 'Aggregate', +} - export enum ReadStatus{ - Done='Done', - Pending= 'Pending' +export enum ReadStatus { + Done = 'Done', + Pending = 'Pending', +} - } - - export enum SingleDeviceIssuanceStatus{ - Requested='Requested', - Failed='Failed', - Cancelled='Cancelled', - Succeeded='Succeeded', - Retry='Retry' - } +export enum SingleDeviceIssuanceStatus { + Requested = 'Requested', + Failed = 'Failed', + Cancelled = 'Cancelled', + Succeeded = 'Succeeded', + Retry = 'Retry', +} diff --git a/apps/drec-api/src/utils/enums/role.enum.ts b/apps/drec-api/src/utils/enums/role.enum.ts index 672534274..5a24c64db 100755 --- a/apps/drec-api/src/utils/enums/role.enum.ts +++ b/apps/drec-api/src/utils/enums/role.enum.ts @@ -1,26 +1,25 @@ export enum Role { - User='User', + User = 'User', DeviceOwner = 'DeviceOwner', OrganizationAdmin = 'OrganizationAdmin', Buyer = 'Buyer', Admin = 'Admin', SubBuyer = 'SubBuyer', - // Intermediary = 'Intermediary', - ApiUser="ApiUser" - + // Intermediary = 'Intermediary', + ApiUser = 'ApiUser', } export enum RoleStatus { Enable = 'Enable', - Disable = 'Disable' + Disable = 'Disable', } export enum EntityType { Role = 'Role', - User = 'User' + User = 'User', } export enum PermissionString { - Read = 'Read', - Delete = 'Delete', - Update = 'Update', - Write = 'Write', - } \ No newline at end of file + Read = 'Read', + Delete = 'Delete', + Update = 'Update', + Write = 'Write', +} diff --git a/apps/drec-api/src/utils/enums/sdgbenefits.enum.ts b/apps/drec-api/src/utils/enums/sdgbenefits.enum.ts index 022c081f5..377d2277b 100755 --- a/apps/drec-api/src/utils/enums/sdgbenefits.enum.ts +++ b/apps/drec-api/src/utils/enums/sdgbenefits.enum.ts @@ -1,20 +1,19 @@ -export enum SDGBenefitsList { - - SDG1 = "No Poverty", - SDG2 = "Zero Hunger", - SDG3 = "Good Health and Well-being", - SDG4 = "Quality Education", - SDG5 = "SDG5", - SDG6 = "SDG6", - SDG7 = "SDG7", - SDG8 = "SDG8", - SDG9 = "SDG9", - SDG10 = "SDG10", - SDG11 = "SDG11", - SDG12 = "SDG12", - SDG13 = "SDG13", - SDG14 = "SDG14", - SDG15 = "SDG15", - SDG16 = "SDG16", - SDG17 = "SDG17" -} \ No newline at end of file +export enum SDGBenefitsList { + SDG1 = 'No Poverty', + SDG2 = 'Zero Hunger', + SDG3 = 'Good Health and Well-being', + SDG4 = 'Quality Education', + SDG5 = 'SDG5', + SDG6 = 'SDG6', + SDG7 = 'SDG7', + SDG8 = 'SDG8', + SDG9 = 'SDG9', + SDG10 = 'SDG10', + SDG11 = 'SDG11', + SDG12 = 'SDG12', + SDG13 = 'SDG13', + SDG14 = 'SDG14', + SDG15 = 'SDG15', + SDG16 = 'SDG16', + SDG17 = 'SDG17', +} diff --git a/apps/drec-api/src/utils/enums/yieldstatus.enum.ts b/apps/drec-api/src/utils/enums/yieldstatus.enum.ts index ef89a5188..9a7021fd9 100755 --- a/apps/drec-api/src/utils/enums/yieldstatus.enum.ts +++ b/apps/drec-api/src/utils/enums/yieldstatus.enum.ts @@ -1,5 +1,4 @@ export enum YieldStatus { - yes = 'Y', - No = 'N', - - } \ No newline at end of file + yes = 'Y', + No = 'N', +} diff --git a/apps/drec-api/src/utils/evident-login.ts b/apps/drec-api/src/utils/evident-login.ts index ab8b95fb8..fd71f92d1 100755 --- a/apps/drec-api/src/utils/evident-login.ts +++ b/apps/drec-api/src/utils/evident-login.ts @@ -1,33 +1,35 @@ import * as jwt from 'jsonwebtoken'; let jwtToken; -export async function login(httpService:any): Promise { - - const url = `${process.env.IREC_EVIDENT_API_URL}/auth/token`; - console.log('In login, url: ' + url); - const payload = { email:process.env.IREC_EVIDENT_REGISTRANT_EMAIL, token:process.env.IREC_EVIDENT_API_Token}; - const response = await httpService.post(url, payload).toPromise(); - jwtToken = response.data.token; - console.log("evident",jwtToken); - return jwtToken; - } - - export async function regenerateToken(httpService:any): Promise { - if (!jwtToken) { - return login(httpService); - } +export async function login(httpService: any): Promise { + const url = `${process.env.IREC_EVIDENT_API_URL}/auth/token`; + console.log('In login, url: ' + url); + const payload = { + email: process.env.IREC_EVIDENT_REGISTRANT_EMAIL, + token: process.env.IREC_EVIDENT_API_Token, + }; + const response = await httpService.post(url, payload).toPromise(); + jwtToken = response.data.token; + console.log('evident', jwtToken); + return jwtToken; +} - // Check if token has expired (assuming expiration is based on 1 hour) - const expired = isTokenExpired(jwtToken); - if (expired) { - return login(httpService); - } +export async function regenerateToken(httpService: any): Promise { + if (!jwtToken) { + return login(httpService); + } - return jwtToken; + // Check if token has expired (assuming expiration is based on 1 hour) + const expired = isTokenExpired(jwtToken); + if (expired) { + return login(httpService); } - export function isTokenExpired(token: string): boolean { - const decodedToken = jwt.decode(token); - const expirationDate = new Date(decodedToken.exp * 1000); // Convert expiration time from seconds to milliseconds - return expirationDate < new Date(); - } \ No newline at end of file + return jwtToken; +} + +export function isTokenExpired(token: string): boolean { + const decodedToken = jwt.decode(token); + const expirationDate = new Date(decodedToken.exp * 1000); // Convert expiration time from seconds to milliseconds + return expirationDate < new Date(); +} diff --git a/apps/drec-api/src/utils/get-capacity-range.spec.ts b/apps/drec-api/src/utils/get-capacity-range.spec.ts index f322dedd8..e54a0e674 100755 --- a/apps/drec-api/src/utils/get-capacity-range.spec.ts +++ b/apps/drec-api/src/utils/get-capacity-range.spec.ts @@ -4,17 +4,17 @@ import { CapacityRange } from './enums'; import { getCapacityRange } from './get-capacity-range'; describe('getCapacityRange function', () => { - it('capacityRange', async()=> { - const capacityRange1 = getCapacityRange(1500); - const capacityRange2 = getCapacityRange(2300000); - const capacityRange3 = getCapacityRange(150); - const capacityRange4 = getCapacityRange(15); - const capacityRange5 = getCapacityRange(1); + it('capacityRange', async () => { + const capacityRange1 = getCapacityRange(1500); + const capacityRange2 = getCapacityRange(2300000); + const capacityRange3 = getCapacityRange(150); + const capacityRange4 = getCapacityRange(15); + const capacityRange5 = getCapacityRange(1); - expect(capacityRange1).toEqual(CapacityRange.fourthRange); - expect(capacityRange2).toEqual(CapacityRange.fifthRange); - expect(capacityRange3).toEqual(CapacityRange.thirdRange); - expect(capacityRange4).toEqual(CapacityRange.secondRange); - expect(capacityRange5).toEqual(CapacityRange.firstRange); - }); + expect(capacityRange1).toEqual(CapacityRange.fourthRange); + expect(capacityRange2).toEqual(CapacityRange.fifthRange); + expect(capacityRange3).toEqual(CapacityRange.thirdRange); + expect(capacityRange4).toEqual(CapacityRange.secondRange); + expect(capacityRange5).toEqual(CapacityRange.firstRange); + }); }); diff --git a/apps/drec-api/src/utils/get-capacity-range.ts b/apps/drec-api/src/utils/get-capacity-range.ts index c1aae0c6b..5e48b1dda 100755 --- a/apps/drec-api/src/utils/get-capacity-range.ts +++ b/apps/drec-api/src/utils/get-capacity-range.ts @@ -1,21 +1,28 @@ import { CapacityRange } from './enums'; -export const getCapacityRange = (capacityInKiloWatts:number): CapacityRange =>{ - let capacityWatts = capacityInKiloWatts * (10 ** 3); - let capacityMegaWatts = capacityInKiloWatts * (10 ** -3); +export const getCapacityRange = ( + capacityInKiloWatts: number, +): CapacityRange => { + let capacityWatts = capacityInKiloWatts * 10 ** 3; + let capacityMegaWatts = capacityInKiloWatts * 10 ** -3; if (capacityWatts <= 1000) { return CapacityRange.firstRange; - } - else if (capacityInKiloWatts > 1.01 && Math.round(capacityInKiloWatts) <= 50) { + } else if ( + capacityInKiloWatts > 1.01 && + Math.round(capacityInKiloWatts) <= 50 + ) { return CapacityRange.secondRange; - } - else if (capacityInKiloWatts >= 51 && Math.round(capacityInKiloWatts) <= 500) { + } else if ( + capacityInKiloWatts >= 51 && + Math.round(capacityInKiloWatts) <= 500 + ) { return CapacityRange.thirdRange; - } - else if (Math.round(capacityInKiloWatts) > 500 && Math.round(capacityMegaWatts) <= 5) { + } else if ( + Math.round(capacityInKiloWatts) > 500 && + Math.round(capacityMegaWatts) <= 5 + ) { return CapacityRange.fourthRange; - } - else if (Math.round(capacityMegaWatts) > 5) { + } else if (Math.round(capacityMegaWatts) > 5) { return CapacityRange.fifthRange; -} -} \ No newline at end of file + } +}; diff --git a/apps/drec-api/src/utils/get-commissioning-date-range.spec.ts b/apps/drec-api/src/utils/get-commissioning-date-range.spec.ts index 56038570a..7f580119c 100755 --- a/apps/drec-api/src/utils/get-commissioning-date-range.spec.ts +++ b/apps/drec-api/src/utils/get-commissioning-date-range.spec.ts @@ -4,18 +4,40 @@ import { getDateRangeFromYear } from './get-commissioning-date-range'; describe('getDateRangeFromYear function', () => { it('should return correct date range for commissioning date', () => { - expect(getDateRangeFromYear('2024-01-01')).toEqual(CommissioningDateRange.Year_1_Q1); - expect(getDateRangeFromYear('2024-05-01')).toEqual(CommissioningDateRange.Year_1_Q2); - expect(getDateRangeFromYear('2024-08-01')).toEqual(CommissioningDateRange.Year_1_Q3); - expect(getDateRangeFromYear('2024-11-01')).toEqual(CommissioningDateRange.Year_1_Q4); - expect(getDateRangeFromYear('2023-02-01')).toEqual(CommissioningDateRange.Year_2); - expect(getDateRangeFromYear('2022-02-01')).toEqual(CommissioningDateRange.Year_3); - expect(getDateRangeFromYear('2021-02-01')).toEqual(CommissioningDateRange.Year_4); - expect(getDateRangeFromYear('2020-02-01')).toEqual(CommissioningDateRange.Year_5); - expect(getDateRangeFromYear('2018-02-01')).toEqual(CommissioningDateRange.Between_years_6_10); - expect(getDateRangeFromYear('2013-02-01')).toEqual(CommissioningDateRange.Between_years_11_15); - expect(getDateRangeFromYear('2005-02-01')).toEqual(CommissioningDateRange.Above_15_years); - //expect(dateRange1).to.eq(CommissioningDateRange.Year_1_Q4); - //expect(dateRange2).to.eq(CommissioningDateRange.Above_15_years); + expect(getDateRangeFromYear('2024-01-01')).toEqual( + CommissioningDateRange.Year_1_Q1, + ); + expect(getDateRangeFromYear('2024-05-01')).toEqual( + CommissioningDateRange.Year_1_Q2, + ); + expect(getDateRangeFromYear('2024-08-01')).toEqual( + CommissioningDateRange.Year_1_Q3, + ); + expect(getDateRangeFromYear('2024-11-01')).toEqual( + CommissioningDateRange.Year_1_Q4, + ); + expect(getDateRangeFromYear('2023-02-01')).toEqual( + CommissioningDateRange.Year_2, + ); + expect(getDateRangeFromYear('2022-02-01')).toEqual( + CommissioningDateRange.Year_3, + ); + expect(getDateRangeFromYear('2021-02-01')).toEqual( + CommissioningDateRange.Year_4, + ); + expect(getDateRangeFromYear('2020-02-01')).toEqual( + CommissioningDateRange.Year_5, + ); + expect(getDateRangeFromYear('2018-02-01')).toEqual( + CommissioningDateRange.Between_years_6_10, + ); + expect(getDateRangeFromYear('2013-02-01')).toEqual( + CommissioningDateRange.Between_years_11_15, + ); + expect(getDateRangeFromYear('2005-02-01')).toEqual( + CommissioningDateRange.Above_15_years, + ); + //expect(dateRange1).to.eq(CommissioningDateRange.Year_1_Q4); + //expect(dateRange2).to.eq(CommissioningDateRange.Above_15_years); }); }); diff --git a/apps/drec-api/src/utils/get-commissioning-date-range.ts b/apps/drec-api/src/utils/get-commissioning-date-range.ts index 743dcfbbc..a03da7751 100755 --- a/apps/drec-api/src/utils/get-commissioning-date-range.ts +++ b/apps/drec-api/src/utils/get-commissioning-date-range.ts @@ -8,7 +8,7 @@ export const getDateRangeFromYear = ( const range = currentYear - year; if (range === 0) { const month = new Date(commissioningDate).getMonth(); - console.log("month:",month); + console.log('month:', month); if (month < 4) { return CommissioningDateRange.Year_1_Q1; } else if (month >= 4 && month < 7) { diff --git a/apps/drec-api/src/utils/get-lastread-influx.ts b/apps/drec-api/src/utils/get-lastread-influx.ts index 6af1ca36c..9dc1d31f1 100755 --- a/apps/drec-api/src/utils/get-lastread-influx.ts +++ b/apps/drec-api/src/utils/get-lastread-influx.ts @@ -1,83 +1,82 @@ -//import { Countries } from '@energyweb/utils-general'; -import { countryCodesList } from '../models/country-code' -import { - - ReadDTO - -} from '@energyweb/energy-api-influxdb'; -import { InfluxDB, QueryApi, FluxTableMetaData } from '@influxdata/influxdb-client'; - - - -export const NewfindLatestRead = async (meterId: string, deviceregisterdate: Date): Promise => { - //console.log("527") - //console.log(deviceregisterdate) - //const regisdate = DateTime.fromISO(deviceregisterdate.toISOString()); - - //@ts-ignore - //@ts-ignore - const url = process.env.INFLUXDB_URL; - //@ts-ignore - const token = process.env.INFLUXDB_TOKEN; - //@ts-ignore - const org = process.env.INFLUXDB_ORG; - - const influx = new InfluxDB({ - url: url, - token: token, - }); - // const queryApi = influx.getQueryApi(org); - let result: any; - - const fluxQuery = `from(bucket: "${process.env.INFLUXDB_BUCKET}") - |> range(start: ${deviceregisterdate}, stop: now()) - |> filter(fn: (r) => r.meter == "${meterId}" and r._field == "read") - |> last()` - await influx.getQueryApi(org) - .queryRows(fluxQuery, { - next(row: string[], meta: FluxTableMetaData) { - const obj = meta.toObject(row); - // return obj.map((record: any) => ({ - // timestamp: new Date(record._time), - // value: Number(record._value), - // })); - console.log(obj); - result = { - timestamp: new Date(obj._time), - value: Number(obj._value), - }; - //return obj - }, - error(error: Error) { - console.error(error); - }, - complete() { - console.log('Query complete!'); - }, - }); - return result -}; - -export const execute = (query: any) => { - - const data = dbReader.collectRows(); - return data.map((record: any) => ({ - timestamp: new Date(record._time), - value: Number(record._value), - })); -}; -export const dbReader: any = () => { - // const url = 'http://localhost:8086'; - // const token = 'admin:admin' - // const org = ''; - - //@ts-ignore - const url = process.env.INFLUXDB_URL; - //@ts-ignore - const token = process.env.INFLUXDB_TOKEN; - //@ts-ignore - const org = process.env.INFLUXDB_ORG; - - //@ts-ignore - return new InfluxDB({ url, token }).getQueryApi(org) -} +//import { Countries } from '@energyweb/utils-general'; +import { countryCodesList } from '../models/country-code'; +import { ReadDTO } from '@energyweb/energy-api-influxdb'; +import { + InfluxDB, + QueryApi, + FluxTableMetaData, +} from '@influxdata/influxdb-client'; + +export const NewfindLatestRead = async ( + meterId: string, + deviceregisterdate: Date, +): Promise => { + //console.log("527") + //console.log(deviceregisterdate) + //const regisdate = DateTime.fromISO(deviceregisterdate.toISOString()); + + //@ts-ignore + //@ts-ignore + const url = process.env.INFLUXDB_URL; + //@ts-ignore + const token = process.env.INFLUXDB_TOKEN; + //@ts-ignore + const org = process.env.INFLUXDB_ORG; + + const influx = new InfluxDB({ + url: url, + token: token, + }); + // const queryApi = influx.getQueryApi(org); + let result: any; + + const fluxQuery = `from(bucket: "${process.env.INFLUXDB_BUCKET}") + |> range(start: ${deviceregisterdate}, stop: now()) + |> filter(fn: (r) => r.meter == "${meterId}" and r._field == "read") + |> last()`; + await influx.getQueryApi(org).queryRows(fluxQuery, { + next(row: string[], meta: FluxTableMetaData) { + const obj = meta.toObject(row); + // return obj.map((record: any) => ({ + // timestamp: new Date(record._time), + // value: Number(record._value), + // })); + console.log(obj); + result = { + timestamp: new Date(obj._time), + value: Number(obj._value), + }; + //return obj + }, + error(error: Error) { + console.error(error); + }, + complete() { + console.log('Query complete!'); + }, + }); + return result; +}; + +export const execute = (query: any) => { + const data = dbReader.collectRows(); + return data.map((record: any) => ({ + timestamp: new Date(record._time), + value: Number(record._value), + })); +}; +export const dbReader: any = () => { + // const url = 'http://localhost:8086'; + // const token = 'admin:admin' + // const org = ''; + + //@ts-ignore + const url = process.env.INFLUXDB_URL; + //@ts-ignore + const token = process.env.INFLUXDB_TOKEN; + //@ts-ignore + const org = process.env.INFLUXDB_ORG; + + //@ts-ignore + return new InfluxDB({ url, token }).getQueryApi(org); +}; diff --git a/apps/drec-api/src/utils/getCodeFromCountry.ts b/apps/drec-api/src/utils/getCodeFromCountry.ts index 5cf63ca3a..dfeb77b30 100755 --- a/apps/drec-api/src/utils/getCodeFromCountry.ts +++ b/apps/drec-api/src/utils/getCodeFromCountry.ts @@ -1,10 +1,11 @@ //import { Countries } from '@energyweb/utils-general'; -import {countryCodesList} from '../models/country-code' +import { countryCodesList } from '../models/country-code'; export const getCodeFromCountry = (countryName: string): string | undefined => { - if (!countryName) { return; } - - return countryCodesList.filter((country) => country.countryCode === countryName)[0]?.countryCode; + + return countryCodesList.filter( + (country) => country.countryCode === countryName, + )[0]?.countryCode; }; diff --git a/apps/drec-api/src/utils/getDeviceTypeFromCode.spec.ts b/apps/drec-api/src/utils/getDeviceTypeFromCode.spec.ts index 690a6a6e7..aa93caf0a 100755 --- a/apps/drec-api/src/utils/getDeviceTypeFromCode.spec.ts +++ b/apps/drec-api/src/utils/getDeviceTypeFromCode.spec.ts @@ -2,7 +2,7 @@ import { getDeviceTypeFromCode } from './getDeviceTypeFromCode'; describe('getDeviceTypeFromCode function', () => { - it('deviceType', async()=> { + it('deviceType', async () => { const code1 = 'TC110'; const code2 = 'TC120'; const code3 = 'TC130'; diff --git a/apps/drec-api/src/utils/getFuelNameFromCode.spec.ts b/apps/drec-api/src/utils/getFuelNameFromCode.spec.ts index a08fde354..909970c80 100755 --- a/apps/drec-api/src/utils/getFuelNameFromCode.spec.ts +++ b/apps/drec-api/src/utils/getFuelNameFromCode.spec.ts @@ -3,7 +3,7 @@ import { FuelCode } from './enums'; import { getFuelNameFromCode } from './getFuelNameFromCode'; describe('getFuelNameFromCode function', () => { - it('getFuelCode', async()=> { + it('getFuelCode', async () => { //const code = 'ES100'; const fuelType = getFuelNameFromCode(FuelCode.ES100); expect(fuelType).toEqual('Solar'); diff --git a/apps/drec-api/src/utils/group-by-properties.spec.ts b/apps/drec-api/src/utils/group-by-properties.spec.ts index c76126dd5..7d9523abf 100755 --- a/apps/drec-api/src/utils/group-by-properties.spec.ts +++ b/apps/drec-api/src/utils/group-by-properties.spec.ts @@ -3,7 +3,7 @@ import { groupByProps } from './group-by-properties'; import TestDevicesToGroup from '../../test/test-devices-for-grouping.json'; describe('groupByProps function', () => { - it('groupByProperties', async()=> { + it('groupByProperties', async () => { const groupDevices = groupByProps(TestDevicesToGroup, (item) => { return [ item['organizationId'], @@ -14,7 +14,7 @@ describe('groupByProps function', () => { item['offTaker'], ]; }); - + console.log(groupDevices); expect(groupDevices).toBeInstanceOf(Array); expect(groupDevices).toHaveLength(5); diff --git a/apps/drec-api/src/utils/history_next_issuance.enum.ts b/apps/drec-api/src/utils/history_next_issuance.enum.ts index 8df8e446e..518e348af 100755 --- a/apps/drec-api/src/utils/history_next_issuance.enum.ts +++ b/apps/drec-api/src/utils/history_next_issuance.enum.ts @@ -1,7 +1,5 @@ export enum HistoryNextInssuanceStatus { - Pending = 'Pending', - Running = 'Running', - Completed = 'Completed', - - } - \ No newline at end of file + Pending = 'Pending', + Running = 'Running', + Completed = 'Completed', +} diff --git a/apps/drec-api/src/utils/localTimeDetailsForDevice.ts b/apps/drec-api/src/utils/localTimeDetailsForDevice.ts index ffb2afe74..47933c2e2 100755 --- a/apps/drec-api/src/utils/localTimeDetailsForDevice.ts +++ b/apps/drec-api/src/utils/localTimeDetailsForDevice.ts @@ -1,37 +1,33 @@ import * as mapBoxTimeSpace from '@mapbox/timespace'; import * as momentTimeZone from 'moment-timezone'; import { countryCodesList } from '../models/country-code'; -import { CountryCodeNameDTO } from '../pods/countrycode/dto' - - +import { CountryCodeNameDTO } from '../pods/countrycode/dto'; export const getLocalTime = (startDate, device) => { let point = [parseFloat(device.longitude), parseFloat(device.latitude)]; - console.log("latitude is::::" + device.latitude); - console.log("longitue is:::" + device.longitude); - console.log("point is:::" + point); + console.log('latitude is::::' + device.latitude); + console.log('longitue is:::' + device.longitude); + console.log('point is:::' + point); let timestamp = new Date(startDate); - let localTime = mapBoxTimeSpace.getFuzzyLocalTimeFromPoint(timestamp, point).startOf('day'); - console.log("localTime Time: " + localTime.utc().format()); + let localTime = mapBoxTimeSpace + .getFuzzyLocalTimeFromPoint(timestamp, point) + .startOf('day'); + console.log('localTime Time: ' + localTime.utc().format()); return localTime; - -} - - +}; export const getLocalTimeZoneFromDevice = (localTime, device) => { if (device.timezone) { - console.log("timezone is there") - // console.log("DEVICE TIMEZONE BEING RETURNED:" + device.timezone); + console.log('timezone is there'); + // console.log("DEVICE TIMEZONE BEING RETURNED:" + device.timezone); return device.timezone; - } - else if (device.longitude && device.latitude && localTime) { + } else if (device.longitude && device.latitude && localTime) { try { - console.log("lat and long are there"); + console.log('lat and long are there'); var timestamp = new Date(localTime); const point = [parseFloat(device.longitude), parseFloat(device.latitude)]; let time = mapBoxTimeSpace.getFuzzyLocalTimeFromPoint(timestamp, point); - console.log("TIME:::::::::::::::::" + time); + console.log('TIME:::::::::::::::::' + time); const actualTimeZone = momentTimeZone.tz.names().find((timezone) => { if (momentTimeZone.tz(timezone).zoneAbbr() == time.zoneAbbr()) { // console.log("TIMEZONE THAT's BEING RETURNED:::" + timezone); @@ -39,79 +35,69 @@ export const getLocalTimeZoneFromDevice = (localTime, device) => { } }); return actualTimeZone; - } - catch { - - const countryCodeFound: CountryCodeNameDTO = countryCodesList.find(entry => entry.countryCode === device.countryCode); + } catch { + const countryCodeFound: CountryCodeNameDTO = countryCodesList.find( + (entry) => entry.countryCode === device.countryCode, + ); return countryCodeFound.timezones[0].name; } - } - else { - console.log("only country code") - const countryCodeFound: CountryCodeNameDTO = countryCodesList.find(entry => entry.countryCode === device.countryCode); + } else { + console.log('only country code'); + const countryCodeFound: CountryCodeNameDTO = countryCodesList.find( + (entry) => entry.countryCode === device.countryCode, + ); return countryCodeFound.timezones[0].name; } -} +}; export const getOffsetFromTimeZoneName = (givenTimeZone) => { - console.log("given timezone::::::::;;" + givenTimeZone); + console.log('given timezone::::::::;;' + givenTimeZone); let matchingTimezone; for (let i = 0; i < countryCodesList.length; i++) { const elementTimeZone = countryCodesList[i].timezones; for (let j = 0; j < elementTimeZone.length; j++) { if (elementTimeZone[j].name === givenTimeZone) { - console.log("FOUND A MATCHING TIMEZONE IN THE LOOPS::::" + elementTimeZone[j].name) + console.log( + 'FOUND A MATCHING TIMEZONE IN THE LOOPS::::' + + elementTimeZone[j].name, + ); matchingTimezone = elementTimeZone[j]; break; - } - else { + } else { continue; } } } - console.log("matching timezone object::::::;" + matchingTimezone); - console.log("matching timezone name:::::::" + matchingTimezone.name); - const offset = matchingTimezone.offset - console.log("matching OFFSET:::::::" + offset); + console.log('matching timezone object::::::;' + matchingTimezone); + console.log('matching timezone name:::::::' + matchingTimezone.name); + const offset = matchingTimezone.offset; + console.log('matching OFFSET:::::::' + offset); return offset; - -} - - - - +}; export const getFormattedOffSetFromOffsetAsJson = (givenOffSet) => { + console.log('given offset:::' + givenOffSet); - console.log("given offset:::" + givenOffSet); - - let hours = Math.floor((Math.abs(givenOffSet)) / 60); + let hours = Math.floor(Math.abs(givenOffSet) / 60); let minutes = Math.abs(givenOffSet % 60); if (givenOffSet < 0) { - hours = -1 * hours; - } - console.log("OFFSET hours FROM UTILS FUNCTOIN" + hours); - - console.log("OFFSET hours FROM UTILS FUNCTOIN" + minutes); + console.log('OFFSET hours FROM UTILS FUNCTOIN' + hours); + console.log('OFFSET hours FROM UTILS FUNCTOIN' + minutes); const formattedJson = { + hours: hours, - "hours": hours, - - "minutes": minutes - + minutes: minutes, }; return formattedJson; - -} - +}; diff --git a/apps/drec-api/src/utils/number.spec.ts b/apps/drec-api/src/utils/number.spec.ts index 18fb87327..ad25415dc 100755 --- a/apps/drec-api/src/utils/number.spec.ts +++ b/apps/drec-api/src/utils/number.spec.ts @@ -2,7 +2,7 @@ import { roundToClosestLower } from './number'; describe('roundToClosestLower function', () => { - it('number', async()=> { + it('number', async () => { const oneMinute = 1000 * 60; const thirtyMinutes = oneMinute * 30; const date = 1626084336714; diff --git a/apps/drec-api/src/utils/types.ts b/apps/drec-api/src/utils/types.ts index 50e640572..6378d31af 100755 --- a/apps/drec-api/src/utils/types.ts +++ b/apps/drec-api/src/utils/types.ts @@ -1,16 +1,16 @@ import { ICertificate as IOriginalCertificate } from '@energyweb/origin-247-certificate'; import { DeviceGroupDTO } from '../pods/device-group/dto'; -import { StandardCompliance,CertificateType } from './enums'; +import { StandardCompliance, CertificateType } from './enums'; export interface ICertificateMetadata { - version:string; + version: string; deviceIds: number[]; //deviceGroup: DeviceGroupDTO; groupId: null | string; - buyerReservationId?:string; - isStandardIssuanceRequested?:StandardCompliance; - type?:CertificateType; - certificateTransactionUID?:string; + buyerReservationId?: string; + isStandardIssuanceRequested?: StandardCompliance; + type?: CertificateType; + certificateTransactionUID?: string; //isStandardIssued?:boolean; } From ec89dd25c9fa216f77b160833e76645fab10af66 Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Thu, 7 Mar 2024 14:30:20 +0100 Subject: [PATCH 2/5] chore: Add prettier CI pipeline --- .github/workflows/check.yml | 71 +++++++++++++++++++++++++++++++++++++ apps/drec-api/package.json | 3 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 000000000..3558d4ffb --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,71 @@ +name: Code Quality + +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +jobs: + lint-prettier: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Pages + uses: actions/configure-pages@v2 + + - uses: actions/setup-node@v4 + with: + node-version: lts/gallium + + - name: Install tooling + run: | + npm i -g yarn + npm i -g @microsoft/rush + npm i -g pnpm + + - name: Install drec-api + working-directory: apps/drec-api + run: | + rush update + rush install + + - name: Run Prettier + working-directory: apps/drec-api + run: pnpm run prettier + + lint-eslint: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Pages + uses: actions/configure-pages@v2 + + - uses: actions/setup-node@v4 + with: + node-version: lts/gallium + + - name: Install tooling + run: | + npm i -g yarn + npm i -g @microsoft/rush + npm i -g pnpm + + - name: Install drec-api + working-directory: apps/drec-api + run: | + rush update + rush install + + - name: Run ESLint + working-directory: apps/drec-api + run: pnpm run lint + continue-on-error: true diff --git a/apps/drec-api/package.json b/apps/drec-api/package.json index 916bd2e26..19cd23287 100755 --- a/apps/drec-api/package.json +++ b/apps/drec-api/package.json @@ -20,7 +20,8 @@ "drop": "yarn redis:drop && yarn typeorm:drop && yarn typeorm:drop:issuer", "redis:drop": "redis-cli flushall", "deploy:heroku": "make -B build deploy-heroku", - "prettier": "prettier --write --config-precedence file-override './src/**/*'", + "prettier": "prettier --check --config-precedence file-override './src/**/*'", + "prettier:fix": "prettier --write --config-precedence file-override './src/**/*'", "lint": "eslint \"src/**/*{.ts,.tsx}\" \"test/**/*{.ts,.tsx}\" \"migrations/**/*{.ts,.tsx}\" --no-error-on-unmatched-pattern", "lint:fix": "eslint \"src/**/*{.ts,.tsx}\" \"test/**/*{.ts,.tsx}\" \"migrations/**/*{.ts,.tsx}\" --fix --no-error-on-unmatched-pattern", "migrate": "yarn typeorm:run:issuer && yarn typeorm:run && yarn typeorm:run:certificate", From 2b5acb8a07d7a4b5b5a574495cff4cfa413812de Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Thu, 7 Mar 2024 14:30:28 +0100 Subject: [PATCH 3/5] chore: Small improvement for yaml files --- .prettierrc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.prettierrc b/.prettierrc index ee879b2ad..cdd38ad80 100755 --- a/.prettierrc +++ b/.prettierrc @@ -4,5 +4,13 @@ "useTabs": false, "semi": true, "tabWidth": 4, - "trailingComma": "none" + "trailingComma": "none", + "overrides": [ + { + "files": "*.{yaml,yml}", + "options": { + "tabWidth": 2 + } + } + ] } From 17734bbaf07eb71174c5a083d53ea9283ab3855a Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Thu, 7 Mar 2024 14:36:52 +0100 Subject: [PATCH 4/5] chore: Add Prettier to project --- apps/drec-api/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/drec-api/package.json b/apps/drec-api/package.json index 19cd23287..e1dd4d7c0 100755 --- a/apps/drec-api/package.json +++ b/apps/drec-api/package.json @@ -150,7 +150,8 @@ "ts-jest": "^26.5.0", "ts-node": "9.1.0", "typescript": "4.1.3", - "wait-on": "5.2.1" + "wait-on": "5.2.1", + "prettier": "~3.2.5" }, "jest": { "moduleFileExtensions": [ From 0de5f1d3df440fbbfe9b1d810105e04fac404f8f Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Mon, 11 Mar 2024 09:42:41 +0100 Subject: [PATCH 5/5] chore: Apply prettier --- apps/drec-api/src/pods/invitation/invitation.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/drec-api/src/pods/invitation/invitation.service.ts b/apps/drec-api/src/pods/invitation/invitation.service.ts index 42e9054d1..c433bb475 100644 --- a/apps/drec-api/src/pods/invitation/invitation.service.ts +++ b/apps/drec-api/src/pods/invitation/invitation.service.ts @@ -155,7 +155,7 @@ export class InvitationService { orgName: organization.name, organizationType: organization.organizationType, //@ts-ignore - orgid: organization.id | undefined + orgid: organization.id | undefined, // orgAddress:'' }; var userid: any;