Skip to content

Commit

Permalink
Merge pull request #205 from RJ-SMTR/feature/#196-cnab-jae-2
Browse files Browse the repository at this point in the history
Feature/#196 cnab jae 2
  • Loading branch information
williamfl2007 committed Mar 7, 2024
2 parents 2bbffd9 + ab1994c commit 5e53e72
Show file tree
Hide file tree
Showing 48 changed files with 11,269 additions and 9,403 deletions.
14,114 changes: 7,005 additions & 7,109 deletions package-lock.json

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@
"prepare": "is-ci || husky install"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.525.0",
"@aws-sdk/client-s3": "3.350.0",
"@google-cloud/bigquery": "^7.3.0",
"@nestjs-modules/mailer": "^1.11.2",
"@nestjs-modules/mailer": "1.8.1",
"@nestjs/axios": "^3.0.0",
"@nestjs/common": "9.4.2",
"@nestjs/config": "2.3.2",
"@nestjs/core": "^7.5.5",
"@nestjs/core": "9.4.2",
"@nestjs/jwt": "10.0.3",
"@nestjs/passport": "9.0.3",
"@nestjs/platform-express": "9.4.2",
"@nestjs/schedule": "^2.2.3",
"@nestjs/swagger": "^5.0.8",
"@nestjs/typeorm": "^7.1.5",
"@nestjs/schedule": "^3.0.4",
"@nestjs/swagger": "6.3.0",
"@nestjs/typeorm": "9.0.1",
"@types/multer-s3": "^3.0.0",
"apple-signin-auth": "1.7.5",
"aws-sdk": "^2.1470.0",
Expand All @@ -59,9 +59,8 @@
"handlebars": "4.7.7",
"multer": "1.4.4",
"multer-s3": "3.0.1",
"nest-sftp": "^3.0.0",
"nestjs-i18n": "10.2.6",
"nodemailer": "^6.9.11",
"nodemailer": "6.9.3",
"passport": "0.6.0",
"passport-anonymous": "1.0.1",
"passport-jwt": "4.0.1",
Expand All @@ -70,8 +69,10 @@
"rimraf": "5.0.1",
"rxjs": "7.8.1",
"source-map-support": "0.5.21",
"ssh2": "^1.15.0",
"ssh2-sftp-client": "^10.0.3",
"swagger-ui-express": "4.6.3",
"twitter": "^1.1.0",
"twitter": "1.7.1",
"typeorm": "0.3.16",
"typeorm-aurora-data-api-driver": "^2.4.4",
"validations-br": "^1.3.0",
Expand All @@ -80,7 +81,7 @@
"devDependencies": {
"@nestjs/cli": "9.5.0",
"@nestjs/schematics": "9.2.0",
"@nestjs/testing": "^7.5.5",
"@nestjs/testing": "9.4.2",
"@types/bcryptjs": "2.4.2",
"@types/express": "4.17.17",
"@types/facebook-js-sdk": "3.3.6",
Expand Down
11 changes: 6 additions & 5 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ import { CronJobsModule } from './cron-jobs/cron-jobs.module';
import { BigqueryModule } from './bigquery/bigquery.module';
import { TestModule } from './test/test.module';
import { CnabModule } from './cnab/cnab.module';
import { SftpModule } from 'nest-sftp';
import { SftpModule } from './sftp/sftp.module';

@Module({
imports: [
SftpModule.forRoot(
{
host: '34.123.217.7',
port: 23,
username: 'cct_devs',
password: 'EzKWSiqqchX3xdF'
host: '',
port: 0,
username: '',
password: ''
},
false,
),
Expand Down Expand Up @@ -119,6 +119,7 @@ import { SftpModule } from 'nest-sftp';
TestModule,
CnabModule,
SftpModule,
// SftpModule,
],
})
export class AppModule {}
6 changes: 3 additions & 3 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Status } from 'src/statuses/entities/status.entity';
import { StatusEnum } from 'src/statuses/statuses.enum';
import { UsersService } from 'src/users/users.service';
import { HttpStatusMessage } from 'src/utils/enums/http-error-message.enum';
import { formatLog } from 'src/utils/logging';
import { formatLog } from 'src/utils/log-utils';
import { User } from '../users/entities/user.entity';
import { LoginResponseType } from '../utils/types/auth/login-response.type';
import { Nullable } from '../utils/types/nullable.type';
Expand All @@ -37,7 +37,7 @@ export class AuthService {
private forgotService: ForgotService,
private mailService: MailService,
private mailHistoryService: MailHistoryService,
) {}
) { }

async validateLogin(
loginDto: AuthEmailLoginDto,
Expand Down Expand Up @@ -397,7 +397,7 @@ export class AuthService {
this.logger.log(
formatLog(
'Email redefinir senha enviado com sucesso.' +
`\n - Detalhes: ${JSON.stringify({ mailSentInfo })}`,
`\n - Detalhes: ${JSON.stringify({ mailSentInfo })}`,
'forgotPassword()',
),
);
Expand Down
17 changes: 15 additions & 2 deletions src/bigquery/entities/ordem-pagamento.bigquery-entity.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
import { HttpStatus } from "@nestjs/common";
import { CommonHttpException } from "src/utils/http-exception/common-http-exception";

/**
* Logic:
* - It has 1 `id_ordem_pagamento` per day.
* - id_ordem_pagamento repeats by combination of id_consorcio (CNPJ), id_operadora (CPF), servico (vehicle)
*/
export class BigqueryOrdemPagamento {
/** Data da ordem de pagamento (partição) */
data_ordem: string | null;

/** Data de pagamento da ordem */
data_pagamento: string | null;

/** Nome cadastro.consorcios */
/**
* Id de cadastro.consorcios
*
* id_consorcio.cnpj = CNPJ
*/
id_consorcio: string | null;

/** Nome do consórcio */
consorcio: string | null;

/** Identificador da operadora na tabela cadastro.operadoras */
/**
* Identificador da operadora na tabela cadastro.operadoras
*
* id_operadora.documento = CPF
*/
id_operadora: string | null;

/** Nome da operadora */
Expand Down
28 changes: 14 additions & 14 deletions src/cnab/dto/cliente-favorecido.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,57 +13,57 @@ export class SaveClienteFavorecidoDTO {

@ValidateIf(isCreate)
@IsNotEmpty()
cpf_cnpj?: string;
cpf_cnpj?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
cod_banco?: string;
cod_banco?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
agencia?: string;
agencia?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
dv_agencia?: string;
dv_agencia?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
conta_corrente?: string;
conta_corrente?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
dv_conta_corrente?: string;
dv_conta_corrente?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
logradouro?: string;
logradouro?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
numero?: string;
numero?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
complemento?: string;
complemento?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
bairro?: string;
bairro?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
cidade?: string;
cidade?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
cep?: string;
cep?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
complemento_cep?: string;
complemento_cep?: string | null;

@ValidateIf(isCreate)
@IsNotEmpty()
uf?: string;
uf?: string | null;
}
28 changes: 14 additions & 14 deletions src/cnab/entity/cliente-favorecido.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,46 +19,46 @@ export class ClienteFavorecido extends EntityHelper {
nome: string;

@Column({ type: String, unique: false, nullable: true, length: 14 })
cpf_cnpj: string;
cpf_cnpj: string | null;

@Column({ type: String, unique: false, nullable: true, length: 10 })
cod_banco: string;
cod_banco: string | null;

@Column({ type: String, unique: false, nullable: true, length: 5 })
agencia: string;
agencia: string | null;

@Column({ type: String, unique: false, nullable: true, length: 2 })
dv_agencia: string;
dv_agencia: string | null;

@Column({ type: String, unique: false, nullable: true, length: 12 })
conta_corrente: string;
conta_corrente: string | null;

@Column({ type: String, unique: false, nullable: true, length: 2 })
dv_conta_corrente: string;
dv_conta_corrente: string | null;

@Column({ type: String, unique: false, nullable: true, length: 200 })
logradouro: string;
logradouro: string | null;

@Column({ type: String, unique: false, nullable: true, length: 15 })
numero: string;
numero: string | null;

@Column({ type: String, unique: false, nullable: true, length: 100 })
complemento: string;
complemento: string | null;

@Column({ type: String, unique: false, nullable: true, length: 150 })
bairro: string;
bairro: string | null;

@Column({ type: String, unique: false, nullable: true, length: 150 })
cidade: string;
cidade: string | null;

@Column({ type: String, unique: false, nullable: true, length: 5 })
cep: string;
cep: string | null;

@Column({ type: String, unique: false, nullable: true, length: 3 })
complemento_cep: string;
complemento_cep: string | null;

@Column({ type: String, unique: false, nullable: true, length: 2 })
uf: string;
uf: string | null;

public getLogInfo(showName?: boolean): string {
if (showName === undefined) {
Expand Down
4 changes: 3 additions & 1 deletion src/cnab/entity/header-arquivo.entity.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityHelper } from 'src/utils/entity-helper';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity()
export class HeaderArquivo extends EntityHelper {
Expand Down Expand Up @@ -33,4 +33,6 @@ export class HeaderArquivo extends EntityHelper {
hr_geracao: Date;
@Column({ type: Number, unique: false, nullable: true })
id_transacao: number;
@CreateDateColumn()
createdAt: Date;
}
2 changes: 1 addition & 1 deletion src/cnab/entity/transacao.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Transacao extends EntityHelper {
})
vlr_rateio_credito: number;

@Column({ type: Number, unique: false, nullable: true, length: 150 })
@Column({ type: Number, unique: false, nullable: true })
qtde_transacao_rateio_debito: number;

@Column({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum HeaderArquivoTipoArquivo {
Remessa = 'remessa',
Retorno = 'retorno',
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { ICnabFieldMap } from './cnab-field-map.interface';

export interface ICnabFieldMapDetalhe extends ICnabFieldMap {
detalheLoteRegistroSequenceField: string;
detalheSegmentoNameField: string;
detalheSegmentoCodeField: string;
}
2 changes: 1 addition & 1 deletion src/cnab/interfaces/cnab-all/cnab-field-map.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface ICnabFieldMap {
*
* @example "A", "B", "J"
*/
detalheSegmentoNameField?: string;
detalheSegmentoCodeField?: string;

// TRAILER ARQUIVO FIELDS

Expand Down
Loading

0 comments on commit 5e53e72

Please sign in to comment.