Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Update] API Route & Tests #151

Merged
merged 3 commits into from
Jun 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Application general information
APP_NAME=Kurozora
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://kurozora-web.test
APP_KEY=
DOMAIN_NAME=kurozora-web.test
APP_URL=https://{$DOMAIN_NAME}
APP_TWITTER_HANDLE=KurozoraApp
APP_BUNDLE_ID=app.kurozora.tracker

Expand All @@ -19,6 +20,14 @@ DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

# Kurozora Dashboard connection
K_DB_CONNECTION=pgsql
K_DB_HOST=127.0.0.1
K_DB_PORT=5432
K_DB_DATABASE=homestead
K_DB_USERNAME=homestead
K_DB_PASSWORD=secret

# Drivers
BROADCAST_DRIVER=
CACHE_DRIVER=file
Expand Down Expand Up @@ -49,11 +58,6 @@ MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

# Optionally use the variable below to limit the amount
# of Anime that can be seeded. This speeds up development
# when using "migrate:fresh --seed" a lot
MAX_ANIME_TO_SEED=200

# StoreKit Configuration
SK_APP_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Expand Down
56 changes: 0 additions & 56 deletions app/Console/Commands/FreshCommand.php

This file was deleted.

13 changes: 13 additions & 0 deletions app/Http/Controllers/APIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@

use App\Helpers\JSONResult;
use FG\ASN1\Exception\NotImplementedException;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Redirector;

class APIController extends Controller
{
/**
* The index page of the API.
*
* @return Application|Redirector|RedirectResponse
*/
function index(): Application|Redirector|RedirectResponse
{
return redirect(route('api'));
}

/**
* Returns a plain JSON response for the API.
*
Expand Down
51 changes: 0 additions & 51 deletions app/Providers/MigrationServiceProvider.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function boot()
$this->configureRateLimiting();

$this->routes(function () {
Route::prefix('api')
Route::domain('api.' . config('app.domain'))
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Expand Down
22 changes: 11 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
| or any other location as required by the application or its packages.
*/

'version' => '1.2.0-alpha.85',
'version' => '1.2.0-alpha.86',

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -211,7 +211,6 @@
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\MigrationServiceProvider::class,
App\Providers\NovaServiceProvider::class,
App\Providers\ProfileServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Expand Down
8 changes: 7 additions & 1 deletion database/factories/AnimeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class AnimeFactory extends Factory
*/
public function definition(): array
{
$jaFaker = \Faker\Factory::create('ja_JP');
$title = $this->faker->sentence;
$totalEpisodesArray = [10, 12, 24];
$totalEpisodes = $totalEpisodesArray[array_rand($totalEpisodesArray)];
Expand Down Expand Up @@ -64,14 +65,19 @@ public function definition(): array
'tagline' => $this->faker->sentence,
'title' => $title,
'synopsis' => $this->faker->paragraph,
'ja' => [
'title' => $jaFaker->sentence,
'synopsis' => $jaFaker->paragraph,
],
'synonym_titles' => $this->faker->sentences(),
'tv_rating_id' => $tvRating,
'media_type_id' => $mediaType,
'source_id' => $source,
'status_id' => $status,
'first_aired' => $firstAired,
'last_aired' => $lastAired,
'runtime' => $this->faker->numberBetween(10, 25),
'air_time' => $this->faker->time('H:i'),
'air_time' => $this->faker->time(),
'air_day' => DayOfWeek::getRandomValue(),
'is_nsfw' => $this->faker->boolean,
'copyright' => $this->faker->randomElement(['© ', '℗ ', '® ']) . $this->faker->year . ' ' . $this->faker->company,
Expand Down
7 changes: 5 additions & 2 deletions database/factories/CharacterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class CharacterFactory extends Factory
*/
public function definition(): array
{
$jaFaker = \Faker\Factory::create('ja_JP');
$month = $this->faker->month;
$isFemale = mt_rand(0, 1);
$genderString = $isFemale ? 'female' : 'male';
$bust = null;
$waist = null;
$hip = null;
$jpFaker = \Faker\Factory::create('ja_JP');

if ($isFemale) {
$bust = $this->faker->randomFloat(2, 20, 80);
Expand All @@ -37,9 +37,12 @@ public function definition(): array

return [
'name' => $this->faker->name($genderString),
'japanese_name' => $jpFaker->name($genderString),
'nicknames' => $this->faker->words(mt_rand(0, 3)),
'about' => $this->faker->paragraph(mt_rand(10, 30)),
'ja' => [
'name' => $jaFaker->name($genderString),
'about' => $jaFaker->paragraph
],
'image' => $this->faker->imageUrl(),
'debut' => $this->faker->numerify('Episode ##'),
'status' => $this->faker->randomElement(['Alive', 'Deceased']),
Expand Down
1 change: 1 addition & 0 deletions database/factories/StudioFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function definition(): array
{
return [
'name' => $this->faker->unique()->company,
'type' => 'anime',
'logo_url' => $this->faker->imageUrl(),
'about' => $this->faker->paragraph(mt_rand(10, 30)),
'founded' => $this->faker->date(),
Expand Down
Loading