Skip to content

Commit 93709d4

Browse files
committed
feat: update createdAt fields in DTOs and improve pagination method formatting
1 parent 7d46663 commit 93709d4

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

contexts/ArticlePublishing/Application/DTOs/GetArticleListDTO.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct(
1616
public readonly ?string $status,
1717
public readonly ?int $categoryId,
1818
public readonly ?int $authorId,
19-
public readonly ?array $createdAtRange,
19+
public readonly ?array $createdAt,
2020
public readonly int $currentPage,
2121
public readonly int $perPage,
2222
public readonly ?array $sorting
@@ -32,7 +32,7 @@ public static function fromRequest(array $data): self
3232
$merged['status'] ?? null,
3333
$merged['category_id'] ?? null,
3434
$merged['author_id'] ?? null,
35-
$merged['created_at_range'] ?? null,
35+
$merged['created_at'] ?? null,
3636
$merged['current_page'] ?? 1,
3737
$merged['per_page'] ?? 10,
3838
self::normalizeAndFilterSorting($merged)
@@ -52,7 +52,7 @@ public function toCriteria(): array
5252
'status' => $this->status,
5353
'category_id' => $this->categoryId,
5454
'author_id' => $this->authorId,
55-
'created_at_range' => $this->createdAtRange,
55+
'created_at' => $this->createdAt,
5656
];
5757
}
5858
}

contexts/Authorization/Application/DTOs/Role/GetRoleListDTO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function __construct(
1414
public readonly ?string $id,
1515
public readonly ?string $label,
1616
public readonly ?string $status,
17-
public readonly ?array $createdAtRange,
17+
public readonly ?array $createdAt,
1818
public readonly int $currentPage,
1919
public readonly int $perPage,
2020
public readonly ?array $sorting
@@ -46,7 +46,7 @@ public function toCriteria(): array
4646
'id' => $this->id,
4747
'label' => $this->label,
4848
'status' => $this->status,
49-
'created_at' => $this->createdAtRange,
49+
'created_at' => $this->createdAt,
5050
];
5151
}
5252
}

contexts/Authorization/Application/DTOs/User/GetUserListDTO.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class GetUserListDTO extends BaseGetListDTO
1313
public function __construct(
1414
public readonly ?string $id,
1515
public readonly ?string $email,
16-
public readonly ?string $display_name,
16+
public readonly ?string $displayName,
1717
public readonly ?string $status,
18-
public readonly ?array $createdAtRange,
18+
public readonly ?array $createdAt,
1919
public readonly int $currentPage,
2020
public readonly int $perPage,
2121
public readonly ?array $sorting
@@ -30,7 +30,7 @@ public static function fromRequest(array $data): self
3030
$merged['email'] ?? null,
3131
$merged['display_name'] ?? null,
3232
$merged['status'] ?? null,
33-
$merged['created_at_range'] ?? null,
33+
$merged['created_at'] ?? null,
3434
$merged['current_page'] ?? 1,
3535
$merged['per_page'] ?? 10,
3636
self::normalizeAndFilterSorting($merged)
@@ -47,9 +47,9 @@ public function toCriteria(): array
4747
return [
4848
'id' => $this->id,
4949
'email' => $this->email,
50-
'display_name' => $this->display_name,
50+
'display_name' => $this->displayName,
5151
'status' => $this->status,
52-
'created_at_range' => $this->createdAtRange,
52+
'created_at' => $this->createdAt,
5353
];
5454
}
5555
}

contexts/CategoryManagement/Application/Coordinators/CategoryManagementCoordinator.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ public function getCategoryList(GetCategoryListDTO $data): LengthAwarePaginator
5353
new GlobalPermissionPolicy('category.list'),
5454
])->check();
5555

56-
return $this->repository->paginate($data->currentPage, $data->perPage, $data->toCriteria(), $data->toSorting());
56+
return $this->repository->paginate(
57+
$data->currentPage,
58+
$data->perPage,
59+
$data->toCriteria(),
60+
$data->toSorting()
61+
);
5762
}
5863

5964
public function updateCategory(int $id, UpdateCategoryDTO $data): Category

contexts/CategoryManagement/Application/DTOs/GetCategoryListDTO.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function __construct(
1414
public readonly ?string $id,
1515
public readonly ?string $label,
1616
public readonly ?string $status,
17-
public readonly ?array $createdAtRange,
17+
public readonly ?array $createdAt,
1818
public readonly int $currentPage,
1919
public readonly int $perPage,
2020
public readonly ?array $sorting
@@ -28,7 +28,7 @@ public static function fromRequest(array $data): self
2828
$merged['id'] ?? null,
2929
$merged['label'] ?? null,
3030
$merged['status'] ?? null,
31-
$merged['created_at_range'] ?? null,
31+
$merged['created_at'] ?? null,
3232
$merged['current_page'] ?? 1,
3333
$merged['per_page'] ?? 10,
3434
self::normalizeAndFilterSorting($merged)
@@ -46,7 +46,7 @@ public function toCriteria(): array
4646
'id' => $this->id,
4747
'label' => $this->label,
4848
'status' => $this->status,
49-
'created_at_range' => $this->createdAtRange,
49+
'created_at' => $this->createdAt,
5050
];
5151
}
5252
}

0 commit comments

Comments
 (0)