1
1
package org .lowcoder .domain .application .service .impl ;
2
2
3
- import static org .lowcoder .sdk .exception .BizError .INVALID_HISTORY_SNAPSHOT ;
4
- import static org .lowcoder .sdk .util .ExceptionUtils .deferredError ;
5
- import static org .lowcoder .sdk .util .ExceptionUtils .ofException ;
6
-
7
- import java .time .Instant ;
8
- import java .util .List ;
9
- import java .util .Map ;
10
-
11
3
import lombok .RequiredArgsConstructor ;
12
- import org .lowcoder .domain .application .model .ApplicationHistorySnapshot ;
4
+ import org .lowcoder .domain .application .model .ApplicationHistorySnapshotTS ;
13
5
import org .lowcoder .domain .application .repository .ApplicationHistorySnapshotRepository ;
14
6
import org .lowcoder .domain .application .service .ApplicationHistorySnapshotService ;
15
7
import org .lowcoder .sdk .exception .BizError ;
16
- import org .springframework .beans .factory .annotation .Autowired ;
17
- import org .springframework .context .annotation .Lazy ;
18
8
import org .springframework .data .domain .PageRequest ;
19
9
import org .springframework .data .domain .Sort .Direction ;
20
10
import org .springframework .stereotype .Service ;
21
-
22
- import org .springframework .web .bind .annotation .RequestParam ;
23
11
import reactor .core .publisher .Mono ;
24
12
13
+ import java .time .Instant ;
14
+ import java .util .List ;
15
+ import java .util .Map ;
16
+
17
+ import static org .lowcoder .sdk .exception .BizError .INVALID_HISTORY_SNAPSHOT ;
18
+ import static org .lowcoder .sdk .util .ExceptionUtils .deferredError ;
19
+ import static org .lowcoder .sdk .util .ExceptionUtils .ofException ;
20
+
25
21
@ RequiredArgsConstructor
26
22
@ Service
27
23
public class ApplicationHistorySnapshotServiceImpl implements ApplicationHistorySnapshotService {
@@ -30,17 +26,17 @@ public class ApplicationHistorySnapshotServiceImpl implements ApplicationHistory
30
26
31
27
@ Override
32
28
public Mono <Boolean > createHistorySnapshot (String applicationId , Map <String , Object > dsl , Map <String , Object > context , String userId ) {
33
- ApplicationHistorySnapshot applicationHistorySnapshot = new ApplicationHistorySnapshot ();
34
- applicationHistorySnapshot .setApplicationId (applicationId );
35
- applicationHistorySnapshot .setDsl (dsl );
36
- applicationHistorySnapshot .setContext (context );
37
- return repository .save (applicationHistorySnapshot )
29
+ ApplicationHistorySnapshotTS applicationHistorySnapshotTS = new ApplicationHistorySnapshotTS ();
30
+ applicationHistorySnapshotTS .setApplicationId (applicationId );
31
+ applicationHistorySnapshotTS .setDsl (dsl );
32
+ applicationHistorySnapshotTS .setContext (context );
33
+ return repository .save (applicationHistorySnapshotTS )
38
34
.thenReturn (true )
39
35
.onErrorReturn (false );
40
36
}
41
37
42
38
@ Override
43
- public Mono <List <ApplicationHistorySnapshot >> listAllHistorySnapshotBriefInfo (String applicationId , String compName , String theme , Instant from , Instant to , PageRequest pageRequest ) {
39
+ public Mono <List <ApplicationHistorySnapshotTS >> listAllHistorySnapshotBriefInfo (String applicationId , String compName , String theme , Instant from , Instant to , PageRequest pageRequest ) {
44
40
return repository .findAllByApplicationId (applicationId , compName , theme , from , to , pageRequest .withSort (Direction .DESC , "id" ))
45
41
.collectList ()
46
42
.onErrorMap (Exception .class , e -> ofException (BizError .FETCH_HISTORY_SNAPSHOT_FAILURE , "FETCH_HISTORY_SNAPSHOT_FAILURE" ));
@@ -55,7 +51,7 @@ public Mono<Long> countByApplicationId(String applicationId) {
55
51
56
52
57
53
@ Override
58
- public Mono <ApplicationHistorySnapshot > getHistorySnapshotDetail (String historySnapshotId ) {
54
+ public Mono <ApplicationHistorySnapshotTS > getHistorySnapshotDetail (String historySnapshotId ) {
59
55
return repository .findById (historySnapshotId )
60
56
.switchIfEmpty (deferredError (INVALID_HISTORY_SNAPSHOT , "INVALID_HISTORY_SNAPSHOT" , historySnapshotId ));
61
57
}
0 commit comments