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: item_update_logs implementation #161

Closed
wants to merge 9 commits into from

Conversation

risaddex
Copy link

@risaddex risaddex commented May 22, 2024

Histórico de Modificações dos Itens do Abrigo
#146

Implementação inicial que fecha a #146

  • método "updateAndAudit" criado
  • método "updateAndAuditMany" criado

Além disso também deixei esquematizado um audit genérico caso achem válido. Caso contrário removo do PR dps de fechar o draft

@rhuam rhuam linked an issue May 22, 2024 that may be closed by this pull request
@rhuam
Copy link
Contributor

rhuam commented May 22, 2024

@risaddex pode só alterar o nome da tabela para supplies_history, por gentileza. Foi uma sugestão pertinente do @giggio que ajuda a entender o que essa tabela armazena de fato.

@risaddex risaddex marked this pull request as ready for review May 22, 2024 13:11
@risaddex risaddex changed the title feat: initial item_update_logs implementation feat: item_update_logs implementation May 22, 2024
@giggio giggio self-assigned this May 23, 2024
.env.test Outdated Show resolved Hide resolved
Copy link
Member

@giggio giggio left a comment

Choose a reason for hiding this comment

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

Estou com erro ao rodar os testes:

> dotenv -e .env.test -- jest --config ./test/jest.e2e.config.ts

 FAIL  test/app.e2e-spec.ts
  ● Test suite failed to run

    test/app.e2e-spec.ts:80:30 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    80     const log = await prisma.suppliesHistory.findFirst({
                                    ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:108:33 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    108     const before = await prisma.suppliesHistory.count();
                                        ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:119:32 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    119     const after = await prisma.suppliesHistory.count();
                                       ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:120:42 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    120     const suppliesHistory = await prisma.suppliesHistory.findMany({
                                                 ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:211:12 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    211     prisma.suppliesHistory.deleteMany(),
                   ~~~~~~~~~~~~~~~

Test Suites: 1 failed, 1 total

@risaddex
Copy link
Author

Estou com erro ao rodar os testes:

> dotenv -e .env.test -- jest --config ./test/jest.e2e.config.ts

 FAIL  test/app.e2e-spec.ts
  ● Test suite failed to run

    test/app.e2e-spec.ts:80:30 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    80     const log = await prisma.suppliesHistory.findFirst({
                                    ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:108:33 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    108     const before = await prisma.suppliesHistory.count();
                                        ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:119:32 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    119     const after = await prisma.suppliesHistory.count();
                                       ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:120:42 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    120     const suppliesHistory = await prisma.suppliesHistory.findMany({
                                                 ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:211:12 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    211     prisma.suppliesHistory.deleteMany(),
                   ~~~~~~~~~~~~~~~

Test Suites: 1 failed, 1 total

Boa. Creio que faltou colocar o "prisma migrade deploy" antes de executar o teste. (achava que rodava antes na pipeline, por isso não mencionei)

@risaddex
Copy link
Author

Estou com erro ao rodar os testes:

> dotenv -e .env.test -- jest --config ./test/jest.e2e.config.ts

 FAIL  test/app.e2e-spec.ts
  ● Test suite failed to run

    test/app.e2e-spec.ts:80:30 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    80     const log = await prisma.suppliesHistory.findFirst({
                                    ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:108:33 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    108     const before = await prisma.suppliesHistory.count();
                                        ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:119:32 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    119     const after = await prisma.suppliesHistory.count();
                                       ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:120:42 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    120     const suppliesHistory = await prisma.suppliesHistory.findMany({
                                                 ~~~~~~~~~~~~~~~
    test/app.e2e-spec.ts:211:12 - error TS2339: Property 'suppliesHistory' does not exist on type 'PrismaService'.

    211     prisma.suppliesHistory.deleteMany(),
                   ~~~~~~~~~~~~~~~

Test Suites: 1 failed, 1 total

Boa. Creio que faltou colocar o "prisma migrade deploy" antes de executar o teste. (achava que rodava antes na pipeline, por isso não mencionei)

Na verdade meu eu do passado tinha me ajudado, colocando o "pre" hook do npm. Ocorre mesmo usando o "npm run test:e2e" ?

@risaddex risaddex requested a review from giggio May 23, 2024 20:56
@fagundesjg fagundesjg closed this May 23, 2024
@giggio giggio removed their request for review May 23, 2024 22:22
@giggio giggio added the duplicate This issue or pull request already exists label May 23, 2024
@fagundesjg
Copy link
Collaborator

Para formalizar o fechamento do PR, vou colar aqui a resposta oficial do @rhuam que foi dada ao author no grupo do discord:

"optamos por uma solução com menos complexidade de código, onde a regra de negócio ficasse no banco de dados de forma nativa, sem usar JSON para armazenar dados. Sua solução estava ótima, mas acreditamos que a #162 performa melhor e é mais fácil para dar manutenção."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants