review changes

This commit is contained in:
prateek banga committed 2023-10-31 01:12:31 +05:30
1 parent 06daa544e8
commit a01d361886
3 files changed
+17 -2

No files matched your search

+1 -1
View File
@@ -1728,7 +1728,7 @@ $commonCollections = [
[
'$id' => ID::custom('_key_search'),
'type' => Database::INDEX_FULLTEXT,
'attributes' => ['name'],
'attributes' => ['search'],
'lengths' => [],
'orders' => [Database::ORDER_ASC],
]
+13
View File
@@ -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']));