Merge pull request #7002 from W8jonas/fix/api-destination-uuid-databases
fix api - set destination_uuid when creating databases
This commit is contained in:
commit
5fd8cff7c7
1 changed files with 12 additions and 0 deletions
|
|
@ -1619,6 +1619,18 @@ public function create_database(Request $request, NewDatabaseTypes $type)
|
||||||
return response()->json(['message' => 'Server has multiple destinations and you do not set destination_uuid.'], 400);
|
return response()->json(['message' => 'Server has multiple destinations and you do not set destination_uuid.'], 400);
|
||||||
}
|
}
|
||||||
$destination = $destinations->first();
|
$destination = $destinations->first();
|
||||||
|
if ($destinations->count() > 1 && $request->has('destination_uuid')) {
|
||||||
|
$destination = $destinations->where('uuid', $request->destination_uuid)->first();
|
||||||
|
if (! $destination) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Validation failed.',
|
||||||
|
'errors' => [
|
||||||
|
'destination_uuid' => 'Provided destination_uuid does not belong to the specified server.',
|
||||||
|
],
|
||||||
|
], 422);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($request->has('public_port') && $request->is_public) {
|
if ($request->has('public_port') && $request->is_public) {
|
||||||
if (isPublicPortAlreadyUsed($server, $request->public_port)) {
|
if (isPublicPortAlreadyUsed($server, $request->public_port)) {
|
||||||
return response()->json(['message' => 'Public port already used by another database.'], 400);
|
return response()->json(['message' => 'Public port already used by another database.'], 400);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue