fix positions
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 54s
Tests / PHPUnit (push) Successful in 1m22s

This commit is contained in:
root
2026-09-03 03:21:37 -04:00
parent 6936a822c8
commit c70f6bdc6e
12 changed files with 344 additions and 18 deletions
+13 -1
View File
@@ -235,7 +235,7 @@ class JobPostingController extends BaseController
public function positions()
{
return view('jobs/admin/positions', [
'positions' => $this->positions->openPositions(),
'positions' => $this->positions->adminPositions(),
]);
}
@@ -263,6 +263,9 @@ class JobPostingController extends BaseController
$payload['position_id'] = $this->newUuid();
$payload['posted_by'] = $this->currentUserId();
if ($payload['status'] === 'open') {
$payload['posted_at'] = utc_now();
}
if (!$this->positions->insert($payload)) {
return redirect()->back()->withInput()->with('error', 'Unable to create position.');
@@ -287,11 +290,20 @@ class JobPostingController extends BaseController
public function updatePosition(string $positionId)
{
$position = $this->positions->find($positionId);
if (!$position) {
return redirect()->to(site_url(self::ADMIN_FILTER_ROUTE . '/positions'))->with('error', 'Position not found.');
}
$payload = $this->positionPayload();
if ($payload === null) {
return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
}
if ($payload['status'] === 'open' && (($position['status'] ?? '') !== 'open' || empty($position['posted_at']))) {
$payload['posted_at'] = utc_now();
}
if (!$this->positions->update($positionId, $payload)) {
return redirect()->back()->withInput()->with('error', 'Unable to update position.');
}