Skip to content
Merged

Qa #2

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
19 changes: 19 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip
Original file line number Diff line number Diff line change
@@ -1,14 +1,57 @@
package com.softtek_preview.api_application.controller;

import com.softtek_preview.api_application.domain.consultant.ConsultantRequestDTO;
import com.softtek_preview.api_application.domain.consultant.ConsultantResponseDTO;
import com.softtek_preview.api_application.service.ConsultantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.UUID;

@RestController
@RequestMapping("/api/consultant")
@RequestMapping("/api/consultants")
public class ConsultantController {

@Autowired
private ConsultantService consultantService;

@PostMapping
public ResponseEntity<ConsultantResponseDTO> createConsultant(@RequestBody ConsultantRequestDTO consultantRequestDTO) {
ConsultantResponseDTO createdConsultant = consultantService.createConsultant(consultantRequestDTO);
return ResponseEntity.status(201).body(createdConsultant);
}

@PostMapping("/bulk")
public ResponseEntity<List<ConsultantResponseDTO>> createConsultantsInBulk(@RequestBody List<ConsultantRequestDTO> consultantRequestDTOs) {
List<ConsultantResponseDTO> createdConsultants = consultantService.createConsultantsInBulk(consultantRequestDTOs);
return ResponseEntity.status(HttpStatus.CREATED).body(createdConsultants);
}

@GetMapping("/{id}")
public ResponseEntity<ConsultantResponseDTO> getConsultantById(@PathVariable UUID id) {
ConsultantResponseDTO consultantResponseDTO = consultantService.getConsultantById(id);
return ResponseEntity.ok(consultantResponseDTO);
}

@GetMapping
public ResponseEntity<List<ConsultantResponseDTO>> getAllConsultants() {
List<ConsultantResponseDTO> consultants = consultantService.getAllConsultants();
return ResponseEntity.ok(consultants);
}

@PutMapping("/{id}")
public ResponseEntity<ConsultantResponseDTO> updateConsultant(
@PathVariable UUID id, @RequestBody ConsultantRequestDTO consultantRequestDTO) {
ConsultantResponseDTO updatedConsultant = consultantService.updateConsultant(id, consultantRequestDTO);
return ResponseEntity.ok(updatedConsultant);
}

@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteConsultant(@PathVariable UUID id) {
consultantService.deleteConsultant(id);
return ResponseEntity.noContent().build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.softtek_preview.api_application.domain.project.ProjectResponseDTO;
import com.softtek_preview.api_application.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

Expand All @@ -22,6 +23,12 @@ public ResponseEntity<ProjectResponseDTO> createProject(@RequestBody ProjectRequ
ProjectResponseDTO project = projectService.createProject(projectRequestDTO);
return ResponseEntity.ok(project);
}

@PostMapping("/bulk")
public ResponseEntity<List<ProjectResponseDTO>> createProjectsInBulk(@RequestBody List<ProjectRequestDTO> projectRequestDTOs) {
List<ProjectResponseDTO> createdProjects = projectService.createProjectsInBulk(projectRequestDTOs);
return ResponseEntity.status(HttpStatus.CREATED).body(createdProjects);
}

@GetMapping("/{id}")
public ResponseEntity<ProjectResponseDTO> getProjectById(@PathVariable UUID id) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,57 @@
package com.softtek_preview.api_application.controller;

import com.softtek_preview.api_application.domain.ticket.TicketRequestDTO;
import com.softtek_preview.api_application.domain.ticket.TicketResponseDTO;
import com.softtek_preview.api_application.service.TicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.UUID;

@RestController
@RequestMapping("/api/tickets")
public class TicketController {

@Autowired
private TicketService ticketService;


// Criar um novo ticket
@PostMapping
public ResponseEntity<TicketResponseDTO> createTicket(@RequestBody TicketRequestDTO ticketRequestDTO) {
TicketResponseDTO ticket = ticketService.createTicket(ticketRequestDTO);
return ResponseEntity.status(HttpStatus.CREATED).body(ticket);
}

// Obter todos os tickets
@GetMapping
public ResponseEntity<List<TicketResponseDTO>> getAllTickets() {
List<TicketResponseDTO> tickets = ticketService.getAllTickets();
return ResponseEntity.ok(tickets);
}

// Obter ticket por ID
@GetMapping("/{id}")
public ResponseEntity<TicketResponseDTO> getTicketById(@PathVariable UUID id) {
TicketResponseDTO ticket = ticketService.getTicketById(id);
return ResponseEntity.ok(ticket);
}

// Atualizar um ticket
@PutMapping("/{id}")
public ResponseEntity<TicketResponseDTO> updateTicket(@PathVariable UUID id, @RequestBody TicketRequestDTO ticketRequestDTO) {
TicketResponseDTO updatedTicket = ticketService.updateTicket(id, ticketRequestDTO);
return ResponseEntity.ok(updatedTicket);
}

// Excluir um ticket
@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteTicket(@PathVariable UUID id) {
ticketService.deleteTicket(id);
return ResponseEntity.noContent().build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class Consultant {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", nullable = false)
private UUID id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
import java.util.List;
import java.util.UUID;

public record ComsultantRequestDTO(
UUID id,
public record ConsultantRequestDTO(
String nome,
String codigoAt,
String descricaoAt,
String senioridade,
List<String> especialidade,
LocalDate ausenciaIni,
LocalDate ausenciaFin,
String ausenciaTipo,
CostRequestDTO cost
String ausenciaTipo
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.softtek_preview.api_application.domain.consultant;

import com.softtek_preview.api_application.domain.cost.CostResponseDTO;

import java.time.LocalDate;
import java.util.List;
import java.util.UUID;

public record ConsultantResponseDTO(
UUID id,
String nome,
String codigoAt,
String descricaoAt,
String senioridade,
List<String> especialidade,
LocalDate ausenciaIni,
LocalDate ausenciaFin,
String ausenciaTipo,
CostResponseDTO cost
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public record ProjectRequestDTO(
@NotNull(message = "A data de fim do contrato é obrigatória")
LocalDate fimContrato,

@NotNull(message = "O status é obrigatório")
String status,

@NotNull(message = "O campo ativo é obrigatório")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import lombok.Setter;

import java.time.LocalDate;
import java.util.UUID;

@Table(name = "ticket")
@Entity
Expand All @@ -20,7 +21,7 @@ public class Ticket {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private UUID id;

@ManyToOne
@JoinColumn(name = "projeto_id", referencedColumnName = "id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
package com.softtek_preview.api_application.domain.ticket;

import java.time.LocalDate;
import java.util.UUID;

public record TicketRequestDTO(
Long id,
Long projetoId,
String projetoNome,
UUID projetoId,
int chamado,
LocalDate dtAberturaChamado,
String moduloChamado,
String tipoChamado,
String statusChamado,
Long consultantId,
String consultantNome,
UUID consultantId,
String moduloConsultor,
int exercicio,
int periodo,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.softtek_preview.api_application.domain.ticket;

import java.time.LocalDate;
import java.util.UUID;

public record TicketResponseDTO(
UUID id,
UUID projetoId,
String projetoNome,
int chamado,
LocalDate dtAberturaChamado,
String moduloChamado,
String tipoChamado,
String statusChamado,
UUID consultantId,
String consultantNome,
String moduloConsultor,
int exercicio,
int periodo,
int dia,
int horas,
String tipoHoras,
String complexidade
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.UUID;

@Repository
public interface TicketRepository extends JpaRepository<Ticket, Long> {
public interface TicketRepository extends JpaRepository<Ticket, UUID> {

}
Loading