FINERACT-2452: New command processing - audit

Co-Authored-By: Adam Saghy <adam.saghy@dpc.hu>
Co-Authored-By: Yu Wati Nyi <nyi22y@mtholyoke.edu>
This commit is contained in:
Aleksandar Vidakovic
2026-02-05 12:55:05 +01:00
committed by Aleksandar Vidakovic
co-authored by Adam Saghy Yu Wati Nyi
parent 1d1876edfd
commit 8d064ddf6c
73 changed files with 1217 additions and 363 deletions
@@ -0,0 +1,27 @@
<?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">
<include relativeToChangelogFile="true" file="parts/0001_command_init.xml"/>
<include relativeToChangelogFile="true" file="parts/0002_command_fix_structure.xml"/>
</databaseChangeLog>
@@ -23,6 +23,11 @@
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">
<changeSet author="fineract" id="command-00001" context="postgresql">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="m_command"/>
</not>
</preConditions>
<createTable tableName="m_command">
<column autoIncrement="true" name="id" type="bigint" remarks="Internal ID">
<constraints nullable="false" primaryKey="true"/>
@@ -35,6 +40,11 @@
</createTable>
</changeSet>
<changeSet author="fineract" id="command-00002" context="mysql">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="command"/>
</not>
</preConditions>
<createTable tableName="command">
<column autoIncrement="true" name="id" type="bigint" remarks="Internal ID">
<constraints nullable="false" primaryKey="true"/>
@@ -0,0 +1,60 @@
<?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">
<changeSet author="fineract" id="command-00002" context="mysql">
<renameTable oldTableName="command" newTableName="m_command" />
<addColumn tableName="m_command">
<column name="updated_at" type="datetime" />
<column name="executed_at" type="datetime" />
<column name="approved_at" type="datetime" />
<column name="rejected_at" type="datetime" />
</addColumn>
</changeSet>
<changeSet author="fineract" id="command-00003" context="postgresql">
<addColumn tableName="m_command">
<column name="updated_at" type="timestamp with time zone" />
<column name="executed_at" type="timestamp with time zone" />
<column name="approved_at" type="timestamp with time zone" />
<column name="rejected_at" type="timestamp with time zone" />
</addColumn>
</changeSet>
<changeSet author="fineract" id="command-00004" context="postgresql,mysql">
<renameColumn tableName="m_command" oldColumnName="username" newColumnName="initiated_by_username" columnDataType="varchar(255)" />
<renameColumn tableName="m_command" oldColumnName="payload" newColumnName="request" columnDataType="text" />
<addColumn tableName="m_command">
<column name="idempotency_key" type="varchar(255)" />
<column name="executed_by_username" type="varchar(255)" />
<column name="approved_by_username" type="varchar(255)" />
<column name="rejected_by_username" type="varchar(255)" />
<column name="ip_address" type="varchar(255)" />
<column name="state" type="varchar(255)" />
<column name="response" type="text" />
<column name="error" type="text" />
</addColumn>
<createIndex tableName="m_command" indexName="m_command_idempotency_key_index">
<column name="idempotency_key" />
</createIndex>
</changeSet>
</databaseChangeLog>
@@ -1,43 +0,0 @@
<?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.
-->
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<!-- This file is only used for static weaving, nothing more. -->
<!-- You can find the runtime configuration in the JPAConfig class -->
<persistence-unit name="jpa-pu" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<!-- Command Module Entities -->
<class>org.apache.fineract.command.persistence.domain.CommandEntity</class>
<class>org.apache.fineract.command.persistence.converter.JsonAttributeConverter</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.weaving" value="static" />
</properties>
</persistence-unit>
</persistence>