various functionality added
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
# Then, build the image with:
|
# Then, build the image with:
|
||||||
#
|
#
|
||||||
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/paypoint-backend-jvm .
|
# docker build -f src/main/docker/Dockerfile.jvm -t veenm/paypoint-backend-jvm .
|
||||||
#
|
#
|
||||||
# Then run the container using:
|
# Then run the container using:
|
||||||
#
|
#
|
||||||
|
|||||||
9
pom.xml
9
pom.xml
@@ -89,10 +89,17 @@
|
|||||||
<artifactId>bcrypt</artifactId>
|
<artifactId>bcrypt</artifactId>
|
||||||
<version>0.9.0</version>
|
<version>0.9.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>${quarkus.platform.group-id}</groupId>
|
<groupId>${quarkus.platform.group-id}</groupId>
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package nl.veenm.paypoint.domain;
|
package nl.veenm.paypoint.domain;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.*;
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class AppUser {
|
public class AppUser {
|
||||||
@@ -17,6 +14,9 @@ public class AppUser {
|
|||||||
private String firstName;
|
private String firstName;
|
||||||
private String lastName;
|
private String lastName;
|
||||||
|
|
||||||
|
@ManyToOne(cascade = CascadeType.ALL)
|
||||||
|
private Company company;
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,14 @@ public class AppUser {
|
|||||||
this.lastName = lastName;
|
this.lastName = lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Company getCompany() {
|
||||||
|
return company;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompany(Company company) {
|
||||||
|
this.company = company;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AppUser{" +
|
return "AppUser{" +
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ public class Appointment {
|
|||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Customer customer;
|
private Customer customer;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
private Company company;
|
||||||
|
|
||||||
public Appointment(Long id, String title, String description, LocalDateTime startDate, int startHour, int startMinute, int endHour, int endMinute, int durationInMinutes) {
|
public Appointment(Long id, String title, String description, LocalDateTime startDate, int startHour, int startMinute, int endHour, int endMinute, int durationInMinutes) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@@ -117,6 +120,14 @@ public class Appointment {
|
|||||||
this.customer = customer;
|
this.customer = customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Company getCompany() {
|
||||||
|
return company;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompany(Company company) {
|
||||||
|
this.company = company;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Appointment{" +
|
return "Appointment{" +
|
||||||
|
|||||||
75
src/main/java/nl/veenm/paypoint/domain/Company.java
Normal file
75
src/main/java/nl/veenm/paypoint/domain/Company.java
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package nl.veenm.paypoint.domain;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class Company {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private String email;
|
||||||
|
private String img_href;
|
||||||
|
private String address;
|
||||||
|
private String postal_code;
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImg_href() {
|
||||||
|
return img_href;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImg_href(String img_href) {
|
||||||
|
this.img_href = img_href;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPostal_code() {
|
||||||
|
return postal_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPostal_code(String postal_code) {
|
||||||
|
this.postal_code = postal_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCity() {
|
||||||
|
return city;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCity(String city) {
|
||||||
|
this.city = city;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,10 @@ package nl.veenm.paypoint.repository;
|
|||||||
import io.quarkus.hibernate.orm.panache.PanacheRepository;
|
import io.quarkus.hibernate.orm.panache.PanacheRepository;
|
||||||
import jakarta.enterprise.context.ApplicationScoped;
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
import nl.veenm.paypoint.domain.Appointment;
|
import nl.veenm.paypoint.domain.Appointment;
|
||||||
|
import nl.veenm.paypoint.domain.Company;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
@@ -17,4 +19,8 @@ public class AppointmentRepository implements PanacheRepository<Appointment> {
|
|||||||
userId, now)
|
userId, now)
|
||||||
.firstResultOptional();
|
.firstResultOptional();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Appointment> findMostRecentByCompanyId(Company company) {
|
||||||
|
return find("company = ?1", company).list();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package nl.veenm.paypoint.repository;
|
||||||
|
|
||||||
|
import io.quarkus.hibernate.orm.panache.PanacheRepository;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import nl.veenm.paypoint.domain.Appointment;
|
||||||
|
import nl.veenm.paypoint.domain.Company;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class CompanyRepository implements PanacheRepository<Company> {
|
||||||
|
}
|
||||||
@@ -1,23 +1,27 @@
|
|||||||
package nl.veenm.paypoint.resource;
|
package nl.veenm.paypoint.resource;
|
||||||
|
|
||||||
import jakarta.annotation.security.PermitAll;
|
|
||||||
import jakarta.annotation.security.RolesAllowed;
|
import jakarta.annotation.security.RolesAllowed;
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
|
import jakarta.json.JsonNumber;
|
||||||
import jakarta.ws.rs.*;
|
import jakarta.ws.rs.*;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
import nl.veenm.paypoint.domain.Appointment;
|
import nl.veenm.paypoint.domain.Appointment;
|
||||||
import nl.veenm.paypoint.service.AppointmentService;
|
import nl.veenm.paypoint.service.AppointmentService;
|
||||||
|
import org.eclipse.microprofile.jwt.JsonWebToken;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Path("/api/appointments")
|
@Path("/appointments")
|
||||||
@RolesAllowed({"ADMIN", "USER"})
|
@RolesAllowed({"ADMIN", "USER"})
|
||||||
public class AppointmentResource {
|
public class AppointmentResource {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
AppointmentService appointmentService;
|
AppointmentService appointmentService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
JsonWebToken jwt;
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public List<Appointment> getAppointments() {
|
public List<Appointment> getAppointments() {
|
||||||
@@ -28,8 +32,11 @@ public class AppointmentResource {
|
|||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("/date")
|
@Path("/date")
|
||||||
public List<Appointment> getAppointmentsByDate(@QueryParam("start") String start) {
|
public List<Appointment> getAppointmentsByDate(@QueryParam("start") String start) {
|
||||||
return appointmentService.getAppointmentsByDate(start);
|
JsonNumber companyIdJson = jwt.getClaim("company_id");
|
||||||
|
Long companyId = companyIdJson.longValue();
|
||||||
|
return appointmentService.getAppointmentsByDate(start, companyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("/recent/{id}")
|
@Path("/recent/{id}")
|
||||||
@@ -47,8 +54,9 @@ public class AppointmentResource {
|
|||||||
@POST
|
@POST
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public Response addAppointment(Appointment appointment) {
|
public Response addAppointment(Appointment appointment) {
|
||||||
System.out.println(appointment);
|
JsonNumber companyIdJson = jwt.getClaim("company_id");
|
||||||
appointmentService.add(appointment);
|
Long companyId = companyIdJson.longValue();
|
||||||
|
appointmentService.add(appointment, companyId);
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import nl.veenm.paypoint.service.CustomerService;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Path("/api/customers")
|
@Path("/customers")
|
||||||
@PermitAll()
|
@PermitAll()
|
||||||
public class CustomerResource {
|
public class CustomerResource {
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ import jakarta.enterprise.context.ApplicationScoped;
|
|||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import nl.veenm.paypoint.domain.Appointment;
|
import nl.veenm.paypoint.domain.Appointment;
|
||||||
|
import nl.veenm.paypoint.domain.Company;
|
||||||
import nl.veenm.paypoint.repository.AppointmentRepository;
|
import nl.veenm.paypoint.repository.AppointmentRepository;
|
||||||
|
import nl.veenm.paypoint.repository.CompanyRepository;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
@@ -17,16 +18,14 @@ public class AppointmentService {
|
|||||||
@Inject
|
@Inject
|
||||||
AppointmentRepository appointmentRepository;
|
AppointmentRepository appointmentRepository;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
CompanyRepository companyRepository;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
EmailService emailService;
|
EmailService emailService;
|
||||||
|
|
||||||
private List<Appointment> appointments;
|
|
||||||
|
|
||||||
public AppointmentService() {
|
public AppointmentService() {
|
||||||
LocalDateTime now = LocalDateTime.now();
|
|
||||||
appointments = new ArrayList<>();
|
|
||||||
appointments.add(new Appointment(1L, "Knippen Mel", "", now, 12, 0, 13, 0, 60));
|
|
||||||
appointments.add(new Appointment(2L, "Knippen Mel", "", now, 14, 0, 15, 0, 60));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -35,20 +34,22 @@ public class AppointmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void add(Appointment appointment) {
|
public void add(Appointment appointment, Long companyId) {
|
||||||
// appointment.setStartDate(appointment.getStartDate().plusDays(1));
|
Company company = companyRepository.findById(companyId);
|
||||||
|
appointment.setCompany(company);
|
||||||
appointmentRepository.persist(appointment);
|
appointmentRepository.persist(appointment);
|
||||||
emailService.stuurBevestiging(appointment);
|
emailService.stuurBevestiging(appointment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public List<Appointment> getAppointmentsByDate(String start) {
|
public List<Appointment> getAppointmentsByDate(String start, Long companyId) {
|
||||||
LocalDate date = LocalDate.parse(start);
|
LocalDate date = LocalDate.parse(start);
|
||||||
|
Company company = companyRepository.findById(companyId);
|
||||||
|
|
||||||
LocalDateTime startOfDay = date.atStartOfDay(); // 00:00:00
|
LocalDateTime startOfDay = date.atStartOfDay();
|
||||||
LocalDateTime endOfDay = date.atTime(23, 59, 59); // 23:59:59
|
LocalDateTime endOfDay = date.atTime(23, 59, 59);
|
||||||
|
|
||||||
return appointmentRepository.find("startDate BETWEEN ?1 AND ?2", startOfDay, endOfDay).list();
|
return appointmentRepository.find("startDate BETWEEN ?1 AND ?2 AND company = ?3", startOfDay, endOfDay, company).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -79,7 +80,7 @@ public class AppointmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Scheduled(cron = "0 0 0 * * ?")
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
public void sendReminder() {
|
public void sendReminder() {
|
||||||
LocalDate date = LocalDate.now();
|
LocalDate date = LocalDate.now();
|
||||||
date = date.plusDays(1);
|
date = date.plusDays(1);
|
||||||
@@ -99,4 +100,8 @@ public class AppointmentService {
|
|||||||
return appointmentRepository.findMostRecentByUserId(userId).orElse(null);
|
return appointmentRepository.findMostRecentByUserId(userId).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Appointment> getAppointmentsByCompany(Long companyId) {
|
||||||
|
Company company = companyRepository.findById(companyId);
|
||||||
|
return appointmentRepository.findMostRecentByCompanyId(company);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import io.quarkus.mailer.Mail;
|
|||||||
import io.quarkus.mailer.Mailer;
|
import io.quarkus.mailer.Mailer;
|
||||||
import jakarta.enterprise.context.ApplicationScoped;
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
import nl.veenm.paypoint.domain.Appointment;
|
import nl.veenm.paypoint.domain.Appointment;
|
||||||
|
import nl.veenm.paypoint.domain.Company;
|
||||||
import nl.veenm.paypoint.helper.EmailHelper;
|
import nl.veenm.paypoint.helper.EmailHelper;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -20,9 +21,9 @@ public class EmailService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void stuurBevestiging(Appointment appointment) {
|
public void stuurBevestiging(Appointment appointment) {
|
||||||
|
Company company = appointment.getCompany();
|
||||||
String location = "<br>Groenestraat 29<br>6681DW Bemmel";
|
String location = String.format("<br>%s<br>%s %s", company.getAddress(), company.getPostal_code(), company.getCity());
|
||||||
String imageUrl = "https://hairstylingbydaan.nl/assets/img/Logo.png";
|
String imageUrl = appointment.getCompany().getImg_href();
|
||||||
String formattedDate = appointment.getStartDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.forLanguageTag("nl")));
|
String formattedDate = appointment.getStartDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.forLanguageTag("nl")));
|
||||||
|
|
||||||
String formattedHour = String.valueOf(appointment.getStartHour()).length() == 1 ? "0" + appointment.getStartHour() : String.valueOf(appointment.getStartHour());
|
String formattedHour = String.valueOf(appointment.getStartHour()).length() == 1 ? "0" + appointment.getStartHour() : String.valueOf(appointment.getStartHour());
|
||||||
@@ -115,15 +116,15 @@ public class EmailService {
|
|||||||
|
|
||||||
mailer.send(Mail.withHtml(recipient, subject, emailBody)
|
mailer.send(Mail.withHtml(recipient, subject, emailBody)
|
||||||
.setFrom("Hairstyling By Daan <paypoint@melvanveen.nl>")
|
.setFrom("Hairstyling By Daan <paypoint@melvanveen.nl>")
|
||||||
|
.setReplyTo(company.getEmail())
|
||||||
.addAttachment("afspraak.ics", EmailHelper.getIcs(dtStamp, date.toLocalDate(), formattedTime, formattedEndTime, location).getBytes(), "text/calendar"));
|
.addAttachment("afspraak.ics", EmailHelper.getIcs(dtStamp, date.toLocalDate(), formattedTime, formattedEndTime, location).getBytes(), "text/calendar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stuurVerwijdering(Appointment appointment) {
|
public void stuurVerwijdering(Appointment appointment) {
|
||||||
|
Company company = appointment.getCompany();
|
||||||
String imageUrl = "https://hairstylingbydaan.nl/assets/img/Logo.png";
|
String imageUrl = company.getImg_href();
|
||||||
String formattedDate = appointment.getStartDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.forLanguageTag("nl")));
|
String formattedDate = appointment.getStartDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.forLanguageTag("nl")));
|
||||||
|
|
||||||
|
|
||||||
// Bouw de HTML-inhoud van de e-mail
|
// Bouw de HTML-inhoud van de e-mail
|
||||||
String emailBody = """
|
String emailBody = """
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -200,9 +201,9 @@ public class EmailService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void stuurBewerking(Appointment appointment) {
|
public void stuurBewerking(Appointment appointment) {
|
||||||
|
Company company = appointment.getCompany();
|
||||||
String location = "<br>Groenestraat 29<br>6681DW Bemmel";
|
String location = String.format("<br>%s<br>%s %s", company.getAddress(), company.getPostal_code(), company.getCity());
|
||||||
String imageUrl = "https://hairstylingbydaan.nl/assets/img/Logo.png";
|
String imageUrl = appointment.getCompany().getImg_href();
|
||||||
String formattedDate = appointment.getStartDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.forLanguageTag("nl")));
|
String formattedDate = appointment.getStartDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.forLanguageTag("nl")));
|
||||||
|
|
||||||
String formattedTime = String.format("%s:%s", appointment.getStartHour(), String.valueOf(appointment.getStartMinute()).length() == 1 ? "0" + appointment.getStartMinute() : appointment.getStartMinute());
|
String formattedTime = String.format("%s:%s", appointment.getStartHour(), String.valueOf(appointment.getStartMinute()).length() == 1 ? "0" + appointment.getStartMinute() : appointment.getStartMinute());
|
||||||
@@ -284,13 +285,13 @@ public class EmailService {
|
|||||||
String subject = String.format(" Afspraak gewijzigd: %s", formattedDate);
|
String subject = String.format(" Afspraak gewijzigd: %s", formattedDate);
|
||||||
String recipient = appointment.getCustomer().getEmail();
|
String recipient = appointment.getCustomer().getEmail();
|
||||||
|
|
||||||
mailer.send(Mail.withHtml(recipient, subject, emailBody).setFrom("Hairstyling By Daan <paypoint@melvanveen.nl>"));
|
mailer.send(Mail.withHtml(recipient, subject, emailBody).setFrom(company.getEmail()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stuurHerinnering(Appointment appointment) {
|
public void stuurHerinnering(Appointment appointment) {
|
||||||
|
Company company = appointment.getCompany();
|
||||||
String location = "<br>Groenestraat 29<br>6681DW Bemmel";
|
String location = String.format("<br>%s<br>%s %s", company.getAddress(), company.getPostal_code(), company.getCity());
|
||||||
String imageUrl = "https://hairstylingbydaan.nl/assets/img/Logo.png";
|
String imageUrl = appointment.getCompany().getImg_href();
|
||||||
String formattedDate = appointment.getStartDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.forLanguageTag("nl")));
|
String formattedDate = appointment.getStartDate().toLocalDate().format(DateTimeFormatter.ofPattern("dd MMMM yyyy", Locale.forLanguageTag("nl")));
|
||||||
|
|
||||||
String formattedTime = String.format("%s:%s", appointment.getStartHour(), String.valueOf(appointment.getStartMinute()).length() == 1 ? "0" + appointment.getStartMinute() : appointment.getStartMinute());
|
String formattedTime = String.format("%s:%s", appointment.getStartHour(), String.valueOf(appointment.getStartMinute()).length() == 1 ? "0" + appointment.getStartMinute() : appointment.getStartMinute());
|
||||||
@@ -372,7 +373,7 @@ public class EmailService {
|
|||||||
String subject = String.format("Herinnering afspraak: %s", formattedDate);
|
String subject = String.format("Herinnering afspraak: %s", formattedDate);
|
||||||
String recipient = appointment.getCustomer().getEmail();
|
String recipient = appointment.getCustomer().getEmail();
|
||||||
|
|
||||||
mailer.send(Mail.withHtml(recipient, subject, emailBody).setFrom("Hairstyling By Daan <paypoint@melvanveen.nl>"));
|
mailer.send(Mail.withHtml(recipient, subject, emailBody).setFrom("Hairstyling By Daan <paypoint@melvanveen.nl>").setReplyTo(company.getEmail()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class TokenService {
|
|||||||
.claim("lastName", appUser.getLastName())
|
.claim("lastName", appUser.getLastName())
|
||||||
.claim("email", appUser.getEmail())
|
.claim("email", appUser.getEmail())
|
||||||
.claim("groups", appUser.getRole())
|
.claim("groups", appUser.getRole())
|
||||||
|
.claim("company_id", appUser.getCompany().getId())
|
||||||
.sign();
|
.sign();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ quarkus.hibernate-orm.log.sql=false
|
|||||||
quarkus.http.cors=true
|
quarkus.http.cors=true
|
||||||
quarkus.http.cors.origins=${CORS_ORIGINS}
|
quarkus.http.cors.origins=${CORS_ORIGINS}
|
||||||
quarkus.http.cors.methods=GET,POST,OPTIONS,DELETE,PUT
|
quarkus.http.cors.methods=GET,POST,OPTIONS,DELETE,PUT
|
||||||
|
quarkus.http.root-path=/api
|
||||||
|
|
||||||
# Mailer configuratie
|
# Mailer configuratie
|
||||||
quarkus.mailer.from=${MAILER_FROM}
|
quarkus.mailer.from=${MAILER_FROM}
|
||||||
@@ -19,6 +20,10 @@ quarkus.mailer.port=${MAILER_PORT}
|
|||||||
quarkus.mailer.username=${MAILER_USERNAME}
|
quarkus.mailer.username=${MAILER_USERNAME}
|
||||||
quarkus.mailer.password=${MAILER_PASSWORD}
|
quarkus.mailer.password=${MAILER_PASSWORD}
|
||||||
quarkus.mailer.mock=false
|
quarkus.mailer.mock=false
|
||||||
|
#quarkus.http.port=8081
|
||||||
|
#quarkus.http.ssl-port=443
|
||||||
|
quarkus.http.ssl.certificate.key-store-file=keystore.jks
|
||||||
|
quarkus.http.ssl.certificate.key-store-password=password
|
||||||
|
|
||||||
# JWT-instellingen
|
# JWT-instellingen
|
||||||
mp.jwt.verify.issuer=PayPoint
|
mp.jwt.verify.issuer=PayPoint
|
||||||
@@ -32,9 +37,14 @@ smallrye.jwt.sign.key.algorithm=RS256
|
|||||||
# Token Levensduur (optioneel)
|
# Token Levensduur (optioneel)
|
||||||
smallrye.jwt.new-token.lifespan=3600
|
smallrye.jwt.new-token.lifespan=3600
|
||||||
|
|
||||||
quarkus.log.category."io.quarkus.security".level=DEBUG
|
#quarkus.log.category."io.quarkus.security".level=DEBUG
|
||||||
mp.jwt.verify.claims.groups=groups
|
#mp.jwt.verify.claims.groups=groups
|
||||||
quarkus.log.category."io.smallrye.jwt".level=DEBUG
|
#quarkus.log.category."io.smallrye.jwt".level=DEBUG
|
||||||
|
##quarkus.log.level=DEBUG
|
||||||
|
##quarkus.log.category."io.quarkus".level=DEBUG
|
||||||
|
#quarkus.log.category."io.quarkus.rest".level=DEBUG
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user