-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FZ-122 initial version of meetings tquery #185
Changes from 11 commits
1fe7bc8
8926259
b5aefa3
8e3a7a8
41ac79d
2b94162
eebfb09
df2d88e
1a278ae
8264355
5c5583a
ff2578c
1eb055d
eefca08
6b24ceb
d23f7c5
63c929c
0d04d8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Facility; | ||
|
||
use App\Http\Controllers\ApiController; | ||
use App\Http\Permissions\Permission; | ||
use App\Http\Permissions\PermissionDescribe; | ||
use App\Tquery\Engine\TqService; | ||
use App\Tquery\OpenApi\OpenApiGet; | ||
use App\Tquery\OpenApi\OpenApiPost; | ||
use App\Tquery\Tables\MeetingTquery; | ||
use Illuminate\Http\JsonResponse; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\App; | ||
|
||
class MeetingTqueryController extends ApiController | ||
{ | ||
protected function initPermissions(): void | ||
{ | ||
$this->permissionOneOf(Permission::globalAdmin); | ||
} | ||
|
||
private function getTqService(): TqService | ||
{ | ||
return App::make(MeetingTquery::class, ['facility' => $this->getFacilityOrFail()]); | ||
} | ||
|
||
#[OpenApiGet( | ||
path: '/api/v1/facility/{facility}/meeting/tquery', | ||
permissions: new PermissionDescribe(Permission::facilityAdmin), | ||
summary: 'All facilities tquery', | ||
tag: 'Facility meeting', | ||
isFacility: true, | ||
)] | ||
public function get(): JsonResponse | ||
{ | ||
return new JsonResponse($this->getTqService()->getConfigArray()); | ||
} | ||
|
||
#[OpenApiPost( | ||
path: '/api/v1/facility/{facility}/meeting/tquery', | ||
permissions: new PermissionDescribe(Permission::facilityAdmin), | ||
summary: 'All facilities tquery', | ||
tag: 'Facility meeting', | ||
isFacility: true, | ||
)] | ||
public function post( | ||
Request $request, | ||
): JsonResponse { | ||
return new JsonResponse($this->getTqService()->query($request)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace App\Models\UuidEnum; | ||
|
||
interface AttributeUuidEnum | ||
{ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Models\UuidEnum; | ||
|
||
enum MeetingAttributeUuidEnum: string implements AttributeUuidEnum | ||
{ | ||
case Type = '5f7d5e66-03f9-4bcd-a726-fde82cf98d6f'; | ||
case Category = '8111626d-130c-454d-b0c0-9fda9ab9917a'; | ||
case Status = 'e443e2c2-82fc-41d3-8fda-fe374e5329d3'; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\Tquery\Config; | ||
|
||
use App\Exceptions\FatalExceptionFactory; | ||
use App\Models\UuidEnum\DictionaryUuidEnum; | ||
|
||
readonly class TqDictDef | ||
{ | ||
public string $dictionaryId; | ||
|
||
public function __construct( | ||
public TqDataTypeEnum $dataType, | ||
string|DictionaryUuidEnum $dictionary, | ||
) { | ||
if (!$this->dataType->isDict()) { | ||
FatalExceptionFactory::tquery()->throw(); | ||
} | ||
$this->dictionaryId = is_string($dictionary) ? $dictionary : $dictionary->value; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ta logika się powtarza, może zrobić jakiegoś helpera? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wydaje mi się, że jeszcze bym tego nie wyciągał, to jest powtórzone 2 razy, i nie jest jakąś wielką logiką. A IDE ogarnia sobie typy dobrze przy tym |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ enum TqTableEnum | |
case users; | ||
case members; | ||
case facilities; | ||
case meetings; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary skopiowane z facilities tu i poniżej.