mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-06-15 13:32:43 +01:00
Fixed private build
This commit is contained in:
18
.github/workflows/build-private.yml
vendored
18
.github/workflows/build-private.yml
vendored
@@ -1,5 +1,13 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'workflows/build-private.yml'
|
||||||
|
- 'docker/prod/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
name: Build - Private
|
name: Build - Private
|
||||||
jobs:
|
jobs:
|
||||||
@@ -29,6 +37,12 @@ jobs:
|
|||||||
only_args: --no-dev --no-ansi --no-interaction --prefer-dist --ignore-platform-reqs --classmap-authoritative
|
only_args: --no-dev --no-ansi --no-interaction --prefer-dist --ignore-platform-reqs --classmap-authoritative
|
||||||
php_version: 8.3
|
php_version: 8.3
|
||||||
|
|
||||||
|
- name: "Setup PHP with PECL extension"
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '8.3'
|
||||||
|
extensions: mbstring, dom, fileinfo, pgsql, swoole
|
||||||
|
|
||||||
- name: "Install dependencies"
|
- name: "Install dependencies"
|
||||||
uses: php-actions/composer@v6
|
uses: php-actions/composer@v6
|
||||||
if: steps.cache-vendor.outputs.cache-hit != 'true' # Skip if cache hit
|
if: steps.cache-vendor.outputs.cache-hit != 'true' # Skip if cache hit
|
||||||
@@ -48,6 +62,9 @@ jobs:
|
|||||||
- name: "Build"
|
- name: "Build"
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
|
- name: "Activate billing extension"
|
||||||
|
run: php artisan module:enable Billing
|
||||||
|
|
||||||
- name: "Login to GitHub Container Registry"
|
- name: "Login to GitHub Container Registry"
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@@ -65,6 +82,7 @@ jobs:
|
|||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=sha,format=long
|
||||||
|
|
||||||
- name: "Set up Docker Buildx"
|
- name: "Set up Docker Buildx"
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|||||||
8
.github/workflows/build-public.yml
vendored
8
.github/workflows/build-public.yml
vendored
@@ -1,5 +1,13 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'workflows/build-public.yml'
|
||||||
|
- 'docker/prod/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
name: Build - Public
|
name: Build - Public
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,3 +30,4 @@ yarn-error.log
|
|||||||
!/extensions/extensions_autoload.php
|
!/extensions/extensions_autoload.php
|
||||||
/auth.json
|
/auth.json
|
||||||
/modules_statuses.json
|
/modules_statuses.json
|
||||||
|
/k8s
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ use Laravel\Passport\HasApiTokens;
|
|||||||
* @property string $timezone
|
* @property string $timezone
|
||||||
* @property bool $is_placeholder
|
* @property bool $is_placeholder
|
||||||
* @property Weekday $week_start
|
* @property Weekday $week_start
|
||||||
|
* @property-read Organization $currentTeam
|
||||||
* @property Collection<Organization> $organizations
|
* @property Collection<Organization> $organizations
|
||||||
* @property Collection<TimeEntry> $timeEntries
|
* @property Collection<TimeEntry> $timeEntries
|
||||||
*
|
*
|
||||||
@@ -37,6 +38,7 @@ use Laravel\Passport\HasApiTokens;
|
|||||||
* @method static UserFactory factory()
|
* @method static UserFactory factory()
|
||||||
* @method static Builder<User> query()
|
* @method static Builder<User> query()
|
||||||
* @method Builder<User> belongsToOrganization(Organization $organization)
|
* @method Builder<User> belongsToOrganization(Organization $organization)
|
||||||
|
* @method Builder<User> active()
|
||||||
*/
|
*/
|
||||||
class User extends Authenticatable implements FilamentUser
|
class User extends Authenticatable implements FilamentUser
|
||||||
{
|
{
|
||||||
@@ -131,6 +133,14 @@ class User extends Authenticatable implements FilamentUser
|
|||||||
return $this->hasMany(TimeEntry::class);
|
return $this->hasMany(TimeEntry::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Builder<User> $builder
|
||||||
|
*/
|
||||||
|
public function scopeActive(Builder $builder): void
|
||||||
|
{
|
||||||
|
$builder->where('is_placeholder', '=', false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Builder<User> $builder
|
* @param Builder<User> $builder
|
||||||
* @return Builder<User>
|
* @return Builder<User>
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ use App\Models\User;
|
|||||||
use App\Providers\Filament\AdminPanelProvider;
|
use App\Providers\Filament\AdminPanelProvider;
|
||||||
use Filament\Panel;
|
use Filament\Panel;
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
|
use PHPUnit\Framework\Attributes\CoversClass;
|
||||||
|
use PHPUnit\Framework\Attributes\UsesClass;
|
||||||
|
|
||||||
|
#[CoversClass(User::class)]
|
||||||
|
#[UsesClass(User::class)]
|
||||||
class UserModelTest extends ModelTestAbstract
|
class UserModelTest extends ModelTestAbstract
|
||||||
{
|
{
|
||||||
public function test_normal_user_can_not_access_admin_panel(): void
|
public function test_normal_user_can_not_access_admin_panel(): void
|
||||||
@@ -87,4 +91,22 @@ class UserModelTest extends ModelTestAbstract
|
|||||||
$this->assertCount(3, $timeEntriesRel);
|
$this->assertCount(3, $timeEntriesRel);
|
||||||
$this->assertTrue($timeEntriesRel->first()->is($timeEntries->first()));
|
$this->assertTrue($timeEntriesRel->first()->is($timeEntries->first()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_scope_active_returns_only_non_placeholder_users(): void
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
$placeholder = User::factory()->create([
|
||||||
|
'is_placeholder' => true,
|
||||||
|
]);
|
||||||
|
$user = User::factory()->create([
|
||||||
|
'is_placeholder' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
$activeUsers = User::query()->active()->get();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
$this->assertCount(1, $activeUsers);
|
||||||
|
$this->assertTrue($activeUsers->first()->is($user));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user