Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lovelykd committed Jan 4, 2024
1 parent 86ec786 commit bb539aa
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
with:
node-version: 18
cache: 'npm'
- run: npm install
working-directory: ${{github.workspace}}/generators/node-server/resources
- run: npm ci
- run: npm run test
- name: Run npm sonar:scanner
Expand Down
32 changes: 16 additions & 16 deletions generators/node-server/resources/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"dependencies": {
"browser-sync-client": "3.0.2",
"@nestjs/common": "7.5.1",
"@nestjs/core": "7.5.1",
"@nestjs/jwt": "7.2.0",
"@nestjs/passport": "7.1.0",
"@nestjs/platform-express": "7.5.1",
"@nestjs/serve-static": "2.1.4",
"@nestjs/swagger": "4.8.0",
"@nestjs/typeorm": "7.1.4",
"@nestjs/common": "8.4.7",
"@nestjs/core": "8.4.7",
"@nestjs/jwt": "8.0.1",
"@nestjs/passport": "8.0.1",
"@nestjs/platform-express": "8.4.7",
"@nestjs/serve-static": "2.2.2",
"@nestjs/swagger": "5.2.1",
"@nestjs/typeorm": "8.1.4",
"bcrypt": "5.1.1",
"class-transformer": "0.5.1",
"class-validator": "0.13.1",
Expand All @@ -18,25 +18,25 @@
"express-session": "1.17.3",
"js-yaml": "4.1.0",
"jwt-decode": "3.1.1",
"mongodb": "6.2.0",
"mongodb": "5.9.1",
"mysql2": "2.2.5",
"pg": "8.4.2",
"oracledb": "5.0.0",
"mssql": "6.2.3",
"pg": "8.5.1",
"oracledb": "5.1.0",
"mssql": "9.1.1",
"passport": "0.4.1",
"passport-jwt": "4.0.0",
"passport-oauth2": "1.7.0",
"reflect-metadata": "0.1.14",
"rxjs": "6.6.3",
"rxjs": "7.8.1",
"mongodb-memory-server": "6.9.2",
"sqlite3": "5.1.6",
"swagger-ui-express": "5.0.0",
"typeorm": "0.2.45",
"typeorm-encrypted": "0.5.6"
"typeorm": "0.3.17",
"typeorm-encrypted": "0.8.0"
},
"devDependencies": {
"@jest/globals": "29.7.0",
"@nestjs/testing": "7.5.1",
"@nestjs/testing": "8.4.7",
"@types/bcrypt": "5.0.2",
"@types/express": "4.17.1",
"@types/express-serve-static-core": "4.17.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ export class CreateTables1570200270081 implements MigrationInterface {
if (queryRunner.isTransactionActive) {
await queryRunner.commitTransaction();
}


await queryRunner.connection.synchronize();
}
await queryRunner.connection.synchronize();
}

// eslint-disable-next-line
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%_ const UserEntity = user.persistClass %>
import { MigrationInterface, QueryRunner, getRepository } from 'typeorm';
import { MigrationInterface, QueryRunner } from 'typeorm';
<%_ if (authenticationType !== 'oauth2') { _%>
import { <%= UserEntity %> } from '../domain/user.entity';
import { transformPassword } from '../security';
Expand Down Expand Up @@ -68,7 +68,7 @@ export class SeedUsersRoles1570200490072 implements MigrationInterface {
// eslint-disable-next-line
public async up(queryRunner: QueryRunner): Promise<any> {

const authorityRepository = getRepository("<%- jhiTablePrefix %>_authority");
const authorityRepository = queryRunner.connection.getRepository("<%- jhiTablePrefix %>_authority");

<%_ if (authenticationType === 'oauth2') { _%>
Expand All @@ -79,7 +79,7 @@ export class SeedUsersRoles1570200490072 implements MigrationInterface {
const adminRole = await authorityRepository.save(this.role1);
const userRole = await authorityRepository.save(this.role2);
const userRepository = getRepository("<%- jhiTablePrefix %>_user");
const userRepository = queryRunner.connection.getRepository("<%- jhiTablePrefix %>_user");
this.user1.authorities= [adminRole, userRole];
this.user3.authorities= [adminRole, userRole];
Expand Down
4 changes: 0 additions & 4 deletions generators/node-server/templates/server/src/orm.config.ts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ _%>
synchronize: true,
entities: commonConf.ENTITIES,
migrations: commonConf.MIGRATIONS,
cli: commonConf.CLI,
migrationsRun: commonConf.MIGRATIONS_RUN,
};
Expand All @@ -58,7 +57,6 @@ _%>
synchronize: commonConf.SYNCRONIZE,
entities: commonConf.ENTITIES,
migrations: commonConf.MIGRATIONS,
cli: commonConf.CLI,
migrationsRun: commonConf.MIGRATIONS_RUN,
};
}
Expand All @@ -82,7 +80,6 @@ _%>
synchronize: true,
entities: commonConf.ENTITIES,
migrations: commonConf.MIGRATIONS,
cli: commonConf.CLI,
migrationsRun: commonConf.MIGRATIONS_RUN,
};
}
Expand All @@ -101,7 +98,6 @@ _%>
synchronize: commonConf.SYNCRONIZE,
entities: commonConf.ENTITIES,
migrations: commonConf.MIGRATIONS,
cli: commonConf.CLI,
migrationsRun: commonConf.MIGRATIONS_RUN,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class UserService {
constructor(@InjectRepository(UserRepository) private userRepository: UserRepository) {}

async findById(id: <%= user.primaryKey.tsType %>): Promise<<%= user.dtoClass%> | undefined> {
const result = await this.userRepository.findOne(id);
const result = await this.userRepository.findOneBy({ id });
return UserMapper.fromEntityToDTO(this.flatAuthorities(result))
}

Expand Down

0 comments on commit bb539aa

Please sign in to comment.