feat: add 'url' field to Integration model and update related requests and seeder
This commit is contained in:
parent
3887a4fcba
commit
21b8fa5f35
|
|
@ -11,6 +11,7 @@ class Integration extends Model
|
|||
protected $fillable = [
|
||||
'integration_code',
|
||||
'name',
|
||||
'url',
|
||||
'integration_data_schema',
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class StoreIntegrationRequest extends FormRequest
|
|||
return [
|
||||
'integration_code' => ['required', 'string', 'unique:integrations,integration_code'],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'url' => ['nullable', 'url', 'max:255'],
|
||||
'integration_data_schema' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class UpdateIntegrationRequest extends FormRequest
|
|||
|
||||
return [
|
||||
'name' => ['sometimes', 'required', 'string', 'max:255'],
|
||||
'url' => ['nullable', 'url', 'max:255'],
|
||||
'integration_data_schema' => ['nullable', 'array'],
|
||||
// the code shouldn't ideally be updatable, but if it is:
|
||||
'integration_code' => ['sometimes', 'required', 'string', 'unique:integrations,integration_code,' . ($integration->id ?? '')],
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ return new class extends Migration
|
|||
$table->id();
|
||||
$table->string('integration_code')->unique();
|
||||
$table->string('name');
|
||||
$table->string('url')->nullable();
|
||||
$table->json('integration_data_schema')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,6 +16,19 @@ class TelepagosIntegrationSeeder extends Seeder
|
|||
['integration_code' => 'telepagos'],
|
||||
[
|
||||
'name' => 'Telepagos',
|
||||
'url' => 'https://api.telepagos.com.ar',
|
||||
'integration_data_schema' => [
|
||||
'username' => 'required|string',
|
||||
'password' => 'required|string',
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
Integration::updateOrCreate(
|
||||
['integration_code' => 'telepagos_homo'],
|
||||
[
|
||||
'name' => 'Telepagos Homologación',
|
||||
'url' => 'https://api.homo.telepagos.com.ar',
|
||||
'integration_data_schema' => [
|
||||
'username' => 'required|string',
|
||||
'password' => 'required|string',
|
||||
|
|
|
|||
Loading…
Reference in New Issue