Conversation
ninidora
left a comment
There was a problem hiding this comment.
Olá, Thiago!
Trouxe mais um feedback de código.
Você aplicou bem os conceitos aprendidos nas últimas aulas. Só fiz uma observação quanto ao que você implementou nos repositories.
Caso queira conversar sobre isso, sou toda ouvidos.
Até mais!
| if (question.answered === true) { | ||
| return { | ||
| question: question.question, | ||
| student: question.student, | ||
| class: question.class, | ||
| tags: question.tags, | ||
| answered: question.answered, | ||
| submitAt: question.submitAt, | ||
| answeredAt: question.answeredAt, | ||
| answeredBy: question.answeredBy, | ||
| answer: question.answer, | ||
| }; | ||
| } | ||
|
|
||
| return { | ||
| question: question.question, | ||
| student: question.student, | ||
| class: question.class, | ||
| tags: question.tags, | ||
| answered: question.answered, | ||
| submitAt: question.submitAt, | ||
| }; |
There was a problem hiding this comment.
Existe uma forma melhor de fazer isso, procure sobre delete do json.
There was a problem hiding this comment.
Isso ficou horrível kkk. Eu tentei outras paradas pra evitar o máximo ter que fazer isso, mas não consegui. Vou procurar sobre o delete
| const classAlreadyRegistered = await connection.query(` | ||
| SELECT * | ||
| FROM classes | ||
| WHERE name=$1 | ||
| `, [userClass]); |
There was a problem hiding this comment.
Essas coisas são funções pequenas que deveriam estar nas services. Lógica de checagem como se a classe já existe devem estar sendo tratadas e chamadas na service.
There was a problem hiding this comment.
Mas aí no caso o service teria uma query lá nele, sem problemas?
No description provided.