Skip to content

Commit

Permalink
will phpunit stall there too
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Mar 25, 2024
1 parent 9fc2c00 commit 85a9cb0
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 7 deletions.
6 changes: 5 additions & 1 deletion app/Enums/ApiKeyTypeEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ enum ApiKeyTypeEnum: string
{
use Values;

case OPENAI = 'openai';
case Openai = 'openai';
case OpenAi_Azure = 'openai_azure';
case Ollama = 'ollama';
case Claude = 'claude';
case Gemini = 'gemini';
}
68 changes: 68 additions & 0 deletions app/Http/Controllers/ProjectController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

namespace App\Http\Controllers;

use App\Http\Resources\ProjectResource;
use App\Models\Collection;
use Illuminate\Http\Request;

class ProjectController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return inertia('Projects/Index', [
'projects' => ProjectResource::collection(Collection::all()),
]);
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}
19 changes: 19 additions & 0 deletions app/Http/Resources/ProjectResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class ProjectResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return parent::toArray($request);
}
}
5 changes: 5 additions & 0 deletions app/Models/ApiKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ class ApiKey extends Model

public $guarded = [];

protected $casts = [
'is_active' => 'boolean',
'settings' => 'encrypted:json',
];

public function isActive()
{
return $this->is_active;
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Project.php → app/Models/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at
*/
class Project extends Model
class Collection extends Model
{
use HasFactory;

Expand Down
Binary file added database/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Project>
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Collection>
*/
class ProjectFactory extends Factory
class CollectionFactory extends Factory
{
/**
* Define the model's default state.
Expand All @@ -22,6 +22,9 @@ public function definition(): array
'description' => $this->faker->paragraph,
'active' => $this->faker->boolean,
'team_id' => Team::factory(),
'settings' => [
'organization_key' => 'testing',
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function up(): void

$table->string('key')->unique();
$table->string('name');
$table->json('settings');

$table->boolean('is_active')->default(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
public function up(): void
{
Schema::create('projects', function (Blueprint $table) {
Schema::create('collections', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->longText('description')->nullable();
Expand Down
Empty file.
18 changes: 18 additions & 0 deletions tests/Feature/Http/Controllers/ProjectControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Tests\Feature\Http\Controllers;

use Tests\TestCase;

class ProjectControllerTest extends TestCase
{
/**
* A basic feature test example.
*/
public function test_example(): void
{
$response = $this->get('/');

$response->assertStatus(200);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

use Tests\TestCase;

class ProjectTest extends TestCase
class CollectionTest extends TestCase
{
/**
* A basic feature test example.
*/
public function test_factory(): void
{
$model = \App\Models\Project::factory()->create();
$model = \App\Models\Collection::factory()->create();

$this->assertNotNull($model->team->id);

Expand Down

0 comments on commit 85a9cb0

Please sign in to comment.