Skip to content
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

PG-25 #5

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
report: clover.xml
coverage_badge_path: output/coverage.svg
push_badge: false
- name: Git push to image-data branch
- name: Git push to testing/develop branch
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function up(): void
$table->uuid('owned_by_id')->nullable()->index();
$table->uuid('parent_id')->nullable()->index();
$table->string('board_type')->nullable()->index();
$table->uuid('backlog_id')->nullable()->index();
$table->uuid('epic_id')->nullable()->index();
$table->uuid('flow_id')->nullable()->index();
$table->uuid('milestone_id')->nullable()->index();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function up(): void
$table->uuid('owned_by_id')->nullable()->index();
$table->uuid('parent_id')->nullable()->index();
$table->string('epic_type')->nullable()->index();
$table->uuid('backlog_id')->nullable()->index();
$table->uuid('board_id')->nullable()->index();
$table->uuid('flow_id')->nullable()->index();
$table->uuid('milestone_id')->nullable()->index();
Expand Down
2 changes: 1 addition & 1 deletion routes/backlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'backlog')
;

Route::put('/unlock/{backlog}', [
Route::delete('/lock/{backlog}', [
'as' => 'playground.matrix.resource.backlogs.unlock',
'uses' => 'BacklogController@unlock',
])->whereUuid('backlog')
Expand Down
2 changes: 1 addition & 1 deletion routes/boards.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'board')
;

Route::put('/unlock/{board}', [
Route::delete('/lock/{board}', [
'as' => 'playground.matrix.resource.boards.unlock',
'uses' => 'BoardController@unlock',
])->whereUuid('board')
Expand Down
2 changes: 1 addition & 1 deletion routes/epics.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'epic')
;

Route::put('/unlock/{epic}', [
Route::delete('/lock/{epic}', [
'as' => 'playground.matrix.resource.epics.unlock',
'uses' => 'EpicController@unlock',
])->whereUuid('epic')
Expand Down
2 changes: 1 addition & 1 deletion routes/flows.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'flow')
;

Route::put('/unlock/{flow}', [
Route::delete('/lock/{flow}', [
'as' => 'playground.matrix.resource.flows.unlock',
'uses' => 'FlowController@unlock',
])->whereUuid('flow')
Expand Down
2 changes: 1 addition & 1 deletion routes/milestones.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'milestone')
;

Route::put('/unlock/{milestone}', [
Route::delete('/lock/{milestone}', [
'as' => 'playground.matrix.resource.milestones.unlock',
'uses' => 'MilestoneController@unlock',
])->whereUuid('milestone')
Expand Down
2 changes: 1 addition & 1 deletion routes/notes.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'note')
;

Route::put('/unlock/{note}', [
Route::delete('/lock/{note}', [
'as' => 'playground.matrix.resource.notes.unlock',
'uses' => 'NoteController@unlock',
])->whereUuid('note')
Expand Down
2 changes: 1 addition & 1 deletion routes/projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'project')
;

Route::put('/unlock/{project}', [
Route::delete('/lock/{project}', [
'as' => 'playground.matrix.resource.projects.unlock',
'uses' => 'ProjectController@unlock',
])->whereUuid('project')
Expand Down
2 changes: 1 addition & 1 deletion routes/releases.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'release')
;

Route::put('/unlock/{release}', [
Route::delete('/lock/{release}', [
'as' => 'playground.matrix.resource.releases.unlock',
'uses' => 'ReleaseController@unlock',
])->whereUuid('release')
Expand Down
2 changes: 1 addition & 1 deletion routes/roadmaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'roadmap')
;

Route::put('/unlock/{roadmap}', [
Route::delete('/lock/{roadmap}', [
'as' => 'playground.matrix.resource.roadmaps.unlock',
'uses' => 'RoadmapController@unlock',
])->whereUuid('roadmap')
Expand Down
2 changes: 1 addition & 1 deletion routes/sources.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'source')
;

Route::put('/unlock/{source}', [
Route::delete('/lock/{source}', [
'as' => 'playground.matrix.resource.sources.unlock',
'uses' => 'SourceController@unlock',
])->whereUuid('source')
Expand Down
2 changes: 1 addition & 1 deletion routes/sprints.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'sprint')
;

Route::put('/unlock/{sprint}', [
Route::delete('/lock/{sprint}', [
'as' => 'playground.matrix.resource.sprints.unlock',
'uses' => 'SprintController@unlock',
])->whereUuid('sprint')
Expand Down
2 changes: 1 addition & 1 deletion routes/tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'tag')
;

Route::put('/unlock/{tag}', [
Route::delete('/lock/{tag}', [
'as' => 'playground.matrix.resource.tags.unlock',
'uses' => 'TagController@unlock',
])->whereUuid('tag')
Expand Down
2 changes: 1 addition & 1 deletion routes/teams.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'team')
;

Route::put('/unlock/{team}', [
Route::delete('/lock/{team}', [
'as' => 'playground.matrix.resource.teams.unlock',
'uses' => 'TeamController@unlock',
])->whereUuid('team')
Expand Down
2 changes: 1 addition & 1 deletion routes/tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'ticket')
;

Route::put('/unlock/{ticket}', [
Route::delete('/lock/{ticket}', [
'as' => 'playground.matrix.resource.tickets.unlock',
'uses' => 'TicketController@unlock',
])->whereUuid('ticket')
Expand Down
2 changes: 1 addition & 1 deletion routes/versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
->can('lock', 'version')
;

Route::put('/unlock/{version}', [
Route::delete('/lock/{version}', [
'as' => 'playground.matrix.resource.versions.unlock',
'uses' => 'VersionController@unlock',
])->whereUuid('version')
Expand Down
41 changes: 21 additions & 20 deletions src/Http/Controllers/BacklogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
use GammaMatrix\Playground\Matrix\Resource\Http\Requests\Backlog\StoreRequest;
use GammaMatrix\Playground\Matrix\Resource\Http\Requests\Backlog\UnlockRequest;
use GammaMatrix\Playground\Matrix\Resource\Http\Requests\Backlog\UpdateRequest;
use GammaMatrix\Playground\Matrix\Resource\Http\Resources\Backlog\Backlog as BacklogResource;
use GammaMatrix\Playground\Matrix\Resource\Http\Resources\Backlog\BacklogCollection;
use GammaMatrix\Playground\Matrix\Resource\Http\Resources\Backlog as BacklogResource;
use GammaMatrix\Playground\Matrix\Resource\Http\Resources\BacklogCollection;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Resources\Json\JsonResource;
Expand Down Expand Up @@ -62,7 +62,7 @@ public function create(
$backlog = new Backlog($validated);

$meta = [
'session_user_id' => $user->id,
'session_user_id' => $user?->id,
'id' => null,
'timestamp' => Carbon::now()->toJson(),
'validated' => $validated,
Expand Down Expand Up @@ -113,7 +113,7 @@ public function edit(
$user = $request->user();

$meta = [
'session_user_id' => $user->id,
'session_user_id' => $user?->id,
'id' => $backlog->id,
'timestamp' => Carbon::now()->toJson(),
'validated' => $validated,
Expand Down Expand Up @@ -186,7 +186,7 @@ public function destroy(
public function lock(
Backlog $backlog,
LockRequest $request
): JsonResponse|RedirectResponse {
): JsonResponse|RedirectResponse|BacklogResource {
$validated = $request->validated();

$user = $request->user();
Expand All @@ -196,14 +196,15 @@ public function lock(
$backlog->save();

$meta = [
'session_user_id' => $user->id,
'session_user_id' => $user?->id,
'id' => $backlog->id,
'timestamp' => Carbon::now()->toJson(),
'info' => $this->packageInfo,
];
// dump($request);

if ($request->expectsJson()) {
return new BacklogResource($backlog);
return (new BacklogResource($backlog))->response($request);
}

$returnUrl = $validated['_return_url'] ?? '';
Expand Down Expand Up @@ -261,13 +262,13 @@ public function index(

if ($request->expectsJson()) {
return (new BacklogCollection($paginator))->additional(['meta' => [
'session_user_id' => $user->id,
'session_user_id' => $user?->id,
'validated' => $validated,
]]);
}

$meta = [
'session_user_id' => $user->id,
'session_user_id' => $user?->id,
'columns' => $request->getPaginationColumns(),
'dates' => $request->getPaginationDates(),
'flags' => $request->getPaginationFlags(),
Expand Down Expand Up @@ -298,15 +299,15 @@ public function index(
public function restore(
Backlog $backlog,
RestoreRequest $request
): JsonResponse|RedirectResponse {
): JsonResponse|RedirectResponse|BacklogResource {
$validated = $request->validated();

$user = $request->user();

$backlog->restore();

if ($request->expectsJson()) {
return new BacklogResource($backlog);
return (new BacklogResource($backlog))->response($request);
}

$returnUrl = $validated['_return_url'] ?? '';
Expand All @@ -326,21 +327,21 @@ public function restore(
public function show(
Backlog $backlog,
ShowRequest $request
): JsonResponse|View {
): JsonResponse|View|BacklogResource {
$validated = $request->validated();

$user = $request->user();

$meta = [
'session_user_id' => $user->id,
'session_user_id' => $user?->id,
'id' => $backlog->id,
'timestamp' => Carbon::now()->toJson(),
'validated' => $validated,
'info' => $this->packageInfo,
];

if ($request->expectsJson()) {
return new BacklogResource($backlog);
return (new BacklogResource($backlog))->response($request);
}

$meta['input'] = $request->input();
Expand All @@ -364,7 +365,7 @@ public function show(
*/
public function store(
StoreRequest $request
): Response|JsonResponse|RedirectResponse {
): Response|JsonResponse|RedirectResponse|BacklogResource {
$validated = $request->validated();

$user = $request->user();
Expand All @@ -374,7 +375,7 @@ public function store(
$backlog->save();

if ($request->expectsJson()) {
return new BacklogResource($backlog);
return (new BacklogResource($backlog))->response($request);
}

$returnUrl = $validated['return_url'] ?? '';
Expand All @@ -394,7 +395,7 @@ public function store(
public function unlock(
Backlog $backlog,
UnlockRequest $request
): JsonResponse|RedirectResponse {
): JsonResponse|RedirectResponse|BacklogResource {
$validated = $request->validated();

$user = $request->user();
Expand All @@ -404,7 +405,7 @@ public function unlock(
$backlog->save();

if ($request->expectsJson()) {
return new BacklogResource($backlog);
return (new BacklogResource($backlog))->response($request);
}

$returnUrl = $validated['return_url'] ?? '';
Expand All @@ -424,15 +425,15 @@ public function unlock(
public function update(
Backlog $backlog,
UpdateRequest $request
): JsonResponse|RedirectResponse {
): JsonResponse|RedirectResponse|BacklogResource {
$validated = $request->validated();

$user = $request->user();

$backlog->update($validated);

if ($request->expectsJson()) {
return new BacklogResource($backlog);
return (new BacklogResource($backlog))->response($request);
}

$returnUrl = $validated['return_url'] ?? '';
Expand Down
Loading