Fineract Asset Externalization models

- [x] Liquibase database model
- [x] JPA model
- [x] API endpoint without implementation
- [x] API endpoint requirements
  - [x] Json Serialization and Deserialization and dependencies
  - [x] New Authentication check interface to the core level
  - [x] CommandWrapperBuilder and dependencies
This commit is contained in:
Janos Haber
2023-05-16 21:43:54 +02:00
committed by Arnold Gálovics
parent 6e69e66b86
commit da1aa9e5a8
56 changed files with 685 additions and 9 deletions
@@ -22,5 +22,6 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<include relativeToChangelogFile="true" file="parts/0001_initial_schema.xml" />
<include relativeToChangelogFile="true" file="parts/0001_initial_schema.xml"/>
<include relativeToChangelogFile="true" file="parts/0002_asset_schemas.xml"/>
</databaseChangeLog>
@@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<!-- Create the m_external_asset_owner table -->
<changeSet author="fineract" id="1" context="postgresql">
<createTable tableName="m_external_asset_owner">
<column autoIncrement="true" name="id" type="BIGINT" remarks="Internal ID">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="external_id" type="varchar(100)" remarks="External id of asset owner">
<constraints nullable="false" unique="true"
uniqueConstraintName="UQ_external_asset_owner_external_id"/>
</column>
<column name="created_by" type="bigint" remarks=""/>
<column name="created_on_utc" type="TIMESTAMP WITH TIME ZONE" remarks=""/>
<column name="last_modified_by" type="bigint" remarks=""/>
<column name="last_modified_on_utc" type="TIMESTAMP WITH TIME ZONE" remarks=""/>
</createTable>
</changeSet>
<changeSet author="fineract" id="1" context="mysql">
<createTable tableName="m_external_asset_owner">
<column autoIncrement="true" name="id" type="BIGINT" remarks="Internal ID">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="external_id" type="varchar(100)" remarks="External id of asset owner">
<constraints nullable="false" unique="true"
uniqueConstraintName="UQ_external_asset_owner_external_id"/>
</column>
<column name="created_by" type="bigint" remarks=""/>
<column name="created_on_utc" type="DATETIME" remarks=""/>
<column name="last_modified_by" type="bigint" remarks=""/>
<column name="last_modified_on_utc" type="DATETIME" remarks=""/>
</createTable>
</changeSet>
<changeSet author="fineract" id="2">
<addForeignKeyConstraint baseColumnNames="created_by" baseTableName="m_external_asset_owner"
constraintName="FK_external_asset_owner_created_by" deferrable="false"
initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_appuser" validate="true"/>
<addForeignKeyConstraint baseColumnNames="last_modified_by"
baseTableName="m_external_asset_owner"
constraintName="FK_external_asset_owner_modified_by" deferrable="false"
initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_appuser" validate="true"/>
</changeSet>
<!-- Create m_external_asset_owner_transfer table -->
<changeSet author="fineract" id="3" context="mysql">
<createTable tableName="m_external_asset_owner_transfer">
<column autoIncrement="true" name="id" type="BIGINT" remarks="Internal ID">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="owner_id" type="BIGINT"/>
<column name="external_id" type="VARCHAR(100)"/>
<column name="status" type="VARCHAR(50)"/>
<column name="purchase_price_ratio" type="NUMERIC(19,6)"/>
<column name="settlement_date" type="DATE"/>
<column name="effective_date_from" type="DATE"/>
<column name="effective_date_to" type="DATe"/>
<column name="created_by" type="bigint" remarks=""/>
<column name="created_on_utc" type="DATETIME" remarks=""/>
<column name="last_modified_by" type="bigint" remarks=""/>
<column name="last_modified_on_utc" type="DATETIME" remarks=""/>
</createTable>
</changeSet>
<changeSet author="fineract" id="3" context="postgresql">
<createTable tableName="m_external_asset_owner_transfer">
<column autoIncrement="true" name="id" type="BIGINT" remarks="Internal ID">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="owner_id" type="BIGINT"/>
<column name="external_id" type="VARCHAR(100)"/>
<column name="status" type="VARCHAR(50)"/>
<column name="purchase_price_ratio" type="NUMERIC(19,6)"/>
<column name="settlement_date" type="DATE"/>
<column name="effective_date_from" type="DATE"/>
<column name="effective_date_to" type="DATe"/>
<column name="created_by" type="bigint" remarks=""/>
<column name="created_on_utc" type="TIMESTAMP WITH TIME ZONE" remarks=""/>
<column name="last_modified_by" type="bigint" remarks=""/>
<column name="last_modified_on_utc" type="TIMESTAMP WITH TIME ZONE" remarks=""/>
</createTable>
</changeSet>
<changeSet author="fineract" id="4">
<createIndex tableName="m_external_asset_owner_transfer"
indexName="external_asset_owner_transfer_external_id">
<column name="external_id"/>
</createIndex>
<createIndex tableName="m_external_asset_owner_transfer"
indexName="external_asset_owner_transfer_status">
<column name="status"/>
</createIndex>
<createIndex tableName="m_external_asset_owner_transfer"
indexName="external_asset_owner_transfer_settlement_date">
<column name="settlement_date"/>
</createIndex>
<createIndex tableName="m_external_asset_owner_transfer"
indexName="external_asset_owner_transfer_effective_date_from">
<column name="effective_date_from"/>
</createIndex>
<createIndex tableName="m_external_asset_owner_transfer"
indexName="external_asset_owner_transfer_effective_date_to">
<column name="effective_date_to"/>
</createIndex>
<addForeignKeyConstraint baseColumnNames="created_by"
baseTableName="m_external_asset_owner_transfer"
constraintName="FK_external_asset_owner_transfer_created_by" deferrable="false"
initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_appuser" validate="true"/>
<addForeignKeyConstraint baseColumnNames="last_modified_by"
baseTableName="m_external_asset_owner_transfer"
constraintName="FK_external_asset_owner_transfer_modified_by" deferrable="false"
initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_appuser" validate="true"/>
<addForeignKeyConstraint baseColumnNames="owner_id"
baseTableName="m_external_asset_owner_transfer"
constraintName="FK_external_asset_owner_transfer_owner_id" deferrable="false"
initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_external_asset_owner" validate="true"/>
</changeSet>
<!-- Create table m_external_asset_owner_transfer_loan_mapping -->
<changeSet author="fineract" id="5" context="mysql">
<createTable tableName="m_external_asset_owner_transfer_loan_mapping">
<column autoIncrement="true" name="id" type="BIGINT" remarks="Internal ID">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="loan_id" type="bigint" remarks="Loan ID">
<constraints nullable="false"/>
</column>
<column name="owner_transfer_id" type="bigint" remarks="Owner">
</column>
<column name="created_by" type="bigint" remarks=""/>
<column name="created_on_utc" type="DATETIME" remarks=""/>
<column name="last_modified_by" type="bigint" remarks=""/>
<column name="last_modified_on_utc" type="DATETIME" remarks=""/>
</createTable>
</changeSet>
<changeSet author="fineract" id="5" context="postgresql">
<createTable tableName="m_external_asset_owner_transfer_loan_mapping">
<column autoIncrement="true" name="id" type="BIGINT" remarks="Internal ID">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="loan_id" type="bigint" remarks="Loan ID">
<constraints nullable="false"/>
</column>
<column name="owner_transfer_id" type="bigint" remarks="Owner">
</column>
<column name="created_by" type="bigint" remarks=""/>
<column name="created_on_utc" type="TIMESTAMP WITH TIME ZONE" remarks=""/>
<column name="last_modified_by" type="bigint" remarks=""/>
<column name="last_modified_on_utc" type="TIMESTAMP WITH TIME ZONE" remarks=""/>
</createTable>
</changeSet>
<changeSet author="fineract" id="6">
<addForeignKeyConstraint baseColumnNames="created_by"
baseTableName="m_external_asset_owner_transfer_loan_mapping"
constraintName="FK_external_asset_owner_transfer_loan_mapping_created_by" deferrable="false"
initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_appuser" validate="true"/>
<addForeignKeyConstraint baseColumnNames="last_modified_by"
baseTableName="m_external_asset_owner_transfer_loan_mapping"
constraintName="FK_external_asset_owner_transfer_loan_mapping_modified_by" deferrable="false"
initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_appuser" validate="true"/>
<addForeignKeyConstraint baseColumnNames="loan_id"
baseTableName="m_external_asset_owner_transfer_loan_mapping"
constraintName="FK_external_asset_owner_transfer_loan_mapping_loan_id" deferrable="false"
initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_loan" validate="true"/>
<addForeignKeyConstraint baseColumnNames="owner_transfer_id"
baseTableName="m_external_asset_owner_transfer_loan_mapping"
constraintName="FK_external_asset_owner_transfer_loan_mapping_owner_transfer_id"
deferrable="false" initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_external_asset_owner_transfer" validate="true"/>
</changeSet>
</databaseChangeLog>