Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CT-42/CT-147 #50

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

RafaelRtx
Copy link
Contributor

  • Adicionada a propriedade sort de ordenação à interface e DTO de paginação.
  • Adicionado arquivo Typescript com mocks de conversas de usuários
  • Implementada a rota /conversations que permite listar as conversas de usuários com a utilização de parâmetros de url de busca (search) e paginação (limit, offset, sort)

Copy link

sonarcloud bot commented Jun 20, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
39.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@@ -17,4 +17,7 @@ export class PaginationDTO implements IPagination {
@Min(0)
@IsNumber()
offset: number;

@IsOptional()
sort: 'asc' | 'desc';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Voce pode adicionar duas validações a mais aqui:
@IsString() para validar se é string
@isin() para validar se é 'asc' ou 'desc', o argumento é assim: ['asc','desc']

E não se preocupe caso não passe o parametro, por que a funcionalidade do IsOptional() anula os outros decorators caso não tenha valor.


@Injectable()
export class ConversationService {
getConversations(filters: ISearchFilterWithPagination): IGetConversations[] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Achei essa funcionalidade bastante complicada de ler, mas por ser uma implementação temporária está tudo bem

@@ -1,4 +1,5 @@
export interface IPagination {
limit: number;
offset: number;
sort: 'asc' | 'desc';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talvez criar uma interface para o sort chamada ISort seja uma boa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants