Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
228f71c404 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,6 +1,5 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
|
||||
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "interactive"
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
# hackathon
|
||||
|
||||
In order to launch any task (Maven compile, clean install ...) be sure to launch the Docker compose in the root directory with :
|
||||
|
||||
docker compose up
|
||||
|
||||
## Getting started
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf.extras</groupId>
|
||||
@@ -97,11 +97,6 @@
|
||||
<artifactId>spring-boot-starter-thymeleaf-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package hackathon.FrisbYEE.jpa.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ActiviteDTO {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String theme;
|
||||
private Long duree; // optional, can be null
|
||||
private List<String> dataActivite;
|
||||
private Integer sessionId;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package hackathon.FrisbYEE.jpa.dto;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AdminDTO {
|
||||
private Integer id;
|
||||
private String name;
|
||||
}
|
||||
@@ -1,18 +1,12 @@
|
||||
package hackathon.FrisbYEE.jpa.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AthleteDTO {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String categorie;
|
||||
public class AthleteDTO implements java.io.Serializable {
|
||||
|
||||
private String nom;
|
||||
private String niveau;
|
||||
private List<String> groupes = new ArrayList<>();
|
||||
private List<Integer> sessionIds = new ArrayList<>();
|
||||
private Integer userId;
|
||||
private String categorie;
|
||||
private List<String> groupes;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package hackathon.FrisbYEE.jpa.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CoachDTO {
|
||||
private Integer id;
|
||||
private String name;
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package hackathon.FrisbYEE.jpa.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SessionDTO {
|
||||
|
||||
private Integer id;
|
||||
private String name;
|
||||
private Boolean isRecurrent;
|
||||
private LocalDateTime creneau;
|
||||
private Long duree;
|
||||
private String groupe;
|
||||
|
||||
private Integer coachId;
|
||||
private List<Integer> athleteIds;
|
||||
private List<Integer> activiteIds;
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package hackathon.FrisbYEE.jpa.dto;
|
||||
|
||||
import hackathon.FrisbYEE.jpa.metier.Role;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserDTO {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String email;
|
||||
private Role role;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package hackathon.FrisbYEE.jpa;
|
||||
|
||||
public interface IAthlete {
|
||||
public void run();
|
||||
|
||||
int getId();
|
||||
void setId(int id);
|
||||
String getNom();
|
||||
void setNom(String nom);
|
||||
void setCategorie(String categorie);
|
||||
String getCategorie();
|
||||
void setNiveau(String niveau);
|
||||
String getNiveau();
|
||||
|
||||
}
|
||||
@@ -3,8 +3,9 @@ package hackathon.FrisbYEE.jpa.metier;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.*;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -21,7 +22,7 @@ public class Activite implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Integer id;
|
||||
private Long id;
|
||||
private String name;
|
||||
private String theme;
|
||||
private Long duree;
|
||||
|
||||
@@ -2,7 +2,6 @@ package hackathon.FrisbYEE.jpa.metier;
|
||||
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -18,12 +17,9 @@ public class Admin {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Integer id;
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
@OneToOne(mappedBy = "admin")
|
||||
private User user;
|
||||
|
||||
public Admin(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ package hackathon.FrisbYEE.jpa.metier;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.ManyToMany;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import jakarta.persistence.Access;
|
||||
@@ -14,14 +14,14 @@ import jakarta.persistence.ElementCollection;
|
||||
import jakarta.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Data @NoArgsConstructor
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
@Access(AccessType.FIELD)
|
||||
|
||||
public class Athlete {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Integer id;
|
||||
private Long id;
|
||||
private String name;
|
||||
private String categorie;
|
||||
private String niveau;
|
||||
@@ -32,9 +32,6 @@ public class Athlete {
|
||||
@ManyToMany(mappedBy = "athletes")
|
||||
private List<Session> sessions = new ArrayList<>(); // plusieurs sessions sont possibles
|
||||
|
||||
@OneToOne(mappedBy = "athlete")
|
||||
private User user;
|
||||
|
||||
public Athlete(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package hackathon.FrisbYEE.jpa.metier;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -21,15 +20,12 @@ public class Coach {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Integer id;
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
@OneToMany(mappedBy = "coach")
|
||||
private List<Session> sessions = new ArrayList<>(); // Un coach peut avoir plusieurs sessions
|
||||
|
||||
@OneToOne(mappedBy = "coach")
|
||||
private User user;
|
||||
|
||||
public Coach(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package hackathon.FrisbYEE.jpa.metier;
|
||||
|
||||
public enum Role {
|
||||
ADMIN,
|
||||
COACH,
|
||||
ATHLETE
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class Session {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Integer id;
|
||||
private Long id;
|
||||
private String name;
|
||||
private Boolean isRecurrent;
|
||||
private LocalDateTime creneau;
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
package hackathon.FrisbYEE.jpa.metier;
|
||||
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import java.io.Serializable;
|
||||
import jakarta.persistence.Access;
|
||||
import jakarta.persistence.AccessType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.CascadeType;
|
||||
|
||||
@Entity
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
@Access(AccessType.FIELD)
|
||||
|
||||
public class User implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Integer id;
|
||||
@Column(unique = true, nullable = false) //pas possible d'avoir le même nom
|
||||
private String name;
|
||||
@Column (nullable = false)
|
||||
private String motDePasse;
|
||||
private String email;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
private Role role;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
private Coach coach;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
private Athlete athlete;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
private Admin admin;
|
||||
|
||||
public User(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public User(String name, String motDePasse, String email, Role role) {
|
||||
this.name = name;
|
||||
this.motDePasse = motDePasse;
|
||||
this.email = email;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User [id=" + id + " , name=" + name + "]";
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,7 @@ package hackathon.FrisbYEE.jpa.service;
|
||||
|
||||
import hackathon.FrisbYEE.jpa.metier.Activite;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ActiviteDAO extends JpaRepository<Activite, Integer> {
|
||||
|
||||
List<Activite> findByTheme(String theme);
|
||||
|
||||
Activite findByKeycloakId(String keycloakId);
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package hackathon.FrisbYEE.jpa.service;
|
||||
|
||||
import hackathon.FrisbYEE.jpa.metier.Admin;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface AdminDAO extends JpaRepository<Admin, Integer> {
|
||||
|
||||
}
|
||||
@@ -1,11 +1,57 @@
|
||||
package hackathon.FrisbYEE.jpa.service;
|
||||
|
||||
import hackathon.FrisbYEE.jpa.metier.Activite;
|
||||
import hackathon.FrisbYEE.jpa.metier.Athlete;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import sample.simple.dao.generic.AbstractJpaDao;
|
||||
import hackathon.FrisbYEE.jpa.interface.IAthlete;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface AthleteDAO extends JpaRepository<Athlete, Integer> {
|
||||
|
||||
private EntityManager em = EntityManagerHelper.getEntityManager();
|
||||
|
||||
public AthleteDAO() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(IAthlete entity) {
|
||||
em.getTransaction().begin();
|
||||
em.persist(entity);
|
||||
em.getTransaction().commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAthlete update(IAthlete entity) {
|
||||
em.getTransaction().begin();
|
||||
IJoueur merged = em.merge(entity);
|
||||
em.getTransaction().commit();
|
||||
return merged;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAthlete findOne(Integer id) {
|
||||
return em.find(IAthlete.class, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IAthlete> findAll() {
|
||||
return em.createQuery("from IAthlete", IAthlete.class).getResultList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(IAthlete entity) {
|
||||
em.getTransaction().begin();
|
||||
em.remove(entity);
|
||||
em.getTransaction().commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(Integer entityId) {
|
||||
IAthlete entity = findOne(entityId);
|
||||
delete(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
package hackathon.FrisbYEE.jpa.service;
|
||||
|
||||
import hackathon.FrisbYEE.jpa.metier.Coach;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface CoachDAO extends JpaRepository<Coach, Integer> {
|
||||
|
||||
public class CoachDAO {
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package hackathon.FrisbYEE.jpa.service;
|
||||
|
||||
import hackathon.FrisbYEE.jpa.metier.Session;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface SessionDAO extends JpaRepository<Session, Integer> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package hackathon.FrisbYEE.jpa.web;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/activite")
|
||||
|
||||
public class ActiviteController {
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
package hackathon.FrisbYEE.rest;
|
||||
|
||||
import hackathon.FrisbYEE.jpa.dto.ActiviteDTO;
|
||||
import hackathon.FrisbYEE.jpa.metier.Activite;
|
||||
import hackathon.FrisbYEE.jpa.metier.Session;
|
||||
import hackathon.FrisbYEE.jpa.service.ActiviteDAO;
|
||||
import hackathon.FrisbYEE.jpa.service.SessionDAO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/activite")
|
||||
|
||||
public class ActiviteResource {
|
||||
@Autowired
|
||||
private ActiviteDAO activiteDAO;
|
||||
|
||||
@Autowired
|
||||
private SessionDAO sessionDAO;
|
||||
|
||||
/*
|
||||
* POST /activite/create
|
||||
* DELETE /activite/delete/{id}
|
||||
*
|
||||
*/
|
||||
|
||||
@PostMapping("/create")
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasRole('Coach')")
|
||||
public ResponseEntity<String> create(@RequestBody ActiviteDTO dto) {
|
||||
|
||||
try {
|
||||
Session session = sessionDAO.findById(dto.getSessionId()).get();
|
||||
Activite activite = mapToEntity(dto);
|
||||
activite.setSession(session);
|
||||
activiteDAO.save(activite);
|
||||
} catch (Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error: " + ex.getMessage());
|
||||
}
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body("Activity created");
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasRole('Coach')")
|
||||
public ResponseEntity<String> delete(@PathVariable("id") int id) {
|
||||
try {
|
||||
Activite activite = activiteDAO.findById(id).get();
|
||||
activiteDAO.delete(activite);
|
||||
} catch (Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error: " + ex.getMessage());
|
||||
|
||||
}
|
||||
return ResponseEntity.ok("Activity deleted");
|
||||
}
|
||||
|
||||
@PostMapping("/update/{id}")
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasRole('Coach')")
|
||||
public ResponseEntity<String> modifyById(@PathVariable("id") int id, @RequestBody ActiviteDTO dto) {
|
||||
try {
|
||||
Session session = sessionDAO.findById(dto.getSessionId()).get();
|
||||
Activite activite = activiteDAO.findById(id).get();
|
||||
activite.setName(dto.getName());
|
||||
activite.setTheme(dto.getTheme());
|
||||
activite.setDuree(dto.getDuree() != null ? dto.getDuree() : 0L);
|
||||
activite.setDataActivite(dto.getDataActivite());
|
||||
activite.setSession(session);
|
||||
activiteDAO.save(activite);
|
||||
} catch (Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error: " + ex.getMessage());
|
||||
}
|
||||
return ResponseEntity.ok("Activity modified");
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("hasRole('Coach') or hasRole('Athlete')")
|
||||
@ResponseBody
|
||||
public ResponseEntity<ActiviteDTO> getActivityById(@PathVariable("id") int id) {
|
||||
try {
|
||||
Activite activite = activiteDAO.findById(id).get();
|
||||
ActiviteDTO dto = mapToDTO(activite);
|
||||
return ResponseEntity.ok(dto);
|
||||
} catch (Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
@PreAuthorize("hasRole('Coach') or hasRole('Athlete')")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<ActiviteDTO>> getAllActivity() {
|
||||
try {
|
||||
List<Activite> activites = activiteDAO.findAll();
|
||||
List<ActiviteDTO> dtos = activites.stream().map(this::mapToDTO).collect(Collectors.toList());
|
||||
return ResponseEntity.ok(dtos);
|
||||
} catch (Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/theme/{theme}")
|
||||
@PreAuthorize("hasRole('Coach') or hasRole('Athlete')")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<ActiviteDTO>> getActivityByTheme(@PathVariable("theme") String theme) {
|
||||
try {
|
||||
List<Activite> activites = activiteDAO.findByTheme(theme);
|
||||
List<ActiviteDTO> dtos = activites.stream().map(this::mapToDTO).collect(Collectors.toList());
|
||||
return ResponseEntity.ok(dtos);
|
||||
} catch (Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Activite mapToEntity(ActiviteDTO dto) {
|
||||
Activite activite = new Activite();
|
||||
//ID géré par Postgre ?
|
||||
activite.setName(dto.getName());
|
||||
activite.setTheme(dto.getTheme());
|
||||
activite.setDuree(dto.getDuree());
|
||||
activite.setDataActivite(dto.getDataActivite());
|
||||
return activite;
|
||||
}
|
||||
|
||||
private ActiviteDTO mapToDTO(Activite activite) {
|
||||
ActiviteDTO dto = new ActiviteDTO();
|
||||
dto.setName(activite.getName());
|
||||
dto.setTheme(activite.getTheme());
|
||||
dto.setDuree(activite.getDuree());
|
||||
dto.setDataActivite(activite.getDataActivite());
|
||||
dto.setSessionId(activite.getSession() != null ? activite.getSession().getId() : null);
|
||||
return dto;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package hackathon.FrisbYEE.rest;
|
||||
|
||||
public class ActiviteResources {
|
||||
|
||||
}
|
||||
@@ -1,219 +1,34 @@
|
||||
package hackathon.FrisbYEE.rest;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.chrono.ChronoLocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import hackathon.FrisbYEE.jpa.dto.ActiviteDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import hackathon.FrisbYEE.jpa.dto.AthleteDTO;
|
||||
import hackathon.FrisbYEE.jpa.dto.SessionDTO;
|
||||
import hackathon.FrisbYEE.jpa.metier.Activite;
|
||||
import hackathon.FrisbYEE.jpa.metier.Athlete;
|
||||
import hackathon.FrisbYEE.jpa.metier.Session;
|
||||
import hackathon.FrisbYEE.jpa.service.AthleteDAO;
|
||||
import hackathon.FrisbYEE.jpa.service.SessionDAO;
|
||||
import hackathon.FrisbYEE.jpa.interface.IAthlete;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/athletes")
|
||||
public class AthleteResource {
|
||||
@Autowired
|
||||
|
||||
private AthleteDAO athleteDAO;
|
||||
private SessionDAO sessionDAO;
|
||||
@Operation(summary = "Récupère tous les utilisateurs")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "Récupère le Joueur ayant l'identifiant correspondant",
|
||||
content = @Content(mediaType = "application/json",
|
||||
schema = @Schema(implementation = AthleteDTO.class)))
|
||||
})
|
||||
@GetMapping("/joueur/{id}")
|
||||
public AthleteDTO getJoueurById(@PathVariable Integer joueurId) {
|
||||
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("hasRole('Admin')") // Only admin can create??
|
||||
public ResponseEntity<AthleteDTO> create(@RequestBody AthleteDTO dto) {
|
||||
Athlete athlete = mapToEntity(dto);
|
||||
athleteDAO.save(athlete);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(mapToDTO(athlete));
|
||||
}
|
||||
|
||||
@PostMapping("/all")
|
||||
@PreAuthorize("hasRole('Admin') or hasRole('Coach') or hasRole('Athlete')")
|
||||
public ResponseEntity<List<AthleteDTO>> all() {
|
||||
List<Athlete> athletes = athleteDAO.findAll();
|
||||
List<AthleteDTO> dtos = new ArrayList<>();
|
||||
for (Athlete athlete : athletes) {
|
||||
dtos.add(mapToDTO(athlete));
|
||||
}
|
||||
return ResponseEntity.ok(dtos);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("hasRole('Admin') or hasRole('Coach') or hasRole('Athlete')")
|
||||
public ResponseEntity<AthleteDTO> getById(@PathVariable Integer id) {
|
||||
return athleteDAO.findById(id)
|
||||
.map(athlete -> ResponseEntity.ok(mapToDTO(athlete)))
|
||||
.orElse(ResponseEntity.notFound().build());
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@PreAuthorize("hasRole('ADMIN') or #id == principal.id")
|
||||
public ResponseEntity<AthleteDTO> update(@PathVariable Integer id,@RequestBody AthleteDTO dto) {
|
||||
try {
|
||||
Athlete athlete = athleteDAO.findById(id).get();
|
||||
athlete.setName(dto.getName());
|
||||
athlete.setCategorie(dto.getCategorie());
|
||||
athlete.setNiveau(dto.getNiveau());
|
||||
|
||||
// Relationship: sessionId → session
|
||||
if (dto.getSessionIds() != null) {
|
||||
List<Session> sessions = new ArrayList<>();
|
||||
for (Integer sessionId : dto.getSessionIds()) {
|
||||
Session session = sessionDAO.findById(sessionId)
|
||||
.orElseThrow(() -> new RuntimeException("Session not found"));
|
||||
sessions.add(session);
|
||||
}
|
||||
athlete.setSessions(sessions);
|
||||
}
|
||||
|
||||
athleteDAO.save(athlete);
|
||||
return ResponseEntity.ok(mapToDTO(athlete));
|
||||
}catch (Exception ex){
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("hasRole('Admin')")
|
||||
public ResponseEntity<Void> delete(@PathVariable Integer id) {
|
||||
if (!athleteDAO.existsById(id)) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
athleteDAO.deleteById(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private AthleteDTO mapToDTO(Athlete athlete) {
|
||||
AthleteDTO dto = new AthleteDTO();
|
||||
dto.setId(athlete.getId());
|
||||
dto.setName(athlete.getName());
|
||||
dto.setCategorie(athlete.getCategorie());
|
||||
dto.setNiveau(athlete.getNiveau());
|
||||
return dto;
|
||||
}
|
||||
|
||||
private Athlete mapToEntity(AthleteDTO dto) {
|
||||
Athlete athlete = new Athlete();
|
||||
athlete.setId(dto.getId());
|
||||
athlete.setName(dto.getName());
|
||||
athlete.setCategorie(dto.getCategorie());
|
||||
athlete.setNiveau(dto.getNiveau());
|
||||
return athlete;
|
||||
}
|
||||
|
||||
@GetMapping("/athlete/{id}/session")
|
||||
public List<SessionDTO> getSessionsAthlete(@PathVariable Integer athleteId) {
|
||||
// return pet
|
||||
System.out.println("ID A CHERCHER" + athleteId);
|
||||
java.util.Optional<Athlete> j = athleteDAO.findById(athleteId);
|
||||
List<Session> sessions = sessionDAO.findAll();
|
||||
List<SessionDTO> athleteSessions = new ArrayList<>();
|
||||
for(Session s : sessions){
|
||||
if(s.getAthletes().contains(j.get())){
|
||||
SessionDTO dto = new SessionDTO();
|
||||
dto.setId(s.getId());
|
||||
dto.setName(s.getName());
|
||||
// Map other fields as necessary
|
||||
athleteSessions.add(dto);
|
||||
}
|
||||
}
|
||||
System.out.println("ID A CHERCHER" + joueurId);
|
||||
IAthlete j = athleteDAO.findOne(joueurId);
|
||||
AthleteDTO jDTO = new AthleteDTO();
|
||||
System.out.println(j);
|
||||
return athleteSessions;
|
||||
return jDTO;
|
||||
}
|
||||
|
||||
@GetMapping("/athletes/session")
|
||||
public List<SessionDTO> getAllSessions() {
|
||||
List<Session> sessions = sessionDAO.findAll();
|
||||
System.out.println(sessions);
|
||||
List<SessionDTO> sessionDTOs = new ArrayList<>();
|
||||
for (Session session : sessions) {
|
||||
SessionDTO dto = new SessionDTO();
|
||||
dto.setId(session.getId());
|
||||
dto.setName(session.getName());
|
||||
// Map other fields as necessary
|
||||
sessionDTOs.add(dto);
|
||||
}
|
||||
return sessionDTOs;
|
||||
}
|
||||
|
||||
@GetMapping("/athletes/session/{id}/activities")
|
||||
public List<ActiviteDTO> getActivitiesForSession(@PathVariable Integer id) {
|
||||
// Récupérer la session par ID
|
||||
java.util.Optional<Session> sessionOpt = sessionDAO.findById(id);
|
||||
if (sessionOpt.isPresent()) {
|
||||
Session session = sessionOpt.get();
|
||||
// Retourner les activités de la session
|
||||
List<ActiviteDTO> activiteDTOs = new ArrayList<>();
|
||||
for (Activite activite : session.getActivites()) {
|
||||
ActiviteDTO dto = new ActiviteDTO();
|
||||
dto.setId(activite.getId());
|
||||
dto.setName(activite.getName());
|
||||
// Map other fields as necessary
|
||||
activiteDTOs.add(dto);
|
||||
}
|
||||
return activiteDTOs;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@GetMapping("/athletes/{id}/session/after/{date}")
|
||||
public List<SessionDTO> getSessionsAfterDate(@PathVariable Integer id, @PathVariable String date) {
|
||||
// Récupérer l'athlète par ID
|
||||
java.util.Optional<Athlete> athleteOpt = athleteDAO.findById(id);
|
||||
if (athleteOpt.isPresent()) {
|
||||
Athlete athlete = athleteOpt.get();
|
||||
// Récupérer les sessions de l'athlète après la date donnée
|
||||
List<Session> sessions = sessionDAO.findAll();
|
||||
List<SessionDTO> filteredSessions = new ArrayList<>();
|
||||
for (Session session : sessions) {
|
||||
if (session.getAthletes().contains(athlete) && session.getCreneau().isAfter(ChronoLocalDateTime.from(LocalDate.parse(date)))) { //WTF toujours sympa les dates
|
||||
SessionDTO dto = new SessionDTO();
|
||||
dto.setId(session.getId());
|
||||
dto.setName(session.getName());
|
||||
// Map other fields as necessary
|
||||
filteredSessions.add(dto);
|
||||
}
|
||||
}
|
||||
return filteredSessions;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@GetMapping("/athletes/{id}/session/between/{startDate}/{endDate}")
|
||||
public List<SessionDTO> getSessionsBetweenDates(@PathVariable Integer id, @PathVariable String startDate, @PathVariable String endDate) {
|
||||
// Récupérer l'athlète par ID
|
||||
java.util.Optional<Athlete> athleteOpt = athleteDAO.findById(id);
|
||||
if (athleteOpt.isPresent()) {
|
||||
Athlete athlete = athleteOpt.get();
|
||||
// Récupérer les sessions de l'athlète entre les deux dates données
|
||||
List<Session> sessions = sessionDAO.findAll();
|
||||
List<SessionDTO> filteredSessions = new ArrayList<>();
|
||||
for (Session session : sessions) {
|
||||
if (session.getAthletes().contains(athlete) && session.getCreneau().isAfter(ChronoLocalDateTime.from(LocalDate.parse(startDate))) && session.getCreneau().isBefore(ChronoLocalDateTime.from(LocalDate.parse(endDate)))) {
|
||||
SessionDTO dto = new SessionDTO();
|
||||
dto.setId(session.getId());
|
||||
dto.setName(session.getName());
|
||||
// Map other fields as necessary
|
||||
filteredSessions.add(dto);
|
||||
}
|
||||
}
|
||||
return filteredSessions;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
package hackathon.FrisbYEE.rest;
|
||||
|
||||
import hackathon.FrisbYEE.jpa.dto.CoachDTO;
|
||||
import hackathon.FrisbYEE.jpa.metier.Coach;
|
||||
import hackathon.FrisbYEE.jpa.service.CoachDAO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CoachResource {
|
||||
@Autowired
|
||||
private CoachDAO coachDAO;
|
||||
|
||||
@PostMapping("/create")
|
||||
@PreAuthorize("hasRole('Admin')") // Only admin can create
|
||||
public ResponseEntity<CoachDTO> create(@RequestBody CoachDTO dto) {
|
||||
Coach coach = mapToEntity(dto);
|
||||
coachDAO.save(coach);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(mapToDTO(coach));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
@PreAuthorize("hasRole('Admin') or hasRole('Coach')")
|
||||
public List<CoachDTO> getAll() {
|
||||
List<Coach> coaches = coachDAO.findAll();
|
||||
List<CoachDTO> dtos = new ArrayList<>();
|
||||
for (Coach coach : coaches) {
|
||||
dtos.add(mapToDTO(coach));
|
||||
}
|
||||
return dtos;
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("hasRole('Admin') or hasRole('Coach')")
|
||||
public CoachDTO getById(@PathVariable Integer id) {
|
||||
Coach coach = coachDAO.findById(id)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Coach not found"));
|
||||
return mapToDTO(coach);
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
@PreAuthorize("hasRole('Admin')")
|
||||
public ResponseEntity<CoachDTO> update(@PathVariable Integer id, @RequestBody CoachDTO dto) {
|
||||
Coach coach = coachDAO.findById(id)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Coach not found"));
|
||||
if (dto.getName() != null) coach.setName(dto.getName());
|
||||
coachDAO.save(coach);
|
||||
CoachDTO updatedDto = mapToDTO(coach);
|
||||
return ResponseEntity.ok(updatedDto);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@PreAuthorize("hasRole('Admin')")
|
||||
public ResponseEntity<Void> delete(@PathVariable Integer id) {
|
||||
Coach coach = coachDAO.findById(id)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Coach not found"));
|
||||
coachDAO.delete(coach);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private CoachDTO mapToDTO(Coach coach) {
|
||||
CoachDTO dto = new CoachDTO();
|
||||
dto.setId(coach.getId());
|
||||
dto.setName(coach.getName());
|
||||
return dto;
|
||||
}
|
||||
|
||||
private Coach mapToEntity(CoachDTO dto) {
|
||||
Coach coach = new Coach();
|
||||
coach.setId(dto.getId());
|
||||
coach.setName(dto.getName());
|
||||
return coach;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
package hackathon.FrisbYEE.rest;
|
||||
|
||||
import hackathon.FrisbYEE.jpa.dto.SessionDTO;
|
||||
import hackathon.FrisbYEE.jpa.metier.Activite;
|
||||
import hackathon.FrisbYEE.jpa.metier.Athlete;
|
||||
import hackathon.FrisbYEE.jpa.metier.Coach;
|
||||
import hackathon.FrisbYEE.jpa.metier.Session;
|
||||
import hackathon.FrisbYEE.jpa.service.ActiviteDAO;
|
||||
import hackathon.FrisbYEE.jpa.service.AthleteDAO;
|
||||
import hackathon.FrisbYEE.jpa.service.CoachDAO;
|
||||
import hackathon.FrisbYEE.jpa.service.SessionDAO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/session")
|
||||
|
||||
public class SessionResource {
|
||||
@Autowired
|
||||
private SessionDAO sessionDAO;
|
||||
|
||||
@Autowired
|
||||
private CoachDAO coachDAO;
|
||||
|
||||
@Autowired
|
||||
private AthleteDAO athleteDAO;
|
||||
|
||||
@Autowired
|
||||
private ActiviteDAO activiteDAO;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasRole('Coach')")
|
||||
public ResponseEntity<?> create(@RequestBody SessionDTO dto) {
|
||||
try {
|
||||
Session session = maptoEntity(dto);
|
||||
sessionDAO.save(session);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(maptoDTO(session));
|
||||
} catch (Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
@PreAuthorize("hasRole('Coach') or hasRole('Athlete')")
|
||||
public ResponseEntity<List<SessionDTO>> getAll() {
|
||||
List<Session> sessions = sessionDAO.findAll();
|
||||
List<SessionDTO> dtos = new ArrayList<>();
|
||||
for (Session session : sessions) {
|
||||
dtos.add(maptoDTO(session));
|
||||
}
|
||||
return ResponseEntity.ok(dtos);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("hasRole('Coach') or hasRole('Athlete')")
|
||||
public ResponseEntity<?> getById(@PathVariable Integer id) {
|
||||
try {
|
||||
Session session = sessionDAO.findById(id).orElseThrow();
|
||||
return ResponseEntity.ok(maptoDTO(session));
|
||||
} catch (Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@ResponseBody
|
||||
@PreAuthorize("hasRole('Coach')")
|
||||
public ResponseEntity<String> delete(@PathVariable("id") int id) {
|
||||
try {
|
||||
Session session = sessionDAO.findById(id).get();
|
||||
sessionDAO.delete(session);
|
||||
return ResponseEntity.ok("Session deleted successfully");
|
||||
} catch (Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
@PreAuthorize("hasRole('Coach')")
|
||||
public ResponseEntity<Void> updateSession(@PathVariable Integer id, @RequestBody SessionDTO dto) {
|
||||
Session session = sessionDAO.findById(id).orElseThrow(() -> new ResponseStatusException(
|
||||
HttpStatus.NOT_FOUND, "Session not found with id " + id));
|
||||
|
||||
if (dto.getDuree() != null) {
|
||||
session.setDuree(dto.getDuree());
|
||||
}
|
||||
if (dto.getAthleteIds() != null) {
|
||||
List<Athlete> athletes = athleteDAO.findAllById(dto.getAthleteIds());
|
||||
session.setAthletes(athletes);
|
||||
}
|
||||
if (dto.getActiviteIds() != null) {
|
||||
List<Activite> activites = activiteDAO.findAllById(dto.getActiviteIds());
|
||||
session.setActivites(activites);
|
||||
}
|
||||
sessionDAO.save(session);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private SessionDTO maptoDTO(Session s) {
|
||||
SessionDTO dto = new SessionDTO();
|
||||
dto.setId(s.getId());
|
||||
dto.setName(s.getName());
|
||||
dto.setIsRecurrent(s.getIsRecurrent());
|
||||
dto.setCreneau(s.getCreneau());
|
||||
dto.setDuree(s.getDuree());
|
||||
dto.setGroupe(s.getGroupe());
|
||||
// Coach
|
||||
if (s.getCoach() != null) {
|
||||
dto.setCoachId(s.getCoach().getId());
|
||||
}
|
||||
// Athletes
|
||||
if (s.getAthletes() != null) {
|
||||
List<Integer> athleteIds = new ArrayList<>();
|
||||
for (Athlete athlete : s.getAthletes()) {
|
||||
athleteIds.add(athlete.getId());
|
||||
}
|
||||
dto.setAthleteIds(athleteIds);
|
||||
}
|
||||
// Activites
|
||||
if (s.getActivites() != null) {
|
||||
List<Integer> activiteIds = new ArrayList<>();
|
||||
for (Activite activite : s.getActivites()) {
|
||||
activiteIds.add(activite.getId());
|
||||
}
|
||||
dto.setActiviteIds(activiteIds);
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
private Session maptoEntity(SessionDTO dto) {
|
||||
Session session = new Session();
|
||||
session.setId(dto.getId());
|
||||
session.setName(dto.getName());
|
||||
session.setIsRecurrent(dto.getIsRecurrent());
|
||||
session.setCreneau(dto.getCreneau());
|
||||
session.setDuree(dto.getDuree());
|
||||
session.setGroupe(dto.getGroupe());
|
||||
// Coach
|
||||
if (dto.getCoachId() != null) {
|
||||
Coach coach = new Coach();
|
||||
coach.setId(dto.getCoachId());
|
||||
session.setCoach(coach);
|
||||
}
|
||||
// Athletes
|
||||
if (dto.getAthleteIds() != null) {
|
||||
List<Athlete> athletes = athleteDAO.findAllById(dto.getAthleteIds());
|
||||
session.setAthletes(athletes);
|
||||
}
|
||||
// Activites
|
||||
if (dto.getActiviteIds() != null) {
|
||||
List<Activite> activites = activiteDAO.findAllById(dto.getActiviteIds());
|
||||
session.setActivites(activites);
|
||||
}
|
||||
return session;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,13 @@
|
||||
package hackathon.FrisbYEE;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.test.web.servlet.client.RestTestClient;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import hackathon.FrisbYEE.rest.AthleteResource;
|
||||
|
||||
|
||||
class FrisbYEEApplicationTests {
|
||||
|
||||
//Controller
|
||||
private AthleteResource athleteResource;
|
||||
private RestTestClient mockMvc;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
athleteResource = new AthleteResource();
|
||||
mockMvc = RestTestClient.bindToController(athleteResource).build();
|
||||
}
|
||||
@SpringBootTest
|
||||
class FrisbYeeApplicationTests {
|
||||
|
||||
@Test
|
||||
void shouldReturnUsers() throws Exception {
|
||||
//mockMvc.perform(get("/api/users"))
|
||||
// .andExpect(status().isOk());
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user