mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-19 05:30:43 +00:00
Don't audit for records that failed their DML
This commit is contained in:
@ -36,6 +36,7 @@ import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.audits.AuditLevel;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.audits.QAuditRules;
|
||||
import com.kingsrook.qqq.backend.core.model.statusmessages.BadInputStatusMessage;
|
||||
import com.kingsrook.qqq.backend.core.modules.backend.implementations.memory.MemoryRecordStore;
|
||||
import com.kingsrook.qqq.backend.core.utils.TestUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -184,6 +185,19 @@ class DMLAuditActionTest extends BaseTest
|
||||
assertEquals(0, auditList.size());
|
||||
MemoryRecordStore.getInstance().reset();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// confirm we don't audit for records with errors //
|
||||
////////////////////////////////////////////////////
|
||||
{
|
||||
qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY).setAuditRules(new QAuditRules().withAuditLevel(AuditLevel.FIELD));
|
||||
new DMLAuditAction().execute(new DMLAuditInput().withTableActionInput(updateInput)
|
||||
.withRecordList(List.of(new QRecord().withValue("id", 1).withValue("firstName", "B").withError(new BadInputStatusMessage("Error"))))
|
||||
.withOldRecordList(List.of(new QRecord().withValue("id", 1).withValue("firstName", "A"))));
|
||||
List<QRecord> auditList = TestUtils.queryTable("audit");
|
||||
assertEquals(0, auditList.size());
|
||||
MemoryRecordStore.getInstance().reset();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user