api(application): fix 'PATCH' nest endpoint
This commit is contained in:
parent
58cfa98b9c
commit
0e366f69ee
|
@ -12,9 +12,9 @@ use Pterodactyl\Transformers\Api\Application\NestTransformer;
|
||||||
use Pterodactyl\Http\Requests\Api\Application\Nests\GetNestRequest;
|
use Pterodactyl\Http\Requests\Api\Application\Nests\GetNestRequest;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||||
use Pterodactyl\Http\Requests\Api\Application\Nests\GetNestsRequest;
|
use Pterodactyl\Http\Requests\Api\Application\Nests\GetNestsRequest;
|
||||||
use Pterodactyl\Http\Requests\Api\Application\Nests\StoreEggRequest;
|
use Pterodactyl\Http\Requests\Api\Application\Nests\StoreNestRequest;
|
||||||
use Pterodactyl\Http\Requests\Api\Application\Nests\UpdateNestRequest;
|
use Pterodactyl\Http\Requests\Api\Application\Nests\UpdateNestRequest;
|
||||||
use Pterodactyl\Http\Requests\Api\Application\Nests\DeleteEggRequest;
|
use Pterodactyl\Http\Requests\Api\Application\Nests\DeleteNestRequest;
|
||||||
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
|
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
|
||||||
|
|
||||||
class NestController extends ApplicationApiController
|
class NestController extends ApplicationApiController
|
||||||
|
@ -105,13 +105,13 @@ class NestController extends ApplicationApiController
|
||||||
/**
|
/**
|
||||||
* Creates a new nest.
|
* Creates a new nest.
|
||||||
*
|
*
|
||||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nests\StoreEggRequest $request
|
* @param \Pterodactyl\Http\Requests\Api\Application\Nests\StoreNestRequest $request
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||||
*/
|
*/
|
||||||
public function store(StoreEggRequest $request): array
|
public function store(StoreNestRequest $request): array
|
||||||
{
|
{
|
||||||
$nest = $this->nestCreationService->handle($request->validated());
|
$nest = $this->nestCreationService->handle($request->validated());
|
||||||
|
|
||||||
|
@ -143,13 +143,13 @@ class NestController extends ApplicationApiController
|
||||||
/**
|
/**
|
||||||
* Deletes an existing nest.
|
* Deletes an existing nest.
|
||||||
*
|
*
|
||||||
* @param \Pterodactyl\Http\Requests\Api\Application\Nests\DeleteEggRequest $request
|
* @param \Pterodactyl\Http\Requests\Api\Application\Nests\DeleteNestRequest $request
|
||||||
* @param \Pterodactyl\Models\Nest $nest
|
* @param \Pterodactyl\Models\Nest $nest
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
|
* @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
|
||||||
*/
|
*/
|
||||||
public function delete(DeleteEggRequest $request, Nest $nest): JsonResponse
|
public function delete(DeleteNestRequest $request, Nest $nest): JsonResponse
|
||||||
{
|
{
|
||||||
$this->nestDeletionService->handle($nest->id);
|
$this->nestDeletionService->handle($nest->id);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace Pterodactyl\Http\Requests\Api\Application\Nests;
|
||||||
|
|
||||||
use Pterodactyl\Models\Nest;
|
use Pterodactyl\Models\Nest;
|
||||||
|
|
||||||
class UpdateNestRequest extends StoreEggRequest
|
class UpdateNestRequest extends StoreNestRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* ?
|
* ?
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
import http from '@/api/http';
|
||||||
|
import { Nest, rawDataToNest } from '@/api/admin/nests/getNests';
|
||||||
|
|
||||||
|
export default (id: number, name: string, description?: string): Promise<Nest> => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
http.patch(`/api/application/nests/${id}`, {
|
||||||
|
name, description,
|
||||||
|
})
|
||||||
|
.then(({ data }) => resolve(rawDataToNest(data)))
|
||||||
|
.catch(reject);
|
||||||
|
});
|
||||||
|
};
|
Loading…
Reference in New Issue