Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad45123 committed May 12, 2024
1 parent 4a4d5b2 commit b9417aa
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
import com.workup.shared.commands.contracts.responses.MarkPaymentCompletedResponse;
import com.workup.shared.commands.contracts.responses.ViewContractMilestonesResponse;
import com.workup.shared.enums.ServiceQueueNames;

import java.util.concurrent.CompletableFuture;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -29,37 +27,45 @@ public class RabbitMQListener {

@RabbitHandler
@Async
public CompletableFuture<InitiateContractResponse> receive(InitiateContractRequest in) throws Exception {
public CompletableFuture<InitiateContractResponse> receive(InitiateContractRequest in)
throws Exception {
InitiateContractResponse response =
((InitiateContractCommand) commandMap.getCommand("InitiateContract")).Run(in);
return CompletableFuture.completedFuture(response);
}

@RabbitHandler
@Async
public CompletableFuture<ContractTerminationResponse> receive(ContractTerminationRequest in) throws Exception {
return CompletableFuture.completedFuture(((RequestContractTerminationCommand) commandMap.getCommand("RequestContractTermination"))
.Run(in));
public CompletableFuture<ContractTerminationResponse> receive(ContractTerminationRequest in)
throws Exception {
return CompletableFuture.completedFuture(
((RequestContractTerminationCommand) commandMap.getCommand("RequestContractTermination"))
.Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<HandleTerminationResponse> receive(HandleTerminationRequest in) throws Exception {
return CompletableFuture.completedFuture(((HandleTerminationRequestCommand) commandMap.getCommand("HandleTerminationRequest"))
.Run(in));
public CompletableFuture<HandleTerminationResponse> receive(HandleTerminationRequest in)
throws Exception {
return CompletableFuture.completedFuture(
((HandleTerminationRequestCommand) commandMap.getCommand("HandleTerminationRequest"))
.Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<MarkPaymentCompletedResponse> receive(MarkPaymentCompletedRequest in) throws Exception {
return CompletableFuture.completedFuture(((MarkMilestoneAsPaidCommand) commandMap.getCommand("MarkMilestoneAsPaid")).Run(in));
public CompletableFuture<MarkPaymentCompletedResponse> receive(MarkPaymentCompletedRequest in)
throws Exception {
return CompletableFuture.completedFuture(
((MarkMilestoneAsPaidCommand) commandMap.getCommand("MarkMilestoneAsPaid")).Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<ViewContractMilestonesResponse> receive(ViewContractMilestonesRequest in) throws Exception {
return CompletableFuture.completedFuture(((ViewContractMilestonesCommand) commandMap.getCommand("ViewContractMilestones"))
.Run(in));
public CompletableFuture<ViewContractMilestonesResponse> receive(ViewContractMilestonesRequest in)
throws Exception {
return CompletableFuture.completedFuture(
((ViewContractMilestonesCommand) commandMap.getCommand("ViewContractMilestones")).Run(in));
}
// NEW_COMMAND_BOILERPLATE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import com.workup.shared.commands.jobs.responses.GetMyJobsResponse;
import com.workup.shared.commands.jobs.responses.SearchJobsResponse;
import com.workup.shared.enums.ServiceQueueNames;

import java.util.concurrent.CompletableFuture;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -50,7 +48,8 @@ public CompletableFuture<CreateJobResponse> receive(CreateJobRequest in) throws

@RabbitHandler
@Async
public CompletableFuture<CreateProposalResponse> receive(CreateProposalRequest in) throws Exception {
public CompletableFuture<CreateProposalResponse> receive(CreateProposalRequest in)
throws Exception {
CreateProposalResponse response =
((CreateProposalCommand) commandMap.getCommand("CreateProposal")).Run(in);
return CompletableFuture.completedFuture(response);
Expand Down Expand Up @@ -82,23 +81,26 @@ public CompletableFuture<GetMyJobsResponse> receive(GetMyJobsRequest request) th

@RabbitHandler
@Async
public CompletableFuture<AcceptProposalResponse> receive(AcceptProposalRequest request) throws Exception {
public CompletableFuture<AcceptProposalResponse> receive(AcceptProposalRequest request)
throws Exception {
AcceptProposalResponse response =
((AcceptProposalCommand) commandMap.getCommand("AcceptProposal")).Run(request);
return CompletableFuture.completedFuture(response);
}

@RabbitHandler
@Async
public CompletableFuture<GetProposalsByJobIdResponse> receive(GetProposalsByJobIdRequest request) throws Exception {
public CompletableFuture<GetProposalsByJobIdResponse> receive(GetProposalsByJobIdRequest request)
throws Exception {
GetProposalsByJobIdResponse response =
((GetProposalsByJobIdCommand) commandMap.getCommand("GetProposalsByJobId")).Run(request);
return CompletableFuture.completedFuture(response);
}

@RabbitHandler
@Async
public CompletableFuture<GetMyProposalsResponse> receive(GetMyProposalsRequest request) throws Exception {
public CompletableFuture<GetMyProposalsResponse> receive(GetMyProposalsRequest request)
throws Exception {
GetMyProposalsResponse response =
((GetMyProposalsCommand) commandMap.getCommand("GetMyProposals")).Run(request);
return CompletableFuture.completedFuture(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import com.workup.shared.commands.contracts.responses.InitiateContractResponse;
import com.workup.shared.enums.HttpStatusCode;
import com.workup.shared.enums.ServiceQueueNames;

import java.util.concurrent.CompletableFuture;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.scheduling.annotation.Async;
Expand All @@ -21,10 +19,12 @@ public class ContractsMockingListener {

@RabbitHandler
@Async
public CompletableFuture<InitiateContractResponse> receive(InitiateContractRequest in) throws Exception {
return CompletableFuture.completedFuture(InitiateContractResponse.builder()
.withContractId(contractIdToBeReturned)
.withStatusCode(statusCodeToBeReturned)
.build());
public CompletableFuture<InitiateContractResponse> receive(InitiateContractRequest in)
throws Exception {
return CompletableFuture.completedFuture(
InitiateContractResponse.builder()
.withContractId(contractIdToBeReturned)
.withStatusCode(statusCodeToBeReturned)
.build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
import com.workup.shared.commands.payments.wallettransaction.responses.GetWalletTransactionsResponse;
import com.workup.shared.commands.payments.wallettransaction.responses.WithdrawFromWalletResponse;
import com.workup.shared.enums.ServiceQueueNames;

import java.util.concurrent.CompletableFuture;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -46,92 +44,111 @@ public class RabbitMQListener {

@RabbitHandler
@Async
public CompletableFuture<CreatePaymentRequestResponse> receive(CreatePaymentRequestRequest in) throws Exception {
return CompletableFuture.completedFuture(((CreatePaymentRequestCommand) commandMap.getCommand("CreatePaymentRequest")).Run(in));
public CompletableFuture<CreatePaymentRequestResponse> receive(CreatePaymentRequestRequest in)
throws Exception {
return CompletableFuture.completedFuture(
((CreatePaymentRequestCommand) commandMap.getCommand("CreatePaymentRequest")).Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<CreateWalletTransactionResponse> receive(CreateWalletTransactionRequest in)
throws Exception {
return CompletableFuture.completedFuture(((CreateWalletTransactionCommand) commandMap.getCommand("CreateWalletTransaction"))
.Run(in));
public CompletableFuture<CreateWalletTransactionResponse> receive(
CreateWalletTransactionRequest in) throws Exception {
return CompletableFuture.completedFuture(
((CreateWalletTransactionCommand) commandMap.getCommand("CreateWalletTransaction"))
.Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<GetClientPaymentRequestsResponse> receive(GetClientPaymentRequestsRequest in)
throws Exception {
return CompletableFuture.completedFuture(((GetClientPaymentRequestsCommand) commandMap.getCommand("GetClientPaymentRequests"))
.Run(in));
public CompletableFuture<GetClientPaymentRequestsResponse> receive(
GetClientPaymentRequestsRequest in) throws Exception {
return CompletableFuture.completedFuture(
((GetClientPaymentRequestsCommand) commandMap.getCommand("GetClientPaymentRequests"))
.Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<GetWalletTransactionResponse> receive(GetWalletTransactionRequest in) throws Exception {
return CompletableFuture.completedFuture(((GetWalletTransactionCommand) commandMap.getCommand("GetWalletTransaction")).Run(in));
public CompletableFuture<GetWalletTransactionResponse> receive(GetWalletTransactionRequest in)
throws Exception {
return CompletableFuture.completedFuture(
((GetWalletTransactionCommand) commandMap.getCommand("GetWalletTransaction")).Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<GetWalletTransactionsResponse> receive(GetWalletTransactionsRequest in) throws Exception {
return CompletableFuture.completedFuture(((GetWalletTransactionsCommand) commandMap.getCommand("GetWalletTransactions")).Run(in));
public CompletableFuture<GetWalletTransactionsResponse> receive(GetWalletTransactionsRequest in)
throws Exception {
return CompletableFuture.completedFuture(
((GetWalletTransactionsCommand) commandMap.getCommand("GetWalletTransactions")).Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<WithdrawFromWalletResponse> receive(WithdrawFromWalletRequest in) throws Exception {
return CompletableFuture.completedFuture(((WithdrawFromWalletCommand) commandMap.getCommand("WithdrawFromWallet")).Run(in));
public CompletableFuture<WithdrawFromWalletResponse> receive(WithdrawFromWalletRequest in)
throws Exception {
return CompletableFuture.completedFuture(
((WithdrawFromWalletCommand) commandMap.getCommand("WithdrawFromWallet")).Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<GetFreelancerPaymentRequestsResponse> receive(GetFreelancerPaymentRequestsRequest in)
throws Exception {
return CompletableFuture.completedFuture(((GetFreelancerPaymentRequestsCommand)
commandMap.getCommand("GetFreelancerPaymentRequests"))
.Run(in));
public CompletableFuture<GetFreelancerPaymentRequestsResponse> receive(
GetFreelancerPaymentRequestsRequest in) throws Exception {
return CompletableFuture.completedFuture(
((GetFreelancerPaymentRequestsCommand)
commandMap.getCommand("GetFreelancerPaymentRequests"))
.Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<GetPaymentRequestResponse> receive(GetPaymentRequestRequest in) throws Exception {
return CompletableFuture.completedFuture(((GetPaymentRequestCommand) commandMap.getCommand("GetPaymentRequest")).Run(in));
public CompletableFuture<GetPaymentRequestResponse> receive(GetPaymentRequestRequest in)
throws Exception {
return CompletableFuture.completedFuture(
((GetPaymentRequestCommand) commandMap.getCommand("GetPaymentRequest")).Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<PayPaymentRequestResponse> receive(PayPaymentRequestRequest in) throws Exception {
return CompletableFuture.completedFuture(((PayPaymentRequestCommand) commandMap.getCommand("PayPaymentRequest")).Run(in));
public CompletableFuture<PayPaymentRequestResponse> receive(PayPaymentRequestRequest in)
throws Exception {
return CompletableFuture.completedFuture(
((PayPaymentRequestCommand) commandMap.getCommand("PayPaymentRequest")).Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<CreateWalletResponse> receive(CreateWalletRequest in) throws Exception {
return CompletableFuture.completedFuture(((CreateWalletCommand) commandMap.getCommand("CreateWallet")).Run(in));
return CompletableFuture.completedFuture(
((CreateWalletCommand) commandMap.getCommand("CreateWallet")).Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<GetWalletResponse> receive(GetWalletRequest in) throws Exception {
return CompletableFuture.completedFuture(((GetWalletCommand) commandMap.getCommand("GetWallet")).Run(in));
return CompletableFuture.completedFuture(
((GetWalletCommand) commandMap.getCommand("GetWallet")).Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<GetClientPaymentTransactionsResponse> receive(GetClientPaymentTransactionsRequest in)
throws Exception {
return CompletableFuture.completedFuture(((GetClientPaymentTransactionsCommand)
commandMap.getCommand("GetClientPaymentTransactions"))
.Run(in));
public CompletableFuture<GetClientPaymentTransactionsResponse> receive(
GetClientPaymentTransactionsRequest in) throws Exception {
return CompletableFuture.completedFuture(
((GetClientPaymentTransactionsCommand)
commandMap.getCommand("GetClientPaymentTransactions"))
.Run(in));
}

@RabbitHandler
@Async
public CompletableFuture<GetFreelancerPaymentTransactionsResponse> receive(
GetFreelancerPaymentTransactionsRequest in) throws Exception {
return CompletableFuture.completedFuture(((GetFreelancerPaymentTransactionsCommand)
commandMap.getCommand("GetFreelancerPaymentTransactions"))
.Run(in));
return CompletableFuture.completedFuture(
((GetFreelancerPaymentTransactionsCommand)
commandMap.getCommand("GetFreelancerPaymentTransactions"))
.Run(in));
}
}
Loading

0 comments on commit b9417aa

Please sign in to comment.