Skip to content

Commit

Permalink
Develop to master v1.0 for works-release (#1622)
Browse files Browse the repository at this point in the history
* [PFM-4665] removed splitting of tenant ids from all services (#1509)

* [PFM-4665] removed splitting of tenant ids from all services

* [PFM-4665]-removed-multiple-mdms-calls-from-estimates

* [PFM-4665] fixed multiple mdms calls in organization service

* fixed multiple mdms calls for expense service

* fixed test cases for estimate serrvice

* [PFM-4665]-removed-multiple-mdms-calls-from-estimates

* fixed the test cases

* Update AttendanceServiceValidator.java

* removed commented tenant ids

* fixed

* fixed user util

* Update ifms-adapter.iml

* Delete reference-adapters/ifms-adapter/ifms-adapter.iml

* Update CODEOWNERS

---------

Co-authored-by: Jagankumar <[email protected]>

* Pfm 1778 update estimate service documentation (#1521)

* [PFM-1778] Added new postman collection for estimate service

* Delete backend/estimates/Estimate Service Collection.postman_collection.json

* Update Estimate_Service_Collection.postman_collection.json

* Estimate sor cherry pick old (#1527)

* added estimate changes from sorid-updated-estimate branch

* check rates only if category sor

* added flyway migration script

* removing validator for testing

* adding mdms criteria models

* removed estimate update validator

* added check if estimateDetails measurements are 0

* Changed Estimate validator from mdmsv2/v2 to mdmsv2/v1

* changed mdms search url from v2 to v1 and mdmsRes to MdmsRes

* added check for SOR for update call

* added check for SOR for update call

* PFM-4879-Order by query fix (#1489)

* made changes in validator to throw proper error

* [PFM-4891] added validations for all fields (#1495)

* [PFM-4891] fixed test cases for estimate-sor-cherry-pick

* [PFM-4892] added all the validations for sor, non sor and overheads (#1500)

* [PFM-4892] added all the validations for sor, non sor and overheads

* [PFM-4892] added required validations for multiple sors

* Setting audit details for update call

* refractored the code for estimate service (#1503)

* reftactored the code for estimate

* fixed the valid date logic for validator

* refractored the code

* fixed the comments in estimate service

* fixed workflow

* removed comments

* added required validations in estimate service (#1524)

* added required validations in estimate service

* fixed validator

* ii

* removed commented code

* fixed variable names

---------

Co-authored-by: shubhang-egov <[email protected]>
Co-authored-by: shubhang-eGov <[email protected]>

* PFM-4762 Impact of MB on contract service (#1525)

* fixed test case (#1530)

* Mb registry and service (#1518)

* Codegen for measurement service

* Formated files

* Created Service

* Added rowmapper and querybuilder

* Added validator

* Updated measurement model

* updated build config to measurement-service (#1367)

* added build config file for measurment service

* build config file

* updated build config

---------

Co-authored-by: admin1 <[email protected]>

* Codegen for measurement-registry

* fix : fixed postgres driver issue

* feat : implemented create-update-search endpoints

* Refactor : Measurement - registry

* feat : implemented create-update-search endpoints in Measurement-Service

* feat : implemented create-update-search endpoints in Measurement-Service

* Refactor : refactored measurement-service enrichment

* fixed additional details, and removed unused files

* fixed additional details, and removed unused files and dependencies

* fixed additional details, and removed unused files and dependencies

* Feat : implemented validation if workflow status is rejected

* Feat : refactored configuration and application properties

* feat : user who is creating that measurement will be assigned to it if it's saving as a draft

* Refactor : refactored configuration and application properties

* Refactor : refactored MeasurementRegistry.java

* Refactor : removed println lines

* Refactor : added https in filestore host

* Added with build config

* Resolved Controllers during build

* Added Consumer for elasticSearch indexing

* Updated self assignee workflow

* Refactor : implemented restTemplate instead of httpget, renamed msService to MeasurementService

* Feat : Implemented update according to workFlow actions

* Fix : Validation for SOR , NON-SOR line items

* Fix : PFM-4794 & PFM-4791

* Feat : Implemented workflow status based create for MeasurementService

* Refactor : refactored Utils and Validators

* Refactor : refactored Search api functions, Configurations, removed unused files,made string constants for reusability

* Refactor : Renamed files according to module names

* Refactor : Removed unused imports from MBRegistry/Service and removed unused constants from ServiceConstants

* PFM-4185-Added notification feature to measurement service

* Updated models to services-common-2.0.0

* Pfm 4794 wrong error message (#1486)

* PFM-4794-Changed wrong error message if contract is not present

* PFM-4794-Added localisation code

* PFM-4794-Added localisation code (#1491)

* PFM-4879-Sort order ASC DESC fix (#1493)

* PFM-4882 added check for tenantId null (#1494)

* PFM-4875 Added check if WO is in accepted state (#1496)

* PFM-4879 mb service search order

* PFM-4747-Fetching estimate id from contract service change (#1497)

* PFM-4882-TenantId MeasurementService validator (#1498)

* PFM-4601 From and to date search (#1501)

* Removed unwanted object creation

* Pfm 4930 code refactoring (#1506)

* PFM-4930 Removed importing of models that are present in common-services from digit-models.

* PFM-4930 Removed hard coded tenantId

* PFM-4930 Changed id field type from UUID to String with max size 64

* PFM-4930 Removed unused model Order

* PFM-4930 Removed unnecessary conversion

* PFM-4927 Fetching only active measure to add to cumulative value (#1502)

* PFM-4927 Fetching only active measure to add to cumulative value

* PFM-4927 Making searchCriteria isActive default value null

* PFM-4927 Fix for null pointer exception when length, breadth, height or num of items is null of 0

* PFM-4799 added comments field in rowmapper (#1504)

* PFM-4930 taking mdms tenants from state level tenant id instead of seperate configuration

* PFM-4689 Enriched elastic payload with workflow assignee (#1507)

* PFM-4927 Setting is active false when action is rejected (#1508)

* PFM-4930 Added workflow validator

* PFM-4930 Removed ErrorConfiguration class and instead throwing CustomException wherever required

* PFM-4930 Removed ErrorConfiguration class and instead throwing CustomException wherever required for mb registry

* PFM-4930 Removed ErrorConfiguration class and instead throwing CustomException wherever required for mb service

* Revert "PFM-4930 Removed ErrorConfiguration class and instead throwing CustomException wherever required for mb registry"

This reverts commit 388086c.

* Revert "Merge remote-tracking branch 'origin/mb-registry-and-service' into mb-registry-and-service"

This reverts commit b0ca3b0, reversing
changes made to c4279e4.

* Revert "Revert "Merge remote-tracking branch 'origin/mb-registry-and-service' into mb-registry-and-service""

This reverts commit ff996d7.

* Revert "PFM-4930 Removed ErrorConfiguration class and instead throwing CustomException wherever required for mb service"

This reverts commit 31622cb.

* PFM-4930 Error config string in mb registry

* PFM-4930 Removed ErrorConfiguration object creation

* PFM-4930 Removed ErrorConfiguration object creation and consolidated all error strings in one file for mb service

* PFM-4930 Removed Constants from MBServiceConfiguration and moved to constants file

* PFM-4930 Removed unused object and made a function to reduce complexity for mb registry

* PFM-4930 Renamed strings with correct regular expression and removed hard-coding

* Pfm 4953 estimate validator (#1517)

* PFM-4953 added estimate quantity validator

* PFM-4953 used stream filter

* null check for measurement response

* All dimension value 0 fix and error message change

* Referring contract LineItems reference number instead of id as targetId

* changing contract business service check and quantity validation

---------

Co-authored-by: Shailesh Pandey <[email protected]>
Co-authored-by: nitish-egov <[email protected]>
Co-authored-by: admin1 <[email protected]>
Co-authored-by: Rishabh-egov <[email protected]>
Co-authored-by: ashish-egov <[email protected]>
Co-authored-by: Lokendra Tyagi <[email protected]>

* Mb refactor cherry pick (#1535)

* changing contract business service check and added service constants

* refactor code as per sonarlint

* [PFM-4970] Change revision create/update search function requires line item (#1539)

* PFM-4824 Impact of revised contract on MB, changed validator to check for accepted state instead of approve for revised contract. (#1551)

* Pfm 4841 impact of revision estimate on mb (#1549)

* fixed test case

* [PFM-4841] Fixed Impact On MB

* [PFM-4841] added required fields to models

* Pfm 4801 revised estimate (#1536)

* [PFM-4801] revision estimate

* cherry pick develop

* [PFM-4801] revision estimate

* added migration script

* estimate create api

* Update Estimate API

* Search Estimate API

* PFM-4801 refractored the code and added validation for contract

* added measurement validation

* refractored code

* fixed test case

* refractored code

* refractored code

* fixed some changes

* refractored code

* removed mandatory buisness service

* fixed code according to test cases

* added

* fixed workflow inactive

* fixed

* f

* added rate validation

* x

* fixed test case and changed application prop.

* fixed previos line id validation on update

* fixed measurement validation

* added max limit for revision estimate

* fixed code according to sonarlint suggestions

* removed measurement validation in case of Reject action

* fixed a test case

* fixed measurement validation

* fixed measurement validation

* renamed files

* Pfm 4803 contract revision (#1550)

* PFM-4803 Contract Revision create update and validate flows

* PFM-4803 Added validator and cleanup

* PFM-4803 Added logs and cleanup

* PFM-4803 SonarLint changes

* PFM-4803 measurement validator changes and status change

* PFM-4803 change name of kafka classes and main

* PFM-4824 Cumulative value check (#1553)

* Pfm 4807 contract revision validation (#1554)

* PFM-4807 Validation for start date

* PFM-4807 Refactored code as per sonarLint

* PFM-4807 Subtracted currentValue if wfStatus is not approved

* PFM-4807 wfStatus check

* PFM-4807 lineItemRef check

* PFM-4807 removed overhead category check

* PFM-4807-revision-estimate-validation (#1556)

* fixed logic in measurement validator

* fixed validation logic

* Update README.md (#1573)

* PFM-5086-Validations-for-estimate (#1569)

* [PFM 5086] Did some validations for estimate service

* fixed some validations and refractored the code

* Pfm 4807 contract document validation (#1562)

* PFM-4807 removed overhead category check

* PFM-4807 document validator contextPath change

* Adding sequence diagram and db schema

* moved db diagram from workflow config to documents

* moved db diagram from workflow configs

* if bussinessService is null then set businessService to 'CONTRACT'.

* created bff for deviation-statement pdf (#1567)

* created bff for deviation-statement pdf

* Refactored the code

* Refactored the code

* refactored

* Refactored the code

* Refactored the code

* Refactored

* added validatin whether it's a revised estimate

* added tenantId to pdfData

* added condition if it's not a revised estimate (#1576)

* added check condition for square bracket (#1577)

* Enriched Workflow in the consumer according to revision estimate service (#1581)

* created bff for measurement-book pdf (#1584)

* created bff for measurement-book pdf

* Refactored the code

* fixed consumedQuantity and estimatedQuantity

* refactored

* Update EnrichmentService.java (#1583)

* PFM-4664-Tech-Debt-Code-lint-recommendations-across-all-modules-muster-roll (#1564)

* fixed muster roll service according to code lint suggestions

* fixed cognitive complexity

* fixed constructor injection for tests

* reduced cognitive complexity

* PFM-4664-Changed Names of Main File

* PFM-4664-Tech-Debt-Code-lint-recommendations-across-all-modules-Organization (#1565)

* fixed code in organization according to codelint

* fixed code in organization according to codelint

* removed cognitive complexity

* fixed cognitive complexity

* PFM-4664 Changed Names of Files

* PFM-4664-Tech-Debt-Code-lint-recommendations-across-all-modules-expense (#1566)

* fixed code according to sonarlint

* reduced cognitive complexity

* fixed constructor injection

* PFM-4664-Changed-the-name-of-producer-and-consumer

* fixed code according to code changes

* Updated attendance query (#1514)

* Updated attendance query

* PFM-4454-Fixed attendance register and staff join query and made changes according to sonarlint

* PFM-4664-Tech-Debt-Code-lint-recommendations-across-all-modules-expense-calculator (#1571)

* fixed expense calculator according to sonar lint

* did some refractoring

* PFM-4664-Changed name of Main File

* deleted workflowutil file

---------

Co-authored-by: Shailesh Pandey <[email protected]>

* Pfm 4666 effective to and from dates in mdms 2 (#1520)

* [PFM-4666] filtered all data in expense service according to dates

* [PFM-4666] added single function for filtering mdms on fetching of data

* fixed effective from and to in expense-calculator

* fixed the code according to sonar lint

* resolved conflicts

* PFM-4468 Organisation encryption service (#1599)

* fixed some issues in validator (#1601)

* ignoring tests for encryption (#1603)

* created bff for detailed estimate pdf (#1596)

* created bff for detailed estimate pdf

* fixed totalEstimatedAmount

* Refactored

* If Overhead and non-sor having null sorId assigned 0 to non-sor

* updated key template

* removed tenantid check for mobile search (#1607)

* Enriched measurement period and project location in mb pdf (#1610)

* Enriched measurement period and project location in mb pdf

* refactored

* PFM-5098 elastic workflow status issue fix (#1612)

* Added json ignore in pagination and org search criteria (#1614)

* Fixed consumedQuantity and currentQuantity in mb pdf (#1615)

* Fixed consumedQuantity and currentQuantity in mb pdf

* Refactored

* PFM-5129 measurement document update (#1618)

* Master to develop sync (#1621)

* PFM-4305 Login page issues (#1477)

* PFM-4305 Updated css version (#1478)

* PFM-4305 Login page issues

* PFM-4305 updated css package version

* PFM-4305 updated css for login and landing page (#1482)

* Fixed the fixed row number of the table in view muster roll screen (#1499)

* Merging the measurement-ui changes to master branch (#1617)

* updating publish sh file to incormorate measurement module (#1619)

* updated the version of measurement module (#1620)

---------

Co-authored-by: vamshikrishnakole-wtt-egov <[email protected]>
Co-authored-by: Tulika-eGov <[email protected]>

* Updated versions for works-1.0 release

---------

Co-authored-by: ansh-egov <[email protected]>
Co-authored-by: Jagankumar <[email protected]>
Co-authored-by: shubhang-egov <[email protected]>
Co-authored-by: shubhang-eGov <[email protected]>
Co-authored-by: nitish-egov <[email protected]>
Co-authored-by: admin1 <[email protected]>
Co-authored-by: Rishabh-egov <[email protected]>
Co-authored-by: ashish-egov <[email protected]>
Co-authored-by: Lokendra Tyagi <[email protected]>
Co-authored-by: Lokendra-egov <[email protected]>
Co-authored-by: vamshikrishnakole-wtt-egov <[email protected]>
Co-authored-by: Tulika-eGov <[email protected]>
  • Loading branch information
13 people authored Jan 2, 2024
1 parent f2fa17c commit 743b081
Show file tree
Hide file tree
Showing 367 changed files with 12,803 additions and 4,153 deletions.
3 changes: 1 addition & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
* @sathishp-eGov @subhashini-egov @jagankumar-egov
*.yaml @egovernments/works-dev-pr-reviewers
* @egovernments/works-dev-pr-reviewers

##Backend
backend/ @egovernments/works-dev-pr-reviewers
Expand Down
2 changes: 1 addition & 1 deletion backend/attendance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>attendance</artifactId>
<packaging>jar</packaging>
<name>attendance</name>
<version>0.2.0</version>
<version>1.0.0</version>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public void enrichRegisterOnCreate(AttendanceRegisterRequest attendanceRegisterR
RequestInfo requestInfo = attendanceRegisterRequest.getRequestInfo();
List<AttendanceRegister> attendanceRegisters = attendanceRegisterRequest.getAttendanceRegister();

String rootTenantId = attendanceRegisters.get(0).getTenantId().split("\\.")[0];
String tenantId = attendanceRegisters.get(0).getTenantId();

//Get Register Numbers from IdGen Service for number of registers present in AttendanceRegisters
List<String> registerNumbers = getIdList(requestInfo, rootTenantId
List<String> registerNumbers = getIdList(requestInfo, tenantId
, config.getIdgenAttendanceRegisterNumberName(), "", attendanceRegisters.size()); //idFormat will be fetched by idGen service

for (int i = 0; i < attendanceRegisters.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ public String getAttendanceAttendeeSearchQuery(AttendeeSearchCriteria criteria,
}
}

addLimitAndOffset(query, criteria, preparedStmtList);

return query.toString();
}
private void addLimitAndOffset(StringBuilder query, AttendeeSearchCriteria criteria, List<Object> preparedStmtList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.apache.commons.lang3.StringUtils;
import org.egov.config.AttendanceServiceConfiguration;
import org.egov.tracer.model.CustomException;
import org.egov.web.models.AttendanceLogSearchCriteria;
import org.egov.web.models.AttendanceRegisterSearchCriteria;
import org.egov.web.models.Status;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -39,6 +38,11 @@ public class RegisterQueryBuilder {
"reg.servicecode " +
"FROM eg_wms_attendance_register reg ";

private static final String JOIN_STAFF = " JOIN eg_wms_attendance_staff staff ";
private static final String JOIN_STAFF_CONDITION = " ON reg.id = staff.register_id ";

private static final String JOIN_ATTENDEE = " JOIN eg_wms_attendance_attendee attendee ";
private static final String JOIN_ATTENDEE_CONDITION = " ON reg.id = attendee.register_id ";

private final String paginationWrapper = "SELECT * FROM " +
"(SELECT *, DENSE_RANK() OVER (ORDER BY lastmodifiedtime DESC , id) offset_ FROM " +
Expand All @@ -52,6 +56,16 @@ public String getAttendanceRegisterSearchQuery(AttendanceRegisterSearchCriteria
log.info("Search criteria of attendance search : " + searchCriteria.toString());
StringBuilder query = new StringBuilder(ATTENDANCE_REGISTER_SELECT_QUERY);

if(!ObjectUtils.isEmpty(searchCriteria.getStaffId())) {
query.append(JOIN_STAFF);
query.append(JOIN_STAFF_CONDITION);
}

if(!ObjectUtils.isEmpty(searchCriteria.getAttendeeId())) {
query.append(JOIN_ATTENDEE);
query.append(JOIN_ATTENDEE_CONDITION);
}

if (!ObjectUtils.isEmpty(searchCriteria.getTenantId())) {
addClauseIfRequired(query, preparedStmtList);
query.append(" reg.tenantid like ? ");
Expand Down Expand Up @@ -119,6 +133,20 @@ public String getAttendanceRegisterSearchQuery(AttendanceRegisterSearchCriteria
preparedStmtList.add(status.toString());
}

if(!ObjectUtils.isEmpty(searchCriteria.getStaffId())) {
String staffId = searchCriteria.getStaffId();
addClauseIfRequired(query, preparedStmtList);
query.append(" staff.individual_id = ? ");
preparedStmtList.add(staffId);
}

if(!ObjectUtils.isEmpty(searchCriteria.getAttendeeId())) {
String attendeeId = searchCriteria.getAttendeeId();
addClauseIfRequired(query, preparedStmtList);
query.append(" attendee.individual_id = ? ");
preparedStmtList.add(attendeeId);
}

addOrderByClause(query, searchCriteria);
//addLimitAndOffset(query, searchCriteria, preparedStmtList);
return addPaginationWrapper(query.toString(), preparedStmtList, searchCriteria);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ public void validateCreateAttendanceRegister(AttendanceRegisterRequest request)
log.info("Attendance registers referenceId and ServiceCode are validated");

String tenantId = attendanceRegisters.get(0).getTenantId();
String rootTenantId = tenantId.split("\\.")[0];

//Get MDMS data using create attendance register request and tenantId
Object mdmsData = mdmsUtils.mDMSCall(requestInfo, rootTenantId);
Object mdmsData = mdmsUtils.mDMSCall(requestInfo, tenantId);
validateMDMSData(attendanceRegisters, mdmsData, errorMap);
log.info("Request data validated with MDMS");

Expand Down Expand Up @@ -108,10 +107,9 @@ public void validateUpdateAttendanceRegisterRequest(AttendanceRegisterRequest re
}

String tenantId = attendanceRegisters.get(0).getTenantId();
String rootTenantId = tenantId.split("\\.")[0];

//Get MDMS data using create attendance register request and tenantId
Object mdmsData = mdmsUtils.mDMSCall(requestInfo, rootTenantId);
Object mdmsData = mdmsUtils.mDMSCall(requestInfo, tenantId);
validateMDMSData(attendanceRegisters, mdmsData, errorMap);
log.info("Request data validated with MDMS");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,8 @@ public void validateMDMSAndRequestInfoForCreateAttendee(AttendeeCreateRequest at
Map<String, String> errorMap = new HashMap<>();

String tenantId = attendeeListFromRequest.get(0).getTenantId();
//split the tenantId
String rootTenantId = tenantId.split("\\.")[0];

Object mdmsData = mdmsUtils.mDMSCall(requestInfo, rootTenantId);
Object mdmsData = mdmsUtils.mDMSCall(requestInfo, tenantId);

//check tenant Id
log.info("validate tenantId with MDMS");
Expand All @@ -238,10 +236,8 @@ public void validateMDMSAndRequestInfoForDeleteAttendee(AttendeeDeleteRequest at
Map<String, String> errorMap = new HashMap<>();

String tenantId = attendeeListFromRequest.get(0).getTenantId();
//split the tenantId
String rootTenantId = tenantId.split("\\.")[0];

Object mdmsData = mdmsUtils.mDMSCall(requestInfo, rootTenantId);
Object mdmsData = mdmsUtils.mDMSCall(requestInfo, tenantId);

//check tenant Id
log.info("validate tenantId with MDMS");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ public void validateMDMSAndRequestInfoForStaff(StaffPermissionRequest request) {
Map<String, String> errorMap = new HashMap<>();

String tenantId = staffPermissionListFromRequest.get(0).getTenantId();
//split the tenantId
String rootTenantId = tenantId.split("\\.")[0];

Object mdmsData = mdmsUtils.mDMSCall(requestInfo, rootTenantId);
Object mdmsData = mdmsUtils.mDMSCall(requestInfo, tenantId);

//validate request-info
log.info("validate request info coming from api request");
Expand Down
6 changes: 3 additions & 3 deletions backend/attendance/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ spring.flyway.table=attendance_service_schema
spring.flyway.baseline-on-migrate=true

#----------------MDMS config---------------------#
egov.mdms.host=https://works-dev.digit.org
egov.mdms.host=https://unified-dev.digit.org
egov.mdms.search.endpoint=/egov-mdms-service/v1/_search

#----------------Idgen Config---------------------#
egov.idgen.host=https://works-dev.digit.org
egov.idgen.host=https://unified-dev.digit.org
egov.idgen.path=/egov-idgen/id/_generate
egov.idgen.attendance.register.number.name=attendance.register.number

#---------------Individual service----------------#
works.individual.host=https://works-dev.digit.org
works.individual.host=https://unified-dev.digit.org
#works.individual.host=http://localhost:9090
works.individual.search.endpoint=/individual/v1/_search

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void enrichCreateAttendanceRegisterTest_1(){
List<IdResponse> idResponses = new ArrayList<>();
IdGenerationResponse idGenerationResponse = IdGenerationResponse.builder().idResponses(idResponses).build();

lenient().when(idGenRepository.getId(eq(attendanceRegisterRequest.getRequestInfo()), eq("pb"), eq("attendance.register.number"), eq(""), eq(1)))
when(idGenRepository.getId(eq(attendanceRegisterRequest.getRequestInfo()), eq("pb.amritsar"), eq("attendance.register.number"), eq(""), eq(1)))
.thenReturn(idGenerationResponse);

CustomException exception = assertThrows(CustomException.class,()->registerEnrichment.enrichRegisterOnCreate(attendanceRegisterRequest));
Expand Down
129 changes: 129 additions & 0 deletions backend/contracts/docs/Contract service.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
CREATE TABLE "eg_wms_contract" (
"id" "character varying(256)" PRIMARY KEY,
"tenant_id" "character varying(64)" NOT NULL,
"contract_number" "character varying(64)" UNIQUE NOT NULL,
"supplement_number" "character varying(64)" UNIQUE,
"version_number" bigint,
"old_uuid" "character varying(256)",
"business_service" "character varying(64)",
"wf_status" "character varying(64)",
"executing_authority" "character varying(64)" NOT NULL,
"contract_type" "character varying(64)",
"total_contracted_amount" decimal,
"security_deposit" decimal,
"agreement_date" bigint NOT NULL,
"issue_date" bigint,
"completion_period" bigint,
"defect_liability_period" bigint,
"org_id" "character varying(256)" NOT NULL,
"start_date" bigint,
"end_date" bigint,
"status" "character varying(64)" NOT NULL,
"additional_details" JSONB,
"created_by" "character varying(256)" NOT NULL,
"last_modified_by" "character varying(256)",
"created_time" bigint,
"last_modified_time" bigint
);

CREATE TABLE "eg_wms_contract_line_items" (
"id" "character varying(256)" PRIMARY KEY,
"contract_line_item_ref" "character varying(256)" NOT NULL,
"estimate_id" "character varying(256)" NOT NULL,
"estimate_line_item_id" "character varying(256)",
"contract_id" "character varying(256)",
"tenant_id" "character varying(64)" NOT NULL,
"unit_rate" decimal,
"no_of_unit" decimal,
"status" "character varying(64)" NOT NULL,
"additional_details" JSONB,
"created_by" "character varying(256)" NOT NULL,
"last_modified_by" "character varying(256)",
"created_time" bigint,
"last_modified_time" bigint
);

CREATE TABLE "eg_wms_contract_amount_breakups" (
"id" "character varying(256)" PRIMARY KEY,
"estimate_amount_breakup_id" "character varying(256)" NOT NULL,
"line_item_id" "character varying(256)",
"amount" decimal NOT NULL,
"status" "character varying(64)" NOT NULL,
"additional_details" JSONB,
"created_by" "character varying(256)" NOT NULL,
"last_modified_by" "character varying(256)",
"created_time" bigint,
"last_modified_time" bigint
);

CREATE TABLE "eg_wms_contract_documents" (
"id" "character varying(256)" PRIMARY KEY,
"filestore_id" "character varying(64)",
"document_type" "character varying(64)",
"document_uid" "character varying(256)",
"status" "character varying(64)",
"contract_id" "character varying(256)",
"additional_details" JSONB,
"created_by" "character varying(256)" NOT NULL,
"last_modified_by" "character varying(256)",
"created_time" bigint,
"last_modified_time" bigint
);

CREATE INDEX "index_eg_wms_contract_id" ON "eg_wms_contract" ("id");

CREATE INDEX "index_eg_wms_contract_tenantId" ON "eg_wms_contract" ("tenant_id");

CREATE INDEX "index_eg_wms_contract_status" ON "eg_wms_contract" ("status");

CREATE INDEX "index_eg_wms_contract_contractNumber" ON "eg_wms_contract" ("contract_number");

CREATE INDEX "index_eg_wms_contract_orgId" ON "eg_wms_contract" ("org_id");

CREATE INDEX "index_eg_wms_contract_startDate" ON "eg_wms_contract" ("start_date");

CREATE INDEX "index_eg_wms_contract_endDate" ON "eg_wms_contract" ("end_date");

CREATE INDEX "index_eg_wms_contract_createdTime" ON "eg_wms_contract" ("created_time");

CREATE INDEX "index_eg_wms_contract_line_items_id" ON "eg_wms_contract_line_items" ("id");

CREATE INDEX "index_eg_wms_contract_line_items_tenantId" ON "eg_wms_contract_line_items" ("tenant_id");

CREATE INDEX "index_eg_wms_contract_line_items_status" ON "eg_wms_contract_line_items" ("status");

CREATE INDEX "index_eg_wms_contract_line_items_estimateId" ON "eg_wms_contract_line_items" ("estimate_id");

CREATE INDEX "index_eg_wms_contract_line_items_estimateLineItemTd" ON "eg_wms_contract_line_items" ("estimate_line_item_id");

CREATE INDEX "index_eg_wms_contract_line_items_contractId" ON "eg_wms_contract_line_items" ("contract_id");

CREATE INDEX "index_eg_wms_contract_line_items_createdTime" ON "eg_wms_contract_line_items" ("created_time");

CREATE INDEX "index_eg_wms_contract_amount_breakups_id" ON "eg_wms_contract_amount_breakups" ("id");

CREATE INDEX "index_eg_wms_contract_amount_breakups_estimateAmountBreakupId" ON "eg_wms_contract_amount_breakups" ("estimate_amount_breakup_id");

CREATE INDEX "index_eg_wms_contract_amount_breakups_status" ON "eg_wms_contract_amount_breakups" ("status");

CREATE INDEX "index_eg_wms_contract_amount_breakups_lineItemId" ON "eg_wms_contract_amount_breakups" ("line_item_id");

CREATE INDEX "index_eg_wms_contract_amount_breakups_createdTime" ON "eg_wms_contract_amount_breakups" ("created_time");

CREATE INDEX "index_eg_wms_contract_documents_id" ON "eg_wms_contract_documents" ("id");

CREATE INDEX "index_eg_wms_contract_documents_filestoreId" ON "eg_wms_contract_documents" ("filestore_id");

CREATE INDEX "index_eg_wms_contract_documents_contractId" ON "eg_wms_contract_documents" ("contract_id");

CREATE INDEX "index_eg_wms_contract_documents_documentUid" ON "eg_wms_contract_documents" ("document_uid");

CREATE INDEX "index_eg_wms_contract_documents_status" ON "eg_wms_contract_documents" ("status");

CREATE INDEX "index_eg_wms_contract_documents_createdTime" ON "eg_wms_contract_documents" ("created_time");

ALTER TABLE "eg_wms_contract_line_items" ADD CONSTRAINT "fk_eg_wms_contract_line_items" FOREIGN KEY ("contract_id") REFERENCES "eg_wms_contract" ("id");

ALTER TABLE "eg_wms_contract_amount_breakups" ADD CONSTRAINT "fk_eg_wms_contract_amount_breakups" FOREIGN KEY ("line_item_id") REFERENCES "eg_wms_contract_line_items" ("id");

ALTER TABLE "eg_wms_contract_documents" ADD CONSTRAINT "fk_eg_wms_contract_documents" FOREIGN KEY ("contract_id") REFERENCES "eg_wms_contract" ("id");
37 changes: 37 additions & 0 deletions backend/contracts/docs/consume-revisions.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@startuml
participant Contracts order 10
participant Attendance as Attendance order 12
participant MeasurementBook as MB order 13
participant Kafka order 14
participant Persister order 15
participant DB order 16
title Consumption of Contract Revisions

== Contract Revision Event published ==
Contracts -> Kafka: Push revision event

== Consumer ==
Consumer -> Kafka: Read revision event
activate Consumer #DarkGreen
Consumer -> Contracts: Fetch contract
Contracts --> Consumer: Return latest version \n of the contract
Consumer -> Consumer: Check if start and end dates of contract \n have changed.
note over Consumer
If start and end dates have changed
end note
Consumer -> Attendance: Update start and end date of register
activate Attendance #DarkSalmon
Attendance -> Contracts: Fetch contract
Contracts --> Attendance: Return latest version of contract
Attendance -> Attendance: Validate start and end \n dates of contract.
note over Attendance
Recorded attendance dates fall within contract period
end note
Attendance -> Consumer: 200 OK
Attendance -> Kafka: Push updated attendance payload
Persister -> Kafka: Read attendance payload
Persister -> DB: Persist update
deactivate Attendance
deactivate Consumer

@enduml
Loading

0 comments on commit 743b081

Please sign in to comment.