10
10
import org .lowcoder .api .framework .view .PageResponseView ;
11
11
import org .lowcoder .api .framework .view .ResponseView ;
12
12
import org .lowcoder .api .permission .view .CommonPermissionView ;
13
+ import org .lowcoder .api .usermanagement .view .UpdateGroupRequest ;
13
14
import org .lowcoder .api .util .BusinessEventPublisher ;
14
15
import org .lowcoder .api .util .GidService ;
15
16
import org .lowcoder .domain .datasource .model .Datasource ;
@@ -52,7 +53,7 @@ public class DatasourceController implements DatasourceEndpoints
52
53
public Mono <ResponseView <Datasource >> create (@ Valid @ RequestBody UpsertDatasourceRequest request ) {
53
54
return datasourceApiService .create (upsertDatasourceRequestMapper .resolve (request ))
54
55
.delayUntil (datasourceService ::removePasswordTypeKeysFromJsDatasourcePluginConfig )
55
- .delayUntil (datasource -> businessEventPublisher .publishDatasourceEvent (datasource , DATA_SOURCE_CREATE ))
56
+ .delayUntil (datasource -> businessEventPublisher .publishDatasourceEvent (datasource , DATA_SOURCE_CREATE , null ))
56
57
.map (ResponseView ::success );
57
58
}
58
59
@@ -69,23 +70,25 @@ public Mono<ResponseView<Datasource>> update(@PathVariable String id,
69
70
@ RequestBody UpsertDatasourceRequest request ) {
70
71
Datasource resolvedDatasource = upsertDatasourceRequestMapper .resolve (request );
71
72
return gidService .convertDatasourceIdToObjectId (id ).flatMap (objectId ->
72
- datasourceApiService .update (objectId , resolvedDatasource )
73
- .delayUntil (datasourceService ::removePasswordTypeKeysFromJsDatasourcePluginConfig )
74
- .delayUntil (datasource -> businessEventPublisher .publishDatasourceEvent (datasource , DATA_SOURCE_UPDATE ))
75
- .map (ResponseView ::success ));
73
+ datasourceService .getById (id ).flatMap (orgDatasource ->
74
+ datasourceApiService .update (objectId , resolvedDatasource )
75
+ .delayUntil (datasourceService ::removePasswordTypeKeysFromJsDatasourcePluginConfig )
76
+ .delayUntil (datasource -> businessEventPublisher .publishDatasourceEvent (datasource , DATA_SOURCE_UPDATE , orgDatasource .getName ()))
77
+ .map (ResponseView ::success )));
76
78
}
77
79
78
80
@ Override
79
81
public Mono <ResponseView <Boolean >> delete (@ PathVariable String id ) {
80
82
return gidService .convertDatasourceIdToObjectId (id ).flatMap (objectId ->
81
- datasourceApiService .delete (objectId )
82
- .delayUntil (result -> {
83
- if (BooleanUtils .isTrue (result )) {
84
- return businessEventPublisher .publishDatasourceEvent (objectId , DATA_SOURCE_DELETE );
85
- }
86
- return Mono .empty ();
87
- })
88
- .map (ResponseView ::success ));
83
+ datasourceService .getById (id ).flatMap (orgDatasource ->
84
+ datasourceApiService .delete (objectId )
85
+ .delayUntil (result -> {
86
+ if (BooleanUtils .isTrue (result )) {
87
+ return businessEventPublisher .publishDatasourceEvent (objectId , DATA_SOURCE_DELETE , orgDatasource .getName ());
88
+ }
89
+ return Mono .empty ();
90
+ })
91
+ .map (ResponseView ::success )));
89
92
}
90
93
91
94
@ Override
0 commit comments