review changes
This commit is contained in:
parent
06daa544e8
commit
a01d361886
|
@ -1728,7 +1728,7 @@ $commonCollections = [
|
|||
[
|
||||
'$id' => ID::custom('_key_search'),
|
||||
'type' => Database::INDEX_FULLTEXT,
|
||||
'attributes' => ['name'],
|
||||
'attributes' => ['search'],
|
||||
'lengths' => [],
|
||||
'orders' => [Database::ORDER_ASC],
|
||||
]
|
||||
|
|
|
@ -1400,6 +1400,9 @@ App::post('/v1/messaging/topics')
|
|||
|
||||
if ($description) {
|
||||
$topic->setAttribute('description', $description);
|
||||
$topic->setAttribute('search', $topic->getId() . ' ' . $name . ' ' . $description);
|
||||
} else {
|
||||
$topic->setAttribute('search', $topic->getId() . ' ' . $name);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -1516,6 +1519,16 @@ App::patch('/v1/messaging/topics/:topicId')
|
|||
$topic->setAttribute('description', $description);
|
||||
}
|
||||
|
||||
if (!empty($name) || !empty($description)) {
|
||||
if (!empty($name) && !empty($description)) {
|
||||
$topic->setAttribute('search', $topic->getId() . ' ' . $name . ' ' . $description);
|
||||
} elseif (!empty($name)) {
|
||||
$topic->setAttribute('search', $topic->getId() . ' ' . $name . ' ' . $topic->getAttribute('description'));
|
||||
} else {
|
||||
$topic->setAttribute('search', $topic->getId() . ' ' . $topic->getAttribute('name') . ' ' . $description);
|
||||
}
|
||||
}
|
||||
|
||||
$topic = $dbForProject->updateDocument('topics', $topicId, $topic);
|
||||
|
||||
$response
|
||||
|
|
|
@ -223,7 +223,7 @@ trait MessagingBase
|
|||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
], [
|
||||
'topicId' => 'unique()',
|
||||
'topicId' => ID::unique(),
|
||||
'name' => 'my-app',
|
||||
'description' => 'web app'
|
||||
]);
|
||||
|
@ -258,6 +258,8 @@ trait MessagingBase
|
|||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||
], [
|
||||
'search' => 'updated-description',
|
||||
]);
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertEquals(1, \count($response['body']['topics']));
|
||||
|
|
Loading…
Reference in a new issue