diff --git a/src/@application/contracts/app.contracts.ts b/src/@application/contracts/app.contracts.ts new file mode 100644 index 0000000..c525db4 --- /dev/null +++ b/src/@application/contracts/app.contracts.ts @@ -0,0 +1,12 @@ +export interface IHttpResponse { + statusCode: number + data: Data +} +/** + * Validation request data + * Create a new instances domain + * Verify incorrect parameters + */ +export interface IUseCasesAPP { + run: (props: DTO) => Promise +} diff --git a/src/@application/helpers/success.ts b/src/@application/helpers/success.ts index 8149ec9..cb7c32f 100644 --- a/src/@application/helpers/success.ts +++ b/src/@application/helpers/success.ts @@ -1,4 +1,4 @@ -import { type IHttpResponse } from '@infra/contracts/app.contracts' +import { type IHttpResponse } from '@application/contracts/app.contracts' export const Success = (data: Data): IHttpResponse => ({ statusCode: 200, diff --git a/src/@application/useCases/user/signup/signUpUseCases.ts b/src/@application/useCases/user/signup/signUpUseCases.ts index 00d940c..6b4c54e 100644 --- a/src/@application/useCases/user/signup/signUpUseCases.ts +++ b/src/@application/useCases/user/signup/signUpUseCases.ts @@ -1,12 +1,14 @@ -import { IpValueObject } from '@domain/user/valueObjects/termsObject/ipValueObject' -import { type ISignUpDTO } from './signupDTO' -import { DateCommonValueObject, EmailValueObject, PasswordValueObject, TermsValueObject, UserAggregate } from '@domain/user' -import { Result } from '@domain/shared/core' +/* eslint-disable */ + +import { DateCommonValueObject, EmailValueObject, IpValueObject, PasswordValueObject, TermsValueObject, UserAggregate } from '@domain/user' import { type IUserRepositoryContract } from '@domain/contracts/repositories/userRepository.contract' -import { useCases } from '@application/useCases/default' import { type IHttpResponse } from '@application/contracts/app.contracts' -import { BadRequest } from '@application/helpers/badRequest' -import { Success } from '@application/helpers/success' +import { useCases } from '@application/useCases/default' +import { Result } from '@domain/shared/core' + +import { type ISignUpDTO } from './signupDTO' + +import { BadRequest, Success } from '@application/helpers' /** * @event @@ -52,7 +54,7 @@ export class SignupUseCases extends useCases { if (termsOrError.isFailure) return BadRequest(termsOrError.error.toString()) const password = passwordOrError.getResult() - await password.encryptPassword() + void await password.encryptPassword() // Validar o usuário agregado e retornar erro caso ocorra um erro const userOrError: Result = UserAggregate.create({ email: emailOrError.getResult(), @@ -67,7 +69,7 @@ export class SignupUseCases extends useCases { // Salvar usuario const user = userOrError.getResult() - await this.userRepository.save(user) + void await this.userRepository.save(user) return Success(null) }