-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sur la page d'accueil de l'espace producteur, revoir l'action dans le…
… cas où l'utilisateur n'a pas déjà un compte #9
- Loading branch information
1 parent
0db13c1
commit e9394b2
Showing
13 changed files
with
406 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
backend/app/src/main/java/eu/viandeendirect/domains/registration/RegistrationsService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package eu.viandeendirect.domains.registration; | ||
|
||
import eu.viandeendirect.api.RegistrationsApiDelegate; | ||
import eu.viandeendirect.common.EmailService; | ||
import eu.viandeendirect.model.Registration; | ||
import jakarta.mail.MessagingException; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class RegistrationsService implements RegistrationsApiDelegate { | ||
|
||
@Autowired | ||
EmailService emailService; | ||
|
||
@Override | ||
public ResponseEntity<Void> processRegistration(Registration registration) { | ||
try { | ||
emailService.sendMail( | ||
"[email protected]", | ||
"Nouvelle demande d'inscription d'un producteur sur ViandeEnDirect.eu", | ||
String.format(""" | ||
<html> | ||
Nouvelle demande d'inscription d'un producteur : | ||
<br> | ||
<br> | ||
<div> | ||
<b>Nom :</b><br> | ||
%s<br> | ||
</div> | ||
<br> | ||
<div> | ||
<b>Prénom :</b><br> | ||
%s<br> | ||
</div> | ||
<br> | ||
<div> | ||
<b>Email :</b><br> | ||
%s<br> | ||
</div> | ||
<br> | ||
<div> | ||
<b>Téléphone :</b><br> | ||
%s<br> | ||
</div> | ||
<br> | ||
<div> | ||
<b>Nom de l'exploitation agricole :</b><br> | ||
%s<br> | ||
</div> | ||
<br> | ||
<div> | ||
<b>N° SIREN de l'exploitation agricole :</b><br> | ||
%s<br> | ||
</div> | ||
<br> | ||
<div> | ||
<b>Description de la production :</b><br> | ||
%s<br> | ||
</div> | ||
</html> | ||
""", | ||
registration.getProducer().getUser().getFirstName(), | ||
registration.getProducer().getUser().getLastName(), | ||
registration.getProducer().getUser().getEmail(), | ||
registration.getProducer().getUser().getPhone(), | ||
registration.getProducer().getLegalName(), | ||
registration.getProducer().getLegalIdentificationNumber(), | ||
registration.getProductionDescription() | ||
) | ||
); | ||
} catch (MessagingException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return new ResponseEntity<>(HttpStatus.OK); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
backend/model/src/main/java/eu/viandeendirect/model/Registration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package eu.viandeendirect.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.annotation.Generated; | ||
import jakarta.validation.Valid; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* the registration of new producer | ||
*/ | ||
|
||
@Schema(name = "Registration", description = "the registration of new producer") | ||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") | ||
public class Registration { | ||
|
||
@JsonProperty("producer") | ||
private Producer producer; | ||
|
||
@JsonProperty("productionDescription") | ||
private String productionDescription; | ||
|
||
public Registration producer(Producer producer) { | ||
this.producer = producer; | ||
return this; | ||
} | ||
|
||
/** | ||
* Get producer | ||
* @return producer | ||
*/ | ||
@Valid | ||
@Schema(name = "producer", required = false) | ||
public Producer getProducer() { | ||
return producer; | ||
} | ||
|
||
public void setProducer(Producer producer) { | ||
this.producer = producer; | ||
} | ||
|
||
public Registration productionDescription(String productionDescription) { | ||
this.productionDescription = productionDescription; | ||
return this; | ||
} | ||
|
||
/** | ||
* Get productionDescription | ||
* @return productionDescription | ||
*/ | ||
|
||
@Schema(name = "productionDescription", required = false) | ||
public String getProductionDescription() { | ||
return productionDescription; | ||
} | ||
|
||
public void setProductionDescription(String productionDescription) { | ||
this.productionDescription = productionDescription; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
Registration registration = (Registration) o; | ||
return Objects.equals(this.producer, registration.producer) && | ||
Objects.equals(this.productionDescription, registration.productionDescription); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(producer, productionDescription); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("class Registration {\n"); | ||
sb.append(" producer: ").append(toIndentedString(producer)).append("\n"); | ||
sb.append(" productionDescription: ").append(toIndentedString(productionDescription)).append("\n"); | ||
sb.append("}"); | ||
return sb.toString(); | ||
} | ||
|
||
/** | ||
* Convert the given object to string with each line indented by 4 spaces | ||
* (except the first line). | ||
*/ | ||
private String toIndentedString(Object o) { | ||
if (o == null) { | ||
return "null"; | ||
} | ||
return o.toString().replace("\n", "\n "); | ||
} | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.