Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ This layer requires a highly specific file organization:
- `index.ts` (exporting `{entity}-form.tsx`)
- `{entity}-form.tsx` (Wrapper rendering `Create` or `Edit` based on `id` prop presence).
- `create-{entity}-form.tsx` (using `<Sheet />`, form className `flex flex-col gap-4`, button text "Criar")
- `edit-{entity}-form.tsx` (fetches the item via Get One hook, displays `<Loading />` while fetching, form className `flex flex-col gap-4`, button text "Salvar")
- `edit-{entity}-form.tsx` (fetches the item via Get One hook, displays `<Loading />` while fetching, form className `flex flex-col gap-4`, button text "Salvar". The `<Sheet.Title>` MUST include a property from the model to identify the entity being edited, e.g., `{`Editar [Entidade] ${selectedEntity?.name}`}`)
- `{entity}-form-inputs.tsx` (UI inputs mapped to `react-hook-form` via `useFormContext`. Use `useAll{Entities}Query` for Comboboxes/Selects)
- `{entity}-initial-form-data.ts` (Empty initial data object)

Expand All @@ -122,6 +122,8 @@ This layer requires a highly specific file organization:

**Presentation Custom Messages:** You must also strictly adapt all success and error toasts, dialog titles, form titles, and action button labels present in the UI layers (`presentation/components`, `presentation/forms`, `presentation/screens`, `presentation/hooks/queries`) to the new entity name. For example, replace `toast.success('Local de utilização removido com sucesso')` with the appropriate label for the new entity. **Pay special attention to `useEffect` error toasts in query hooks** (`presentation/hooks/queries/{entity}-query.hook.ts`).

**Sub-modules and Prefixes:** When creating a sub-module (e.g., `input-use-active-ingredients` inside `input-uses`), ensure all file names, class names, and variable names use the full prefix (e.g., `InputUseActiveIngredient...`) to avoid name collisions within the same module or global namespace. The directory structure should remain consistent: `src/app/modules/{parent-module}/{layer}/.../{sub-module}-...`.

**Form Inputs and Placeholders:** Inside `presentation/forms/{entity}-form-inputs.tsx`, you must adapt all `<Form.Label>` and `<Input placeholder="..." />` to match the new entity's fields and context. Avoid leaving generic labels like "Descrição" if the field is "Nome", and update examples in placeholders (e.g., from "Ex: Galpão" to "Ex: Fertilizantes").

**Constants and Variables:** All constant names, like `INITIAL_FORM_DATA` or `FORM_SCHEMA`, should also be renamed to match the new entity prefix (e.g., `PRODUCT_CATEGORY_INITIAL_FORM_DATA`). Ensure that all imports of these constants are also updated accordingly.
Expand Down
33 changes: 33 additions & 0 deletions scripts/seed/data/forage-availabilities.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { faker } from '@faker-js/faker/locale/pt_BR'

import { foragesData } from './forages.mjs'

export const forageAvailabilitiesDependencies = ['forages']

export const forageAvailabilitiesData = Array.from(
{
length: faker.number.int({
min: 50,
max: 150,
}),
},
(_, index) => {
const forage = faker.helpers.arrayElement(foragesData)

return {
id: index + 1,
date: faker.date.recent(),
forage: forage.cultivation,
entranceCm: faker.number.int({ min: 20, max: 40 }),
residueCm: faker.number.int({ min: 5, max: 15 }),
kgPerSquareMeter: faker.number.float({
min: 0.5,
max: 3,
fractionDigits: 2,
}),
paddockArea: faker.number.int({ min: 500, max: 5000 }),
efficiencyPercent: faker.number.int({ min: 60, max: 90 }),
numberOfCows: faker.number.int({ min: 10, max: 100 }),
}
}
)
1 change: 1 addition & 0 deletions scripts/seed/data/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './forages.mjs'
export * from './forage-availabilities.mjs'
export * from './improvements.mjs'
export * from './machines.mjs'
export * from './properties.mjs'
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/app/modules/animals/domain/use-cases/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './create-animal-use-case'
export * from './delete-animal-use-case'
export * from './get-all-animals-use-case'
export * from './get-animals-use-case'
export * from './get-animal-use-case'
export * from './update-animal-use-case'
1 change: 0 additions & 1 deletion src/app/modules/animals/main/factories/use-cases/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './remote-create-animal-use-case-factory'
export * from './remote-delete-animal-use-case-factory'
export * from './remote-get-all-animals-use-case-factory'
export * from './remote-get-animal-use-case-factory'
export * from './remote-get-animals-use-case-factory'
export * from './remote-update-animal-use-case-factory'

This file was deleted.

31 changes: 0 additions & 31 deletions src/app/modules/animals/mocks/handlers/get-all-animals-handler.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/app/modules/animals/mocks/handlers/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './create-animal-handler'
export * from './delete-animal-handler'
export * from './get-all-animals-handler'
export * from './get-animal-handler'
export * from './get-animals-handler'
export * from './update-animal-handler'
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function AnimalChildbirthDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animal-childbirths'],
queryKey: ['animal-childbirths', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function AnimalDeathDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animal-deaths'],
queryKey: ['animal-deaths', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function AnimalDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animals'],
queryKey: ['animals', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function AnimalDiseaseDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animal-diseases'],
queryKey: ['animal-diseases', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function AnimalHeiferCalfStageDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animal-heifer-calf-stages'],
queryKey: ['animal-heifer-calf-stages', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function AnimalInseminationDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animal-inseminations'],
queryKey: ['animal-inseminations', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function AnimalMastitisDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animal-mastitides'],
queryKey: ['animal-mastitides', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function AnimalMedicationDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animal-medications'],
queryKey: ['animal-medications', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function AnimalPregnancyDiagnosisDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animal-pregnancy-diagnoses'],
queryKey: ['animal-pregnancy-diagnoses', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function AnimalPurchaseDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animal-purchases'],
queryKey: ['animal-purchases', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function AnimalSaleDeleteDialog() {
})

queryClient.invalidateQueries({
queryKey: ['animal-sales'],
queryKey: ['animal-sales', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function CreateAnimalChildbirthForm() {
})

queryClient.invalidateQueries({
queryKey: ['animal-childbirths'],
queryKey: ['animal-childbirths', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function EditAnimalChildbirthForm() {
propertyId,
})
queryClient.invalidateQueries({
queryKey: ['animal-childbirths'],
queryKey: ['animal-childbirths', propertyId],
exact: false,
})
toast.success('Parto de animal foi editado com sucesso')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function CreateAnimalDeathForm() {
})

queryClient.invalidateQueries({
queryKey: ['animal-deaths'],
queryKey: ['animal-deaths', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function EditAnimalDeathForm() {
propertyId,
})
queryClient.invalidateQueries({
queryKey: ['animal-deaths'],
queryKey: ['animal-deaths', propertyId],
exact: false,
})
toast.success('Óbito do animal foi editado com sucesso')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function CreateAnimalDiseaseForm() {
})

queryClient.invalidateQueries({
queryKey: ['animal-diseases'],
queryKey: ['animal-diseases', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function EditAnimalDiseaseForm() {
propertyId,
})
queryClient.invalidateQueries({
queryKey: ['animal-diseases'],
queryKey: ['animal-diseases', propertyId],
exact: false,
})
toast.success('Doença de animal foi editada com sucesso')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function CreateAnimalForm() {
},
})
queryClient.invalidateQueries({
queryKey: ['animals'],
queryKey: ['animals', propertyId],
exact: false,
})
toast.success('Animal foi cadastrado com sucesso')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function EditAnimalForm() {
propertyId,
})
queryClient.invalidateQueries({
queryKey: ['animals'],
queryKey: ['animals', propertyId],
exact: false,
})
toast.success('Animal foi editado com sucesso')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function CreateAnimalHeiferCalfStageForm() {
})

queryClient.invalidateQueries({
queryKey: ['animal-heifer-calf-stages'],
queryKey: ['animal-heifer-calf-stages', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function EditAnimalHeiferCalfStageForm() {
propertyId,
})
queryClient.invalidateQueries({
queryKey: ['animal-heifer-calf-stages'],
queryKey: ['animal-heifer-calf-stages', propertyId],
exact: false,
})
toast.success('Fase bezerra novilha foi editada com sucesso')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function CreateAnimalInseminationForm() {
})

queryClient.invalidateQueries({
queryKey: ['animal-inseminations'],
queryKey: ['animal-inseminations', propertyId],
exact: false,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function EditAnimalInseminationForm() {
propertyId,
})
queryClient.invalidateQueries({
queryKey: ['animal-inseminations'],
queryKey: ['animal-inseminations', propertyId],
exact: false,
})
toast.success('Inseminação Artificial foi editada com sucesso')
Expand Down
Loading
Loading