diff --git a/be/app/Console/Commands/SyncUsersFromKarat.php b/be/app/Console/Commands/SyncUsersFromKarat.php new file mode 100644 index 0000000..c1aa39e --- /dev/null +++ b/be/app/Console/Commands/SyncUsersFromKarat.php @@ -0,0 +1,39 @@ +syncUsers()); + + + return Command::SUCCESS; + } +} diff --git a/be/app/Services/Karat/Api.php b/be/app/Services/Karat/Api.php new file mode 100644 index 0000000..f2ce08f --- /dev/null +++ b/be/app/Services/Karat/Api.php @@ -0,0 +1,47 @@ +username = Config::get('services.karat.username'); + $this->password = Config::get('services.karat.password'); + $this->endpoint = Config::get('services.karat.endpoint'); + } + + private function doRequest($command) + { + $response = Http::withOptions([ + 'debug' => true, + 'verify' => false, + ])->withBasicAuth($this->username, $this->password) + ->post($this->endpoint, [ + 'command' => $command, + ]); + + return $response->json(); + } + + public function getUsers() + { + return $this->doRequest('TM_GET_USERS'); + } +} diff --git a/be/app/Services/Karat/KaratService.php b/be/app/Services/Karat/KaratService.php new file mode 100644 index 0000000..6baf116 --- /dev/null +++ b/be/app/Services/Karat/KaratService.php @@ -0,0 +1,24 @@ +api = new Api(); + } + + public function syncUsers() + { + $users = $this->api->getUsers(); + + dd($users); + + return $users; + } + + +} diff --git a/be/config/services.php b/be/config/services.php index 0ace530..af7867b 100644 --- a/be/config/services.php +++ b/be/config/services.php @@ -31,4 +31,11 @@ return [ 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], + 'karat' => [ + 'username' => env('KARAT_USERNAME'), + 'password' => env('KARAT_PASSWORD'), + 'endpoint' => 'https://86.110.228.181:39001/service', + + ], + ]; diff --git a/be/database/migrations/2023_02_22_135036_add_created_by_to_master_tasks.php b/be/database/migrations/2023_02_22_135036_add_created_by_to_master_tasks.php new file mode 100644 index 0000000..ab9e1b7 --- /dev/null +++ b/be/database/migrations/2023_02_22_135036_add_created_by_to_master_tasks.php @@ -0,0 +1,32 @@ +foreignIdFor( \App\Models\User::class, 'created_by')->after('team_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('master_tasks', function (Blueprint $table) { + // + }); + } +}; diff --git a/be/database/migrations/2023_02_22_135045_add_created_by_to_sub_tasks.php b/be/database/migrations/2023_02_22_135045_add_created_by_to_sub_tasks.php new file mode 100644 index 0000000..768cd62 --- /dev/null +++ b/be/database/migrations/2023_02_22_135045_add_created_by_to_sub_tasks.php @@ -0,0 +1,32 @@ +foreignIdFor( \App\Models\User::class, 'created_by')->after('master_task_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('sub_tasks', function (Blueprint $table) { + // + }); + } +};