Communication amend test.
This commit is contained in:
@@ -260,5 +260,12 @@ public class GepafinConstant {
|
|||||||
public static final String S3_PATH_CONFIG_DUPLICATE_TYPE_ALREADY_EXIST ="s3.path.config.already.exist.";
|
public static final String S3_PATH_CONFIG_DUPLICATE_TYPE_ALREADY_EXIST ="s3.path.config.already.exist.";
|
||||||
public static final String S3_PATH_GENERATION_ERROR_MSG ="s3.path.config.already.exist.";
|
public static final String S3_PATH_GENERATION_ERROR_MSG ="s3.path.config.already.exist.";
|
||||||
public static final String INVALID_APPLICATION_STATUS = "invalid.application.status";
|
public static final String INVALID_APPLICATION_STATUS = "invalid.application.status";
|
||||||
|
|
||||||
|
public static final String COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS = "added.comment.to.amendment.request.success";
|
||||||
|
public static final String AMENDMENT_NOT_FOUND = "amendment.not.found";
|
||||||
|
public static final String COMMENT_NOT_FOUND = "comment.not.found";
|
||||||
|
public static final String COMMENT_UPDATED_SUCCESS_MSG = "comment.updated.successfully";
|
||||||
|
public static final String COMMENT_DELETED_SUCCESS_MSG = "comment.deleted.successfully";
|
||||||
|
public static final String COMMENT_NOT_ASSOCIATE_WITH_AMENDMENT_ID_ERROR_MSG = "comment.not.associate.with.amendment";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.repositories.CommunicationAmendmentRepository;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.ApplicationAmendmentRepository;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class CommunicationAmendmentDao {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(CommunicationAmendmentDao.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CommunicationAmendmentRepository communicationAmendmentRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ApplicationAmendmentRepository applicationAmendmentRepository;
|
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// ApplicationAmendmentRequestRepository applicationAmendmentRequestRepository;
|
||||||
|
|
||||||
|
public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationReq) {
|
||||||
|
|
||||||
|
log.info("Adding communication request...");
|
||||||
|
|
||||||
|
// Fetch amendment request by ID to set the relationship
|
||||||
|
ApplicationAmendmentRequestEntity amendmentRequest = applicationAmendmentRepository
|
||||||
|
.findAmendmentById(communicationReq.getAmendmentId());
|
||||||
|
// Create and populate CommunicationAmendmentEntity
|
||||||
|
CommunicationAmendmentEntity communicationAmendmentEntity = new CommunicationAmendmentEntity();
|
||||||
|
communicationAmendmentEntity.setAmendmentRequest(amendmentRequest);
|
||||||
|
communicationAmendmentEntity.setCommunicationTitle(communicationReq.getTitle());
|
||||||
|
communicationAmendmentEntity.setCommunicationComment(communicationReq.getComment());
|
||||||
|
communicationAmendmentEntity.setIsDeleted(false);
|
||||||
|
|
||||||
|
// Save the communication amendment entity
|
||||||
|
communicationAmendmentEntity = communicationAmendmentRepository.save(communicationAmendmentEntity);
|
||||||
|
log.info("Added comment: {}", communicationAmendmentEntity);
|
||||||
|
|
||||||
|
// Convert and return the response bean
|
||||||
|
return convertToCommunicationResponseBean(communicationAmendmentEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String deleteCommunicationAmendmentComment(Long amendmentId, Long commentId) {
|
||||||
|
// Optional<ApplicationAmendmentRequestEntity> amendmentData = communicationAmendmentRepository.findById(amendmentId);
|
||||||
|
// if(amendmentData.isEmpty()) {
|
||||||
|
// throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_ASSOCIATE_WITH_AMENDMENT_ID_ERROR_MSG));
|
||||||
|
// }
|
||||||
|
Optional<CommunicationAmendmentEntity> data = communicationAmendmentRepository.findById(commentId);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.COMMENT_NOT_FOUND));
|
||||||
|
}
|
||||||
|
communicationAmendmentRepository.deleteById(commentId);
|
||||||
|
return "Deleted Comment Successfully.";
|
||||||
|
}
|
||||||
|
public CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean) {
|
||||||
|
|
||||||
|
log.info("Updating communication comment...");
|
||||||
|
CommunicationAmendmentEntity communicationAmendmentEntity = convertToCommunicationAmendmentEntity(communicationRequestBean);
|
||||||
|
communicationAmendmentEntity = communicationAmendmentRepository.save(communicationAmendmentEntity);
|
||||||
|
log.info("Updated Comment {}", communicationAmendmentEntity);
|
||||||
|
return convertToCommunicationResponseBean(communicationAmendmentEntity);
|
||||||
|
|
||||||
|
}
|
||||||
|
public CommunicationResponseBean getAmendmentComments(Long amendmentId, Long commentId) {
|
||||||
|
// Optional<ApplicationAmendmentRequestEntity> amendmentData = communicationAmendmentRepository.findById(amendmentId);
|
||||||
|
// if(amendmentData.isEmpty()) {
|
||||||
|
// throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.AMENDMENT_NOT_FOUND));
|
||||||
|
// }
|
||||||
|
CommunicationAmendmentEntity commentData = communicationAmendmentRepository.findCommentsById(commentId);
|
||||||
|
CommunicationResponseBean data = convertToCommunicationResponseBean1(commentData);
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}
|
||||||
|
private CommunicationResponseBean convertToCommunicationResponseBean(CommunicationAmendmentEntity entity) {
|
||||||
|
|
||||||
|
CommunicationResponseBean response = new CommunicationResponseBean();
|
||||||
|
response.setComment(entity.getCommunicationComment());
|
||||||
|
response.setCommunicationAddedDate(Instant.now());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
private CommunicationResponseBean convertToCommunicationResponseBean1(CommunicationAmendmentEntity entity) {
|
||||||
|
|
||||||
|
CommunicationResponseBean response = new CommunicationResponseBean();
|
||||||
|
response.setComment(entity.getCommunicationComment());
|
||||||
|
response.setCommunicationAddedDate(Instant.now());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CommunicationAmendmentEntity convertToCommunicationAmendmentEntity(CommunicationRequestBean communicationReq) {
|
||||||
|
|
||||||
|
CommunicationAmendmentEntity communicationAmendmentEntity = new CommunicationAmendmentEntity();
|
||||||
|
ApplicationAmendmentRequestEntity entity = applicationAmendmentRepository.findAmendmentById(communicationReq.getAmendmentId());
|
||||||
|
if (entity == null) {
|
||||||
|
throw new CustomValidationException(Status.NOT_FOUND, "Amendment Request not found for id: " + communicationReq.getAmendmentId());
|
||||||
|
}
|
||||||
|
communicationAmendmentEntity.setAmendmentRequest(entity);
|
||||||
|
communicationAmendmentEntity.setCommunicationTitle(communicationReq.getComment());
|
||||||
|
communicationAmendmentEntity.setCommunicationComment(communicationReq.getComment());
|
||||||
|
return communicationAmendmentEntity;
|
||||||
|
}
|
||||||
|
public ApplicationAmendmentRequestEntity getAmendmentRequestById(Long id) {
|
||||||
|
|
||||||
|
if(id==null){
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST, "Please provide amendmentId" + null);
|
||||||
|
}
|
||||||
|
ApplicationAmendmentRequestEntity applicationAmendmentData = applicationAmendmentRepository.findAmendmentById(id);
|
||||||
|
if(Boolean.FALSE.equals(applicationAmendmentData)){
|
||||||
|
throw new CustomValidationException(Status.NOT_FOUND, "Amendment Request not found for id: " + applicationAmendmentData.getId());
|
||||||
|
}
|
||||||
|
return applicationAmendmentData;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.ElementCollection;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "application_amendment_request")
|
||||||
|
@Data
|
||||||
|
public class ApplicationAmendmentRequestEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@Column(name = "NOTE")
|
||||||
|
private String note;
|
||||||
|
|
||||||
|
@Column(name = "RESPONSE_DAYS")
|
||||||
|
private Long responseDays;
|
||||||
|
|
||||||
|
@Column(name = "IS_NOTIFICATION")
|
||||||
|
private Boolean isNotification;
|
||||||
|
|
||||||
|
@Column(name = "IS_EMAIL")
|
||||||
|
private Boolean isEmail;
|
||||||
|
|
||||||
|
@ElementCollection
|
||||||
|
@Column(name = "FIELD_ID")
|
||||||
|
private List<String> fieldId;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "amendmentRequest", cascade = CascadeType.ALL)
|
||||||
|
private List<CommunicationAmendmentEntity> communicationAmendmentEntities;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package net.gepafin.tendermanagement.entities;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "communication_amendment")
|
||||||
|
@Data
|
||||||
|
public class CommunicationAmendmentEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@Column(name = "COMMUNICATION_TITLE")
|
||||||
|
private String communicationTitle;
|
||||||
|
|
||||||
|
@Column(name = "COMMUNICATION_COMMENT")
|
||||||
|
private String communicationComment;
|
||||||
|
|
||||||
|
@Column(name = "IS_DELETED")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "AMENDMENT_ID", referencedColumnName = "id", nullable = false)
|
||||||
|
private ApplicationAmendmentRequestEntity amendmentRequest;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CommunicationRequestBean {
|
||||||
|
private String title;
|
||||||
|
private String comment;
|
||||||
|
private Long amendmentId;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CommunicationResponseBean {
|
||||||
|
private Instant communicationAddedDate;
|
||||||
|
private String comment;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface CommunicationAmendmentRepository extends JpaRepository<CommunicationAmendmentEntity, Long> {
|
||||||
|
|
||||||
|
@Query("Select c from CommunicationAmendmentEntity c Where c.id = :id")
|
||||||
|
CommunicationAmendmentEntity findCommentsById(@Param("id") Long id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package net.gepafin.tendermanagement.service;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface CommunicationAmendmentService {
|
||||||
|
CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean);
|
||||||
|
|
||||||
|
String deleteCommunicationAmendmentComment(Long amendmentId, Long commentId);
|
||||||
|
|
||||||
|
CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean);
|
||||||
|
|
||||||
|
CommunicationResponseBean getAmendmentComments(Long id, Long commentId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package net.gepafin.tendermanagement.service.impl;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.dao.CommunicationAmendmentDao;
|
||||||
|
import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.service.CommunicationAmendmentService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CommunicationAmendmentServiceImpl implements CommunicationAmendmentService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CommunicationAmendmentDao communicationAmendmentDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommunicationResponseBean addCommentToAmendmentRequest(CommunicationRequestBean communicationRequestBean) {
|
||||||
|
return communicationAmendmentDao.addCommentToAmendmentRequest(communicationRequestBean);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String deleteCommunicationAmendmentComment(Long amendmentId, Long commentId) {
|
||||||
|
|
||||||
|
return communicationAmendmentDao.deleteCommunicationAmendmentComment(amendmentId, commentId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public CommunicationResponseBean updateCommunicationAmendment(CommunicationRequestBean communicationRequestBean) {
|
||||||
|
|
||||||
|
return communicationAmendmentDao.updateCommunicationAmendment(communicationRequestBean);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public CommunicationResponseBean getAmendmentComments(Long id, Long commentId) {
|
||||||
|
|
||||||
|
return communicationAmendmentDao.getAmendmentComments(id, commentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api;
|
||||||
|
|
||||||
|
import feign.Param;
|
||||||
|
import net.gepafin.tendermanagement.entities.ApplicationAmendmentRequestEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface ApplicationAmendmentRepository extends JpaRepository<ApplicationAmendmentRequestEntity, Long> {
|
||||||
|
|
||||||
|
@Query("SELECT app FROM ApplicationAmendmentRequestEntity app WHERE app.id = :id")
|
||||||
|
ApplicationAmendmentRequestEntity findAmendmentById(@Param("id") Long id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Validated
|
||||||
|
public interface CommunicationAmendmentApi {
|
||||||
|
@Operation(summary = "Api to create communication amendment comment", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@PostMapping(value = "", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, @Parameter CommunicationRequestBean communicationResponseBean);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to Get Amendment request comment", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@GetMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<CommunicationResponseBean>> getAmendmentComments(HttpServletRequest request, @Param(value = "amendmentId") Long id,
|
||||||
|
@Param(value = "commentId") Long commentId);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to update communication comments", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@PutMapping(value = "", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request, @Parameter CommunicationRequestBean communicationResponseBean);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to delete communication comments", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
|
@DeleteMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
|
||||||
|
ResponseEntity<Response<String>> deleteApplicationAmendmentComment(HttpServletRequest request, @Param(value = "amendmentId")Long amendmentId, @Param(value = "commentId")Long commentId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.entities.CommunicationAmendmentEntity;
|
||||||
|
import net.gepafin.tendermanagement.model.request.CommunicationRequestBean;
|
||||||
|
import net.gepafin.tendermanagement.model.response.CommunicationResponseBean;
|
||||||
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
|
import net.gepafin.tendermanagement.service.CommunicationAmendmentService;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.CommunicationAmendmentApi;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("${openapi.gepafin.base-path:/v1/communication-amendment}")
|
||||||
|
public class CommunicationAmendmentController implements CommunicationAmendmentApi {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CommunicationAmendmentService communicationAmendmentService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request, CommunicationRequestBean communicationRequestBean) {
|
||||||
|
|
||||||
|
CommunicationResponseBean communicationResponseBean = communicationAmendmentService.addCommentToAmendmentRequest(communicationRequestBean);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS)));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<CommunicationResponseBean>> getAmendmentComments(HttpServletRequest request, Long id, Long commentId) {
|
||||||
|
|
||||||
|
CommunicationResponseBean communicationResponseBean = communicationAmendmentService.getAmendmentComments(id, commentId);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS)));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request, CommunicationRequestBean communicationRequestBean) {
|
||||||
|
|
||||||
|
CommunicationResponseBean communicationResponseBean = communicationAmendmentService.updateCommunicationAmendment(communicationRequestBean);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS)));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<Response<String>> deleteApplicationAmendmentComment(HttpServletRequest request, Long applicationAmendId, Long commentId) {
|
||||||
|
|
||||||
|
String communicationResponseBean = communicationAmendmentService.deleteCommunicationAmendmentComment(applicationAmendId, commentId);
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(new Response<>(communicationResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.COMMUNICATION_ADDED_TO_AMENDMENT_REQUEST_SUCCESS)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1483,6 +1483,62 @@
|
|||||||
</insert>
|
</insert>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="25-10-2024_4" author="Piyush">
|
||||||
|
<createTable tableName="application_amendment_request">
|
||||||
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
|
<constraints nullable="false" primaryKey="true" primaryKeyName="application_amendment_request_pkey"/>
|
||||||
|
</column>
|
||||||
|
<column name="note" type="TEXT">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="response_days" type="INTEGER">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="is_notification" type="BOOLEAN">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="is_email" type="BOOLEAN">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="field_id" type="TEXT">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="25-10-2024_3" author="Piyush">
|
||||||
|
<createTable tableName="communication_amendment">
|
||||||
|
<column name="id" type="INTEGER" autoIncrement="true">
|
||||||
|
<constraints nullable="false" primaryKey="true" primaryKeyName="communication_amendment_pkey"/>
|
||||||
|
</column>
|
||||||
|
<column name="communication_title" type="VARCHAR(255)">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="communication_comment" type="TEXT">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="is_deleted" type="BOOLEAN" defaultValueBoolean="false">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="amendment_id" type="INTEGER">
|
||||||
|
<constraints nullable="false" foreignKeyName="fk_amendment_id" references="application_amendment_request(id)"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
Reference in New Issue
Block a user