Various bug fixes

This commit is contained in:
Julien Nahum 2023-10-13 10:05:10 +02:00
parent 7a4b6dbd79
commit ebedaaf796
4 changed files with 39 additions and 2 deletions

View File

@ -14,7 +14,7 @@ class AiGenerateFormRequest extends FormRequest
public function rules() public function rules()
{ {
return [ return [
'form_prompt' => 'required|string' 'form_prompt' => 'required|string|max:1000'
]; ];
} }
} }

View File

@ -55,7 +55,7 @@ class GenerateAiForm implements ShouldQueue
} catch (\Exception $e) { } catch (\Exception $e) {
$this->completion->update([ $this->completion->update([
'status' => AiFormCompletion::STATUS_FAILED, 'status' => AiFormCompletion::STATUS_FAILED,
'result' => $e->getMessage() 'result' => ['error' => $e->getMessage()]
]); ]);
} }

View File

@ -218,6 +218,11 @@ class Form extends Model
return !empty($this->password); return !empty($this->password);
} }
public function getRemovedPropertiesAttribute()
{
return $this->attributes['removed_properties'] ?? [];
}
/** /**
* Relationships * Relationships
*/ */

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('ai_form_completions', function (Blueprint $table) {
$table->text('form_prompt')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('ai_form_completions', function (Blueprint $table) {
$table->string('form_prompt')->change();
});
}
};