33import eu .pretix .libpretixsync .api .*;
44import eu .pretix .libpretixsync .models .Question ;
55import eu .pretix .libpretixsync .models .db .QuestionExtensionsKt ;
6+ import eu .pretix .libpretixsync .sqldelight .Closing ;
7+ import eu .pretix .libpretixsync .sqldelight .ClosingExtensionsKt ;
68import eu .pretix .libpretixsync .sqldelight .QueuedCall ;
79import eu .pretix .libpretixsync .sqldelight .QueuedCheckIn ;
810import eu .pretix .libpretixsync .sqldelight .SyncDatabase ;
2022import eu .pretix .libpretixsync .SentryInterface ;
2123import eu .pretix .libpretixsync .config .ConfigStore ;
2224import eu .pretix .libpretixsync .db .Answer ;
23- import eu .pretix .libpretixsync .db .Closing ;
2425import eu .pretix .libpretixsync .db .QueuedOrder ;
2526import eu .pretix .libpretixsync .db .Receipt ;
2627import eu .pretix .libpretixsync .db .ReceiptLine ;
@@ -672,10 +673,7 @@ protected void uploadOrders(ProgressFeedback feedback) throws SyncException {
672673 protected void uploadClosings (ProgressFeedback feedback ) throws SyncException {
673674 sentry .addBreadcrumb ("sync.queue" , "Start closings upload" );
674675
675- List <Closing > closings = dataStore .select (Closing .class )
676- .where (Closing .OPEN .eq (false ))
677- .and (Closing .SERVER_ID .isNull ())
678- .get ().toList ();
676+ List <Closing > closings = db .getClosingQueries ().selectClosedWithoutServerId ().executeAsList ();
679677
680678 try {
681679 int i = 0 ;
@@ -686,11 +684,10 @@ protected void uploadClosings(ProgressFeedback feedback) throws SyncException {
686684 i ++;
687685 PretixApi .ApiResponse response = api .postResource (
688686 api .organizerResourceUrl ("posdevices/" + configStore .getPosId () + "/closings" ),
689- closing .toJSON ()
687+ ClosingExtensionsKt .toJSON (closing )
690688 );
691689 if (response .getResponse ().code () == 201 ) {
692- closing .setServer_id (response .getData ().getLong ("closing_id" ));
693- dataStore .update (closing );
690+ db .getClosingQueries ().updateServerId (response .getData ().getLong ("closing_id" ), closing .getId ());
694691 } else {
695692 throw new SyncException (response .getData ().toString ());
696693 }
0 commit comments