Skip to content

Commit

Permalink
Merge branch 'release-3.5.0' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicWatson committed Nov 2, 2022
2 parents d0cb0e1 + 36b361b commit 5c2e547
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 39 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v3.5.0

* [#64](https://github.com/pixl8/preside-ext-data-api/issues/64) Change to way delete operations queue when there are outstanding insert/update operations in the queue
* [#67](https://github.com/pixl8/preside-ext-data-api/issues/67) New `postValidateUpsertData` interception point

## v3.4.0

* Time values now have default formatting of HH:mm
Expand Down
1 change: 1 addition & 0 deletions config/Config.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ component {
, "preDataApiSelectData"
, "postDataApiSelectData"
, "preValidateUpsertData"
, "postValidateUpsertData"
];
conf.interceptorSettings.customInterceptionPoints.append( conf.settings.dataApiInterceptionPoints, true );
}
Expand Down
60 changes: 23 additions & 37 deletions services/DataApiQueueService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -259,45 +259,31 @@ component {
if ( !configService.objectIsApiEnabled( objectName, namespace ) || !configService.isObjectQueueEnabled( objectName, namespace ) ) {
continue;
}
var subscribers = getSubscribers( arguments.objectName, "delete", namespace );

if ( subscribers.len() ) {
var queueSettings = configService.getQueueForObject( objectName, namespace );
var dao = $getPresideObject( "data_api_queue" );
for( var subscriber in subscribers ) {
var deletedInserts = !queueSettings.atomicChanges && dao.deleteData( filter = {
is_checked_out = false
, subscriber = subscriber
, namespace = namespace
, queue_name = queueSettings.name
, operation = "insert"
, object_name = arguments.objectName
, record_id = arguments.id
} );

if ( !deletedInserts ) {
dao.insertData( {
object_name = arguments.objectName
, record_id = arguments.id
, subscriber = subscriber
, namespace = namespace
, queue_name = queueSettings.name
, operation = "delete"
} );
var dao = $getPresideObject( "data_api_queue" );
var queueSettings = configService.getQueueForObject( objectName, namespace );
var subscribers = getSubscribers( arguments.objectName, "delete", namespace );

for( var subscriber in subscribers ) {
dao.insertData( {
object_name = arguments.objectName
, record_id = arguments.id
, subscriber = subscriber
, namespace = namespace
, queue_name = queueSettings.name
, operation = "delete"
} );
}

if ( !queueSettings.atomicChanges ) {
dao.deleteData( filter = {
is_checked_out = false
, subscriber = subscriber
, namespace = namespace
, queue_name = queueSettings.name
, operation = "update"
, object_name = arguments.objectName
, record_id = arguments.id
} );
}
}
}
if ( !queueSettings.atomicChanges ) {
dao.deleteData( filter = {
is_checked_out = false
, namespace = namespace
, queue_name = queueSettings.name
, operation = [ "update", "insert" ]
, object_name = arguments.objectName
, record_id = arguments.id
} );
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions services/DataApiService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ component {
, ignoreMissing = arguments.ignoreMissing
);

$announceInterception( "postValidateUpsertData#namespace#", { validateUpsertDataArgs=prepped, entity=arguments.entity, data=arguments.data, validation=validation } );

if ( validation.validated() ) {
result.validationResults.append({
record = record
Expand All @@ -218,11 +220,15 @@ component {
var prepped = _prepRecordForInsertAndUpdate( arguments.entity, arguments.data, arguments.isUpdate );
$announceInterception( "preValidateUpsertData#namespace#", { validateUpsertDataArgs=prepped, entity=arguments.entity, data=arguments.data } );

return _translateValidationErrors( $getValidationEngine().validate(
var validation = $getValidationEngine().validate(
ruleset = ruleset
, data = prepped
, ignoreMissing = arguments.ignoreMissing
) );
);

$announceInterception( "postValidateUpsertData#namespace#", { validateUpsertDataArgs=prepped, entity=arguments.entity, data=arguments.data, validation=validation } );

return _translateValidationErrors( validation );
}

public string function i18nNamespaced(
Expand Down

0 comments on commit 5c2e547

Please sign in to comment.