Skip to content

Commit 75da445

Browse files
authored
Merge pull request #489 from topcoder-platform/issues-474
Issues-474: synced the categories schema with the categories controller
2 parents 3f03269 + e766365 commit 75da445

File tree

2 files changed

+941
-5
lines changed

2 files changed

+941
-5
lines changed

vanilla/applications/vanilla/controllers/api/CategoriesApiController.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public function __construct(
5151
*/
5252
public function categoryPostSchema($type = '', array $extra = []) {
5353
if ($this->categoryPostSchema === null) {
54-
$fields = ['name', 'parentCategoryID?', 'urlcode', 'displayAs?', 'customPermissions?', 'groupID?'];
54+
$fields = ['name', 'parentCategoryID?', 'urlcode', 'displayAs?', 'customPermissions?',
55+
'groupID?', 'archived?'];
5556
$this->categoryPostSchema = $this->schema(
5657
Schema::parse(array_merge($fields, $extra))->add($this->schemaWithParent()),
5758
'CategoryPost'
@@ -129,7 +130,7 @@ protected function fullSchema() {
129130
'parentCategoryID:i|n' => 'Parent category ID.',
130131
'groupID:i|n' => 'Group ID.',
131132
'customPermissions:b' => 'Are custom permissions set for this category?',
132-
'isArchived:b' => 'The archived state of this category.',
133+
'archived:b' => 'The archived state of this category.',
133134
'urlcode:s' => 'The URL code of the category.',
134135
'url:s' => 'The URL to the category.',
135136
'displayAs:s' => [
@@ -551,9 +552,6 @@ public function normalizeOutput(array $dbRecord) {
551552
if (!empty($dbRecord['Children']) && is_array($dbRecord['Children'])) {
552553
$dbRecord['Children'] = array_map([$this, 'normalizeOutput'], $dbRecord['Children']);
553554
}
554-
555-
$dbRecord['isArchived'] = $dbRecord['Archived'];
556-
557555
$schemaRecord = ApiUtils::convertOutputKeys($dbRecord);
558556
return $schemaRecord;
559557
}

0 commit comments

Comments
 (0)