1
0
Fork 0
mirror of synced 2024-07-03 21:50:34 +12:00

review changes

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

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],
]

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

View file

@ -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']));