Commit graph

45 commits

Author SHA1 Message Date
Hongbo Wu
8bc05dad03 fix tests 2024-06-28 11:56:28 +08:00
Hongbo Wu
a3ba8573b7 fix: validate ownership of library item before assigning labels to the item 2024-06-28 11:53:20 +08:00
Hongbo Wu
8034e18825 fix tests 2024-05-10 16:40:55 +08:00
Hongbo Wu
a9779a51e8 fix: LABEL_ALREADY_EXIST bug occured during label creation
* comparing both user_id and label name when looking for an existing matching label
2024-04-16 09:56:57 +08:00
Hongbo Wu
6f03b214b5 allow delete internal labels 2024-04-05 15:58:39 +08:00
Hongbo Wu
9f4f1d07ca do not create label if label name case-insensitively matches existing label name 2024-04-05 15:50:01 +08:00
Hongbo Wu
06e17e2eb8 return source of the labels tagged to an item 2023-12-14 10:40:18 +08:00
Hongbo Wu
024d558cfe update labels rls 2023-10-05 14:30:10 +08:00
Hongbo Wu
6672ca0109 fix labels tests 2023-10-05 14:30:10 +08:00
Hongbo Wu
4b95b732cf fix highlight tests 2023-10-05 14:30:10 +08:00
Hongbo Wu
669cddeec8 fix some rls issue 2023-10-05 14:30:10 +08:00
Hongbo Wu
50bfc1fa74 fix tests 2023-10-05 14:29:23 +08:00
Hongbo Wu
fc52b522f2 fix test 2023-10-05 14:22:58 +08:00
Hongbo Wu
9370951893 create a repository directory 2023-10-05 14:22:56 +08:00
Hongbo Wu
425864ce01 remove knex 2023-10-05 14:21:56 +08:00
Hongbo Wu
9df1546323 Fix tests 2023-03-22 10:37:07 +08:00
Hongbo Wu
05ecac7c52 Fix tests 2022-11-24 08:59:21 +08:00
Hongbo Wu
3a39ec55cc Delete user with right permission 2022-11-24 08:59:10 +08:00
Hongbo Wu
5da6a5e036 Fix setLabelsForHighlights integration tests 2022-08-09 10:10:07 +08:00
Hongbo Wu
4aa62d6031 Add list integrations API and integration tests 2022-08-08 18:12:44 +08:00
Hongbo Wu
8070273dad Fix tests 2022-08-05 16:10:33 +08:00
Hongbo Wu
f2319bd70d Fix conflicts after rebasing 2022-08-04 21:56:38 +08:00
Hongbo Wu
73ce9072f3 Add test for afterLabel not exists 2022-08-04 21:39:45 +08:00
Hongbo Wu
eee918c522 Fix test Con't 2022-08-04 21:39:45 +08:00
Hongbo Wu
4916bdf1f3 Fix tests 2022-08-04 21:39:45 +08:00
Hongbo Wu
7c73982fe3 Add test for moving to the top 2022-08-04 21:39:45 +08:00
Hongbo Wu
ace5628c11 Add integration test 2022-08-04 21:39:43 +08:00
Hongbo Wu
31d8f72840 Sort labels by position order 2022-08-04 21:37:32 +08:00
Hongbo Wu
83f988bb35 Soft delete articles 2022-07-29 15:53:13 +08:00
Hongbo Wu
c3ef286cc5 fix set labels for highlight test 2022-07-14 19:31:51 +08:00
Hongbo Wu
edd44fcafc fix get article test 2022-07-14 17:56:55 +08:00
Hongbo Wu
cc2b492c16 Fix tests 2022-06-09 12:38:09 +08:00
Hongbo Wu
a981e13c86 Add test case for deleteLabel 2022-06-08 17:01:38 +08:00
Hongbo Wu
145867fe05 Add test for setLabelsForHighlight resolver 2022-06-08 15:25:11 +08:00
Hongbo Wu
444c21ad09 Fix labels test 2022-05-19 18:12:14 +08:00
Hongbo Wu
34349e925c Add unit test 2022-05-19 16:36:35 +08:00
Jackson Harper
782781639d Update API in test 2022-04-12 12:53:08 -07:00
Hongbo Wu
ae0d1dd2ee
Feature/search highlights backend (#395)
* add highlight mappings

* return highlight in resolvers

* temporarily skip highlight tests

* add test for getting highlights

* update merge highlight

* separate elastic methods

* roll back merge highlight test

* add highlight to elastic script

* update delete highlight in elastic

* migrate highlight data from postgres to elastic

* rescue not found exception when page is not found in the migration script

* exclude highlights in searching pages results

* search pages with highlights only with has:highlight query

* add search endpoint to search pages or highlights

* reduce code smell in search api

* fix rebase error

* fix tests

* add test for search highlight

* add test for new search endpoint

* add labels to search results

* update schema

* update search query

* fix update/share highlights

* fix rebase error

* fix tests

* add highlight model in elastic

* add savedAt and publishedAt date range in search query

* add sort by updated and recently read

* fix tests

* close db connection when tests are done

* test github action

* revert github action test

* fix rebase error

* add docker-compose for api-test

* remove unused env

* remove highlights with no page attached to

* allow get_articles resolver to search for query so we can merge it without web changes
2022-04-12 12:31:08 +08:00
Jackson Harper
a68a5fb066 Labels are ordered by creation time in API now 2022-04-06 11:00:14 -07:00
Hongbo Wu
7569e988bf
upgrade typeorm to 3.0 (#359)
* upgrade typeorm to 3.0

* use new datasource object in typeorm 3

* fix tests

* fix tests

* migrate before creating connection

* fail the test if migration failed
2022-04-06 10:32:41 +08:00
Jackson Harper
e652a6ea8c
Rebased version of the elastic PR (#225)
* Add elastic to our docker compose

* add AND/OR/NOT search operations

* add elastic and create article in elastic

* change error code when elastic throws error

* add search pages in elastic

* add search by labels

* Add elastic to GitHub Action

* Update elastic version

* Fix port for elastic

* add url in search query

* Set elastic features when running tests

* add debug logs

* Use localhost instead of service hostname

* refresh elastic after create/update

* update search labels query

* add typescript support

* search pages in elastic

* fix search queries

* use elastic for saving page

* fix test failure

* update getArticle api to use elastic

* use generic get page function

* add elastic migration python script

* fix bulk helper param

* save elastic page id in article_saving_request instead of postgres article_id

* fix page archiving and deleting

* add tests for deleteArticle

* remove custom date type in elastic mappings which not exist in older version of elastic

* fix timestamp format issue

* add tests for save reading progress

* add tests for save file

* optimize search results

* add alias to index

* update migration script to receive env var as params

* Add failing test to validate we don't decrease reading progress

This test is failing with Elastic because we aren't fetching
the reading progress from elastic here, and are fetching it
from postgres.

* Rename readingProgress to readingProgressPercent

This is the name stored in elastic, so fixes issues pulling the
value out.

* Linting

* Add failing test for creating highlights w/elastic

This test fails because the highlight can't be looked up. Is there
a different ID we should be passing in to query for highlights,
or do we need to update the query to look for elastic_id?

* add tests code coverage threshold

* update nyc config

* include more files in test coverage

* change alias name

* update updateContent to update pages in elastic

* remove debug log

* fix createhighlight test

* search pages by alias in elastic

* update set labels and delete labels in elastic

* migration script enumeration

* make BULK_SIZE an env var

* fix pdf search indexing

* debug github action exit issue

* call pubsub when create/update/delete page in elastic

* fix json parsing bug and reduce reading data from file

* replace a depreciated pubsub api call

* debug github action exit issue

* debug github action exit issue

* add handler to upload elastic page data to GCS

* fix tests

* Use http_auth instead of basic_auth

* add index creation and existing postgres tables update in migration script

* fix a typo to connect to elastic

* rename readingProgress to readingProgressPercent

* migrate elastic_page_id in highlights and article_saving_request tables

* update migration script to include number of updated rows

* update db migration query

* read index mappings from file

* fix upload pages to gcs

* fix tests failure due to pageContext

* fix upload file id not exist error

* Handle savedAt & isArchived attributes w/out quering elastic

* Fix prettier issues

* fix content-type mismatching

* revert pageId to linkId because frontend was not deployed yet

* fix newsletters and attachment not saved in elastic

* put linkId in article for setting labels

* exclude orginalHtml in the result of searching to improve performace

* exclude content in the result of searching to improve performace

* remove score sorting

* do not refresh immediately to reduce searching and indexing time

* do not replace the backup data in gcs

* fix no article id defined in articleSavingRequest

* add logging of elastic api running time

* reduce home feed pagination size to 15

* reduce home feed pagination size to 10

* stop revalidating first page

* do not use a separate api to fetch reading progress

* Remove unused comment

* get reading progress if not exists

* replace ngram tokenizer with standard tokenizer

* fix tests

* remove .env.local

* add sort keyword in searching to sort by score

Co-authored-by: Hongbo Wu <hongbo@omnivore.app>
2022-03-16 12:08:59 +08:00
Hongbo Wu
d33b213092 add setLabels api and tests 2022-02-24 14:44:48 +08:00
Hongbo Wu
9150e7dbc2 add tests for create/delete labels 2022-02-24 14:44:48 +08:00
Hongbo Wu
a04e91472d
fix a bug of using article as table name in the reminders query (#34)
* fix a bug of using article as table name in the reminders query

* fix test

* increase timeout value

* increase timeout value to 50000

* add import mocha

* add import mocha for label test

* add import mocha for every test

* fix test in deleting labels

* add timeout for each label test

* one more test

* fix reminders router by allowing sendrid template id to be null

* do not retry if reminders not found
2022-02-14 13:59:04 +08:00
Jackson Harper
84f32935f5 Open source omnivore 2022-02-11 09:24:33 -08:00