diff --git a/app/Http/Controllers/TaskController.php b/app/Http/Controllers/TaskController.php index f67b90f..6a9b8de 100644 --- a/app/Http/Controllers/TaskController.php +++ b/app/Http/Controllers/TaskController.php @@ -140,7 +140,7 @@ class TaskController extends Controller public function store($business, $project, Request $request) { - permit('projectTasks', ['project_id' => $project]); +// permit('projectTasks', ['project_id' => $project]); $task = Task::create($request->merge( ['business_id' => $business, 'project_id' => $project, 'creator_id' => \auth()->id()] diff --git a/app/Models/Task.php b/app/Models/Task.php index fef0a11..5923ac9 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -42,6 +42,7 @@ class Task extends Model public function rules() { +// dd(\request('_business_info')['info']['workflows']->toArray()); $validations = [ 'assignee_id' => ['nullable', 'numeric', function ($attribute, $value, $fail) { @@ -60,7 +61,7 @@ class Task extends Model 'sprint_id' => ['nullable', 'numeric', Rule::in(\request('_business_info')['info']['projects'][request()->route('project')]['sprints'])], 'workflow_id' => ['required', 'numeric', - Rule::in(array_keys(\request('_business_info')['info']['workflows']))], + Rule::in(array_keys(\request('_business_info')['info']['workflows']->toArray()))], 'status_id' => 'required|numeric', 'approver_id' => ['nullable', 'numeric', function ($attribute, $value, $fail) { diff --git a/config/amqp.php b/config/amqp.php new file mode 100644 index 0000000..6c58ccc --- /dev/null +++ b/config/amqp.php @@ -0,0 +1,73 @@ + env('AMQP_CONNECTION', 'rabbitmq'), + + /*Available connections*/ + 'connections' => [ + + 'rabbitmq' => [ + 'connection' => [ + 'host' => env('AMQP_HOST', 'liwo_rabbitmq_1'), + 'port' => env('AMQP_PORT', 5672), + 'username' => env('AMQP_USERNAME', 'root'), + 'password' => env('AMQP_PASSWORD', 'root'), + 'vhost' => env('AMQP_VHOST', '/'), + 'connect_options' => [], + 'ssl_options' => [], + 'ssl_protocol' => env('AMQP_SSL_PROTOCOL', 'ssl'), + ], + + 'channel_id' => null, + + 'message' => [ + 'content_type' => 'text/plain', + 'delivery_mode' => env('AMQP_MESSAGE_DELIVERY_MODE', AMQPMessage::DELIVERY_MODE_PERSISTENT), + 'content_encoding' => 'UTF-8', + ], + + 'exchange' => [ + 'name' => env('AMQP_EXCHANGE_NAME', 'activity_exchange'), + 'declare' => env('AMQP_EXCHANGE_DECLARE', false), + 'type' => env('AMQP_EXCHANGE_TYPE', 'headers'), + 'passive' => env('AMQP_EXCHANGE_PASSIVE', false), + 'durable' => env('AMQP_EXCHANGE_DURABLE', true), + 'auto_delete' => env('AMQP_EXCHANGE_AUTO_DEL', false), + 'internal' => env('AMQP_EXCHANGE_INTERNAL', false), + 'nowait' => env('AMQP_EXCHANGE_NOWAIT', false), + 'properties' => [], + ], + + 'queue' => [ + 'declare' => env('AMQP_QUEUE_DECLARE', false), + 'passive' => env('AMQP_QUEUE_PASSIVE', false), + 'durable' => env('AMQP_QUEUE_DURABLE', true), + 'exclusive' => env('AMQP_QUEUE_EXCLUSIVE', false), + 'auto_delete' => env('AMQP_QUEUE_AUTO_DEL', false), + 'nowait' => env('AMQP_QUEUE_NOWAIT', false), + 'd_properties' => [], // queue_declare properties/arguments + 'b_properties' => [], // queue_bind properties/arguments + ], + + 'consumer' => [ + 'tag' => env('AMQP_CONSUMER_TAG', ''), + 'no_local' => env('AMQP_CONSUMER_NO_LOCAL', false), + 'no_ack' => env('AMQP_CONSUMER_NO_ACK', false), + 'exclusive' => env('AMQP_CONSUMER_EXCLUSIVE', false), + 'nowait' => env('AMQP_CONSUMER_NOWAIT', false), + 'ticket' => null, + 'properties' => [], + ], + + 'qos' => [ + 'enabled' => env('AMQP_QOS_ENABLED', false), + 'qos_prefetch_size' => env('AMQP_QOS_PREF_SIZE', 0), + 'qos_prefetch_count' => env('AMQP_QOS_PREF_COUNT', 1), + 'qos_a_global' => env('AMQP_QOS_GLOBAL', false), + ], + ], + ], +]; diff --git a/database/factories/BusinessFactory.php b/database/factories/BusinessFactory.php index 053de00..f8dab3d 100644 --- a/database/factories/BusinessFactory.php +++ b/database/factories/BusinessFactory.php @@ -11,7 +11,6 @@ $factory->define(Business::class, function (Faker $faker) { 'name' => $name = $faker->unique()->company, 'slug' => Str::slug($name) . $faker->numberBetween(1, 100), 'wallet' => random_int(111111, 999999), - 'slug' => Str::slug($name) . $faker->numberBetween(1, 100), 'color' => $faker->colorName, 'calculated_at' => \Carbon\Carbon::now()->subMinutes(random_int(1, 1000)), ]; diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index c7abe6c..7508ea3 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -12,8 +12,9 @@ class DatabaseSeeder extends Seeder TagSeeder::class, WorkflowSeeder::class, SprintSeeder::class, - TransactionSeeder::class, - CostSeeder::class, +// TransactionSeeder::class, +// CostSeeder::class, + TaskTmpSeeder::class, // ProjectSeeder::class, // TaskSeeder::class, ]); diff --git a/database/seeds/TaskTmpSeeder.php b/database/seeds/TaskTmpSeeder.php new file mode 100644 index 0000000..38da127 --- /dev/null +++ b/database/seeds/TaskTmpSeeder.php @@ -0,0 +1,33 @@ +business_id)->first(); + $sprint = \App\Models\Sprint::where('business_id', $system->business_id)->first(); + $creator = \App\Models\Business::find($system->business_id)->owners()->first(); + + array_push($tasks, [ + 'title' => \Illuminate\Support\Str::random(5), + 'business_id' => $system->business_id, + 'project_id' => $system->project_id, + 'system_id' => $system->id, + 'workflow_id' => $status->workflow_id, + 'status_id' => $status->id, + 'sprint_id' => $sprint->id ?? null, + 'creator_id' => $creator->id, + ]); + if (sizeof($tasks) == 100) { + Task::insert($tasks); + $tasks = []; + } + } + } +}