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

Feat/delete task #45

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

Feat/delete task #45

wants to merge 28 commits into from

Conversation

lauanegcsilva
Copy link
Contributor

adiciona endpoint de deletar task

src/modules/task/task.controller.ts Outdated Show resolved Hide resolved
src/modules/task/task.repository.ts Outdated Show resolved Hide resolved
src/modules/task/task.repository.ts Outdated Show resolved Hide resolved
src/modules/task/task.repository.ts Outdated Show resolved Hide resolved
src/modules/task/task.repository.ts Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
src/modules/task/task.repository.ts Outdated Show resolved Hide resolved
src/modules/task/task.repository.ts Outdated Show resolved Hide resolved
src/modules/task/task.service.ts Outdated Show resolved Hide resolved
src/modules/task/task.service.ts Outdated Show resolved Hide resolved
@viniciuscosmome
Copy link
Contributor

viniciuscosmome commented Mar 13, 2024

requisitos de aceite

Criar ponto de acesso que permite a exclusão definitiva de uma tarefa.

  • Usuário deve estar autenticado
  • A tarefa deve existir na base de dados
  • A tarefa deve ser do usuário que fez o pedido de exclusão
  • Uma mensagem avisando que a tarefa foi excluída definitivamente deve ser retornada.\
    • Mensagem: "Atividade excluída com sucesso"

@viniciuscosmome viniciuscosmome self-requested a review March 21, 2024 14:05
Copy link
Contributor

@viniciuscosmome viniciuscosmome left a comment

Choose a reason for hiding this comment

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

requisitos de aceite

Criar ponto de acesso que permite a exclusão definitiva de uma tarefa.

  • Usuário deve estar autenticado
  • A tarefa deve existir na base de dados
  • A tarefa deve ser do usuário que fez o pedido de exclusão
  • Uma mensagem avisando que a tarefa foi excluída definitivamente deve ser retornada.\
    • Mensagem: "Atividade excluída com sucesso"

@Daaaiii Daaaiii removed their request for review May 9, 2024 18:45
Copy link
Contributor

@viniciuscosmome viniciuscosmome left a comment

Choose a reason for hiding this comment

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

🔍

Comment on lines 49 to 53
const existingTask = await this.repository.findTaskByIdAndChildren(
taskId,
childrenId,
);
const parent = await this.repository.validateParent(input.parentId);
const parent = await this.repository.validateParent(parentId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Aqui apenas está sendo validado se a tarefa existe e se a conta existe, não valida se a conta é dona da tarefa, no caso, se ela tem permissão para excluir.

Opção: Usar os tres parametros taskId, childrenId, parentId, para verificar se é um tarefa existente e pertence a essa pessoa.

Outro ponto: Não precisa validar se o parentId é valido uma vez que ele já validado no módulo de autorização e seu valor é obtido da resposta desse módulo.

OBS: Atualmente, outro usuário tem permissão de deletar tarefa que não é dele. Mas alterando a verificar já deve corrigir também.

Comment on lines 114 to 120
async validateParent(parentId: string) {
return await this.prisma.parentProfile.findUnique({
return this.prisma.parentProfile.findFirst({
where: {
id: parentId,
},
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Essa verificação de conta já é realizada na autorização, certo? se tiver mais algum motivo pra usá-la, tudo bem.

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

5 participants