Commit 2b298f25 authored by LAVENIER's avatar LAVENIER
Browse files

[fix] Fix saveTrip when saving from desktop

parent 9facd75f
......@@ -308,32 +308,21 @@ public class DataGraphQLService {
return result;
}
/**
* @deprecated
*/
@GraphQLMutation(name = "saveTrip", description = "Create or update a trip",
deprecationReason = "Please use saveTrip(TripVO, TripSaveOptions)")
@IsUser
@Deprecated
public TripVO saveTrip(@GraphQLArgument(name = "trip") TripVO trip,
@GraphQLArgument(name = "withOperation", defaultValue = "false") Boolean withOperation,
@GraphQLEnvironment() Set<String> fields) {
// Warn in log
logDeprecatedUse("saveTrip(TripVO, withOperation)", "1.5.0");
return saveTrip(trip, TripSaveOptions.builder()
.withOperation(withOperation)
.build(),
fields);
}
@GraphQLMutation(name = "saveTrip", description = "Create or update a trip")
@IsUser
public TripVO saveTrip(@GraphQLArgument(name = "trip") TripVO trip,
@GraphQLArgument(name = "withOperation", defaultValue = "false") Boolean withOperation,
@GraphQLArgument(name = "saveOptions") TripSaveOptions saveOptions,
@GraphQLEnvironment() Set<String> fields) {
// For compat prior to 1.5
if (saveOptions == null && withOperation != null) {
logDeprecatedUse("saveTrip(TripVO, withOperation)", "1.5.0");
saveOptions = TripSaveOptions.builder()
.withOperation(withOperation)
.build();
}
final TripVO result = tripService.save(trip, saveOptions);
// Add additional properties if needed
......@@ -342,31 +331,21 @@ public class DataGraphQLService {
return result;
}
/**
* @deprecated
*/
@GraphQLMutation(name = "saveTrips", description = "Create or update many trips",
deprecationReason = "Please use saveTrips(TripVO, TripSaveOptions)")
@GraphQLMutation(name = "saveTrips", description = "Create or update many trips")
@IsUser
@Deprecated
public List<TripVO> saveTrips(@GraphQLArgument(name = "trips") List<TripVO> trips,
@GraphQLArgument(name = "withOperation", defaultValue = "false") Boolean withOperation,
@GraphQLArgument(name = "saveOptions") TripSaveOptions saveOptions,
@GraphQLEnvironment() Set<String> fields) {
// Warn in log
logDeprecatedUse("saveTrips(TripVO, withOperation)", "1.5.0");
return saveTrips(trips, TripSaveOptions.builder()
.withOperation(withOperation)
.build(),
fields);
}
// For compat prior to 1.5
if (saveOptions == null && withOperation != null) {
logDeprecatedUse("saveTrip(TripVO, withOperation)", "1.5.0");
saveOptions = TripSaveOptions.builder()
.withOperation(withOperation)
.build();
}
@GraphQLMutation(name = "saveTrips", description = "Create or update many trips")
@IsUser
public List<TripVO> saveTrips(@GraphQLArgument(name = "trips") List<TripVO> trips,
@GraphQLArgument(name = "saveOptions") TripSaveOptions saveOptions,
@GraphQLEnvironment() Set<String> fields) {
final List<TripVO> result = tripService.save(trips, saveOptions);
// Add additional properties if needed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment