Ajuste conexao oracle & postgres
This commit is contained in:
@@ -9,10 +9,10 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import { UsersService } from '../users/users.service';
|
||||
import { UserModel } from '../../core/models/user.model';
|
||||
import { ResultModel } from '../../core/models/result.model';
|
||||
import { ResetPasswordModel } from '../../core/models/reset-password.model';
|
||||
import { ChangePasswordModel } from '../../core/models/change-password.model';
|
||||
import { UserModel } from 'src/core/models/user.model';
|
||||
import { ResultModel } from 'src/core/models/result.model';
|
||||
import { ResetPasswordModel } from 'src/core/models/reset-password.model';
|
||||
import { ChangePasswordModel } from 'src/core/models/change-password.model';
|
||||
|
||||
@Controller('api/v1/auth')
|
||||
export class AuthController {
|
||||
@@ -69,4 +69,4 @@ export class AuthController {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,4 +29,4 @@ export class AuthService {
|
||||
//return await this.accountService.findOneByUsername(payload.username);
|
||||
return payload;
|
||||
}
|
||||
}
|
||||
}
|
||||
4
src/auth/users/dto/auth-request.dto.ts
Normal file
4
src/auth/users/dto/auth-request.dto.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class AuthRequestDto {
|
||||
userName: string;
|
||||
password: string;
|
||||
}
|
||||
6
src/auth/users/models/change-password.model.ts
Normal file
6
src/auth/users/models/change-password.model.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export class ChangePasswordModel {
|
||||
id: string;
|
||||
currentPassword: string;
|
||||
newPassword: string;
|
||||
}
|
||||
|
||||
5
src/auth/users/models/reset-password.model.ts
Normal file
5
src/auth/users/models/reset-password.model.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export class ResetPasswordModel {
|
||||
document: string;
|
||||
email: string;
|
||||
}
|
||||
|
||||
10
src/auth/users/models/user.model.ts
Normal file
10
src/auth/users/models/user.model.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export interface UserModel {
|
||||
id: string;
|
||||
name: string;
|
||||
sellerId: string;
|
||||
storeId: string;
|
||||
email: string;
|
||||
username: string;
|
||||
dataDesligamento: Date | null;
|
||||
situacao: string;
|
||||
}
|
||||
@@ -7,4 +7,4 @@ import { UsersService } from './users.service';
|
||||
providers: [UsersService],
|
||||
exports: [UsersService],
|
||||
})
|
||||
export class UsersModule {}
|
||||
export class UsersModule {}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { UsersService } from './users.service';
|
||||
|
||||
describe('UsersService', () => {
|
||||
let service: UsersService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [UsersService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<UsersService>(UsersService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,17 +1,16 @@
|
||||
/* eslint-disable prettier/prettier */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
||||
import { DataSource } from 'typeorm';
|
||||
import md5 = require('md5');
|
||||
import { Guid } from "guid-typescript";
|
||||
import { typeOrmConfig } from '../../core/configs/typeorm.config';
|
||||
import { UserModel } from '../../core/models/user.model';
|
||||
|
||||
import { createOracleConfig } from '../../core/configs/typeorm.oracle.config';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
constructor(private readonly configService: ConfigService) {}
|
||||
|
||||
async authenticate(user: any): Promise<any> {
|
||||
const dataSource = new DataSource(typeOrmConfig);
|
||||
const dataSource = new DataSource(createOracleConfig(this.configService));
|
||||
await dataSource.initialize();
|
||||
const queryRunner = dataSource.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
@@ -51,7 +50,7 @@ export class UsersService {
|
||||
}
|
||||
|
||||
async resetPassword(user: any): Promise<any> {
|
||||
const dataSource = new DataSource(typeOrmConfig);
|
||||
const dataSource = new DataSource(createOracleConfig(this.configService));
|
||||
await dataSource.initialize();
|
||||
const queryRunner = dataSource.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
@@ -105,7 +104,7 @@ export class UsersService {
|
||||
|
||||
|
||||
async changePassword(user: any): Promise<any> {
|
||||
const dataSource = new DataSource(typeOrmConfig);
|
||||
const dataSource = new DataSource(createOracleConfig(this.configService));
|
||||
await dataSource.initialize();
|
||||
const queryRunner = dataSource.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
@@ -149,4 +148,4 @@ export class UsersService {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user