Skip to content

Commit

Permalink
Merge pull request #1135 from shikorism/develop
Browse files Browse the repository at this point in the history
Release 2023.12.2
  • Loading branch information
shibafu528 authored Dec 17, 2023
2 parents dcdbd48 + d25e875 commit 7ed5e91
Show file tree
Hide file tree
Showing 30 changed files with 3,202 additions and 1,879 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,19 @@ jobs:
# Run unit test
- run:
command: |
mkdir -p /tmp/phpunit
./vendor/bin/phpunit --log-junit /tmp/phpunit/phpunit.xml --coverage-clover=/tmp/phpunit/coverage.xml
mkdir -p /tmp/phpunit{,-coverage}
./vendor/bin/phpunit --log-junit /tmp/phpunit/phpunit.xml --coverage-clover=/tmp/phpunit-coverage/coverage.xml
when: always
environment:
XDEBUG_MODE: coverage
- store_test_results:
path: /tmp/phpunit
- store_artifacts:
path: /tmp/phpunit/coverage.xml
path: /tmp/phpunit-coverage/coverage.xml

# Upload coverage
- run:
command: bash <(curl -s https://codecov.io/bash) -f /tmp/phpunit/coverage.xml
command: bash <(curl -s https://codecov.io/bash) -f /tmp/phpunit-coverage/coverage.xml
when: always

test_resolver:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ docker compose up -d
## デバッグ実行

```
docker compose -f docker compose.yml -f docker compose.debug.yml up -d
docker compose -f compose.yaml -f compose.debug.yaml up -d
```

で起動することにより、DB のポート`5432`を開放してホストマシンから接続できるようになります。
Expand Down
3 changes: 3 additions & 0 deletions app/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

namespace App;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Collection extends Model
{
use HasFactory;

/** @var int ユーザーごとの作成数制限 */
const PER_USER_LIMIT = 100;

Expand Down
3 changes: 3 additions & 0 deletions app/CollectionItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
namespace App;

use App\Utilities\Formatter;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class CollectionItem extends Model
{
use HasFactory;

const PER_COLLECTION_LIMIT = 1000;

protected $fillable = [
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Api/UserCollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Http\Controllers\Controller;
use App\Http\Resources\CollectionResource;
use App\User;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

class UserCollectionController extends Controller
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Controllers\Api;
namespace App\Http\Controllers\Api\V1;

use App\Collection;
use App\CollectionItem;
Expand All @@ -20,7 +20,6 @@ class CollectionController extends Controller
{
public function __construct()
{
$this->middleware('auth')->except('show');
$this->middleware(function (Request $request, $next) {
$collection = $request->route('collection');
if ($collection instanceof Collection && !$collection->user->isMe()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Controllers\Api;
namespace App\Http\Controllers\Api\V1;

use App\Collection;
use App\CollectionItem;
Expand All @@ -19,7 +19,6 @@ class CollectionItemController extends Controller
{
public function __construct()
{
$this->middleware('auth')->except('index');
$this->middleware(function (Request $request, $next) {
$collection = $request->route('collection');
if ($collection instanceof Collection && !$collection->user->isMe()) {
Expand Down
32 changes: 32 additions & 0 deletions app/Http/Controllers/Api/V1/UserCollectionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\Http\Controllers\Api\V1;

use App\Http\Controllers\Controller;
use App\Http\Resources\CollectionResource;
use App\User;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

class UserCollectionController extends Controller
{
public function index(Request $request, User $user)
{
if (!$user->isMe() && $user->is_protected) {
throw new AccessDeniedHttpException('このユーザはチェックイン履歴を公開していません');
}

$inputs = $request->validate([
'per_page' => 'nullable|integer|between:10,100',
]);

$query = $user->collections();
if (!$user->isMe()) {
$query = $query->where('is_private', false);
}
$collections = $query->orderBy('id')
->paginate($inputs['per_page'] ?? 20);

return response()->fromPaginator($collections, CollectionResource::class);
}
}
4 changes: 4 additions & 0 deletions compose.debug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:
db:
ports:
- 5432:5432
3 changes: 0 additions & 3 deletions docker-compose.mailcatcher.yml → compose.mailcatcher.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
version: "3"

services:
mailcatcher:
image: schickling/mailcatcher
ports:
- 1080:1080
networks:
- backend

8 changes: 4 additions & 4 deletions docker-compose.yml → compose.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: "3"

services:
web:
build: .
build:
context: .
dockerfile: docker/development/web.dockerfile
env_file:
- .env
volumes:
Expand All @@ -28,7 +28,7 @@ services:
antlr:
build:
context: .
dockerfile: antlr.Dockerfile
dockerfile: docker/development/antlr.dockerfile
volumes:
- .:/app
working_dir: /app
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ext-pdo": "*",
"anhskohbo/no-captcha": "^3.0",
"antlr/antlr4-php-runtime": "^0.7.0",
"doctrine/dbal": "^2.9",
"doctrine/dbal": "^3.7",
"erusev/parsedown": "^1.7",
"guzzlehttp/guzzle": "^7.4.5",
"jakeasmith/http_build_url": "^1.0",
Expand All @@ -29,11 +29,11 @@
"laravel/legacy-factories": "^1.3",
"laravel/passport": "^10.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^3.0",
"laravel/ui": "^4.2",
"league/csv": "^9.5",
"misd/linkify": "^1.1",
"openpear/stream_filter_mbstring": "dev-master",
"sentry/sentry-laravel": "^2.4.2",
"sentry/sentry-laravel": "^4.1.0",
"staudenmeir/eloquent-eager-limit": "~1.7.1",
"symfony/css-selector": "^4.3",
"symfony/dom-crawler": "4.4.37",
Expand Down
Loading

0 comments on commit 7ed5e91

Please sign in to comment.