Skip to content

Commit 580e5ac

Browse files
committed
Begin working on administrative server view changes
Also includes tests for the DatabaseCreation service.
1 parent 0c513f2 commit 580e5ac

File tree

18 files changed

+584
-135
lines changed

18 files changed

+584
-135
lines changed

app/Contracts/Repository/AllocationRepositoryInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,12 @@ interface AllocationRepositoryInterface extends RepositoryInterface
3434
* @return int
3535
*/
3636
public function assignAllocationsToServer($server, array $ids);
37+
38+
/**
39+
* Return all of the allocations for a specific node.
40+
*
41+
* @param int $node
42+
* @return \Illuminate\Database\Eloquent\Collection
43+
*/
44+
public function getAllocationsForNode($node);
3745
}

app/Contracts/Repository/Daemon/ServerRepositoryInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface ServerRepositoryInterface extends BaseRepositoryInterface
3232
* @param int $id
3333
* @param array $overrides
3434
* @param bool $start
35-
* @return mixed
35+
* @return \Psr\Http\Message\ResponseInterface
3636
*/
3737
public function create($id, $overrides = [], $start = false);
3838
}

app/Contracts/Repository/NodeRepositoryInterface.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,11 @@
2828

2929
interface NodeRepositoryInterface extends RepositoryInterface, SearchableInterface
3030
{
31-
//
31+
/**
32+
* Return a collection of nodes beloning to a specific location for use on frontend display.
33+
*
34+
* @param int $location
35+
* @return mixed
36+
*/
37+
public function getNodesForLocation($location);
3238
}

app/Contracts/Repository/ServerRepositoryInterface.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public function getAllServers($paginate);
4141
*
4242
* @param int $id
4343
* @return mixed
44+
*
45+
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
4446
*/
4547
public function findWithVariables($id);
4648

@@ -49,7 +51,30 @@ public function findWithVariables($id);
4951
* default if there is no value defined for the specific server requested.
5052
*
5153
* @param int $id
52-
* @return array
54+
* @param bool $returnAsObject
55+
* @return array|object
56+
*
57+
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
58+
*/
59+
public function getVariablesWithValues($id, $returnAsObject = false);
60+
61+
/**
62+
* Return enough data to be used for the creation of a server via the daemon.
63+
*
64+
* @param int $id
65+
* @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model
66+
*
67+
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
68+
*/
69+
public function getDataForCreation($id);
70+
71+
/**
72+
* Return a server as well as associated databases and their hosts.
73+
*
74+
* @param int $id
75+
* @return mixed
76+
*
77+
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
5378
*/
54-
public function getVariablesWithValues($id);
79+
public function getWithDatabases($id);
5580
}

app/Exceptions/Handler.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Pterodactyl\Exceptions;
44

5-
use Log;
65
use Exception;
76
use Illuminate\Auth\AuthenticationException;
87
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
@@ -21,27 +20,31 @@ class Handler extends ExceptionHandler
2120
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
2221
\Illuminate\Session\TokenMismatchException::class,
2322
\Illuminate\Validation\ValidationException::class,
23+
\Pterodactyl\Exceptions\Model\DataValidationException::class,
2424
];
2525

2626
/**
2727
* Report or log an exception.
2828
*
2929
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
3030
*
31-
* @param \Exception $exception
32-
* @return void
31+
* @param \Exception $exception
32+
*
33+
* @throws \Exception
3334
*/
3435
public function report(Exception $exception)
3536
{
36-
return parent::report($exception);
37+
parent::report($exception);
3738
}
3839

3940
/**
4041
* Render an exception into an HTTP response.
4142
*
42-
* @param \Illuminate\Http\Request $request
43-
* @param \Exception $exception
44-
* @return \Illuminate\Http\Response
43+
* @param \Illuminate\Http\Request $request
44+
* @param \Exception $exception
45+
* @return \Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\Response
46+
*
47+
* @throws \Exception
4548
*/
4649
public function render($request, Exception $exception)
4750
{

0 commit comments

Comments
 (0)