Skip to content

Commit

Permalink
fix:fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
divinecharlotte committed Dec 11, 2024
2 parents 6bb4711 + 9b680dc commit 21a1381
Show file tree
Hide file tree
Showing 47 changed files with 304 additions and 211 deletions.
61 changes: 61 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: Bug Report
description: File a bug report.
title: "[Bug]: "
labels:
- bug
- triage
projects:
- d-rec/2
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: bug-description
attributes:
label: Description of the bug
description: Tell us what bug you encountered and what should have happened
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: Please write the steps in a list form
validations:
required: true
- type: dropdown
id: env
attributes:
label: What environment are you seeing the problem on?
multiple: true
options:
- Production
- Staging
- Dev
- type: dropdown
id: os
attributes:
label: What Operating System(OS) are you seeing the problem on?
multiple: true
options:
- Android
- iOS
- Windows
- MacOS
- Linux
- Other
- type: dropdown
id: browsers
attributes:
label: What browsers are you seeing the problem on?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- API
45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/ideas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Idea / Feature request
description: Suggest an idea to improve Testing Form
title: "[Idea]: "
labels:
- idea
- feature-request
projects:
- d-rec/2
body:
- type: markdown
attributes:
value: >
Thank you for sharing your ideas. Please take the time to provide as much
detail as possible.
- type: textarea
id: problem
attributes:
label: The problem
description: Describe what problem you would like to see solved.
placeholder: I'm always frustrated when...
validations:
required: false
- type: textarea
id: solution
attributes:
label: The solution
description: Describe the solution(s) that you imagine for the aforementioned problem.
placeholder: Changing XYZ would help because...
validations:
required: true
- type: textarea
id: alternative
attributes:
label: Alternatives
description: Are there any other solutions to that problem that you have considered?
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: Additional context
description: Add any other helpful information or screenshots here.
validations:
required: false
20 changes: 10 additions & 10 deletions apps/drec-api/src/drec.module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ 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 { SdgBenefit } from './pods/sdgbenefit/sdgbenefit.entity';
import { SDGBenefit } from './pods/sdgbenefit/sdgbenefit.entity';
import { DeltaFirstRead } from './pods/reads/delta_firstread.entity';
import { IrecDevicesInformationEntity } from './pods/device/irec_devices_information.entity';
import { IrecErrorLogInformationEntity } from './pods/device/irec_error_log_information.entity';
import { UserLoginSessionEntity } from './pods/user/user_login_session.entity';
import { DeviceLateongoingIssueCertificateEntity } from './pods/device/device_lateongoing_certificate.entity';
import { DeviceLateOngoingIssueCertificateEntity } from './pods/device/device_lateongoing_certificate.entity';
import { CertificateLogModule } from './pods/certificate-log/certificate-log.module';
import { SdgbenefitModule } from './pods/sdgbenefit/sdgbenefit.module';
import { CountrycodeModule } from './pods/countrycode/countrycode.module';
import { SDGBenefitModule } from './pods/sdgbenefit/sdgbenefit.module';
import { CountryCodeModule } from './pods/countrycode/countrycode.module';
import { PermissionModule } from './pods/permission/permission.module';
import { AccessControlLayerModuleServiceModule } from './pods/access-control-layer-module-service/access-control-layer-module-service.module';
import { YieldConfigModule } from './pods/yield-config/yieldconfig.module';
Expand Down Expand Up @@ -187,8 +187,8 @@ describe('DrecModule', () => {
});

it('should provide SdgBenefit repository', () => {
const sdgBenefitRepository = module.get<Repository<SdgBenefit>>(
getRepositoryToken(SdgBenefit),
const sdgBenefitRepository = module.get<Repository<SDGBenefit>>(
getRepositoryToken(SDGBenefit),
);
expect(sdgBenefitRepository).toBeDefined();
});
Expand Down Expand Up @@ -223,8 +223,8 @@ describe('DrecModule', () => {

it('should provide DeviceLateongoingIssueCertificateEntity repository', () => {
const deviceLateongoingIssueCertificateRepository = module.get<
Repository<DeviceLateongoingIssueCertificateEntity>
>(getRepositoryToken(DeviceLateongoingIssueCertificateEntity));
Repository<DeviceLateOngoingIssueCertificateEntity>
>(getRepositoryToken(DeviceLateOngoingIssueCertificateEntity));
expect(deviceLateongoingIssueCertificateRepository).toBeDefined();
});

Expand Down Expand Up @@ -317,12 +317,12 @@ describe('DrecModule', () => {
});

it('should import CountrycodeModule', () => {
const countrycodeModule = module.get(CountrycodeModule);
const countrycodeModule = module.get(CountryCodeModule);
expect(countrycodeModule).toBeDefined();
});

it('should import SdgbenefitModule', () => {
const sdgbenefitModule = module.get(SdgbenefitModule);
const sdgbenefitModule = module.get(SDGBenefitModule);
expect(sdgbenefitModule).toBeDefined();
});

Expand Down
16 changes: 8 additions & 8 deletions apps/drec-api/src/drec.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ 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 { 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';
Expand All @@ -60,7 +60,7 @@ import { IrecErrorLogInformationEntity } from './pods/device/irec_error_log_info
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 { DeviceLateOngoingIssueCertificateEntity } from './pods/device/device_lateongoing_certificate.entity';
import { CertificateSettingEntity } from './pods/device-group/certificate_setting.entity';
import { HttpModule } from '@nestjs/axios';

Expand Down Expand Up @@ -103,12 +103,12 @@ export const entities = [
HistoryDeviceGroupNextIssueCertificate,
CheckCertificateIssueDateLogForDeviceEntity,
CheckCertificateIssueDateLogForDeviceGroupEntity,
SdgBenefit,
SDGBenefit,
DeltaFirstRead,
IrecDevicesInformationEntity,
IrecErrorLogInformationEntity,
UserLoginSessionEntity,
DeviceLateongoingIssueCertificateEntity,
DeviceLateOngoingIssueCertificateEntity,
CertificateSettingEntity,
...IssuerEntities,
...OnChainCertificateEntities,
Expand Down Expand Up @@ -176,8 +176,8 @@ const QueueingModule = () => {
YieldConfigModule,
AccessControlLayerModuleServiceModule,
PermissionModule,
CountrycodeModule,
SdgbenefitModule,
CountryCodeModule,
SDGBenefitModule,
CertificateLogModule,
OnChainCertificateModule,
BlockchainPropertiesModule,
Expand Down
17 changes: 9 additions & 8 deletions apps/drec-api/src/guards/PermissionGuard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@ export class PermissionGuard implements CanActivate {
return false;
}
const request = context.switchToHttp().getRequest();
let user: IUser;
user = request.user;
if (request.url.split('/')[3] === 'register') {
const user: IUser = request.user;
if (!user) {
return false;
}
if (
request.url.split('/')[3] === 'register' &&
request.body.organizationType === Role.ApiUser
) {
this.logger.verbose(`When ${request.url.split('/')[3]}`);
if (request.body.organizationType === Role.ApiUser) {
return true;
}
} else {
user = request.user;
return true;
}

if (user.role === 'Admin') {
Expand Down
2 changes: 1 addition & 1 deletion apps/drec-api/src/models/Delta_firstread.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Unit } from '@energyweb/energy-api-influxdb';

export interface IDeltaintermediate {
export interface IDeltaIntermediate {
id: number;
unit: Unit;
readsvalue: number;
Expand Down
2 changes: 1 addition & 1 deletion apps/drec-api/src/models/General.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ export const ResponseFailure = (
message,
});

export type onUploadProgressFunction = (progressEvent: ProgressEvent) => void;
export type OnUploadProgressFunction = (progressEvent: ProgressEvent) => void;
2 changes: 1 addition & 1 deletion apps/drec-api/src/models/UserRegistrationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class UserRegistrationData {
password: string;
}

export class UserORGRegistrationData {
export class UserOrgRegistrationData {
@IsNotEmpty()
@IsString()
firstName: string;
Expand Down
6 changes: 3 additions & 3 deletions apps/drec-api/src/pods/admin/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { UserFilterDTO } from './dto/user-filter.dto';
import { OrganizationDTO, UpdateOrganizationDTO } from '../organization/dto';
import { IUser, LoggedInUser, ResponseSuccess } from '../../models';
// import { CreateUserDTO } from '../user/dto/create-user.dto';
import { CreateUserORGDTO } 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';
Expand Down Expand Up @@ -173,11 +173,11 @@ export class AdminController {
@ApiResponse({
status: HttpStatus.OK,
// type: CreateUserDTO,
type: CreateUserORGDTO,
type: CreateUserOrgDTO,
description: 'Returns a new created user',
})
public async createUser(
@Body() newUser: CreateUserORGDTO,
@Body() newUser: CreateUserOrgDTO,
@UserDecorator() { api_user_id }: LoggedInUser,
): Promise<UserDTO> {
newUser.api_user_id = api_user_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import {
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';
import { Permission } from '../permission/decorators/permission.decorator';
import { ACLModules } from '../access-control-layer-module-service/decorator/aclModule.decorator';
import { deviceFilterDTO } from './dto/deviceFilter.dto';
import { DeviceFilterDTO } from './dto/deviceFilter.dto';
import { Role } from '../../utils/enums';
import { OrganizationService } from '../organization/organization.service';
import { UserService } from '../user/user.service';
Expand Down Expand Up @@ -269,7 +269,7 @@ export class CertificateLogController {
@Query('certiifcateEndDate') generationEndTime?: string,
@Query('targetVolumeCertificateGenerationRequestedInMegaWattHour')
targetVolumeCertificateGenerationRequestedInMegaWattHour?: number,
@Query('deviceFilter') deviceFilter?: deviceFilterDTO,
@Query('deviceFilter') deviceFilter?: DeviceFilterDTO,
): Promise<{
result: any[];
pageNumber: number;
Expand Down Expand Up @@ -298,7 +298,7 @@ export class CertificateLogController {
description: 'This query parameter is for apiuser',
})
@ApiOkResponse({
type: [CertificatelogResponse],
type: [CertificateLogResponse],
description: 'Returns issuer Certificate of Reservation',
})
async getCertificatesForDeveloper(
Expand All @@ -310,7 +310,7 @@ export class CertificateLogController {
new ValidationPipe({ skipMissingProperties: true }),
)
organizationId: number,
): Promise<CertificatelogResponse> {
): Promise<CertificateLogResponse> {
this.logger.verbose(`With in getCertificatesForDeveloper`);

if (user.role === Role.ApiUser) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
Role,
} from '../../utils/enums';
import { FilterDTO } from './dto/filter.dto';
import { CertificatelogResponse } from './dto';
import { CertificateLogResponse } from './dto';

describe('CertificateLogService', () => {
let service: CertificateLogService;
Expand Down Expand Up @@ -386,7 +386,7 @@ describe('CertificateLogService', () => {
jest
.spyOn(service, 'getDeveloperfindCertifiedReservations')
.mockResolvedValueOnce(
expectedCertificates as unknown as CertificatelogResponse,
expectedCertificates as unknown as CertificateLogResponse,
);

const result = await service.getCertifiedlogofDevices(
Expand Down Expand Up @@ -529,7 +529,7 @@ describe('CertificateLogService', () => {
'getDeveloperCertificatesUsingGroupIDVersionUpdateOrigin247',
)
.mockResolvedValueOnce(
expectedCertificates as unknown as CertificatelogResponse,
expectedCertificates as unknown as CertificateLogResponse,
);

const result = await service.getCertifiedlogofDevices(
Expand Down
Loading

0 comments on commit 21a1381

Please sign in to comment.