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

Dev #4

Merged
merged 41 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f8554be
Модели
alexandrignatushin Oct 26, 2024
dd54b23
Добавлен TeamSeeder
alexandrignatushin Oct 26, 2024
e9fd436
Добавлен TeamSeeder: cs fix
alexandrignatushin Oct 26, 2024
e3db8dd
added factories and seeders
romo4ko Oct 26, 2024
21e5a4f
binding users & achievements
romo4ko Oct 26, 2024
11dda39
feat: add api route
deniskorbakov Oct 26, 2024
ffca196
feat: create auth controller
deniskorbakov Oct 26, 2024
c2575aa
feat: create auth service
deniskorbakov Oct 26, 2024
1ac3559
dev: add new packages
deniskorbakov Oct 26, 2024
c9385a6
feat: add controller from api controllers
deniskorbakov Oct 26, 2024
369e9eb
feat: add fields in fillable
deniskorbakov Oct 26, 2024
695755f
feat: create dto for auth controller
deniskorbakov Oct 26, 2024
82e77e4
feat: create table for api token
deniskorbakov Oct 26, 2024
bcfc409
feat: create api rote file
deniskorbakov Oct 26, 2024
ead0f6d
feat: create configs
deniskorbakov Oct 26, 2024
2842793
Merge remote-tracking branch 'origin/dev' into dev
deniskorbakov Oct 26, 2024
2b3bc00
Добавлены сидеры для связанных таблиц
alexandrignatushin Oct 26, 2024
047bd07
Merge remote-tracking branch 'origin/dev' into dev
alexandrignatushin Oct 26, 2024
2571344
added filament resources; image saving type changed
romo4ko Oct 26, 2024
beb5292
Merge remote-tracking branch 'origin/dev' into dev
romo4ko Oct 26, 2024
460547b
feat: add files
deniskorbakov Oct 26, 2024
0ce27d6
added challenges to admin panel
romo4ko Oct 26, 2024
fb329f6
added teams to admin panel
romo4ko Oct 26, 2024
2559d5b
feat: add routes
deniskorbakov Oct 26, 2024
13e2c24
feat: add needed trait
deniskorbakov Oct 26, 2024
f80bb97
feat: add logic for update user
deniskorbakov Oct 26, 2024
897f7a2
fix: add logic for upadte user
deniskorbakov Oct 26, 2024
1d72d25
feat: create dto
deniskorbakov Oct 26, 2024
e820709
Merge remote-tracking branch 'origin/dev' into dev
deniskorbakov Oct 26, 2024
3d842e0
feat: add image
deniskorbakov Oct 26, 2024
c732bb3
feat: create dto
deniskorbakov Oct 26, 2024
2b024ad
fix: add logic for view team
deniskorbakov Oct 26, 2024
b9281b3
feat: add logic for team
deniskorbakov Oct 26, 2024
7c9dcc3
added captain and challenges to teams in adminpanel
romo4ko Oct 26, 2024
7010552
binding relative entities in admin panel
romo4ko Oct 26, 2024
ebc30e8
feat: add logic
deniskorbakov Oct 26, 2024
ecc18fb
Merge remote-tracking branch 'origin/dev' into dev
deniskorbakov Oct 26, 2024
db86d4e
change challenges type logic
romo4ko Oct 26, 2024
c61cf87
feat: add logic
deniskorbakov Oct 26, 2024
f828a13
Merge remote-tracking branch 'origin/dev' into dev
deniskorbakov Oct 26, 2024
734cfb1
fixed git missed changes
romo4ko Oct 27, 2024
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
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=en
APP_LOCALE=ru

# Hostname without http
APP_HOST=localhost
Expand Down
33 changes: 33 additions & 0 deletions app/DTO/Api/Auth/Request/UserAuthDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace App\DTO\Api\Auth\Request;

use Spatie\LaravelData\Support\Validation\ValidationContext;
use Spatie\LaravelData\Data;

class UserAuthDTO extends Data
{
public function __construct(
public string $email,
public string $password,
) {
}

public static function rules(ValidationContext $context): array
{
return [
'email' => [
'required',
'max:255',
'email',
],
'password' => [
'required',
'max:255',
'min:8',
],
];
}
}
50 changes: 50 additions & 0 deletions app/DTO/Api/Auth/Request/UserRegisterDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

declare(strict_types=1);

namespace App\DTO\Api\Auth\Request;

use Illuminate\Validation\Rule;
use Spatie\LaravelData\Support\Validation\ValidationContext;
use Spatie\LaravelData\Data;

class UserRegisterDTO extends Data
{
public function __construct(
public string $name,
public string $surname,
public string $email,
public string $password,
public string $patronymic,
) {
}

public static function rules(ValidationContext $context): array
{
return [
'name' => [
'required',
'max:255',
],
'surname' => [
'required',
'max:255',
],
'email' => [
'required',
'max:255',
'email',
Rule::unique('users', 'email'),
],
'password' => [
'required',
'max:255',
'min:8',
],
'patronymic' => [
'required',
'max:255',
]
];
}
}
25 changes: 25 additions & 0 deletions app/DTO/Api/Auth/Response/UserAuthShowDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace App\DTO\Api\Auth\Response;

use App\Models\User;
use Spatie\LaravelData\Data;

class UserAuthShowDTO extends Data
{
public function __construct(
public User $user,
public string $token,
) {
}

public static function fromMultiple(User $user, string $token): self
{
return new self(
$user,
$token
);
}
}
25 changes: 25 additions & 0 deletions app/DTO/Api/Auth/Response/UserRegisterShowDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace App\DTO\Api\Auth\Response;

use App\Models\User;
use Spatie\LaravelData\Data;

class UserRegisterShowDTO extends Data
{
public function __construct(
public User $user,
public string $token,
) {
}

public static function fromMultiple(User $user, string $token): self
{
return new self(
$user,
$token
);
}
}
19 changes: 19 additions & 0 deletions app/DTO/Api/Team/Request/TeamUpdateDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\DTO\Api\Team\Request;

use Illuminate\Http\UploadedFile;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Data;

class TeamUpdateDTO extends Data
{
public function __construct(
#[Max(255)]
public ?string $name,
#[Max(255)]
public ?string $description,
public ?UploadedFile $image,
){
}
}
41 changes: 41 additions & 0 deletions app/DTO/Api/User/Request/UserUpdateDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace App\DTO\Api\User\Request;

use Illuminate\Http\UploadedFile;
use Illuminate\Validation\Rule;
use Spatie\LaravelData\Attributes\Validation\Image;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Support\Validation\ValidationContext;

class UserUpdateDTO extends Data
{
public function __construct(
#[Image]
public ?UploadedFile $image,
#[Max(255)]
public ?string $name,
#[Max(255)]
public ?string $surname,
#[Max(255)]
public ?string $patronymic,
#[Max(255)]
public ?string $email,
#[Max(255)]
public ?string $about,
) {
}

public static function rules(ValidationContext $context): array
{
return [
'email' => [
'email',
Rule::unique('users', 'email')->ignore(auth()->id()),
],
];
}
}
30 changes: 30 additions & 0 deletions app/DTO/Api/User/Response/UserAchievementPersonalDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\DTO\Api\User\Response;

use App\Models\Achievement;
use App\Models\Enums\Achievement\TypeAchievement;
use Spatie\LaravelData\Data;

class UserAchievementPersonalDTO extends Data
{
public function __construct(
public string $id,
public ?string $image,
public string $name,
public string $description,
public TypeAchievement $type
){
}

public static function fromModal(Achievement $achievement): self
{
return new self(
$achievement->id,
$achievement->image,
$achievement->name,
$achievement->description,
TypeAchievement::Personal,
);
}
}
30 changes: 30 additions & 0 deletions app/DTO/Api/User/Response/UserAchievementTeamsDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\DTO\Api\User\Response;

use App\Models\Achievement;
use App\Models\Enums\Achievement\TypeAchievement;
use Spatie\LaravelData\Data;

class UserAchievementTeamsDTO extends Data
{
public function __construct(
public string $id,
public ?string $image,
public string $name,
public string $description,
public TypeAchievement $type
){
}

public static function fromModal(Achievement $achievement): self
{
return new self(
$achievement->id,
$achievement->image,
$achievement->name,
$achievement->description,
TypeAchievement::Team,
);
}
}
29 changes: 29 additions & 0 deletions app/DTO/Api/User/Response/UserChallengeDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\DTO\Api\User\Response;

use App\Models\Challenge;
use Spatie\LaravelData\Data;

class UserChallengeDTO extends Data
{
public function __construct(
public int $id,
public ?string $image,
public string $name,
public string $description,
public string $endDate
){
}

public static function fromModal(Challenge $challenge): self
{
return new self(
$challenge->id,
$challenge->image,
$challenge->name,
$challenge->description,
$challenge->end_date
);
}
}
30 changes: 30 additions & 0 deletions app/DTO/Api/User/Response/UserTeamDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace App\DTO\Api\User\Response;

use App\Models\Team;
use Illuminate\Database\Eloquent\Collection;
use Spatie\LaravelData\Data;

class UserTeamDTO extends Data
{
public function __construct(
public int $id,
public ?string $image,
public string $name,
public ?int $countMembers
) {
}

public static function fromModal(Team $team): self
{
return new self(
$team->id,
$team->image,
$team->name,
$team->users->count(),
);
}
}
Loading
Loading