Merge pull request 'Leo/Backend' (#95) from Leo/Backend into master
Reviewed-on: PGL/Clyde#95 Reviewed-by: Maxime <231026@umons.ac.be> Reviewed-by: Wal <karpinskiwal@gmail.com> Reviewed-by: Debucquoy Anthony <d.tonitch@gmail.com>
This commit is contained in:
commit
cead1188ab
@ -41,3 +41,4 @@ tasks.register("run") {
|
|||||||
tasks.withType<Test> {
|
tasks.withType<Test> {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,14 @@
|
|||||||
package ovh.herisson.Clyde.EndPoints;
|
package ovh.herisson.Clyde.EndPoints;
|
||||||
|
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import ovh.herisson.Clyde.Repositories.TokenRepository;
|
import ovh.herisson.Clyde.Repositories.TokenRepository;
|
||||||
import ovh.herisson.Clyde.Repositories.UserRepository;
|
import ovh.herisson.Clyde.Repositories.UserRepository;
|
||||||
import ovh.herisson.Clyde.Services.TokenService;
|
import ovh.herisson.Clyde.Services.TokenService;
|
||||||
import ovh.herisson.Clyde.Tables.Role;
|
import ovh.herisson.Clyde.Tables.*;
|
||||||
import ovh.herisson.Clyde.Tables.Token;
|
|
||||||
import ovh.herisson.Clyde.Tables.User;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -26,6 +20,7 @@ public class MockController {
|
|||||||
public final UserRepository userRepo;
|
public final UserRepository userRepo;
|
||||||
public final TokenRepository tokenRepo;
|
public final TokenRepository tokenRepo;
|
||||||
public final TokenService tokenService;
|
public final TokenService tokenService;
|
||||||
|
|
||||||
ArrayList<User> mockUsers;
|
ArrayList<User> mockUsers;
|
||||||
|
|
||||||
|
|
||||||
@ -62,3 +57,4 @@ public class MockController {
|
|||||||
userRepo.deleteAll(mockUsers);
|
userRepo.deleteAll(mockUsers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package ovh.herisson.Clyde.Services;
|
package ovh.herisson.Clyde.Services;
|
||||||
|
|
||||||
import org.springframework.core.io.UrlResource;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import ovh.herisson.Clyde.Repositories.FileRepository;
|
import ovh.herisson.Clyde.Repositories.FileRepository;
|
||||||
import ovh.herisson.Clyde.Tables.FileType;
|
import ovh.herisson.Clyde.Tables.*;
|
||||||
import ovh.herisson.Clyde.Tables.StorageFile;
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -53,4 +53,12 @@ public class StorageService {
|
|||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void delete(StorageFile file) throws SecurityException {
|
||||||
|
File f = new File(file.getUrl());
|
||||||
|
f.delete();
|
||||||
|
|
||||||
|
//Delete l'entité
|
||||||
|
fileRepo.delete(file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,10 @@ import jakarta.persistence.*;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
public class InscriptionRequest {
|
public class InscriptionRequest {
|
||||||
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
private int id;
|
private int id;
|
||||||
private String firstName;
|
private String firstName;
|
||||||
|
@ -20,7 +20,7 @@ public class ReinscriptionRequest {
|
|||||||
|
|
||||||
//Permet de différencier les demandes de changement et une réinscription dans le même cursus
|
//Permet de différencier les demandes de changement et une réinscription dans le même cursus
|
||||||
//Pour la réinscription on va le mettre a 0
|
//Pour la réinscription on va le mettre a 0
|
||||||
private boolean type;
|
private boolean type = false;
|
||||||
|
|
||||||
public ReinscriptionRequest(){}
|
public ReinscriptionRequest(){}
|
||||||
|
|
||||||
@ -31,6 +31,12 @@ public class ReinscriptionRequest {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReinscriptionRequest(User user, Cursus newCursus, RequestState state){
|
||||||
|
this.user = user;
|
||||||
|
this.newCursus = newCursus;
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package ovh.herisson.Clyde.Tables;
|
package ovh.herisson.Clyde.Tables;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.*;
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@ -19,7 +16,6 @@ public class StorageFile {
|
|||||||
|
|
||||||
private FileType fileType;
|
private FileType fileType;
|
||||||
|
|
||||||
|
|
||||||
public StorageFile(String name, String url, FileType fileType){
|
public StorageFile(String name, String url, FileType fileType){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
@ -60,4 +56,5 @@ public class StorageFile {
|
|||||||
public void setFileType(FileType fileType) {
|
public void setFileType(FileType fileType) {
|
||||||
this.fileType = fileType;
|
this.fileType = fileType;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user