Repositorio movido
This commit is contained in:
36
.gitignore
vendored
Normal file
36
.gitignore
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
# Maven
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
# Eclipse
|
||||
.settings/
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# IntelliJ IDEA
|
||||
.idea/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
out/
|
||||
|
||||
# VS Code
|
||||
.vscode/
|
||||
|
||||
# Environment variables
|
||||
.env
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
18
LICENSE
Normal file
18
LICENSE
Normal file
@@ -0,0 +1,18 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 axel
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
||||
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
154
README.md
Normal file
154
README.md
Normal file
@@ -0,0 +1,154 @@
|
||||
<div align="center">
|
||||
|
||||
<h1>FocusAgenda</h1>
|
||||
|
||||
<p><strong>Plataforma digital de organização de estudos para alunos do ensino médio e técnico</strong></p>
|
||||
|
||||
<p>
|
||||
<img src="https://img.shields.io/badge/Java-ED8B00?style=for-the-badge&logo=openjdk&logoColor=white" />
|
||||
<img src="https://img.shields.io/badge/MongoDB-4EA94B?style=for-the-badge&logo=mongodb&logoColor=white" />
|
||||
<img src="https://img.shields.io/badge/HTML5-E34F26?style=for-the-badge&logo=html5&logoColor=white" />
|
||||
<img src="https://img.shields.io/badge/CSS3-1572B6?style=for-the-badge&logo=css3&logoColor=white" />
|
||||
<img src="https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<img src="https://img.shields.io/badge/Status-Em%20Desenvolvimento-orange?style=for-the-badge" />
|
||||
<img src="https://img.shields.io/badge/Licença-MIT-blue?style=for-the-badge" />
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
## Sobre o Projeto
|
||||
|
||||
O **FocusAgenda** é uma plataforma digital desenvolvida como Trabalho de Conclusão de Curso (TCC) na **ETEC Pedro D'Arcádia Neto**, no curso Técnico em Desenvolvimento de Sistemas.
|
||||
|
||||
A proposta nasce de um problema real: muitos estudantes do ensino médio e técnico passam horas na escola e, ao chegar em casa, ainda precisam lidar com inúmeras atividades — o que torna difícil manter uma rotina de estudos organizada e eficiente.
|
||||
|
||||
O FocusAgenda oferece uma solução simples e prática para isso: um calendário interativo com notificações, lembretes e visualizações diárias, semanais e mensais, ajudando o aluno a gerenciar seu tempo com mais autonomia e produtividade.
|
||||
|
||||
---
|
||||
|
||||
## Funcionalidades
|
||||
|
||||
- **Calendário interativo** com visualizações diária, semanal e mensal
|
||||
- **Criação e edição de eventos** e afazeres em datas específicas
|
||||
- **Notificações e lembretes** de tarefas, provas e compromissos acadêmicos
|
||||
- **Painel informativo (HUD)** com o dia atual, afazeres do dia e feriados do mês
|
||||
- **Sistema de login e cadastro** de usuários
|
||||
- **Design responsivo** — funciona bem em celulares e computadores
|
||||
|
||||
---
|
||||
|
||||
## Tecnologias Utilizadas
|
||||
|
||||
### Frontend
|
||||
| Tecnologia | Uso |
|
||||
|---|---|
|
||||
| **HTML5** | Estrutura das páginas (campos, botões, calendário) |
|
||||
| **CSS3** | Estilização visual, responsividade e identidade do projeto |
|
||||
| **JavaScript** | Interatividade, navegação sem reload e comunicação com o backend |
|
||||
|
||||
### Backend
|
||||
| Tecnologia | Uso |
|
||||
|---|---|
|
||||
| **Java** | Linguagem principal do servidor, processa requisições do frontend |
|
||||
| **MongoDB** | Banco de dados NoSQL, armazena eventos e dados dos alunos |
|
||||
|
||||
---
|
||||
|
||||
## Telas do Sistema
|
||||
|
||||
### Login
|
||||
> Acesso seguro com e-mail e senha. Usuários sem conta podem se cadastrar diretamente pela tela.
|
||||
|
||||
### Cadastro
|
||||
> Criação de perfil com e-mail, nome de usuário e senha.
|
||||
|
||||
### Calendário Mensal
|
||||
> Visão geral do mês com todos os eventos cadastrados. Painel lateral em laranja exibe o dia atual, afazeres do dia e feriados.
|
||||
|
||||
### Calendário Semanal
|
||||
> Visualização dos afazeres da semana atual com navegação entre períodos.
|
||||
|
||||
### Calendário Diário
|
||||
> Detalhamento das atividades do dia selecionado com horários e feriados.
|
||||
|
||||
---
|
||||
|
||||
## Como Executar o Projeto
|
||||
|
||||
### Pré-requisitos
|
||||
|
||||
- [Java 17+](https://www.oracle.com/java/technologies/downloads/)
|
||||
- [Maven](https://maven.apache.org/)
|
||||
- [MongoDB](https://www.mongodb.com/try/download/community) rodando localmente ou via Atlas
|
||||
|
||||
### Passos
|
||||
|
||||
```bash
|
||||
# Clone o repositório
|
||||
git clone https://git.morpheusnox.shop/morpheus/projeto.git
|
||||
|
||||
# Entre na pasta do projeto
|
||||
cd projeto
|
||||
|
||||
# Instale as dependências e compile
|
||||
mvn install
|
||||
|
||||
# Execute o servidor
|
||||
mvn spring-boot:run
|
||||
```
|
||||
|
||||
> Após iniciar o servidor, acesse o frontend pelo navegador em `http://localhost:8080`
|
||||
|
||||
---
|
||||
|
||||
## Estrutura do Projeto
|
||||
|
||||
```
|
||||
projeto/
|
||||
├── src/
|
||||
│ └── main/
|
||||
│ ├── java/ # Código-fonte do backend (Java)
|
||||
│ └── resources/ # Configurações da aplicação
|
||||
├── pom.xml # Dependências Maven
|
||||
├── .gitignore
|
||||
└── README.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Equipe
|
||||
|
||||
| Nome | Função |
|
||||
|---|---|
|
||||
| Gabriel H. M. Borges | Desenvolvimento |
|
||||
| Fernando M. B. da Cruz | Desenvolvimento |
|
||||
| Gustavo Ferreira Araujo | Desenvolvimento |
|
||||
| Henry E. de Oliveira | Desenvolvimento |
|
||||
| Nádia Sakae Habu | Professora Orientadora |
|
||||
|
||||
---
|
||||
|
||||
## Instituição
|
||||
|
||||
**ETEC Pedro D'Arcádia Neto**
|
||||
Centro Estadual de Educação Tecnológica Paula Souza
|
||||
Curso: Técnico em Desenvolvimento de Sistemas
|
||||
|
||||
---
|
||||
|
||||
## Referencias
|
||||
|
||||
- CETIC. [TIC Educação 2023](https://cetic.br/)
|
||||
- MORAN, José. *Educação e tecnologias: mudar para valer.* 2007.
|
||||
- PROESC. [Engajamento escolar com uma agenda digital.](https://proesc.com/blog/engajamento-escolar-com-uma-agenda-digital-beneficios-e-dicas-praticas/) 2024.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<sub>Desenvolvido na ETEC Pedro D'Arcádia Neto — 2025/2026</sub>
|
||||
</div>
|
||||
75
pom.xml
Normal file
75
pom.xml
Normal file
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<groupId>com.agendaestudantil</groupId>
|
||||
<artifactId>agenda-digital-estudantes</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>Agenda Digital para Estudantes</name>
|
||||
<description>Backend para agenda digital destinado a estudantes com dificuldade de organização</description>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.cdimascio</groupId>
|
||||
<artifactId>dotenv-java</artifactId>
|
||||
<version>2.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.agendaestudantil;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class AgendaDigitalEstudantesApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AgendaDigitalEstudantesApplication.class, args);
|
||||
}
|
||||
}
|
||||
25
src/main/java/com/agendaestudantil/config/EnvConfig.java
Normal file
25
src/main/java/com/agendaestudantil/config/EnvConfig.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.agendaestudantil.config;
|
||||
|
||||
import io.github.cdimascio.dotenv.Dotenv;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
public class EnvConfig {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
Dotenv dotenv = Dotenv.configure()
|
||||
.ignoreIfMissing()
|
||||
.load();
|
||||
|
||||
if (dotenv != null) {
|
||||
Map<String, String> envVars = (Map<String, String>) dotenv.entries();
|
||||
for (Map.Entry<String, String> entry : envVars.entrySet()) {
|
||||
System.setProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.agendaestudantil.controller;
|
||||
|
||||
import com.agendaestudantil.dto.CadastroRequestDTO;
|
||||
import com.agendaestudantil.dto.EstudanteResponseDTO;
|
||||
import com.agendaestudantil.dto.LoginRequestDTO;
|
||||
import com.agendaestudantil.service.EstudanteService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/estudantes")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class EstudanteController {
|
||||
|
||||
@Autowired
|
||||
private EstudanteService estudanteService;
|
||||
|
||||
@PostMapping("/cadastro")
|
||||
public ResponseEntity<EstudanteResponseDTO> cadastrar(@RequestBody CadastroRequestDTO dto) {
|
||||
EstudanteResponseDTO resposta = estudanteService.cadastrar(dto);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(resposta);
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
public ResponseEntity<EstudanteResponseDTO> login(@RequestBody LoginRequestDTO dto) {
|
||||
EstudanteResponseDTO resposta = estudanteService.login(dto);
|
||||
return ResponseEntity.ok(resposta);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.agendaestudantil.controller;
|
||||
|
||||
import com.agendaestudantil.dto.TarefaRequestDTO;
|
||||
import com.agendaestudantil.entity.Tarefa;
|
||||
import com.agendaestudantil.service.TarefaService;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/tarefas")
|
||||
@RequiredArgsConstructor
|
||||
public class TarefaController {
|
||||
|
||||
private final TarefaService tarefaService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<Tarefa> criarTarefa(@Valid @RequestBody TarefaRequestDTO dto) {
|
||||
Tarefa tarefa = tarefaService.criarTarefa(dto);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(tarefa);
|
||||
}
|
||||
|
||||
@GetMapping("/estudante/{estudanteId}")
|
||||
public ResponseEntity<List<Tarefa>> listarTarefasPorEstudante(@PathVariable String estudanteId) {
|
||||
List<Tarefa> tarefas = tarefaService.listarTarefasPorEstudante(estudanteId);
|
||||
return ResponseEntity.ok(tarefas);
|
||||
}
|
||||
|
||||
@GetMapping("/estudante/{estudanteId}/pendentes")
|
||||
public ResponseEntity<List<Tarefa>> listarTarefasPendentes(@PathVariable String estudanteId) {
|
||||
List<Tarefa> tarefas = tarefaService.listarTarefasPendentes(estudanteId);
|
||||
return ResponseEntity.ok(tarefas);
|
||||
}
|
||||
|
||||
@GetMapping("/estudante/{estudanteId}/data")
|
||||
public ResponseEntity<List<Tarefa>> listarTarefasPorData(
|
||||
@PathVariable String estudanteId,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate data) {
|
||||
List<Tarefa> tarefas = tarefaService.listarTarefasPorData(estudanteId, data);
|
||||
return ResponseEntity.ok(tarefas);
|
||||
}
|
||||
|
||||
@GetMapping("/estudante/{estudanteId}/periodo")
|
||||
public ResponseEntity<List<Tarefa>> listarTarefasPorPeriodo(
|
||||
@PathVariable String estudanteId,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate inicio,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate fim) {
|
||||
List<Tarefa> tarefas = tarefaService.listarTarefasPorPeriodo(estudanteId, inicio, fim);
|
||||
return ResponseEntity.ok(tarefas);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<Tarefa> buscarTarefaPorId(@PathVariable String id) {
|
||||
return tarefaService.buscarTarefaPorId(id)
|
||||
.map(ResponseEntity::ok)
|
||||
.orElse(ResponseEntity.notFound().build());
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
public ResponseEntity<Tarefa> atualizarTarefa(@PathVariable String id, @Valid @RequestBody TarefaRequestDTO dto) {
|
||||
Tarefa tarefa = tarefaService.atualizarTarefa(id, dto);
|
||||
return ResponseEntity.ok(tarefa);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Void> excluirTarefa(@PathVariable String id) {
|
||||
tarefaService.excluirTarefa(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@PatchMapping("/{id}/concluir")
|
||||
public ResponseEntity<Tarefa> marcarConcluida(@PathVariable String id) {
|
||||
Tarefa tarefa = tarefaService.marcarConcluida(id);
|
||||
return ResponseEntity.ok(tarefa);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.agendaestudantil.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CadastroRequestDTO {
|
||||
private String nome;
|
||||
private String email;
|
||||
private String senha;
|
||||
private String curso;
|
||||
private Integer periodo;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.agendaestudantil.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EstudanteResponseDTO {
|
||||
private String id;
|
||||
private String nome;
|
||||
private String email;
|
||||
private String curso;
|
||||
private Integer periodo;
|
||||
}
|
||||
13
src/main/java/com/agendaestudantil/dto/LoginRequestDTO.java
Normal file
13
src/main/java/com/agendaestudantil/dto/LoginRequestDTO.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.agendaestudantil.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LoginRequestDTO {
|
||||
private String email;
|
||||
private String senha;
|
||||
}
|
||||
28
src/main/java/com/agendaestudantil/dto/TarefaRequestDTO.java
Normal file
28
src/main/java/com/agendaestudantil/dto/TarefaRequestDTO.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.agendaestudantil.dto;
|
||||
|
||||
import com.agendaestudantil.entity.Tarefa;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class TarefaRequestDTO {
|
||||
|
||||
@NotBlank(message = "Título é obrigatório")
|
||||
private String titulo;
|
||||
|
||||
private String descricao;
|
||||
|
||||
private Tarefa.Prioridade prioridade;
|
||||
|
||||
private Tarefa.StatusTarefa status;
|
||||
|
||||
@NotNull(message = "Data de entrega é obrigatória")
|
||||
private LocalDate dataEntrega;
|
||||
|
||||
private String disciplinaId;
|
||||
|
||||
@NotBlank(message = "ID do estudante é obrigatório")
|
||||
private String estudanteId;
|
||||
}
|
||||
30
src/main/java/com/agendaestudantil/entity/Disciplina.java
Normal file
30
src/main/java/com/agendaestudantil/entity/Disciplina.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.agendaestudantil.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Document(collection = "disciplinas")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Disciplina {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String nome;
|
||||
|
||||
private String professor;
|
||||
|
||||
private String sala;
|
||||
|
||||
private String cor;
|
||||
|
||||
private String estudanteId;
|
||||
|
||||
private LocalDateTime dataCriacao;
|
||||
}
|
||||
32
src/main/java/com/agendaestudantil/entity/Estudante.java
Normal file
32
src/main/java/com/agendaestudantil/entity/Estudante.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.agendaestudantil.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Document(collection = "estudantes")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Estudante {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String nome;
|
||||
|
||||
private String email;
|
||||
|
||||
private String senha;
|
||||
|
||||
private String curso;
|
||||
|
||||
private Integer periodo;
|
||||
|
||||
private LocalDateTime dataCriacao;
|
||||
|
||||
private LocalDateTime dataAtualizacao;
|
||||
}
|
||||
40
src/main/java/com/agendaestudantil/entity/Evento.java
Normal file
40
src/main/java/com/agendaestudantil/entity/Evento.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.agendaestudantil.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Document(collection = "eventos")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Evento {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String titulo;
|
||||
|
||||
private String descricao;
|
||||
|
||||
private TipoEvento tipo;
|
||||
|
||||
private LocalDateTime dataInicio;
|
||||
|
||||
private LocalDateTime dataFim;
|
||||
|
||||
private String local;
|
||||
|
||||
private String disciplinaId;
|
||||
|
||||
private String estudanteId;
|
||||
|
||||
private LocalDateTime dataCriacao;
|
||||
|
||||
public enum TipoEvento {
|
||||
AULA, PROVA, TRABALHO, ATIVIDADE, EVENTO, LEMBRETE
|
||||
}
|
||||
}
|
||||
45
src/main/java/com/agendaestudantil/entity/Tarefa.java
Normal file
45
src/main/java/com/agendaestudantil/entity/Tarefa.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.agendaestudantil.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Document(collection = "tarefas")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Tarefa {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String titulo;
|
||||
|
||||
private String descricao;
|
||||
|
||||
private Prioridade prioridade;
|
||||
|
||||
private StatusTarefa status;
|
||||
|
||||
private LocalDate dataEntrega;
|
||||
|
||||
private String disciplinaId;
|
||||
|
||||
private String estudanteId;
|
||||
|
||||
private LocalDateTime dataCriacao;
|
||||
|
||||
private LocalDateTime dataAtualizacao;
|
||||
|
||||
public enum Prioridade {
|
||||
BAIXA, MEDIA, ALTA, URGENTE
|
||||
}
|
||||
|
||||
public enum StatusTarefa {
|
||||
PENDENTE, EM_ANDAMENTO, CONCLUIDA, ATRASADA
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.agendaestudantil.repository;
|
||||
|
||||
import com.agendaestudantil.entity.Disciplina;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface DisciplinaRepository extends MongoRepository<Disciplina, String> {
|
||||
List<Disciplina> findByEstudanteId(String estudanteId);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.agendaestudantil.repository;
|
||||
|
||||
import com.agendaestudantil.entity.Estudante;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface EstudanteRepository extends MongoRepository<Estudante, String> {
|
||||
Optional<Estudante> findByEmail(String email);
|
||||
boolean existsByEmail(String email);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.agendaestudantil.repository;
|
||||
|
||||
import com.agendaestudantil.entity.Evento;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface EventoRepository extends MongoRepository<Evento, String> {
|
||||
List<Evento> findByEstudanteId(String estudanteId);
|
||||
|
||||
List<Evento> findByDisciplinaId(String disciplinaId);
|
||||
|
||||
@Query("{'estudanteId': ?0, 'dataInicio': {$gte: ?1, $lte: ?2}}")
|
||||
List<Evento> findByEstudanteIdAndDataInicioBetween(String estudanteId, LocalDateTime inicio, LocalDateTime fim);
|
||||
|
||||
@Query("{'estudanteId': ?0, 'dataInicio': {$gte: ?1}}")
|
||||
List<Evento> findProximosEventosByEstudanteId(String estudanteId, LocalDateTime data);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.agendaestudantil.repository;
|
||||
|
||||
import com.agendaestudantil.entity.Tarefa;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface TarefaRepository extends MongoRepository<Tarefa, String> {
|
||||
List<Tarefa> findByEstudanteId(String estudanteId);
|
||||
|
||||
List<Tarefa> findByEstudanteIdAndStatus(String estudanteId, Tarefa.StatusTarefa status);
|
||||
|
||||
List<Tarefa> findByDisciplinaId(String disciplinaId);
|
||||
|
||||
@Query("{'estudanteId': ?0, 'dataEntrega': ?1}")
|
||||
List<Tarefa> findByEstudanteIdAndDataEntrega(String estudanteId, LocalDate data);
|
||||
|
||||
@Query("{'estudanteId': ?0, 'dataEntrega': {$gte: ?1, $lte: ?2}}")
|
||||
List<Tarefa> findByEstudanteIdAndDataEntregaBetween(String estudanteId, LocalDate inicio, LocalDate fim);
|
||||
|
||||
@Query("{'estudanteId': ?0, 'status': {$ne: 'CONCLUIDA'}}")
|
||||
List<Tarefa> findTarefasPendentesByEstudanteId(String estudanteId);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.agendaestudantil.service;
|
||||
|
||||
import com.agendaestudantil.dto.CadastroRequestDTO;
|
||||
import com.agendaestudantil.dto.EstudanteResponseDTO;
|
||||
import com.agendaestudantil.dto.LoginRequestDTO;
|
||||
import com.agendaestudantil.entity.Estudante;
|
||||
import com.agendaestudantil.repository.EstudanteRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class EstudanteService {
|
||||
|
||||
@Autowired
|
||||
private EstudanteRepository estudanteRepository;
|
||||
|
||||
public EstudanteResponseDTO cadastrar(CadastroRequestDTO dto) {
|
||||
Optional<Estudante> existente = estudanteRepository.findByEmail(dto.getEmail());
|
||||
if (existente.isPresent()) {
|
||||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Email já cadastrado");
|
||||
}
|
||||
|
||||
Estudante estudante = new Estudante();
|
||||
estudante.setNome(dto.getNome());
|
||||
estudante.setEmail(dto.getEmail());
|
||||
estudante.setSenha(dto.getSenha());
|
||||
estudante.setCurso(dto.getCurso());
|
||||
estudante.setPeriodo(dto.getPeriodo());
|
||||
estudante.setDataCriacao(LocalDateTime.now());
|
||||
estudante.setDataAtualizacao(LocalDateTime.now());
|
||||
|
||||
Estudante salvo = estudanteRepository.save(estudante);
|
||||
return toResponse(salvo);
|
||||
}
|
||||
|
||||
public EstudanteResponseDTO login(LoginRequestDTO dto) {
|
||||
Optional<Estudante> estudante = estudanteRepository.findByEmail(dto.getEmail());
|
||||
|
||||
if (estudante.isEmpty()) {
|
||||
throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "Email ou senha incorretos");
|
||||
}
|
||||
|
||||
if (!estudante.get().getSenha().equals(dto.getSenha())) {
|
||||
throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "Email ou senha incorretos");
|
||||
}
|
||||
|
||||
return toResponse(estudante.get());
|
||||
}
|
||||
|
||||
private EstudanteResponseDTO toResponse(Estudante estudante) {
|
||||
return new EstudanteResponseDTO(
|
||||
estudante.getId(),
|
||||
estudante.getNome(),
|
||||
estudante.getEmail(),
|
||||
estudante.getCurso(),
|
||||
estudante.getPeriodo()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.agendaestudantil.service;
|
||||
|
||||
import com.agendaestudantil.dto.TarefaRequestDTO;
|
||||
import com.agendaestudantil.entity.Disciplina;
|
||||
import com.agendaestudantil.entity.Tarefa;
|
||||
import com.agendaestudantil.repository.DisciplinaRepository;
|
||||
import com.agendaestudantil.repository.TarefaRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TarefaService {
|
||||
|
||||
private final TarefaRepository tarefaRepository;
|
||||
private final DisciplinaRepository disciplinaRepository;
|
||||
|
||||
@Transactional
|
||||
public Tarefa criarTarefa(TarefaRequestDTO dto) {
|
||||
Tarefa tarefa = new Tarefa();
|
||||
tarefa.setTitulo(dto.getTitulo());
|
||||
tarefa.setDescricao(dto.getDescricao());
|
||||
tarefa.setPrioridade(dto.getPrioridade() != null ? dto.getPrioridade() : Tarefa.Prioridade.MEDIA);
|
||||
tarefa.setStatus(dto.getStatus() != null ? dto.getStatus() : Tarefa.StatusTarefa.PENDENTE);
|
||||
tarefa.setDataEntrega(dto.getDataEntrega());
|
||||
tarefa.setEstudanteId(dto.getEstudanteId());
|
||||
tarefa.setDataCriacao(LocalDateTime.now());
|
||||
tarefa.setDataAtualizacao(LocalDateTime.now());
|
||||
|
||||
if (dto.getDisciplinaId() != null) {
|
||||
Disciplina disciplina = disciplinaRepository.findById(dto.getDisciplinaId())
|
||||
.orElseThrow(() -> new RuntimeException("Disciplina não encontrada"));
|
||||
tarefa.setDisciplinaId(disciplina.getId());
|
||||
}
|
||||
|
||||
return tarefaRepository.save(tarefa);
|
||||
}
|
||||
|
||||
public List<Tarefa> listarTarefasPorEstudante(String estudanteId) {
|
||||
return tarefaRepository.findByEstudanteId(estudanteId);
|
||||
}
|
||||
|
||||
public List<Tarefa> listarTarefasPendentes(String estudanteId) {
|
||||
return tarefaRepository.findTarefasPendentesByEstudanteId(estudanteId);
|
||||
}
|
||||
|
||||
public List<Tarefa> listarTarefasPorData(String estudanteId, LocalDate data) {
|
||||
return tarefaRepository.findByEstudanteIdAndDataEntrega(estudanteId, data);
|
||||
}
|
||||
|
||||
public List<Tarefa> listarTarefasPorPeriodo(String estudanteId, LocalDate inicio, LocalDate fim) {
|
||||
return tarefaRepository.findByEstudanteIdAndDataEntregaBetween(estudanteId, inicio, fim);
|
||||
}
|
||||
|
||||
public Optional<Tarefa> buscarTarefaPorId(String id) {
|
||||
return tarefaRepository.findById(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Tarefa atualizarTarefa(String id, TarefaRequestDTO dto) {
|
||||
Tarefa tarefa = tarefaRepository.findById(id)
|
||||
.orElseThrow(() -> new RuntimeException("Tarefa não encontrada"));
|
||||
|
||||
tarefa.setTitulo(dto.getTitulo());
|
||||
tarefa.setDescricao(dto.getDescricao());
|
||||
tarefa.setPrioridade(dto.getPrioridade());
|
||||
tarefa.setStatus(dto.getStatus());
|
||||
tarefa.setDataEntrega(dto.getDataEntrega());
|
||||
tarefa.setDataAtualizacao(LocalDateTime.now());
|
||||
|
||||
if (dto.getDisciplinaId() != null) {
|
||||
Disciplina disciplina = disciplinaRepository.findById(dto.getDisciplinaId())
|
||||
.orElseThrow(() -> new RuntimeException("Disciplina não encontrada"));
|
||||
tarefa.setDisciplinaId(disciplina.getId());
|
||||
}
|
||||
|
||||
return tarefaRepository.save(tarefa);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void excluirTarefa(String id) {
|
||||
tarefaRepository.deleteById(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Tarefa marcarConcluida(String id) {
|
||||
Tarefa tarefa = tarefaRepository.findById(id)
|
||||
.orElseThrow(() -> new RuntimeException("Tarefa não encontrada"));
|
||||
tarefa.setStatus(Tarefa.StatusTarefa.CONCLUIDA);
|
||||
tarefa.setDataAtualizacao(LocalDateTime.now());
|
||||
return tarefaRepository.save(tarefa);
|
||||
}
|
||||
}
|
||||
8
src/main/resources/application.properties
Normal file
8
src/main/resources/application.properties
Normal file
@@ -0,0 +1,8 @@
|
||||
spring.application.name=${APP_NAME:Agenda Digital para Estudantes}
|
||||
server.port=${SERVER_PORT:8080}
|
||||
|
||||
spring.data.mongodb.host=${MONGODB_HOST:localhost}
|
||||
spring.data.mongodb.port=${MONGODB_PORT:27017}
|
||||
spring.data.mongodb.database=${MONGODB_DATABASE:agenda_estudantil}
|
||||
|
||||
logging.level.org.springframework.data.mongodb=DEBUG
|
||||
Reference in New Issue
Block a user