Skip to content

Commit

Permalink
Merge pull request #258 from d-rec/develop
Browse files Browse the repository at this point in the history
Dev to Stage Push
  • Loading branch information
Aish1990 authored May 22, 2024
2 parents a94d2d1 + c8ab456 commit 9f1a323
Show file tree
Hide file tree
Showing 119 changed files with 4,997 additions and 1,473 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install tooling
run: |
npm i -g @microsoft/rush
npm i -g pnpm@6
npm i -g pnpm@7
- name: Install drec-origin
run: |
Expand All @@ -47,13 +47,17 @@ jobs:
- name: Install tooling
run: |
npm i -g @microsoft/rush
npm i -g pnpm@6
npm i -g pnpm@7
- name: Install drec-origin
run: |
rush install
- name: Run ESLint
- name: Run ESLint (error)
working-directory: apps/drec-api
run: pnpm run lint:error

- name: Run ESLint (all)
working-directory: apps/drec-api
run: pnpm run lint
continue-on-error: true
Expand All @@ -72,7 +76,7 @@ jobs:
- name: Install tooling
run: |
npm i -g @microsoft/rush
npm i -g pnpm@6
npm i -g pnpm@7
- name: Install drec-origin
run: |
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/deploy-gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v2
Expand All @@ -36,23 +36,17 @@ jobs:
node-version: lts/gallium

- name: Install tooling
run: |
npm i -g @microsoft/rush
npm i -g pnpm@6
working-directory: docs
run: npm install

- name: Install drec-api
working-directory: apps/drec-api
run: |
rush install
- name: Build docs with compodoc
working-directory: apps/drec-api
run: pnpm run compodoc
- name: Build docs with VitePress
working-directory: docs
run: npm run docs:build

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: apps/drec-api/documentation/
path: docs/.vitepress/dist/

# Deployment job
deploy:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ apps/drec-api/bin/drec-api

# Docs build output
apps/drec-api/documentation
docs/.vitepress/cache
docs/.vitepress/dist
5 changes: 2 additions & 3 deletions apps/drec-api/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ module.exports = {
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
// Temporarily disable `eslint:recommended` until other lint issues have been fixed
// 'eslint:recommended',
// 'plugin:@typescript-eslint/eslint-recommended',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
Expand Down
2 changes: 1 addition & 1 deletion apps/drec-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN npm cache clean --force
COPY . .

RUN npm i -g @microsoft/rush
RUN npm i -g pnpm@6
RUN npm i -g pnpm@7

WORKDIR /dist/src/app/apps/drec-api

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ export class IntermideatryTableFields1658924656241
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE IF EXISTS aggregate_meterread`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ export class DeviceMreterReadTypeField1659507181646
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "device" DROP COLUMN "meterReadtype"`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ export class DeviceGroupIssueCertificate1661178024560
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP TABLE IF EXISTS public.next_issuance_date_log_for_device_group`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,17 @@ export class DeviceGroupNewFieldsForBuyerReservation1661776597766
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "device_group"
DROP COLUMN IF EXISTS "frequency",
DROP COLUMN IF EXISTS "reservationStartDate",
DROP COLUMN IF EXISTS "reservationEndDate",
DROP COLUMN IF EXISTS "targetVolumeInMegaWattHour",
DROP COLUMN IF EXISTS "targetVolumeCertificateGenerationRequestedInMegaWattHour",
DROP COLUMN IF EXISTS "targetVolumeCertificateGenerationSucceededInMegaWattHour",
DROP COLUMN IF EXISTS "targetVolumeCertificateGenerationFailedInMegaWattHour",
DROP COLUMN IF EXISTS "authorityToExceed",
DROP COLUMN IF EXISTS "leftoverReadsByCountryCode"
`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ export class CheckcretificatelogforDeviceField1662610170745
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP TABLE IF EXISTS public.check_certificate_issue_date_log_for_device`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ export class CheckcretificatelogforDeviceGroupField1663162320749
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP TABLE IF EXISTS public.check_certificate_issue_date_log_for_device_group`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,12 @@ export class DeviceGroupNewIdField1663219743369 implements MigrationInterface {
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "device_group" DROP COLUMN "devicegroup_uid"`,
);
await queryRunner.query(
`ALTER TABLE "check_certificate_issue_date_log_for_device_group" DROP COLUMN "countryCode"`,
);
}
}
4 changes: 3 additions & 1 deletion apps/drec-api/migrations/1663329270791-Sdgbenefit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ export class Sdgbenefit1663329270791 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE IF EXISTS public.sdgbenefit`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ export class AddNewFieldDeviceLog1665143885251 implements MigrationInterface {
ADD "groupId" integer`);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "check_certificate_issue_date_log_for_device" DROP COLUMN "groupId"`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,12 @@ export class HistoryIntermideateFirlds1665490980305
ADD "type" character varying`);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP TABLE IF EXISTS public.history_intermediate_meteread`,
);
await queryRunner.query(
`ALTER TABLE "device_group" DROP COLUMN IF EXISTS "type"`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ export class HistoryNextIssuanceLog1665639446819 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP TABLE IF EXISTS public.history_next_issuance_log`,
);
}
}
4 changes: 3 additions & 1 deletion apps/drec-api/migrations/1669270905713-delta_firstread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ export class deltaFirstread1669270905713 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE IF EXISTS public.delta_firstread`);
}
}
4 changes: 3 additions & 1 deletion apps/drec-api/migrations/1669278431805-delta_firstread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ export class deltaFirstread1669278431805 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE IF EXISTS public.delta_firstread`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ export class Deviceexternalidcitext1669979907621 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "device" ALTER COLUMN "externalId" TYPE varchar`,
);
await queryRunner.query(`DROP EXTENSION IF EXISTS citext`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ export class devicesdgbdatatypechange1671692507995
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "device" ALTER COLUMN "SDGBenefits" TYPE jsonb`,
);
}
}
6 changes: 5 additions & 1 deletion apps/drec-api/migrations/1673435097445-devicesIdscolumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ export class devicesIdscolumn1673435097445 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "device_group" DROP COLUMN "deviceIds"`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ export class addDeveloperExternalId1676611071793 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "device" DROP COLUMN IF EXISTS "developerExternalId"`,
);
await queryRunner.query(`DROP EXTENSION IF EXISTS citext`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@ export class certificateTransactionUID1678690129095
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "check_certificate_issue_date_log_for_device_group" DROP COLUMN IF EXISTS "certificateTransactionUID"`,
);
await queryRunner.query(
`ALTER TABLE "check_certificate_issue_date_log_for_device" DROP COLUMN IF EXISTS "certificateTransactionUID"`,
);
await queryRunner.query(`DROP EXTENSION IF EXISTS citext`);
}
}
6 changes: 5 additions & 1 deletion apps/drec-api/migrations/1681791249032-Secretkeyremove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ export class Secretkeyremove1681791249032 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "organization" ADD "secretKey" character varying`,
);
}
}
16 changes: 15 additions & 1 deletion apps/drec-api/migrations/1681978992039-clean-up-dtofield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,19 @@ export class cleanUpDtofield1681978992039 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "device"
ADD COLUMN "status" character varying,
ADD COLUMN "data" jsonb,
ADD COLUMN "integrator" character varying`,
);
await queryRunner.query(
`ALTER TABLE "device_group"
ADD COLUMN "standardCompliance" jsonb,
ADD COLUMN "installationConfigurations" jsonb,
ADD COLUMN "sectors" jsonb,
ADD COLUMN "labels" jsonb`,
);
}
}
11 changes: 10 additions & 1 deletion apps/drec-api/migrations/1682658608261-updateTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,14 @@ export class updateTable1682658608261 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "developer_specific_manageGroupDevices_notFor_buyerReservation" (
-- Define table columns here if needed
)`,
);
await queryRunner.query(
`ALTER TABLE device_group DROP COLUMN IF EXISTS "deviceIdsInt"`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ export class updateColumnvaluinNew1682659987637 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
// eslint-disable-next-line @typescript-eslint/no-empty-function
public async down(queryRunner: QueryRunner): Promise<void> {
// Since updating column values in a down migration can lead to data loss or inconsistency,
// and reverting the update operation is complex and risky, leaving the down method empty.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ export class addReservationActiveCloumn1683004757319
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "device_group" DROP COLUMN IF EXISTS "reservationActive"`,
);
}
}
9 changes: 8 additions & 1 deletion apps/drec-api/migrations/1683267973604-addDeviceTimezone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,12 @@ export class addDeviceTimezone1683267973604 implements MigrationInterface {
);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "device" DROP COLUMN IF EXISTS "timezone"`,
);
await queryRunner.query(
`ALTER TABLE "device" DROP COLUMN IF EXISTS "version"`,
);
}
}
Loading

0 comments on commit 9f1a323

Please sign in to comment.