forked from jhipster/generator-jhipster-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider entitySuffix and dtoSuffix refs jhipster#209
- Use asDto and asEntity methods provided by JHipster (this ensures that the entitySuffix and dtoSuffix configOptions are used) - Fix error where Instant fieldType did not work with sqlite
- Loading branch information
Showing
21 changed files
with
124 additions
and
112 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
generators/entity-server/templates/server/src/repository/entity.repository.ts.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { EntityRepository, Repository } from 'typeorm'; | ||
import { <%= entityClass %> } from '../domain/<%= entityFileName %>.entity'; | ||
import { <%= asEntity(entityClass) %> } from '../domain/<%= entityFileName %>.entity'; | ||
|
||
@EntityRepository(<%= entityClass %>) | ||
export class <%= entityClass %>Repository extends Repository<<%= entityClass %>> {} | ||
@EntityRepository(<%= asEntity(entityClass) %>) | ||
export class <%= entityClass %>Repository extends Repository<<%= asEntity(entityClass) %>> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import { AppModule } from '../src/app.module'; | |
import { ExecutionContext, INestApplication } from '@nestjs/common'; | ||
import { AuthGuard } from '../src/security/guards/auth.guard'; | ||
import { RolesGuard } from '../src/security/guards/roles.guard'; | ||
import { UserDTO } from '../src/service/dto/user.dto'; | ||
import { <%= asDto('User')%> } from '../src/service/dto/user.dto'; | ||
import { UserService } from '../src/service/user.service'; | ||
import { PasswordChangeDTO } from '../src/service/dto/password-change.dto'; | ||
import { AuthService } from '../src/service/auth.service'; | ||
|
@@ -14,7 +14,7 @@ describe('Account', () => { | |
let service: UserService; | ||
let authService: AuthService; | ||
|
||
const testUserDTO: UserDTO = { | ||
const testUserDTO: <%= asDto('User')%> = { | ||
login: 'userTestLogin', | ||
email: '[email protected]', | ||
password: 'testPassword', | ||
|
@@ -33,7 +33,7 @@ describe('Account', () => { | |
newPassword: 'newPassword', | ||
}; | ||
|
||
let userAuthenticated: UserDTO; | ||
let userAuthenticated: <%= asDto('User')%>; | ||
|
||
const authGuardMock = { canActivate: (context: ExecutionContext): any => { | ||
const req = context.switchToHttp().getRequest(); | ||
|
@@ -63,7 +63,7 @@ describe('Account', () => { | |
}); | ||
|
||
it('/POST register new user', async () => { | ||
const createdUser: UserDTO = ( | ||
const createdUser: <%= asDto('User')%> = ( | ||
await request(app.getHttpServer()) | ||
.post('/api/register') | ||
.send(testUserDTO) | ||
|
@@ -109,7 +109,7 @@ describe('Account', () => { | |
|
||
it('/POST account update settings', async () => { | ||
|
||
const savedTestUser: UserDTO = { | ||
const savedTestUser: <%= asDto('User')%> = { | ||
firstName: 'updateFirstName', | ||
lastName: 'updateLastName', | ||
...testUserAuthenticated, | ||
|
@@ -119,7 +119,7 @@ describe('Account', () => { | |
.send(savedTestUser) | ||
.expect(201); | ||
|
||
const updatedUserSettings: UserDTO = await service.findByFields({ where: { login: testUserAuthenticated.login } }); | ||
const updatedUserSettings: <%= asDto('User')%> = await service.findByFields({ where: { login: testUserAuthenticated.login } }); | ||
expect(updatedUserSettings.firstName).toEqual(savedTestUser.firstName); | ||
expect(updatedUserSettings.lastName).toEqual(savedTestUser.lastName); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import { AppModule } from '../src/app.module'; | |
import { INestApplication } from '@nestjs/common'; | ||
import { AuthGuard } from '../src/security/guards/auth.guard'; | ||
import { RolesGuard } from '../src/security/guards/roles.guard'; | ||
import { UserDTO } from '../src/service/dto/user.dto'; | ||
import { <%= asDto('User')%> } from '../src/service/dto/user.dto'; | ||
import { UserService } from '../src/service/user.service'; | ||
|
||
describe('User', () => { | ||
|
@@ -21,7 +21,7 @@ describe('User', () => { | |
email: '[email protected]' | ||
}; | ||
|
||
const testUserDTO: UserDTO = { | ||
const testUserDTO: <%= asDto('User')%> = { | ||
login: 'userTestLogin', | ||
firstName: 'UserTest', | ||
lastName: 'UserTest', | ||
|
@@ -45,7 +45,7 @@ describe('User', () => { | |
}); | ||
|
||
it('/POST create user', async () => { | ||
const createdUser: UserDTO = ( | ||
const createdUser: <%= asDto('User')%> = ( | ||
await request(app.getHttpServer()) | ||
.post('/api/admin/users') | ||
.send(testUserRequestObject) | ||
|
@@ -82,16 +82,16 @@ describe('User', () => { | |
expect(updatedUser.firstName).toEqual(savedUser.firstName); | ||
<%_ } _%> | ||
|
||
await service.delete(savedUser as UserDTO); | ||
await service.delete(savedUser as <%= asDto('User')%>); | ||
}); | ||
|
||
it('/GET user with a login name', async () => { | ||
testUserDTO.login = 'TestUserGet'; | ||
const savedUser: UserDTO = await service.save(testUserDTO); | ||
const savedUser: <%= asDto('User')%> = await service.save(testUserDTO); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const { password, ...savedUserWithoutPassword } = savedUser; | ||
|
||
const getUser: UserDTO = ( | ||
const getUser: <%= asDto('User')%> = ( | ||
await request(app.getHttpServer()) | ||
.get('/api/admin/users/' + savedUser.login) | ||
.expect(200) | ||
|
@@ -108,7 +108,7 @@ describe('User', () => { | |
|
||
it('/DELETE user', async () => { | ||
testUserDTO.login = 'TestUserDelete'; | ||
const savedUser: UserDTO = await service.save(testUserDTO); | ||
const savedUser: <%= asDto('User')%> = await service.save(testUserDTO); | ||
|
||
await request(app.getHttpServer()) | ||
.delete('/api/admin/users/' + savedUser.login) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { Request as ExpressRequest} from 'express'; | ||
import { UserDTO } from '../service/dto/user.dto'; | ||
import { <%= asDto('User')%> } from '../service/dto/user.dto'; | ||
|
||
export interface Request extends ExpressRequest { | ||
user?: UserDTO; | ||
user?: <%= asDto('User')%>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
generators/server/templates/server/src/repository/user.repository.ts.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { EntityRepository, Repository } from 'typeorm'; | ||
import { User } from '../domain/user.entity'; | ||
import { <%= asEntity('User') %> } from '../domain/user.entity'; | ||
|
||
@EntityRepository(User) | ||
export class UserRepository extends Repository<User> {} | ||
@EntityRepository(<%= asEntity('User') %>) | ||
export class UserRepository extends Repository<<%= asEntity('User') %>> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.