An open API service indexing awesome lists of open source software.

https://github.com/gbdsantos/brain-agriculture-challenge

A rural platform for managing rural producers. Brain Agriculture code challenge/technical test.
https://github.com/gbdsantos/brain-agriculture-challenge

2024 docker docker-compose express nodejs postgresql prisma typescript vitest zod

Last synced: 3 months ago
JSON representation

A rural platform for managing rural producers. Brain Agriculture code challenge/technical test.

Awesome Lists containing this project

README

        



Brain Agriculture




GitHub last commit

GitHub top language

Repository size

Node.js logo

Prisma logo

CSS logo

TypeScript logo

Vitest logo


Getting Started   |   
About   |   
Technologies used

## Table of contents

- [Getting Started](#start "Getting Started")
- [About](#about "About")
- [Business requirements](#business "Business requirements")
- [Technical requirements](#technical "Technical requirements")
- [Extra mile](#extra-mile "Extra mile")
- [Technologies used](#technologies "Technologies used")

***

## 🚀 Getting Started

[![Run in Insomnia}](https://insomnia.rest/images/run.svg)](https://insomnia.rest/run/?label=Brain%20Agriculture&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fgbdsantos%2Fbrain-ag-challenge%2Fmaster%2Finsomnia-collection.json)

```bash
# Install dependencies
npm install

# Create a new Docker environment
docker compose up -d

# Run Prisma migrations [OPTIONAL]
npx prisma migrate dev

# Run seeds
npm run seed

# Run tests [OPTIONAL]
npm test
```

## 💡 About

This test aims to assess the candidate's skills in some problem-solving related the programming logic, business rules and object-oriented.

In summary, it involves registering rural producers with the following data:

1. CPF or CNPJ
2. Producer name
3. Farm Name
4. City
5. State
6. Total area of the farm in hectares
7. Arable area in hectares
8. Vegetation area in hectares
9. Planted crops (Soybeans, Corn, Cotton, Coffee, Sugarcane)


## Business requirements

- [x] The user must be able to register, edit, and exclude rural producers.
- [x] The system must validate incorrectly entered CPF and CNPJ .
- [x] The sum of arable area and vegetation must not exceed the total farm area
- [x] Each producer can cultivate more than one crop on their Farm.
- [x] The platform must include a Dashboard that shows:
- [x] Total number of farms
- [x] Total farms in hectares (total area)
- [x] Pie chart by state.
- [x] Pie chart by crop type.
- [x] Pie chart by land use (Agricultural area and vegetation)

## Technical requirements

- [x] Save the data in a Postgres database using Node.js as a backend layer, and deliver the endpoints to **register**, **edit**, and **delete rural producers**, in addition to the endpoint that returns the **totals to the dashboard**.
- [x] The creation of "mocked" data structures is part of the evaluation.


## Extra mile

- [x] Implements automated tests (unit tests)
- [x] Accept CPF or CNJP masked


## Technologies used

- [Express](https://expressjs.com "Express.js") - Minimalist and unopinionated framework for Node.js
- [Node.js](https://nodejs.org "Node.js") - JavaScript runtime environment / plataform
- [PostgreSQL](https://www.postgresql.org "PostgreSQL") - Open source relational database
- [Prisma](https://www.prisma.io "Prisma ORM") - ORM (Object Mapping Relation) for Node.js and TypeScript
- [TypeScript](https://www.typescriptlang.org "TypeScript") - Programming language and superset for JavaScript
- [Vitest](https://vitest.dev "Vitest") - Testing framework that use esbuild
- [Zod](https://zod.dev "Zod") - TypeScript-first schema validations

---
Made with ❤️ by 🧑‍🚀 Guilherme Bezerra 👋 [Get in touch!](https://www.linkedin.com/in/gbdsantos/)