Skip to content

Commit

Permalink
Merge pull request #94 from TTBMP/release/v0.13
Browse files Browse the repository at this point in the history
Release/v0.13
  • Loading branch information
buracchi authored Jun 12, 2021
2 parents 1183c28 + df6cb50 commit 32fbc61
Show file tree
Hide file tree
Showing 207 changed files with 3,825 additions and 3,603 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ jobs:
restore-keys: ${{ runner.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Build with Gradle and analyze with Sonarqube
run: |
./gradlew assemble
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import com.ttbmp.cinehub.app.service.payment.PaymentService;
import com.ttbmp.cinehub.app.service.payment.PaymentServiceException;
import com.ttbmp.cinehub.app.service.security.SecurityService;
import com.ttbmp.cinehub.app.usecase.buyticket.reply.*;
import com.ttbmp.cinehub.app.usecase.buyticket.request.*;
import com.ttbmp.cinehub.app.usecase.buyticket.response.*;
import com.ttbmp.cinehub.app.utilities.request.AuthenticatedRequest;
import com.ttbmp.cinehub.app.utilities.request.Request;
import com.ttbmp.cinehub.domain.Customer;
Expand Down Expand Up @@ -67,7 +67,7 @@ public void getMovieList(MovieListRequest request) {
var movieList = movieRepository.getMovieList(localDate).stream()
.map(MovieDto::new)
.collect(Collectors.toList());
presenter.presentMovieList(new MovieListResponse(movieList));
presenter.presentMovieList(new MovieListReply(movieList));
} catch (Request.NullRequestException e) {
presenter.presentNullRequest();
} catch (Request.InvalidRequestException e) {
Expand All @@ -91,7 +91,7 @@ public void getCinemaList(CinemaListRequest request) {
var cinemaList = cinemaRepository.getListCinema(movie, request.getDate()).stream()
.map(CinemaDto::new)
.collect(Collectors.toList());
presenter.presentCinemaList(new CinemaListResponse(cinemaList));
presenter.presentCinemaList(new CinemaListReply(cinemaList));
} catch (Request.NullRequestException e) {
presenter.presentNullRequest();
} catch (Request.InvalidRequestException e) {
Expand Down Expand Up @@ -119,7 +119,7 @@ public void getProjectionList(ProjectionListRequest request) {
var projectionList = projectionRepository.getProjectionList(cinema, movie, request.getLocalDate()).stream()
.map(ProjectionDto::new)
.collect(Collectors.toList());
presenter.presentProjectionList(new ProjectionListResponse(projectionList));
presenter.presentProjectionList(new ProjectionListReply(projectionList));
} catch (Request.NullRequestException e) {
presenter.presentNullRequest();
} catch (Request.InvalidRequestException e) {
Expand All @@ -139,7 +139,7 @@ public void getSeatList(SeatListRequest request) {
var seatList = projection.getHall().getSeatList().stream()
.map(seat -> new SeatDto(seat, projection.isBooked(seat)))
.collect(Collectors.toList());
presenter.presentSeatList(new SeatListResponse(seatList));
presenter.presentSeatList(new SeatListReply(seatList));
} catch (Request.NullRequestException e) {
presenter.presentNullRequest();
} catch (Request.InvalidRequestException e) {
Expand Down Expand Up @@ -173,7 +173,7 @@ public void pay(PaymentRequest request) {
var seat = seatRepository.getSeat(request.getSeatId());
semanticValidatePay(request, customer, projection, seat);
if (projection.isBooked(seat)) {
presenter.presentSeatAlreadyBookedError(new SeatErrorResponse("The place has already been booked"));
presenter.presentSeatAlreadyBookedError(new SeatErrorReply("The place has already been booked"));
} else {
//-DECORATOR-//
var ticket = new Ticket(0, projection.getBasePrice(), customer, seat, projection);
Expand All @@ -197,7 +197,7 @@ public void pay(PaymentRequest request) {
));
ticketRepository.saveTicket(ticket);
emailService.sendMail(new EmailServiceRequest(request.getEmail(), "Payment receipt"));
presenter.presentTicket(new TicketResponse(new TicketDto(ticket)));
presenter.presentTicket(new TicketReply(new TicketDto(ticket)));
}
} catch (Request.NullRequestException e) {
presenter.presentNullRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.ttbmp.cinehub.app.repository.RepositoryException;
import com.ttbmp.cinehub.app.service.payment.PaymentServiceException;
import com.ttbmp.cinehub.app.usecase.buyticket.response.*;
import com.ttbmp.cinehub.app.usecase.buyticket.reply.*;
import com.ttbmp.cinehub.app.utilities.request.AuthenticatedRequest;
import com.ttbmp.cinehub.app.utilities.request.Request;

Expand All @@ -11,15 +11,15 @@
*/
public interface BuyTicketPresenter {

void presentMovieList(MovieListResponse response);
void presentMovieList(MovieListReply reply);

void presentCinemaList(CinemaListResponse response);
void presentCinemaList(CinemaListReply reply);

void presentProjectionList(ProjectionListResponse response);
void presentProjectionList(ProjectionListReply reply);

void presentSeatList(SeatListResponse response);
void presentSeatList(SeatListReply reply);

void presentTicket(TicketResponse response);
void presentTicket(TicketReply reply);

void presentInvalidRequest(Request request);

Expand All @@ -31,7 +31,7 @@ public interface BuyTicketPresenter {

void presentRepositoryError(RepositoryException exception);

void presentSeatAlreadyBookedError(SeatErrorResponse response);
void presentSeatAlreadyBookedError(SeatErrorReply reply);

void presentPaymentServiceException(PaymentServiceException exception);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ttbmp.cinehub.app.usecase.buyticket.response;
package com.ttbmp.cinehub.app.usecase.buyticket.reply;

import com.ttbmp.cinehub.app.dto.CinemaDto;

Expand All @@ -7,11 +7,11 @@
/**
* @author Ivan Palmieri
*/
public class CinemaListResponse {
public class CinemaListReply {

private final List<CinemaDto> cinemaList;

public CinemaListResponse(List<CinemaDto> cinemaList) {
public CinemaListReply(List<CinemaDto> cinemaList) {
this.cinemaList = cinemaList;

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ttbmp.cinehub.app.usecase.buyticket.response;
package com.ttbmp.cinehub.app.usecase.buyticket.reply;

import com.ttbmp.cinehub.app.dto.MovieDto;

Expand All @@ -7,11 +7,11 @@
/**
* @author Ivan Palmieri
*/
public class MovieListResponse {
public class MovieListReply {

private final List<MovieDto> movieList;

public MovieListResponse(List<MovieDto> movieList) {
public MovieListReply(List<MovieDto> movieList) {
this.movieList = movieList;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.ttbmp.cinehub.app.usecase.buyticket.response;
package com.ttbmp.cinehub.app.usecase.buyticket.reply;

import com.ttbmp.cinehub.app.dto.ProjectionDto;

import java.util.ArrayList;
import java.util.List;

public class ProjectionListResponse {
public class ProjectionListReply {


private final List<ProjectionDto> projectionDtoList;
private final List<String> projectionDtoTime = new ArrayList<>();

public ProjectionListResponse(List<ProjectionDto> projectionDtoList) {
public ProjectionListReply(List<ProjectionDto> projectionDtoList) {
this.projectionDtoList = projectionDtoList;
for (var projection : projectionDtoList) {
addProjectionDtoTime(projection.getStartTime());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.ttbmp.cinehub.app.usecase.buyticket.response;
package com.ttbmp.cinehub.app.usecase.buyticket.reply;

public class SeatErrorResponse {
public class SeatErrorReply {

private String error;

public SeatErrorResponse(String error) {
public SeatErrorReply(String error) {
this.error = error;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ttbmp.cinehub.app.usecase.buyticket.response;
package com.ttbmp.cinehub.app.usecase.buyticket.reply;

import com.ttbmp.cinehub.app.dto.SeatDto;

Expand All @@ -7,11 +7,11 @@
/**
* @author Ivan Palmieri
*/
public class SeatListResponse {
public class SeatListReply {

private final List<SeatDto> seatDtoList;

public SeatListResponse(List<SeatDto> seatDtoList) {
public SeatListReply(List<SeatDto> seatDtoList) {
this.seatDtoList = seatDtoList;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.ttbmp.cinehub.app.usecase.buyticket.response;
package com.ttbmp.cinehub.app.usecase.buyticket.reply;

import com.ttbmp.cinehub.app.dto.TicketDto;

/**
* @author Ivan Palmieri
*/
public class TicketResponse {
public class TicketReply {

private final TicketDto ticketDto;

public TicketResponse(TicketDto ticketDto) {
public TicketReply(TicketDto ticketDto) {
this.ticketDto = ticketDto;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class PaymentRequest extends AuthenticatedRequest {
public static final Request.Error LENGTH_CVV_CREDIT_CARD_ERROR = new Request.Error("The CVV must be three numbers in length");
public static final Request.Error EXPIRATION_CREDIT_CARD_ERROR = new Request.Error("You cannot select a date in the past");
public static final Request.Error EMAIL_ERROR = new Request.Error("The email entered is syntactically incorrect");
public static final Request.Error CREDIT_CARD_LENGTH_ERROR = new Request.Error("The credit card must have a minimum length of 12 characters and a maximum of 16 characters");
public static final Request.Error CREDIT_CARD_LENGTH_ERROR = new Request.Error("The credit card must have a length of 16 characters");
public static final Request.Error CVV_LETTERS_ERROR = new Request.Error("The CVV cannot contain letters");
public static final Request.Error NUMBER_OF_CARD_LETTERS_ERROR = new Request.Error("The number of card cannot contain letters");
public static final Request.Error MISSING_OPTION_ONE_ERROR = new Request.Error("Option one can't be null");
Expand Down Expand Up @@ -150,9 +150,6 @@ public void onValidate() {
if (!email.contains("@")) {
addError(EMAIL_ERROR);
}
if (!email.contains(".")) {
addError(EMAIL_ERROR);
}
if (magicBoxOption == null) {
addError(MISSING_OPTION_ONE_ERROR);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public void getUserRoles(RoleRequest request) {
AuthenticatedRequest.validate(request, securityService, permissions);
var user = userRepository.getUser(request.getUserId());
var roleList = user.getRoleList().stream()
.map(RoleResponse.Role::getRole)
.map(RoleReply.Role::getRole)
.collect(Collectors.toList());
presenter.present(new RoleResponse(roleList));
presenter.present(new RoleReply(roleList));
} catch (Request.NullRequestException e) {
presenter.presentNullRequest();
} catch (Request.InvalidRequestException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public interface GetUserRolePresenter {

void present(RoleResponse response);
void present(RoleReply reply);

void presentInvalidRequest(Request request);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import static com.ttbmp.cinehub.domain.security.Role.*;

public class RoleResponse {
public class RoleReply {

private final List<Role> roleList;

public RoleResponse(List<Role> roleList) {
public RoleReply(List<Role> roleList) {
this.roleList = roleList;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void login(LoginRequest request) {
try {
Request.validate(request);
var sessionToken = securityService.authenticate(request.getUsername(), request.getPassword());
presenter.presentSessionToken(new LoginResponse(sessionToken));
presenter.presentSessionToken(new LoginReply(sessionToken));
} catch (Request.NullRequestException e) {
presenter.presentNullRequest();
} catch (Request.InvalidRequestException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public interface LoginPresenter {

void presentSessionToken(LoginResponse response);
void presentSessionToken(LoginReply reply);

void presentInvalidRequest(Request request);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.ttbmp.cinehub.app.usecase.login;

public class LoginResponse {
public class LoginReply {

String sessionCookie;

public LoginResponse(String sessionCookie) {
public LoginReply(String sessionCookie) {
this.sessionCookie = sessionCookie;
}

Expand Down
Loading

0 comments on commit 32fbc61

Please sign in to comment.