-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1426 from bakaphp/feat-task-list
feat: task list
- Loading branch information
Showing
15 changed files
with
214 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
database/migrations/ActionEngine/2024_06_03_011634_create_task_list.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class () extends Migration { | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::create('company_task_list', function (Blueprint $table) { | ||
$table->id(); | ||
$table->uuid('uuid')->index(); | ||
$table->bigInteger('apps_id')->index(); | ||
$table->bigInteger('companies_id')->index(); | ||
$table->bigInteger('users_id')->index(); | ||
$table->string('name'); | ||
$table->json('config')->nullable(); | ||
$table->timestamps(); | ||
$table->tinyInteger('is_deleted')->default(0)->index(); | ||
}); | ||
|
||
Schema::create('company_task_list_items', function (Blueprint $table) { | ||
$table->id(); | ||
$table->foreignId('task_list_id')->constrained('company_task_list')->onDelete('cascade'); | ||
$table->string('name'); | ||
$table->bigInteger('companies_action_id')->index(); | ||
$table->enum('status', ['pending', 'in_progress', 'completed'])->default('pending')->comment('pending, in_progress, completed')->index(); | ||
$table->json('config')->nullable(); | ||
$table->decimal('weight', 8, 2)->default(0)->index(); | ||
$table->timestamps(); | ||
$table->tinyInteger('is_deleted')->default(0)->index(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('company_task_list'); | ||
Schema::dropIfExists('company_task_list_items'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
type Action { | ||
id: ID! | ||
name: String! | ||
slug: String! | ||
description: String | ||
icon: String | ||
form_fields: Mixed | ||
form_config: Mixed | ||
is_active: Boolean! | ||
is_published: Boolean! | ||
collects_info: Boolean! | ||
config: Mixed | ||
parent: Action | ||
children: [Action!] | ||
} | ||
|
||
type CompanyAction { | ||
id: ID! | ||
action: Action! | ||
company: Company! | ||
name: String! | ||
description: String | ||
form_config: Mixed | ||
status: String! | ||
is_active: Boolean! | ||
is_published: Boolean! | ||
weight: Float! | ||
parent: CompanyAction | ||
children: [CompanyAction!] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
type TaskList { | ||
id: ID! | ||
name: String! | ||
company: Company! | ||
config: Mixed | ||
tasks: [TaskListItem!] @hasMany | ||
} | ||
|
||
type TaskListItem { | ||
id: ID! | ||
name: String! | ||
status: String! | ||
due_date: Date | ||
completed_date: Date | ||
config: Mixed | ||
action: CompanyAction! | ||
weight: Float! | ||
} | ||
|
||
extend type Query @guard { | ||
leadTaskList (lead_id: ID!): [TaskList!]! | ||
@paginate( | ||
model: "Kanvas\\ActionEngine\\Tasks\\Models\\TaskList" | ||
scopes: ["fromApp", "fromCompany"] | ||
defaultCount: 25 | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kanvas\ActionEngine\Tasks\Models; | ||
|
||
use Baka\Casts\Json; | ||
use Baka\Traits\UuidTrait; | ||
use Illuminate\Database\Eloquent\Relations\HasMany; | ||
use Kanvas\ActionEngine\Models\BaseModel; | ||
|
||
/** | ||
* Class Tasks. | ||
* | ||
* @property int $id | ||
* @property string $uuid | ||
* @property int $apps_id | ||
* @property int $companies_id | ||
* @property int $users_id | ||
* @property string $name | ||
* @property string $config | ||
*/ | ||
class TaskList extends BaseModel | ||
{ | ||
use UuidTrait; | ||
|
||
protected $table = 'company_task_list'; | ||
protected $guarded = []; | ||
|
||
protected $casts = [ | ||
'config' => Json::class, | ||
]; | ||
|
||
public function tasks(): HasMany | ||
{ | ||
return $this->hasMany(TaskListItem::class, 'task_list_id')->orderBy('weight'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kanvas\ActionEngine\Tasks\Models; | ||
|
||
use Baka\Casts\Json; | ||
use Baka\Traits\UuidTrait; | ||
use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
use Kanvas\ActionEngine\Actions\Models\CompanyAction; | ||
use Kanvas\ActionEngine\Models\BaseModel; | ||
|
||
/** | ||
* Class Tasks. | ||
* | ||
* @property int $id | ||
* @property int $task_list_id | ||
* @property int $companies_action_id | ||
* @property string $name | ||
* @property string $config | ||
* @property string $status | ||
* @property float $weight | ||
*/ | ||
class TaskListItem extends BaseModel | ||
{ | ||
use UuidTrait; | ||
|
||
protected $table = 'company_task_list_items'; | ||
protected $guarded = []; | ||
|
||
protected $casts = [ | ||
'config' => Json::class, | ||
]; | ||
|
||
public function task(): BelongsTo | ||
{ | ||
return $this->belongsTo(TaskList::class, 'task_list_id'); | ||
} | ||
|
||
public function action(): BelongsTo | ||
{ | ||
return $this->belongsTo(CompanyAction::class, 'companies_action_id'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters