Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
- Added rate limit response headers (`X-RateLimit-Limit`, `X-RateLimit-Remaining`, `Retry-After`)
- Added route-level metadata support on `Route` and `RouteBuilder` for rate limiting
- Added unit test coverage for router integration, middleware flow, adapters, factory resolution, and exception behavior
- Updated `DemoApi` module templates to include default API route throttling and generated `config/rate_limit.php` (#510)
- SleekDB adapter now supports related-model criteria path filtering across join depths while preserving DBAL public API (#508)

### Removed
Expand Down
23 changes: 0 additions & 23 deletions src/Module/Templates/DemoApi/src/DTOs/CommentDTO.php.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,12 @@ use Quantum\Http\Request;
*/
class CommentDTO
{
/**
* @var string
*/
private string $postUuid;

/**
* @var string
*/
private string $userUuid;

/**
* @var string
*/
private string $content;

/**
* @param string $postUuid
* @param string $userUuid
* @param string $content
*/
public function __construct(
string $postUuid,
string $userUuid,
Expand All @@ -52,12 +38,6 @@ class CommentDTO
$this->content = $content;
}

/**
* @param Request $request
* @param string $postUuid
* @param string $userUuid
* @return self
*/
public static function fromRequest(Request $request, string $postUuid, string $userUuid): self
{
return new self($postUuid, $userUuid, trim((string)$request->get('content')));
Expand All @@ -78,9 +58,6 @@ class CommentDTO
return $this->content;
}

/**
* @return array
*/
public function toArray(): array
{
return [
Expand Down
27 changes: 0 additions & 27 deletions src/Module/Templates/DemoApi/src/DTOs/PostDTO.php.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,14 @@ use Quantum\Http\Request;
*/
class PostDTO
{
/**
* @var string
*/
private string $title;

/**
* @var string
*/
private string $content;

/**
* @var string|null
*/
private ?string $userUuid;

/**
* @var string|null
*/
private ?string $image;

/**
* @param string $title
* @param string $content
* @param string|null $userUuid
* @param string|null $image
*/
public function __construct(
string $title,
string $content,
Expand All @@ -60,12 +42,6 @@ class PostDTO
$this->image = $image;
}

/**
* @param Request $request
* @param string|null $userUuid
* @param string|null $image
* @return self
*/
public static function fromRequest(Request $request, ?string $userUuid = null, ?string $image = null): self
{
return new self(
Expand Down Expand Up @@ -96,9 +72,6 @@ class PostDTO
return $this->image;
}

/**
* @return array
*/
public function toArray(): array
{
return array_filter([
Expand Down
37 changes: 0 additions & 37 deletions src/Module/Templates/DemoApi/src/DTOs/UserDTO.php.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,20 @@ use Quantum\Http\Request;
*/
class UserDTO
{
/**
* @var string
*/
private string $email;

/**
* @var string
*/
private string $password;

/**
* @var string
*/
private string $firstname;

/**
* @var string
*/
private string $lastname;

/**
* @var string
*/
private string $role;

/**
* @var string|null
*/
private ?string $uuid;

/**
* @var string
*/
private string $image;

/**
* @param string $email
* @param string $password
* @param string $firstname
* @param string $lastname
* @param string $role
* @param string|null $uuid
* @param string $image
*/
public function __construct(
string $email,
string $password,
Expand All @@ -84,12 +54,6 @@ class UserDTO
$this->image = $image;
}

/**
* @param Request $request
* @param string $role
* @param string|null $uuid
* @return self
*/
public static function fromRequest(Request $request, string $role, ?string $uuid = null): self
{
return new self(
Expand Down Expand Up @@ -139,7 +103,6 @@ class UserDTO

/**
* Converts DTO to array for framework interface compatibility
* @return array
*/
public function toArray(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ abstract class BaseMiddleware extends Middleware

/**
* Validate the request and respond with error if invalid.
* @return Response|null
*/
protected function validateRequest(Request $request): ?Response
{
Expand Down
4 changes: 0 additions & 4 deletions src/Module/Templates/DemoApi/src/Models/Comment.php.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,16 @@ class Comment extends DbModel

/**
* ID column of table
* @var string
*/
public string $idColumn = 'id';

/**
* The table name
* @var string
*/
public string $table = 'comments';

/**
* Fillable properties
* @var array
*/
public array $fillable = [
'uuid',
Expand All @@ -54,7 +51,6 @@ class Comment extends DbModel

/**
* Model relations configuration
* @return array[]
*/
public function relations(): array
{
Expand Down
4 changes: 0 additions & 4 deletions src/Module/Templates/DemoApi/src/Models/Post.php.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,16 @@ class Post extends DbModel

/**
* ID column of table
* @var string
*/
public string $idColumn = 'id';

/**
* The table name
* @var string
*/
public string $table = 'posts';

/**
* Fillable properties
* @var array
*/
public array $fillable = [
'uuid',
Expand All @@ -55,7 +52,6 @@ class Post extends DbModel

/**
* Model relations configuration
* @return array[]
*/
public function relations(): array
{
Expand Down
18 changes: 0 additions & 18 deletions src/Module/Templates/DemoApi/src/Services/AuthService.php.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ use {{MODULE_NAMESPACE}}\Models\User;
*/
class AuthService extends Service implements AuthServiceInterface
{

/**
* @var User
*/
private User $model;

/**
Expand All @@ -46,7 +42,6 @@ class AuthService extends Service implements AuthServiceInterface

/**
* Get users
* @return ModelCollection
* @throws BaseException
*/
public function getAll(): ModelCollection
Expand All @@ -56,8 +51,6 @@ class AuthService extends Service implements AuthServiceInterface

/**
* Get user
* @param string $uuid
* @return User|null
* @throws BaseException
*/
public function getUserByUuid(string $uuid): ?User
Expand All @@ -67,9 +60,6 @@ class AuthService extends Service implements AuthServiceInterface

/**
* Get user
* @param string $field
* @param $value
* @return AuthUser|null
* @throws BaseException
*/
public function get(string $field, $value): ?AuthUser
Expand All @@ -85,8 +75,6 @@ class AuthService extends Service implements AuthServiceInterface

/**
* Add user
* @param array $data
* @return AuthUser
* @throws BaseException
* @throws ConfigException
* @throws DiException
Expand All @@ -107,10 +95,6 @@ class AuthService extends Service implements AuthServiceInterface

/**
* Update user
* @param string $field
* @param string|null $value
* @param array $data
* @return AuthUser|null
* @throws BaseException
* @throws ModelException
*/
Expand Down Expand Up @@ -140,7 +124,6 @@ class AuthService extends Service implements AuthServiceInterface

/**
* User Schema
* @return array
*/
public function userSchema(): array
{
Expand All @@ -166,7 +149,6 @@ class AuthService extends Service implements AuthServiceInterface

/**
* Creates user directory
* @param string $uuid
* @throws DiException
* @throws ReflectionException
* @throws BaseException
Expand Down
18 changes: 0 additions & 18 deletions src/Module/Templates/DemoApi/src/Services/CommentService.php.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,11 @@ use {{MODULE_NAMESPACE}}\Models\User;
*/
class CommentService extends Service
{

/**
* @var Comment
*/
private Comment $model;

/**
* @var CommentTransformer
*/
private CommentTransformer $transformer;

/**
* @param CommentTransformer $transformer
* @throws ModelException
*/
public function __construct(CommentTransformer $transformer)
Expand All @@ -51,8 +43,6 @@ class CommentService extends Service

/**
* Get comments by post
* @param string $postUuid
* @return mixed
* @throws BaseException
* @throws ModelException
*/
Expand All @@ -77,8 +67,6 @@ class CommentService extends Service

/**
* Get comment
* @param string $uuid
* @return Comment
*/
public function getComment(string $uuid): Comment
{
Expand All @@ -87,8 +75,6 @@ class CommentService extends Service

/**
* Add a new comment
* @param CommentDTO $commentDto
* @return array
* @throws ModelException
*/
public function addComment(CommentDTO $commentDto): array
Expand All @@ -104,8 +90,6 @@ class CommentService extends Service

/**
* Delete a comment
* @param string $uuid
* @return bool
* @throws BaseException
* @throws ModelException
*/
Expand All @@ -125,8 +109,6 @@ class CommentService extends Service

/**
* Transform data
* @param array $comments
* @return array
*/
public function transformData(array $comments): array
{
Expand Down
Loading
Loading