Skip to content

Issues-474: synced the categories schema with the categories controller #489

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

Merged
merged 2 commits into from
Mar 23, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public function __construct(
*/
public function categoryPostSchema($type = '', array $extra = []) {
if ($this->categoryPostSchema === null) {
$fields = ['name', 'parentCategoryID?', 'urlcode', 'displayAs?', 'customPermissions?', 'groupID?'];
$fields = ['name', 'parentCategoryID?', 'urlcode', 'displayAs?', 'customPermissions?',
'groupID?', 'archived?'];
$this->categoryPostSchema = $this->schema(
Schema::parse(array_merge($fields, $extra))->add($this->schemaWithParent()),
'CategoryPost'
Expand Down Expand Up @@ -129,7 +130,7 @@ protected function fullSchema() {
'parentCategoryID:i|n' => 'Parent category ID.',
'groupID:i|n' => 'Group ID.',
'customPermissions:b' => 'Are custom permissions set for this category?',
'isArchived:b' => 'The archived state of this category.',
'archived:b' => 'The archived state of this category.',
'urlcode:s' => 'The URL code of the category.',
'url:s' => 'The URL to the category.',
'displayAs:s' => [
Expand Down Expand Up @@ -551,9 +552,6 @@ public function normalizeOutput(array $dbRecord) {
if (!empty($dbRecord['Children']) && is_array($dbRecord['Children'])) {
$dbRecord['Children'] = array_map([$this, 'normalizeOutput'], $dbRecord['Children']);
}

$dbRecord['isArchived'] = $dbRecord['Archived'];

$schemaRecord = ApiUtils::convertOutputKeys($dbRecord);
return $schemaRecord;
}
Expand Down
Loading